3

what does \[length] mean? like this:

\documentclass{article}
\begin{document}
mmmmm\\[-0.33em]
mmmmm

mmmmm

\hspace{-0.33em}mmmmm
\end{document}

why are these do not render the same?

1 Answer 1

2

To begin with, LaTeX commands can take both required and optional arguments. Required arguments are (generally) enclosed by curly braces, while optional arguments are enclosed by square brackets.

Next, if the string

mmmmm\\[-0.33em]

occurs inside an array or a tabular-like environment, the sub-string \\ is the instruction to insert a line break and [-0.33em] represents an optional argument to the \\ instruction. If the argument, which is supposed to be a length, is a positive, additional vertical whitespace -- in the amount of that argument -- will be inserted; it it's negative, that amount will be subtracted from the default amount of vertical space that's inserted by \\.

(Aside: If you use \\ outside of array and tabular-like environments, it's quite likely that you're doing something wrong...)

In contrast, \hspace is a text-mode command that serves to insert or subtract horizontal space. Incidentally, to LaTeX, \hspace{0pt} is not the same as "doing nothing" -- inserting "zero-length whitespace" can have significant and (if used correctly) very handy use cases.

In short, there's no reason to believe that \\[-0.33em] and \hspace{-0.33em} would, let alone should, produce the same outcome.

2
  • I see this in pkuthss, it is in a section like ` \section*{mmmmmmmmm \[-0.33em]\textmd{xxxxxxxxxxxxxxxxxxx}}, so it should be equal to a line break plus \vspace{-0.33em}`? Jun 4, 2023 at 5:05
  • @Firestar-Reimu - I guess it's a way of creating a subheader, in non-bold font weight, on a line below the main section-level header. I deliberately used the qualifier "quite likely", as there's no rule without an exception, right? For sure, though, the vast majority of uses of doble-backslash in postings to TeX.SE, outside of array and tabular settings, do not serve such a legitimate purpose...
    – Mico
    Jun 4, 2023 at 5:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .