TeX - LaTeX Asked on June 6, 2021
I am trying to align some text in the following way (shown below from a word processor):
What is the best way to do this? Should I use makebox
es?
Here is a MWE:
documentclass{article}
begin{document}
begin{itemize}
item{In outer space,
the change in pressure is dominated by unicorns at low temperature;
by gnomes at moderate temperature; and
by dwarves at high temperature.}
item{Underwater,
the change in pressure is dominated by lemmings at low temperature;
by elves at moderate temperature; and
by trolls at high temperature.}
end{itemize}
end{document}
You could use phantom
for example as follows:
documentclass{article}
usepackage{geometry}
newcommand{myplaceholder}{phantom{the change in pressure is dominated }}
begin{document}
begin{itemize}
item{In outer space,
the change in pressure is dominated by unicorns at low temperature;
myplaceholder by gnomes at moderate temperature; and
myplaceholder by dwarves at high temperature.}
item{Underwater,
the change in pressure is dominated by lemmings at low temperature;
myplaceholder by elves at moderate temperature; and
myplaceholder by trolls at high temperature.}
end{itemize}
end{document}
Here is an alternative version using widthof
from the calc
package in combination with hspace
:
documentclass{article}
usepackage{geometry}
usepackage{calc}
newlength{mylength}
setlength{mylength}{widthof{the change in pressure is dominated}}
begin{document}
begin{itemize}
item{In outer space,
the change in pressure is dominated by unicorns at low temperature;
hspace{mylength} by gnomes at moderate temperature; and
hspace{mylength} by dwarves at high temperature.}
item{Underwater,
the change in pressure is dominated by lemmings at low temperature;
hspace{mylength} by elves at moderate temperature; and
hspace{mylength} by trolls at high temperature.}
end{itemize}
end{document}
Correct answer by leandriis on June 6, 2021
by use of the tabular
:
documentclass{article}
begin{document}
begin{itemize}
item In outer space,
the change in pressure is dominated
begin{tabular}[t]{@{} l}
by unicorns at low temperature;
by gnomes at moderate temperature; and
by dwarves at high temperature.
end{tabular}
item In outer space,
the change in pressure is dominated
begin{tabular}[t]{@{} l}
by unicorns at low temperature;
by gnomes at moderate temperature; and
by dwarves at high temperature.
end{tabular}
end{itemize}
end{document}
Answered by Zarko on June 6, 2021
With a Longunderstack
.
documentclass{article}
usepackage{stackengine}
setstackEOL{}
begin{document}
begin{itemize}
item In outer space,
the change in pressure is dominated Longunderstack[l]{%
by unicorns at low temperature;
by gnomes at moderate temperature; and
by dwarves at high temperature.}
item Underwater,
the change in pressure is dominated Longunderstack[l]{%
by lemmings at low temperature;
by elves at moderate temperature; and
by trolls at high temperature.}
end{itemize}
end{document}
Answered by Steven B. Segletes on June 6, 2021
This solution uses a parbox
. Note that there really isn't enough room on the page for the "and."
documentclass{article}
usepackage{showframe}
begin{document}
begin{itemize}
sbox0{the change in pressure is dominated }% measure width
item In outer space,
usebox0parbox[t]{dimexpr linewidth-wd0}{% remaining space
by unicorns at low temperature;
by gnomes at moderate temperature; and
by dwarves at high temperature.}
item Underwater,
usebox0parbox[t]{dimexpr linewidth-wd0}{%
by lemmings at low temperature;
by elves at moderate temperature; and
by trolls at high temperature.}
end{itemize}
end{document}
Answered by John Kormylo on June 6, 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