1

I am trying to understand the documentation of \parbox (documentation link: http://www.emerson.emory.edu/services/latex/latex_147.html). However, I don't understand the difference between [position] and [inner-pos]. To use [position], you need to set a height (in my case I said 10cm) I have tried tampering with them in Overleaf but I have noticed no change at all, could someone please explain me the difference between them and, if possible, provide example/s. Thank you in advance.

Parbox command is defined as: \parbox[position][height][inner-pos]{width}{text}

2 Answers2

3

The first is how it is aligned relative to the surrounding material, the second is how the contents inside the box are aligned when you fixed the height. Compare the following usages (\fbox used to better show the boxes):

\documentclass[]{article}

\newlength\mylength \begin{document} \settowidth\mylength{box} Base \fbox{\parbox[t]{\mylength}{box box box}} % top aligned \fbox{\parbox[c]{\mylength}{box box box}} % centred \fbox{\parbox[b]{\mylength}{box box box}} % bottom aligned Line

Base \fbox{\parbox[t][4\baselineskip][t]{\mylength}{box box box}} \fbox{\parbox[t][4\baselineskip][c]{\mylength}{box box box}} \fbox{\parbox[t][4\baselineskip][b]{\mylength}{box box box}} Line \end{document}

The last two usages can't "inherit" the baseline of the first line inside the box (since that isn't top-aligned) so they are shifted down a bit, placement of the box (not its contents) would be the same for all three if c or b was used for their first optional argument.

enter image description here

Skillmon
  • 60,462
0

To add to @Skillmon's answer:

position x inner-pos gives 9 combinations:

parbox demo

MWE

\documentclass[]{article}

\newlength\mylength \begin{document} Parbox command is defined as: \textbackslash parbox[position][height][inner-pos]{width}{text}

\settowidth\mylength{box} Base t \fbox{\parbox[t]{\mylength}{box box box}} % top aligned c \fbox{\parbox[c]{\mylength}{box box box}} % centred b \fbox{\parbox[b]{\mylength}{box box box}} % bottom aligned Line

Base tt \fbox{\parbox[t][4\baselineskip][t]{\mylength}{box}} tc \fbox{\parbox[t][4\baselineskip][c]{\mylength}{box}} tb \fbox{\parbox[t][4\baselineskip][b]{\mylength}{box}} Line

Base ct \fbox{\parbox[c][4\baselineskip][t]{\mylength}{box}} cc \fbox{\parbox[c][4\baselineskip][c]{\mylength}{box}} cb \fbox{\parbox[c][4\baselineskip][b]{\mylength}{box}} Line

Base bt \fbox{\parbox[b][4\baselineskip][t]{\mylength}{box}} bc \fbox{\parbox[b][4\baselineskip][c]{\mylength}{box}} bb \fbox{\parbox[b][4\baselineskip][b]{\mylength}{box}} Line

\end{document}

Cicada
  • 10,129