21

Why do

``` 

and

''' 

produce outputs with different spaces?

enter image description here

\documentclass{article}
\parindent=0pt

\begin{document}
Input:
\begin{verbatim}
```\\
'''
\end{verbatim}

Output:

```\\
'''
\end{document}
Moriambar
  • 11,466

1 Answers1

19

The TeX Book mentions (Chapter 2: Book Printing versus Ordinary Typing, p 5): "There's usually less space preceding a single left quote than there is preceding a double left quote. (Left and right are opposites.)"

As such, in the default Computer Modern font,

```\ \ldots\ '''

is interpreted as “‘ ... ”’ that has an opening double quote and a closing single quote, resulting in incorrect spacing. In these instances, Knuth suggests using

enter image description here

Outer double, inner single: ``\thinspace`\ \ldots\ '\thinspace'' \par
Outer single, inner double: `\thinspace``\ \ldots\ ''\thinspace'
Werner
  • 603,163