LaTeX users online

In total there are 10 users online :: 0 registered, 0 hidden and 10 guests (based on users active over the past 5 minutes)
Most users ever online was 1327 on Tue Nov 05, 2013 7:11 pm

Users browsing this forum: No registered users and 10 guests

enumerate with horizontal align

LaTeX Forum: Document Classes

Add tags Information and discussion about specific document classes and how to create your own document classes.

Postby bkarpuz on Fri Mar 25th, 2011

Dear LC members,

I spent more than a hour for searching how to align items horizontally instead of vertically, but I could not find any examples.
Would you please help me having a list as follows?

1. Item 1....2. Item 2....3. Item 3

Thanks a lot.
bkarpuz
Last edited by bkarpuz on Sat Mar 26th, 2011, edited 1 time in total.
bkarpuz
 
Posts: 124
Joined: Thu Dec 18th, 2008

Postby Stefan_K on Fri Mar 25th, 2011

Hi bkarpuz,

you could use the paralist package and the inparaenum environment.

Stefan
LaTeX Community Administrator
User avatar
Stefan_K
Site Admin
 
Posts: 7474
Joined: Mon Mar 10th, 2008
Location: Hamburg, Germany

Postby bkarpuz on Sat Mar 26th, 2011

Thanks Stefan_K, but I still need help.

I use the following preamble.
Code: Select all  •  Open in online LaTeX editor
\documentclass{article}

\usepackage{amsmath}
\usepackage{paralist}
\usepackage{enumitem
}

When I use enumerate for my questions as follows
Code: Select all  •  Open in online LaTeX editor
\textbf{Questions}.
\begin{enumerate}[label={(\alph*)},leftmargin=*,ref=(\alph*)]
\item\label{q1a} Question~1.
\item\label{q1b} Question~2.
\end{enumerate
}

I can refer those items in answers in itemize as follows
Code: Select all  •  Open in online LaTeX editor
\textbf{Answers}.
\begin{itemize}
\item[\ref{q1a}] Answer~1.
\item[\ref{q1b}] Answer~2.
\end{itemize
}

But when I use inparaenum instead of enumerate as follows,
I dont get the same output in answers.
Code: Select all  •  Open in online LaTeX editor
\textbf{Questions}.
\begin{inparaenum}[(a)]
\item\label{q1a} Question~1. \item\label{q1b} Question~2.
\end{inparaenum
}

Is it possible to fix it?

Moreover, the distance between '(a)' and 'Question 1' when inparaenum is used is not the same as enumerate gives.

Thanks.
bkarpuz
bkarpuz
 
Posts: 124
Joined: Thu Dec 18th, 2008

Postby Stefan_K on Sat Mar 26th, 2011

You could simply write (\ref{...}) with your own parentheses. The paralist documentation does that.

Regarding the distance: those packages use different distances. Instead of programming, you could also simply write

Code: Select all  •  Open in online LaTeX editor
\begin{inparaenum}[(a)~] ...


or use another spacing command instead of ~.

Stefan
LaTeX Community Administrator
User avatar
Stefan_K
Site Admin
 
Posts: 7474
Joined: Mon Mar 10th, 2008
Location: Hamburg, Germany

Postby bkarpuz on Sat Mar 26th, 2011

Stefan_K wrote:You could simply write (\ref{...}) with your own parentheses. The paralist documentation does that.

Since I also use hyperref they exactly differ from each other in the output.
Is there another way for this to look them identically same as enumerate generated items?

Stefan_K wrote:Regarding the distance: those packages use different distances. Instead of programming, you could also simply write

Code: Select all  •  Open in online LaTeX editor
\begin{inparaenum}[(a)~] ...


or use another spacing command instead of ~.

Thanks this works very well.

Your help is really appreciated.
bkarpuz
bkarpuz
 
Posts: 124
Joined: Thu Dec 18th, 2008

Postby Stefan_K on Sat Mar 26th, 2011

You didn't mention hyperref before., ;-)
Ok, here's another way:

Code: Select all  •  Open in online LaTeX editor
\documentclass{article}
\usepackage{paralist}
\usepackage{hyperref}
\renewcommand*{\theenumi}{(\alph{enumi})}
\renewcommand*{\labelenumi}{\theenumi~}
\begin{document}
\textbf{Questions}.
\begin{inparaenum}
\item\label{q1a} Question~1. \item\label{q1b} Question~2.
\end{inparaenum}

\textbf{Answers}.
\begin{itemize}
\item[\ref{q1a}] Answer~1.
\item[\ref{q1b}] Answer~2.
\end{itemize}
\end{document
}


Stefan
LaTeX Community Administrator
User avatar
Stefan_K
Site Admin
 
Posts: 7474
Joined: Mon Mar 10th, 2008
Location: Hamburg, Germany

Postby bkarpuz on Sat Mar 26th, 2011

Stefan_K wrote:You didn't mention hyperref before., ;-)
Ok, here's another way:

Code: Select all  •  Open in online LaTeX editor
\documentclass{article}
\usepackage{paralist}
\usepackage{hyperref}
\renewcommand*{\theenumi}{(\alph{enumi})}
\renewcommand*{\labelenumi}{\theenumi~}
\begin{document}
\textbf{Questions}.
\begin{inparaenum}
\item\label{q1a} Question~1. \item\label{q1b} Question~2.
\end{inparaenum}

\textbf{Answers}.
\begin{itemize}
\item[\ref{q1a}] Answer~1.
\item[\ref{q1b}] Answer~2.
\end{itemize}
\end{document
}


Stefan

This is awesome!

Thanks a lot Stefan.
bkarpuz
bkarpuz
 
Posts: 124
Joined: Thu Dec 18th, 2008


Return to Document Classes

LaTeX users online

Users browsing this forum: No registered users and 10 guests