15

I'm typesetting an English text in an 18th century style (based on a 1725 edition of Alexander Pope's "Dunciad"). Is there a LaTeX package I can use to automatically add the correct space before (and after) punctuation? I need something similar to the spacing given for "french" in babel, but there doesn't seem to be an option to do this for "english", and the closest I can find in another package is ecclesiastic.sty, which does a similar thing for Latin.

lockstep
  • 250,273
  • 6
    You probably need to explain what this entails more clearly. Surprisingly, not everyone is familiar with the 1725 edition of the Dunciad. Is it identical to what French typography requires, or only similar in certain respects? – jon Jul 25 '12 at 01:25
  • 1
    LaTeX provides the \frenchspacing declaration, which turns off the (ugly) default habit of adding extra spacing after fullstops. I'm not aware of other options. Is this what you're looking for? –  Jul 25 '12 at 02:12
  • Just from looking at a facsimile, I'm not sure what the rules are. I was hoping for guidance on that as well as technical suggestion. – Reuben Thomas Jul 25 '12 at 10:52

2 Answers2

15

You could make the !, ?, ;, and : characters "active" in TeX jargon, i.e., turn them into control sequences which, in this case, automatically insert a "thinspace" before the corresponding characters.

\documentclass{article}
\catcode`\!=\active \edef!{\unskip\noexpand\,\string!}
\catcode`\:=\active \edef:{\unskip\noexpand\,\string:}
\catcode`\;=\active \edef;{\unskip\noexpand\,\string;}
\catcode`\?=\active \edef?{\unskip\noexpand\,\string?}

\begin{document}
Hello? World! I'm; here: now.
\end{document}

enter image description here

Mico
  • 506,678
  • 3
    Spaces are not ignored after active characters, so \xspace is not needed. I'd add instead \unskip before the thin space: copying from a source where the punctuation signs are spaced can lead to inserting spaces in the input. I'd write \edef!{\unskip\noexpand\,\string!}, so defining \ExclaSign is redundant, but it's a matter of taste. In any case a space before the closing brace in the definition of \ExclaSign is important. – egreg Jul 25 '12 at 06:45
  • 1
    Is there a functional solution that would also work for commas (i.e. without messing up all lists and multiple arguments)? I know there was some discussion of this a while ago… In some ancient texts, there is also a space before commas. – ienissei Jul 25 '12 at 07:10
  • How to make it work for slashes (/)? The naive solution doesn't work. – Kyle_the_hacker Oct 06 '16 at 15:31
  • @Kyle_the_hacker - Please state what you mean by "the naive solution". For sure, copying the last line of the preamble and changing the three instances of ? to / works just fine. – Mico Oct 06 '16 at 21:12
  • This doesn't go well with \label{with:colon}. – Toothrot Aug 13 '17 at 22:29
  • It doesn't apply to the other answer. And the question doesn't mention active characters. – Toothrot Aug 13 '17 at 23:19
  • @Toothrot - And the OP didn't mention \label{with:colon} -- or cross-referencing in general. What are you trying to get at? – Mico Aug 13 '17 at 23:59
  • That there is a problem with this solution. Same with tikz and semicolons. – Toothrot Aug 14 '17 at 00:08
  • @Toothrot -- please be less cryptic. – Mico Aug 14 '17 at 00:42
  • This will probably produce errors with tikz as well, which I think uses semicolons to end commands. – Toothrot Aug 14 '17 at 00:47
  • @Toothrot -- I made no claim that the proposed solution works with all packages under the sun. I made no claim that it works always and everywhere, regardless of the circumstances . I'm confident, though, that it's entirely adequate for the setup described by the OP. I thus see no reason to make any changes. If you disagree, you are entirely free to provide a new answer, in which you can (and should) explain in which sense your solution is better than mine. – Mico Aug 14 '17 at 01:16
  • Why so antagonistic? I pointed out a problem; I didn't blame you for it or demand that you fix it. – Toothrot Aug 14 '17 at 23:09
  • @Toothrot - "Why so antagonistic?" It's you who's being antagonistic, not me. You keep calling things "problems" even though, given the OP's setup, it's quite clear that they're not. It's been more than five years since I wrote the original answer; nobody else, not even the OP, appears to have felt strongly enough about this answer to point out the (non-existent, in my view) problems. – Mico Aug 15 '17 at 04:01
12

If you use a recent pdflatex you can also enable the french extrakerning of microtype:

\documentclass{scrbook}
\usepackage[T1]{fontenc}
\usepackage[kerning=true]{microtype}

\begin{document}
What is the result of these settings? 
Some space! 

\microtypecontext{kerning=french}
What is the result of these settings?
Some space!
\end{document}
Ulrike Fischer
  • 327,261
  • This is great! Merely adding \usepackage{microtype} gets me basic optical alignment, and the manual explains how to customize the spacing of punctuation. I will start with the settings for French and try to find out what old-style English actually requires (and if I get a good answer, add it here). – Reuben Thomas Jul 25 '12 at 12:56
  • 1
    @ReubenThomas - Be aware that (current) French typographic usage calls for (and microtype's kerning=french setting thus implements) a slightly larger amount of whitespace before a colon (:) than before the other three symbols of interest. This may, or may not, be what your typesetting needs require. – Mico Jul 25 '12 at 13:15
  • Thanks @Mico, I have adapted the default French settings to make the spacing before each of ; : ! and ? the same, as that is what seems to be the case in the facsimile I'm working from (though there the extra space varies quite a bit). – Reuben Thomas Aug 06 '12 at 19:19