The calc package provides also the function \settototalheight{\mylength}{some text}

When using these commands, you may duplicate the text that you want to use as reference if you plan to also display it. But LaTeX also provides \savebox to avoid this duplication. You may wish to look at the example below to see how you can use these. See Boxes for more details.

You can also define stretched values. A stretching value is a length preceded by plus or minus to specify to what extent tex is authorized to change the length. Example:

\setlength{\parskip}{10pt plus 5pt minus 3pt}

It means that tex will try to use a length of 10pt; if it is underfull, it will raise the length up to a maximum of 15pt; if it is overfull, it will lower the length up to a minimum of 7pt.

Note that it is not mandatory to specify both the plus and the minus values, but if you do, plus must be placed before minus.

If such a space should be kept even if it falls at the end or the start of a line, use \hspace* instead.

If the space should be preserved at the top or at the bottom of a page, use the starred version of the command, \vspace*, instead of \vspace. If you want to add space at the beginning of the document, without anything else written before, then you may use

{\vspace*{length}}

It's important you use the \vspace* command instead of \vspace, otherwise LaTeX can silently ignore the extra space.

TeX features some macros for fixed-length spacing.

\smallskip

Inserts a small space in vertical mode (between two paragraphs).

\medskip

Inserts a medium space in vertical mode (between two paragraphs).

\bigskip

Inserts a big space in vertical mode (between two paragraphs).

The vertical mode is during the process of assembling boxes "vertically", like paragraphs to build a page. The horizontal mode is during the process of assembling boxes "horizontally", like letters to build a word or words to build a paragraph.

The fact they are vertical mode commands mean they will be ignored (or fail) in horizontal mode such as in the middle of a paragraph. The first token next the a double linebreak is still in vertical mode if it does not expand to characters.

generates a special rubber space where factor is a number, possibly a float. It stretches until all the remaining space on a line is filled up. If two \hspace{\stretch{factor}} commands are issued on the same line, they grow according to the stretch factor.

% Create the holders we will need for our work\newlength{\mytitleheight}\newsavebox{\mytitletext}% Create the reference text for measures\savebox{\mytitletext}{%\Large\bfseries This is our title%}\settoheight{\mytitleheight}{\usebox{\mytitletext}}% Now creates the actual object in our document\framebox[\textwidth][l]{%\includegraphics[height=\mytitleheight]{my_image}%\hspace{2mm}%\usebox{\mytitletext}%}