# [texhax] correct spacing between adjacent quote marks

Philip TAYLOR P.Taylor at Rhul.Ac.Uk
Sun Oct 25 11:18:46 CET 2009

P. R. Stanley wrote:

>         Paul: In which case the question is, what class of fonts would
> suit what sort of spacing, or are there too many to list?
>
> If getting the right font and kerning combinations relies essentially on
> one's ability to "see", then what alternative would the list recommend?

This is one of the most interesting (and stimulating)
questions I have ever encountered, because it challenges
the very way in which I think about typography.

As someone who is in the privileged position of being
able to see, there are many many elements of fine tuning
that I make to a document before I consider it finally
Mittlebach, he will tell you that in preparing the LaTeX
series of books, the 10% that is the fine-tuning actually
requires 90% of the total time.  Now your question -- which
I think is a very reasonable one -- is "could someone
who cannot see perform this fine-tuning ?", and if (as
I suspect) the answer to that is "probably not", then
"what additional  steps could such a person take in order
to ensure that no fine-tuning is actually needed ?".

The answer to the latter question seems to me to be at the
heart of the matter.  In practice, if fine-tuning is to be
avoidable, then every step of the process has to be very
carefully automated, and the person responsible for each
element has to ensure that his or her contribution can be
used without any need to visually check the result.  Let
me give an example.  Suppose you were writing a book,
and you wanted to typeset the following passage of
dialogue :

<example>
\parindent = 0 em
\parskip = 1 ex
\hsize = 16,5 pc

Jill said, somewhat casually,
I was having lunch today at Pod Samsonek'''.

What?'', Jim interrupted,  Pod Samsonek'
as in the famous Warszawa restaurant?!''
\end
</example>

The result of typesetting this passage in TeX is not
only ugly, it's actually wrong : TeX interprets the
sequence of three consecutive closing quotation marks
as meaning <close double quotes><close single quotes>
whereas the author actually intended (and required)
the converse.

Therefore, to mark up such passages successfully, it
is necessary to augment the low-level markup with one
or more macros, the function of which is to clarify
the semantic nature of the markup and thereby to
ensure that the results are as intended.  This can
be accomplished as follows :

<example>
\parindent = 0 em
\parskip = 1 ex
\hsize = 16,5 pc

\def \lq  {{}}
\def \rq  {{'}}
\def \lqq {{`}}
\def \rqq {{''}}

Jill said, somewhat casually,
\lqq I was having lunch today at \lq Pod Samsonek\rq \rqq.

\lqq What?\rqq, Jim interrupted,  \lqq \lq Pod Samsonek'
as in the famous Warszawa restaurant?!\rq \rqq
\end
</example>

This generates semantically correct output, but many would
argue that it still leaves something to be desired.  For
example, the spacing between consecutive quotation marks
could be increased, tall punctuation (such an the interrogative
and exclamation marks) set off by a small amount of white
space and so on.

Rather than having to do this laboriously throughout the
text, the obvious step would be to introduce a little
AI[1] into the code.  The \lq, \lqq, \rq and \rqq macros
could use look-ahead to see if each is followed by another
of the family, and if so, some additional spacing introduced.
The interrogative and exclamation marks could be made
active, and could similarly become self-spacing.

But there is an alternative.  Remember that, within
a single font, kerning (the choice of spacing between
consecutive glyphs) is a function of the font.  It would
therefore be possible to implement a so-called /virtual/
font that performs the same tasks as the macros and
active characters of the preceding paragraph.  Since
virtual fonts "know" what glyphs follow, all possible
combinations can be specified and optimised for spacing.

But ultimately, no matter how one attempts to automate
the task, the final decision is /essentially/ a visual
one : I do not think that AI and AT[2] have yet advanced
to the point where someone who cannot see can be
/certain/ that the spacing of a document is absolutely
optimal, since the whole purpose of the spacing is
to provide visual cues and clues for a sighted reader.
Yes, Beethoven composed amazing music even when he was
almost totally deaf, but for many deaf people, that
would be a nigh-impossible task.  And I suspect (with
sadness) that the same is probably true for typography :
because it is intended to communicate /visually/, it is
very hard indeed for a person who cannot see to produce
results that cannot be improved, although if the typesetting
engine, macros and fonts have all been designed perfectly,
then the achievable results will almost certainly be more
than acceptable to 99,9% of the readers.

Philip TAYLOR
--------
[1] AI : Artificial Intelligence
[2] AT : Assistive Technology