TeX - LaTeX Asked by at. on April 20, 2021
There are plenty of questions about vertically aligning text within a table. I wan’t to make text to the left of a table vertically aligned to the top:
I want this text aligned to top:
begin{tabular}{lll}
1. & First step &
2. & Second step &
3. & Go back & Step 1\
hline
4. & Can't get here & Error.
end{tabular}
This is what the above LaTeX looks like:
Is there a way to make the "I want this text aligned to top" be aligned to the top instead of the vertical center of the table?
You need to add option [t]
to tabular
for its position:
documentclass{article}
begin{document}
I want this text aligned to top:
begin{tabular}[t]{lll} % <--- observe `t`
1. & First step &
2. & Second step &
3. & Go back & Step 1\
hline
4. & Can't get here & Error.
end{tabular}
end{document}
Correct answer by Zarko on April 20, 2021
simplicity as our elite member Zarko said
begin{tabular}[]{lll}
I want this text aligned to top:& 1. & First step
& 2. & Second step
& 3. & Go back Step 1
cline{2-3}
& 4. & Can't get here Error.
end{tabular}
Answered by js bibra on April 20, 2021
As said by Zarko, the solution to that question is to use the key t
of the environment {tabular}
but, for information, I add this answer to show that with {NiceTabular}
of nicematrix
, there is also a key baseline
to choice the row of the alignment.
documentclass{article}
usepackage{nicematrix}
begin{document}
I want this text aligned to the second row:
begin{NiceTabular}{lll}[baseline=2]
1. & First step &
2. & Second step &
3. & Go back & Step 1\
hline
4. & Can't get here & Error.
end{NiceTabular}
end{document}
You need several compilations because nicematrix
uses PGF/Tikz.
Answered by F. Pantigny on April 20, 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