LaTeX forum ⇒ Document Classesenumerate with horizontal align

Information and discussion about specific document classes and how to create your own document classes.
bkarpuz
Posts: 124
Joined: Thu Dec 18, 2008 4:53 pm
Contact:

enumerate with horizontal align

Postby bkarpuz » Fri Mar 25, 2011 10:36 pm

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 26, 2011 1:28 am, edited 1 time in total.

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
Stefan Kottwitz
Site Admin
Posts: 7801
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Fri Mar 25, 2011 10:59 pm

Hi bkarpuz,

you could use the paralist package and the inparaenum environment.

Stefan
Site admin

Link:
BBcode:
HTML:
Hide post links
Show post links

bkarpuz
Posts: 124
Joined: Thu Dec 18, 2008 4:53 pm
Contact:

Postby bkarpuz » Sat Mar 26, 2011 12:16 am

Thanks Stefan_K, but I still need help.

I use the following preamble.
  1. \documentclass{article}
  2.  
  3. \usepackage{amsmath}
  4. \usepackage{paralist}
  5. \usepackage{enumitem}

When I use enumerate for my questions as follows
  1. \textbf{Questions}.
  2. \begin{enumerate}[label={(\alph*)},leftmargin=*,ref=(\alph*)]
  3. \item\label{q1a} Question~1.
  4. \item\label{q1b} Question~2.
  5. \end{enumerate}

I can refer those items in answers in itemize as follows
  1. \textbf{Answers}.
  2. \begin{itemize}
  3. \item[\ref{q1a}] Answer~1.
  4. \item[\ref{q1b}] Answer~2.
  5. \end{itemize}

But when I use inparaenum instead of enumerate as follows,
I dont get the same output in answers.
  1. \textbf{Questions}.
  2. \begin{inparaenum}[(a)]
  3. \item\label{q1a} Question~1. \item\label{q1b} Question~2.
  4. \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

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
Stefan Kottwitz
Site Admin
Posts: 7801
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Sat Mar 26, 2011 12:55 am

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

  1. \begin{inparaenum}[(a)~] ...


or use another spacing command instead of ~.

Stefan
Site admin

Link:
BBcode:
HTML:
Hide post links
Show post links

bkarpuz
Posts: 124
Joined: Thu Dec 18, 2008 4:53 pm
Contact:

Postby bkarpuz » Sat Mar 26, 2011 1:11 am

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

  1. \begin{inparaenum}[(a)~] ...


or use another spacing command instead of ~.

Thanks this works very well.

Your help is really appreciated.
bkarpuz

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
Stefan Kottwitz
Site Admin
Posts: 7801
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Sat Mar 26, 2011 1:24 am

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

  1. \documentclass{article}
  2. \usepackage{paralist}
  3. \usepackage{hyperref}
  4. \renewcommand*{\theenumi}{(\alph{enumi})}
  5. \renewcommand*{\labelenumi}{\theenumi~}
  6. \begin{document}
  7. \textbf{Questions}.
  8. \begin{inparaenum}
  9. \item\label{q1a} Question~1. \item\label{q1b} Question~2.
  10. \end{inparaenum}
  11.  
  12. \textbf{Answers}.
  13. \begin{itemize}
  14. \item[\ref{q1a}] Answer~1.
  15. \item[\ref{q1b}] Answer~2.
  16. \end{itemize}
  17. \end{document}


Stefan
Site admin

Link:
BBcode:
HTML:
Hide post links
Show post links

bkarpuz
Posts: 124
Joined: Thu Dec 18, 2008 4:53 pm
Contact:

Postby bkarpuz » Sat Mar 26, 2011 1:28 am

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

  1. \documentclass{article}
  2. \usepackage{paralist}
  3. \usepackage{hyperref}
  4. \renewcommand*{\theenumi}{(\alph{enumi})}
  5. \renewcommand*{\labelenumi}{\theenumi~}
  6. \begin{document}
  7. \textbf{Questions}.
  8. \begin{inparaenum}
  9. \item\label{q1a} Question~1. \item\label{q1b} Question~2.
  10. \end{inparaenum}
  11.  
  12. \textbf{Answers}.
  13. \begin{itemize}
  14. \item[\ref{q1a}] Answer~1.
  15. \item[\ref{q1b}] Answer~2.
  16. \end{itemize}
  17. \end{document}


Stefan

This is awesome!

Thanks a lot Stefan.
bkarpuz

Link:
BBcode:
HTML:
Hide post links
Show post links


Return to “Document Classes”

Who is online

Users browsing this forum: No registered users and 1 guest