When using \hspace
and \vspace
, I often run into a decision of which units to use. In many examples I see the use of ex
, cm
, mm
, pt
, in
, and so on. I also use .1\textwidth
or .1\textheight
. I wonder if there is a standard unit that makes sense for moving boxes or figures in beamer; I am recently consolidating all of my vertical space units to ex
but is this sensible? Is there an equivalent horizontal space unit which corresponds to character width (for a monospace font), for instance?
1 Answer
It depends why you are moving things.
.1\textwidth
is a fraction of the page size so changes if you change page size (which is perhaps less likely in beamer than in a journal article class). 5pt
is a fixed unit (at some notional size which may not relate to any actual size by the time you have projected your presentation, so it is more or less used the same way as a fraction of \textwidth
for positioning things relative to the page in fixed units. cm
, in
etc are just (in TeX) defined as fixed multiples of pt
so they are just for human convenience. If you find cm
more convenient than pt
use it if not, don't.
ex
and em
are font related sizes so don't use them for positioning on page as the position will change depending on the font. Use them for things like indents (or defining the size of inter-word-space) or inter-paragraph space where the size determination relates to the content rather than the area into which the content is being typeset.
Traditionally em
is used for horizontal units (its name derives from the width of an M
) and ex
is used for vertical units (its name derives from the height of an x
).
em
for horizontal space. See this for more info: tex.stackexchange.com/questions/8260/… ,especially Herbert's last answer and this one tex.stackexchange.com/questions/4239/…\documentclass
has a10pt
(11pt
) option then1em
will be equal to10pt
(11pt
). Some lengths are better expressed relative to the type size, in which case you should useem
orex
. Other units are better expressed in absolute units such ascm
,m
, and eveninch
.