1

We can use

\renewcommand{\arraystretch}{2}

to increase the height of rows. The text, however, is just in the center.

How can we simply put it on the top-left, as in second and third columns in the picture?

Note : this is drawn by Tikz. I want it with tabular if possible.

3 columns

2

The easiest solution is to modify the contents of the cell, The first solutions added a "strut" extending downward, while the second shows a more general approach using \raisebox.

\documentclass{article}
\begin{document}
\begin{tabular}{|c|c|c|}
\hline
\rule[-2\normalbaselineskip]{0pt}{3\normalbaselineskip}% strut
a) T.Insert(8) & b) T.Insert(12) & c) T.Insert(10) \\
\hline
\end{tabular}

\bigskip
\begin{tabular}{|c|c|c|}
\hline
\raisebox{\normalbaselineskip}{a) T.Insert(8)} & 
\raisebox{0pt}[2\normalbaselineskip][1.6\normalbaselineskip]{b) T.Insert(12)} &% baseline here
\raisebox{-\normalbaselineskip}{c) T.Insert(10)} \\
\hline
\end{tabular}
\end{document}

tabulars

|improve this answer|||||
  • It doesn't look like a real solution. It looks like a workaround. Could we just say that in normal circumstances there is no easy way to align cell content top-left? You always have to use typographic "tricks". Isn't it that way? – buhtz Jul 10 '16 at 7:17
  • @bulitz - All of LaTeX is based on typographical tricks. There is strut automatically added whose size is determined by \arraystretch. If you want to modify the source code you could have a real solution. But in the end, both would be doing the exact same thing. – John Kormylo Jul 10 '16 at 15:48

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.