Now, everytime I want to use hspace/vspace/... I always have to type "mm" behind my number and I often forget it. Is it possible to make sure that latex "knows" my units are in mm?

  • 1
    Welcome to TeX.SX! Why not simply defining an own version that doesn't interfere with TeX's units? – TeXnician Oct 31 '17 at 13:57
  • 1
    Can you give some example when you use \hspace and \vspace? Maybe there is a way to automatically generate your desired format without putting in manual spaces. – samcarter_is_at_topanswers.xyz Oct 31 '17 at 14:02
  • it's just in beamer when making my slides, to shift the text sometimes – guywithaproblem Oct 31 '17 at 14:09

How about defining the following macros in the preamble


and writing \myhsp{7}, \myvsp{12}, etc in the body of the document?

This is safer than redefining the way \hspace and \vspace operate. These two macros are used in lots of LaTeX kernel commands, and modifying them has the potential to precipitate mysterious crashes. Don't even think about going there.

| improve this answer | |

Using @TeXnician's suggestion, the following could be an easy implementation:


\newcommand*{\hspacemm@@}[1]{\hspace*{ #1 mm}}
\newcommand*{\hspacemm@}[1]{\hspace{ #1 mm}}
\newcommand*{\vspacemm@@}[1]{\vspace*{ #1 mm}}
\newcommand*{\vspacemm@}[1]{\vspace{ #1 mm}}

\hspacemm*{10}This \hspacemm{20}is spaced\\
This not
| improve this answer | |

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.