TeX - LaTeX Asked by wazzle on January 21, 2021
I would like to use a table for a heading column and a text column that would be a enumerated list. However, it seems like when I begin the list it automatically starts a new horizontal line for the list text. Can this be aligned to the heading column text? Below is some code that I have tried and the compiled result…
documentclass{article}
usepackage{enumitem}
usepackage[left=1in, right=1in, bottom=0.7in, top=0.7in]{geometry}
begin{document}
begin{tabular}{ p{1in} p{5in} }
Top left cell & begin{enumerate}[itemindent=-20pt]
item Is it possible to get this text to line up horizontally with the top left cell when using enumerate?
item Thank you!
end{enumerate}
end{tabular}
end{document}
documentclass{article}
usepackage{enumitem}
usepackage[left=1in, right=1in, bottom=0.7in, top=0.7in]{geometry}
begin{document}
begin{tabular}{ p{1in} p{5in} }
begin{enumerate}[wide=0pt]item[] Top left cellend{enumerate} & begin{enumerate}[]
item Is it possible to get this text to line up horizontally with the top left cell when using enumerate?
item Thank you!
end{enumerate}
end{tabular}
end{document}
Answered by js bibra on January 21, 2021
Welcome to TeX.SE community!
One of possible solution is to enclose enumerate
list in a minipage
. This can be done by using enumitem
package option before
and after
:
documentclass{article}
usepackage[hmargin=1in, vmargin=0.7in]{geometry}
usepackage{enumitem}
usepackage{etoolbox}
AtBeginEnvironment{tabular}{% this will have effect in each tabular
setlist[enumerate]{before=begin{minipage}[t]{linewidth}, % <---
after =end{minipage} % <---
} }
begin{document}
begin{tabular}{ p{1in} p{5in} }
Top left cell & begin{enumerate}
item Is it possible to get this text to line up horizontally with the top left cell when using enumerate?
item Thank you!
end{enumerate}
end{tabular}
end{document}
Addendum:
Alternative possibilities is extend column specification p{...}
with minipages:
documentclass{article}
usepackage[hmargin=1in, vmargin=0.7in]{geometry}
usepackage{array}
usepackage{enumitem}
begin{document}
begin{tabular}{ p{1in} >{csname @minipagetrueendcsname}p{5in} } % <---
Top left cell & begin{enumerate}
item Is it possible to get this text to line up horizontally with the top left cell when using enumerate?
item Thank you!
end{enumerate}
end{tabular}
end{document}
RCompilation result is the same as before.
Answered by Zarko on January 21, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP