Text FormattingHow do I uniformly typeset tabbing in enumerate?

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
mado
Posts: 16
Joined: Thu Dec 10, 2015 5:55 am

How do I uniformly typeset tabbing in enumerate?

Post by mado »

tabbing_in_enumerate.png
tabbing_in_enumerate.png (101.51 KiB) Viewed 8955 times
I want to typeset the above picture. But, I have no idea on how to uniformly apply tabbing in enumerate. Can anyone help me?

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

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: How do I uniformly typeset tabbing in enumerate?

Post by Stefan Kottwitz »

Hi mado,

shall I type text and code for you? ;)

Perhaps show your enumerate code with the sample text and I gladly help to improve it. I just don't type everything from zero. If you save your reader's time, you would get more and quicker answers.

Stefan
LaTeX.org admin
mado
Posts: 16
Joined: Thu Dec 10, 2015 5:55 am

How do I uniformly typeset tabbing in enumerate?

Post by mado »

Stefan_K wrote:Hi mado,

shall I type text and code for you? ;)

Perhaps show your enumerate code with the sample text and I gladly help to improve it. I just don't type everything from zero. If you save your reader's time, you would get more and quicker answers.

Stefan
It seems you're the most present contributor to this website. If you felt offended, I'm sorry. I don't need something that exactly looks like that. But, I wanted to separate enumerate items from (premiss) and (from ...) as in the picture above.

Below is the sample LaTeX code.

Code: Select all

\documentclass[oneside,12pt]{article}
\usepackage{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{amsthm}
\theoremstyle{definition}
\newtheorem*{sol}{Solution}

\begin{document}
\section*{Exercises 5}
Which of the following arguments are valid? Where an argument is valid, pro-
vide a proof. Some of the examples are enthymemes that need repair.
\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.
\begin{enumerate}
\item No philosopher is illogical. (premiss)
\item\label{ok1} Jones keeps making argumentative blunders. (premiss)
\item\label{ok2} No logical person keeps making argumentative blunders.
(premiss)
\item All existentialists are philosophers. (premiss)
\item Jones is illogical (from~\ref{ok1} and~\ref{ok2})
\item Jones is not a philosopher.
\item So, Jones is not an existentialist.
\end{enumerate}
\end{enumerate}
\end{document}
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 »

I'm not feeling offended, don't worry. I just like to see code to work with, as I don't have the time to construct code by myself for any screenshot I see in the forum. Working with real code is better.

I think this should be a tabular like environment. it's just not easy to mix enumerate and tabular. I will take a look.

Stefan
LaTeX.org admin
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 »

Hi mado,

here is a suggestion with tabularx. I did not use enumerate but a self made counter.

Code: Select all

\documentclass[oneside,12pt]{article}
\usepackage{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}{0.75\textwidth}{>{\stepcounter{tab}\thetab}rXl}
  & No philosopher is illogical. &(premiss) \\
  & 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. \\
  & So, Jones is not an existentialist.
\end{tabularx}
\end{enumerate}
\end{document}
list.png
list.png (25.89 KiB) Viewed 8926 times
It still has the disadvantage that \label and \ref don't work. This can be solved with some effort, but perhaps this already works for you.

Stefan
LaTeX.org admin
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 »

It still has the disadvantage that \label and \ref don't work. This can be solved with some effort, but perhaps this already works for you.
\refstepcounter ;-)
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
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 »

Hello Johannes,

that's correct, it needs to be changed then. But I get a line break already by just including \label at the beginning of a tabular cell. And we need to set an anchor, otherwise the reference goes to the earlier anchor, which belongs to the outer enumerate environment.

Stefan
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 »

Hm, seems i am doing something different.

Code: Select all

\documentclass[oneside,12pt]{article}
\usepackage{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}{0.75\textwidth}{>{\refstepcounter{tab}\thetab}rXl}
			\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.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: How do I uniformly typeset tabbing in enumerate?

Post by Stefan Kottwitz »

Ah, this works. I had the \label together with the text in the second column, the column change is the problem. Though I still wonder why there's a line break then.

Stefan
LaTeX.org admin
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 »

Stefan_K wrote:Though I still wonder why there's a line break then.
I don't want to dive the source right now, but ...

Code: Select all

\documentclass{standalone}
\begin{document}
\begin{tabular}{cp{1cm}}
	l& \label{}No .  \\
\end{tabular}
\begin{tabular}{cp{1cm}}
	l& \hbox{}No .  \\
\end{tabular}
\fbox{
1	\parbox{1cm}{\hbox{} N}
}
\fbox{
1	\parbox{1cm}{\mbox{} N}
}
\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.
Post Reply