0

Please take a look at the table below:

enter image description here

Is there any way to vertically align an individual table cell in LaTex as shown in the "I" cell above?

6
  • Welcome to TeX.SX! There is most likely more than just one way to change the vertical alignment of the contents of a single sell. Could you please add some background information on why you want to do that, as well as some information on what the contents of your actal table will be (numbers, single words, text...)?
    – leandriis
    Oct 5 '19 at 12:53
  • Yes, of course, but, do you want all the rows with the same fixed heigth? And the columns width?
    – e_moro
    Oct 5 '19 at 12:58
  • @leandriis I'm making a builder that converts an XML table into a LaTex table. Since source XML tables are configured to have an alignment attribute for every single cell, the target LaTex table also should have that feature. Oct 5 '19 at 13:00
  • @e_moro No, the height will be dynamically resized according to the length of text. Oct 5 '19 at 13:01
  • tex.stackexchange.com/a/6496/134144 might be interesting.
    – leandriis
    Oct 5 '19 at 13:10
1

There are two new vertical h and f alignment with tabularray package and you can set vertical alignment for an individual table cell:

\documentclass{article}

\usepackage{xcolor}
\usepackage{tabularray}

\begin{document}

\begin{tblr}{
  colspec = {Q[h]Q[m]Q[f]},
  rowspec = {Q[l]Q[c]Q[r]},
  hlines, vlines,
}
  Head Left   & Middle Left & {Foot Left\\Foot Left\\Foot Left} \\
  Head Center & {Middle Center\\Middle Center\\Middle Center} & Foot Center \\
  {Head Right\\Head Right\\Head Right} & Middle Right & \SetCell{h,l,fg=blue3} Head Left \\
\end{tblr}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.