5

I would like to set \parindent to 2em (or \quad which is the same if I know correctly). How can I do it?

\setlength{\parindent}{...} only accepts values with length units, for example, 15pt, 1cm, etc. It doesn't accept \quad; it gives the error "Illegal unit of measure".

Example:

\documentclass{article}
\setlength{\parindent}{\quad}
\begin{document}
A
\end{document}
  • 1
    \parindent=2em\relax Note that \quad is not a length, but a macro for skipping a length, so one cannot set \parindent to it. – Steven B. Segletes Mar 23 '15 at 16:48
  • \quad is a skip of 1em, so \setlength{\parindent}{1em} should do the trick. – Thruston Mar 23 '15 at 16:49
7

\quad means \hskip 1em\relax. You have to give a length directly as the argument to \parindent. So use \setlength{\parindent}{2em}.

\documentclass{article}
\usepackage{showframe}  %% just for demo
\setlength{\parindent}{2em}
\begin{document}
A\\
\hspace*{2em}A
\end{document}

enter image description here

You can find the meaning of \quad by texdef \quad in terminal. And to find the value of \parindent, put \showthe\parindent in your file and the value will be show in the log.

  • 2
    \AtBeginDocument{\setlength{\parskip}{1em}} is better. Why? Well, exercise for you. – egreg Mar 23 '15 at 18:08
  • @egreg For me? :-) May be I am a lazy student who runs out of time quickly these days. :-) – user11232 Mar 24 '15 at 0:24

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.