Document Classes ⇒ enumerate with horizontal align
enumerate with horizontal align
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
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
enumerate with horizontal align
enumerate with horizontal align
I use the following preamble.
Code: Select all
\documentclass{article}
\usepackage{amsmath}
\usepackage{paralist}
\usepackage{enumitem}
Code: Select all
\textbf{Questions}.
\begin{enumerate}[label={(\alph*)},leftmargin=*,ref=(\alph*)]
\item\label{q1a} Question~1.
\item\label{q1b} Question~2.
\end{enumerate}
Code: Select all
\textbf{Answers}.
\begin{itemize}
\item[\ref{q1a}] Answer~1.
\item[\ref{q1b}] Answer~2.
\end{itemize}
I dont get the same output in answers.
Code: Select all
\textbf{Questions}.
\begin{inparaenum}[(a)]
\item\label{q1a} Question~1. \item\label{q1b} Question~2.
\end{inparaenum}
Moreover, the distance between '(a)' and 'Question 1' when inparaenum is used is not the same as enumerate gives.
Thanks.
bkarpuz
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
enumerate with horizontal align
Regarding the distance: those packages use different distances. Instead of programming, you could also simply write
Code: Select all
\begin{inparaenum}[(a)~] ...
Stefan
enumerate with horizontal align
Since I also use hyperref they exactly differ from each other in the output.Stefan_K wrote:You could simply write (\ref{...}) with your own parentheses. The paralist documentation does that.
Is there another way for this to look them identically same as enumerate generated items?
Thanks this works very well.Stefan_K wrote: Regarding the distance: those packages use different distances. Instead of programming, you could also simply write
or use another spacing command instead of ~.Code: Select all
\begin{inparaenum}[(a)~] ...
Your help is really appreciated.
bkarpuz
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
enumerate with horizontal align

Ok, here's another way:
Code: Select all
\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}
enumerate with horizontal align
This is awesome!Stefan_K wrote:You didn't mention hyperref before.,
Ok, here's another way:
StefanCode: Select all
\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}
Thanks a lot Stefan.
bkarpuz