LaTeX forum ⇒ Text FormattingHow do I uniformly typeset tabbing in enumerate? Topic is solved

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?

Postby mado » Mon Jan 04, 2016 10:10 am

tabbing_in_enumerate.png
tabbing_in_enumerate.png (101.51 KiB) Viewed 3452 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?

Tags:

User avatar
Stefan Kottwitz
Site Admin
Posts: 9444
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Mon Jan 04, 2016 11:58 am

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
Site admin

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

Postby mado » Mon Jan 04, 2016 1:26 pm

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.

  1. \documentclass[oneside,12pt]{article}
  2. \usepackage{geometry}
  3. \usepackage{microtype}
  4. \usepackage[utf8]{inputenc}
  5. \usepackage[T1]{fontenc}
  6. \usepackage{lmodern}
  7.  
  8. \usepackage{enumitem}
  9. \setlist[enumerate,1]{label=\bfseries\Alph*,align=left,leftmargin=*,
  10. labelsep=1.5em}
  11. \setlist[enumerate,2]{label= (\arabic*),leftmargin=*,align=right}
  12.  
  13. \usepackage{amsthm}
  14. \theoremstyle{definition}
  15. \newtheorem*{sol}{Solution}
  16.  
  17. \begin{document}
  18. \section*{Exercises 5}
  19. Which of the following arguments are valid? Where an argument is valid, pro-
  20. vide a proof. Some of the examples are enthymemes that need repair.
  21. \begin{enumerate}
  22. \item No philosopher is illogical. Jones keeps making argumentative blunders.
  23. No logical person keeps making argumentative blunders. All existentialists are
  24. philosophers. So, Jones is not an existentialist.
  25. \begin{enumerate}
  26. \item No philosopher is illogical. (premiss)
  27. \item\label{ok1} Jones keeps making argumentative blunders. (premiss)
  28. \item\label{ok2} No logical person keeps making argumentative blunders.
  29. (premiss)
  30. \item All existentialists are philosophers. (premiss)
  31. \item Jones is illogical (from~\ref{ok1} and~\ref{ok2})
  32. \item Jones is not a philosopher.
  33. \item So, Jones is not an existentialist.
  34. \end{enumerate}
  35. \end{enumerate}
  36. \end{document}

User avatar
Stefan Kottwitz
Site Admin
Posts: 9444
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Mon Jan 04, 2016 5:10 pm

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
Site admin

User avatar
Stefan Kottwitz
Site Admin
Posts: 9444
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Mon Jan 04, 2016 6:31 pm

Hi mado,

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

  1. \documentclass[oneside,12pt]{article}
  2. \usepackage{geometry}
  3. \usepackage{microtype}
  4. \usepackage[utf8]{inputenc}
  5. \usepackage[T1]{fontenc}
  6. \usepackage{lmodern}
  7. \usepackage{enumitem}
  8. \setlist[enumerate,1]{label=\bfseries\Alph*,align=left,leftmargin=*,
  9. labelsep=1.5em}
  10. \setlist[enumerate,2]{label= (\arabic*),leftmargin=*,align=right}
  11. \usepackage{tabularx}
  12. \newcounter{tab}
  13. \renewcommand*{\thetab}{(\arabic{tab})}
  14. \begin{document}
  15. \begin{enumerate}
  16. \item No philosopher is illogical. Jones keeps making argumentative blunders.
  17. No logical person keeps making argumentative blunders. All existentialists are
  18. philosophers. So, Jones is not an existentialist.
  19.  
  20. \setcounter{tab}{0}
  21. \begin{tabularx}{0.75\textwidth}{>{\stepcounter{tab}\thetab}rXl}
  22. & No philosopher is illogical. &(premiss) \\
  23. & Jones keeps making argumentative blunders. &(premiss) \\
  24. & No logical person keeps making argumentative blunders.
  25. & (premiss) \\
  26. & All existentialists are philosophers. & (premiss) \\
  27. & Jones is illogical & (from~(2) and~(3))\\
  28. & Jones is not a philosopher. \\
  29. & So, Jones is not an existentialist.
  30. \end{tabularx}
  31. \end{enumerate}
  32. \end{document}


list.png
list.png (25.89 KiB) Viewed 3423 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
Site admin

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

Postby Johannes_B » Mon Jan 04, 2016 6:45 pm

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: 9444
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Mon Jan 04, 2016 7:14 pm

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: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Mon Jan 04, 2016 7:19 pm

Hm, seems i am doing something different.
  1. \documentclass[oneside,12pt]{article}
  2. \usepackage{geometry}
  3. \usepackage{microtype}
  4. \usepackage[utf8]{inputenc}
  5. \usepackage[T1]{fontenc}
  6. \usepackage{lmodern}
  7. \usepackage{enumitem}
  8. \setlist[enumerate,1]{label=\bfseries\Alph*,align=left,leftmargin=*,
  9. labelsep=1.5em}
  10. \setlist[enumerate,2]{label= (\arabic*),leftmargin=*,align=right}
  11. \usepackage{tabularx}
  12. \newcounter{tab}
  13. \renewcommand*{\thetab}{(\arabic{tab})}
  14. \begin{document}
  15. \begin{enumerate}
  16. \item No philosopher is illogical. Jones keeps making argumentative blunders.
  17. No logical person keeps making argumentative blunders. All existentialists are
  18. philosophers. So, Jones is not an existentialist.
  19.  
  20. \setcounter{tab}{0}
  21. \begin{tabularx}{0.75\textwidth}{>{\refstepcounter{tab}\thetab}rXl}
  22. \label{first}& No philosopher is illogical. &(premiss) \\
  23. \label{second}& Jones keeps making argumentative blunders. &(premiss) \\
  24. & No logical person keeps making argumentative blunders.
  25. & (premiss) \\
  26. & All existentialists are philosophers. & (premiss) \\
  27. & Jones is illogical & (from~(2) and~(3))\\
  28. & Jones is not a philosopher. from~\ref{first} and~\ref{second}\\
  29. & So, Jones is not an existentialist.
  30. \end{tabularx}
  31. \end{enumerate}
  32. \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: 9444
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Mon Jan 04, 2016 7:30 pm

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
Site admin

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

Postby Johannes_B » Mon Jan 04, 2016 8:05 pm

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 ...

  1. \documentclass{standalone}
  2. \begin{document}
  3. \begin{tabular}{cp{1cm}}
  4. l& \label{}No . \\
  5. \end{tabular}
  6. \begin{tabular}{cp{1cm}}
  7. l& \hbox{}No . \\
  8. \end{tabular}
  9. \fbox{
  10. 1 \parbox{1cm}{\hbox{} N}
  11. }
  12. \fbox{
  13. 1 \parbox{1cm}{\mbox{} N}
  14. }
  15. \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.


Return to “Text Formatting”

Who is online

Users browsing this forum: MSN [Bot] and 5 guests