TeX - LaTeX Asked on April 28, 2021
I would like to make two columns within an item
in itemize
. Here is an example that I made with — gasp! — a word processor:
I would like to be able to adjust the "column" widths/"tabs." How can I accomplish this?
Here is a MWE:
documentclass{article}
begin{document}
List:
begin{itemize}
item{apple fruit}
item{cucumber vegetable}
item{steak meat}
end{itemize}
end{document}
You can use tabto
:
documentclass{article}
usepackage{tabto}
begin{document}
List:
begin{itemize}
item apple tabto{10em} fruit
item cucumber tabto{10em} vegetable
item steak tabto{10em} meat
end{itemize}
List:
begin{itemize}
item appletabto{10em}fruit
item cucumbertabto{10em}vegetable
item steaktabto{10em}meat
end{itemize}
end{document}
The second list is just to show that spaces around tabto{10em}
are ignored, so the input can be organized to see the alignment.
Correct answer by egreg on April 28, 2021
You can get your desired result by using a tabularx
environment as part of your item
.
documentclass{article}
usepackage{tabularx}
begin{document}
List:
begin{itemize}
item
begin{tabularx}{linewidth}{XX}
apple & fruit
end{tabularx}
item
begin{tabularx}{linewidth}{XX}
cucumber & vegetable
end{tabularx}
item
begin{tabularx}{linewidth}{XX}
steak & meat
end{tabularx}
end{itemize}
end{document}
If you don't want the two columns to be spaced out thus far, you could also use a tabular
environment and use three columns, one of which is the spacing between the two strings. The problem with this method is, that you need to define a fixed width for at least the first and the second column.
documentclass{article}
begin{document}
List:
begin{itemize}
item
begin{tabular}[t]{p{10em}p{1em}l}
apple && fruit
end{tabular}
item
begin{tabular}[t]{p{10em}p{1em}l}
cucumber && vegetable
end{tabular}
item
begin{tabular}[t]{p{10em}p{1em}l}
steak && meat
end{tabular}
item
begin{tabular}[t]{p{10em}p{1em}l}
a very long entry to sow why the central column is important to have && meat
end{tabular}
end{itemize}
end{document}
Answered by Sam on April 28, 2021
This version uses textbullet
automatically in each line.
documentclass{article}
begin{document}
List:
begin{trivlist}% for vertical spacing
itembegin{tabular}{@{hbox to leftmargini{hfilltextbullethspace{labelsep}}}ll}
apple&fruit
cucumber&vegetable
steak&meat
end{tabular}
end{trivlist}
begin{itemize}
item normal itemize
end{itemize}
end{document}
Answered by John Kormylo on April 28, 2021
Just use a table. You can match the spacing and style of lists using the appropriate parameters.
documentclass{article}
usepackage{array}
newenvironment*{tabularitemize}[1]{%
parnoindent
begin{tabular}{ @{hskipleftmarginllap{labelitemihskiplabelsep}} #1 }%
}{%
end{tabular}par
}
begin{document}
begin{tabularitemize}{ l l }
apple & fruit
cucumber & vegetable
steak & meat
end{tabularitemize}
begin{itemize}
item This is a real list.
end{itemize}
end{document}
Spacing between the rows and columns of the table can be adjusted as usual.
Answered by schtandard on April 28, 2021
You also can do that either with the listliketab
package or with a standard itemize and the eqparbox
package:
documentclass{article}
usepackage{listliketab}
usepackage{eqparbox}
begin{document}
List:
storestyleof{itemize}
begin{listliketab}
begin{tabular}[t]{Ll@{qquad}l }
textbullet & apple & fruit
textbullet & cucumber & vegetable
textbullet & steak & meat
end{tabular}
end{listliketab}
begin{itemize}
itemeqmakebox[L][l]{apple} fruit
itemeqmakebox[L][l]{cucumberhspace{2em}null} vegetable
itemeqmakebox[L][l]{steak} meat
end{itemize}
end{document}
Answered by Bernard on April 28, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP