Text FormattingHow do I uniformly typeset tabbing in enumerate?

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

How do I uniformly typeset tabbing in enumerate?

Post by Stefan Kottwitz »

Well, the line break goes away when I insert an \mbox{} before.

Stefan

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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

mado
Posts: 16
Joined: Thu Dec 10, 2015 5:55 am

Re: How do I uniformly typeset tabbing in enumerate?

Post by mado »

Thanks for support. The code works well.

How do I make the table fill the width of the surrounding enumerate item? Is there a way to obtain the width of the surrounding enumerate item?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

How do I uniformly typeset tabbing in enumerate?

Post by Johannes_B »

Code: Select all

\documentclass[oneside,12pt]{article}
\usepackage[showframe]{geometry}
\usepackage{microtype}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{enumitem}
\setlist[enumerate,1]{label=\bfseries\Alph*,align=left,leftmargin=*,
labelsep=1.5em}
\setlist[enumerate,2]{label= (\arabic*),leftmargin=*,align=right}
\usepackage{tabularx}
\newcounter{tab}
\renewcommand*{\thetab}{(\arabic{tab})}
\begin{document}
\begin{enumerate}
	\item No philosopher is illogical. Jones keeps making argumentative blunders.
		No logical person keeps making argumentative blunders. All existentialists are
		philosophers. So, Jones is not an existentialist.

		\setcounter{tab}{0}
		\begin{tabularx}{\linewidth}{@{}>{\refstepcounter{tab}\thetab}rX@{\quad\quad}l@{}}
			\label{first}& No philosopher is illogical. &(premiss) \\
			\label{second}& Jones keeps making argumentative blunders. &(premiss) \\
			& No logical person keeps making argumentative blunders.
			& (premiss) \\
			& All existentialists are philosophers. & (premiss) \\
			& Jones is illogical & (from~(2) and~(3))\\
			& Jones is not a philosopher. from~\ref{first} and~\ref{second}\\
			& So, Jones is not an existentialist.
		\end{tabularx}
\end{enumerate}
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
mado
Posts: 16
Joined: Thu Dec 10, 2015 5:55 am

Re: How do I uniformly typeset tabbing in enumerate?

Post by mado »

What is \thetab? Ah, it's defined in preamble.
Why do you insert @{} in preamble of tabularx? It doesn't seem to make a difference.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

How do I uniformly typeset tabbing in enumerate?

Post by Johannes_B »

\thetab[\latex] defines the graphical representation of the tab counter.
In this case, this is an opening parenthesis, the value of the counter in arabic numerals (possible would be also roman, Roman, alph and Alph numerals) and a closing paren.

The other question is dealt with in the followup: [url=http://latex-community.org/forum/viewtopic.php?p=93039#p93039]Why do people insert @{} in table preamble?[/url]
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
mado
Posts: 16
Joined: Thu Dec 10, 2015 5:55 am

Re: How do I uniformly typeset tabbing in enumerate?

Post by mado »

Great.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: How do I uniformly typeset tabbing in enumerate?

Post by Johannes_B »

@Stefan, neither hbox nor label enter horizontal mode. But the reerence point is moved, see texdoc grfguide, page 6, footnote dor reference.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply