Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When working with large documents, or even across multiple (smaller) documents, I often find that I forget which typographical consistencies I should stick to.

With TeX being inherently consistent in the way it does things, most things are kept organized without the user even knowing about it. Additionally, using a customized documentclass (like memoir, for example) or packages (like xspace and titlesec, to name two) improves on this consistency by user's choice. Sometimes, however, you are left to your own devices and have to do things manually. Of course, the latter could also stem from not knowing that a package exists to do the job for you, or because you'd rather have more control over the placement/use of a certain things without having it automated or globally set.

To this extent, I though this would be a good place to ask the question: "Which tools/techniques do you use to maintain consistency within your document?"

Sure, the question sounds broad. Many answers are scattered across this site and elsewhere (like the Chicago Manual of Style or Bringhurst's Elements of Typographic Style). I was hoping to contain this diverse knowledge base in one location on TeX.SX (similar to what was done for Showcase of beautiful typography done in TeX & friends and LaTeX IDEs).

Here are some examples of useful (manual) tips/tricks:

  • The TeX Book mentions (p 25) the use of ties (~) in the context of Thor's "A SHORT STORY" when typesetting Mr.~Drofnats:

    A good typist will use ties within names...

  • \emph or \textit provides a good example of when/why to use either \emph or \textit.

  • The contents of DO’s and DON’Ts when typesetting a document has some very relevant manual application of consistencies, including:

    • Put a tilde before references or citations, e.g., Jie~\cite{habit06}.
    • Differentiate between text comma and math comma, e.g., type for $x=a$, $b$, or~$c$ instead of for $x=a,b$, or $c$.
    • Write ellipsis using \ldots instead of three dots.
  • The l2tabu documentation also provides an interesting list of "do's and dont's".

Any more?

share|improve this question
16  
Define commands for common structures; even if keywords will be typeset with \textsf, better define \newcommand\keyword{\textsf}. Similarly, define environments for common logical units that might deserve particular typographical treatment. –  egreg Sep 28 '11 at 22:16
4  
@egreg: I would suggest turning this into an answer. –  Werner Sep 28 '11 at 22:41
    
I'm assuming that the note about citations only applies if you are not using footnote citations, which you want to come right after the word? Or am I missing something? –  Canageek Sep 28 '11 at 22:45
    
@Canageek: I would think so, otherwise it would probably have used \footcite. –  Werner Sep 29 '11 at 5:02
    
A somewhat related question: Best practices references –  Werner Oct 7 '11 at 23:30

5 Answers 5

up vote 86 down vote accepted

Define commands for common structures; for instance, even if keywords will be typeset with \textsf, it's better to define

\newcommand\keyword{\textsf}

and use \keyword{mykey}. This not only adds visual clues when writing and reading the TeX document, but makes possible to change the typographical aspect at once everywhere.

Similarly, define environments for common logical units that might deserve particular typographical treatment.

Put structured comments around things like \enlargethispage or \pagebreak used during the final revision (which often turns out not to be really definitive). Make liberal use of comments in general.

share|improve this answer
3  
+1 for suggesting making "liberal use of comments in general". :-) –  Mico Oct 4 '11 at 10:59
4  
Thanks @egreg for "consistently" delivering valuable answers! –  Werner Dec 23 '11 at 6:10
    
Why would you use \newcommand\keyword{\textsf} instead of \let\keyword=\textsf? The \let variant leads to the same result (?) and doesn't need to be expanded on every occurence. –  Henri Menke Mar 23 at 16:36
1  
@HenriMenke There are two reasons: first, \newcommand is documented in the manual, \let isn't; second, if you change meaning to \textsf also \keyword will follow it. –  egreg Mar 23 at 16:37
1  
@cfr No, it's just a bit slower, but perhaps clearer. The “no argument” version better illustrates the concept of macro replacement. –  egreg Sep 21 at 9:17

I would add:

csquotes

Use csquotes rather than entering quotation marks manually. There are several ways to use the package. I tend to use the following in my preamble:

\usepackage[utf8]{inputenc}
\usepackage{csquotes}
   \MakeAutoQuote{‘}{’}
   \MakeAutoQuote*{“}{”}

The package will automatically switch from inner to outer quotes, at least for 2 levels of quotation marks. For example,

‘This is a quote which quotes ‘another quote’.’

produces

US style autoquotes

That is all very well if I'm writing for the other side of the Atlantic. But what if I'm writing on my own side?

\documentclass[british]{article}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
  \MakeAutoQuote{‘}{’}
  \MakeAutoQuote*{“}{”}

\begin{document}

‘This is a quote which quotes ‘another quote’.’

\end{document}

will produce this:

UK style autoquotes

Similar support is available for a number of other languages. One advantage of this is that simply by changing the style in the preamble, I can easily change to the style of quotes required by a particular journal or publisher. I don't have to search and replace every occurrence of `...' with ``..'' in my text.

Not all languages supported by babel and polyglossia are supported by csquotes. Welsh is supported by babel, for example, but not by csquotes. Fortunately, welsh can be straightforwardly defined as an alias of british (see moewe's comment on my question about biblatex support for Welsh:

\documentclass[welsh]{article}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\DeclareQuoteAlias{british}{welsh}
  \MakeAutoQuote{‘}{’}
  \MakeAutoQuote*{“}{”}

\begin{document}

‘Pwy sy'n gofyn ‘pwy sy'n gofyn?’?’

\end{document}

produces

Welsh quotes

In addition, csquotes and biblatex cooperate if used together, and csquotes also offers facilities for typesetting block quotations, quotations in foreign languages, quotations with citations, ellipses and more. For US English, for example, it also offers automated support for the illogical punctuation some publishers insist on (where the punctuation is moved inside the quotation marks even though it is not part of the material quoted).

Package Customisation

In addition to defining macros as egreg suggests, make liberal use of the support packages offer for creating custom commands and environments.

For example, if you use enumitem to customise lists, and want to use the same settings for several lists in a document or in several documents, rather than repeating the settings each time, use \newlist and \setlist so that you can tweak the settings in one place as required, ensuring consistency.

\documentclass{article}
\usepackage{enumitem}
\newlist{mylist}{enumerate}{1}
\setlist[mylist]{label={Item \Alph*)}, font=\sffamily\bfseries, ref={item \Alph*}, wide}
\begin{document}

  This is an example of a customised enumeration environment which could be used repeatedly in one or many documents to ensure a consistent style:
  \begin{mylist}
    \item First
    \item \label{item:second}Second
  \end{mylist}
  Consider \ref{item:second}. Moreover, if you need the enumeration to increment consistently, you may also wish to use a further option:
  \begin{mylist}[resume]
    \item Third
  \end{mylist}

\end{document}

My list

Using the facilities offered by referencing packages such as fancyref or cleveref can ensure consistent cross-references, and packages such as geometry and fancyhdr can assist with consistent page layout.

Finally, if using TiKZ, use styles for the sake of both compact, readable code and consistency.

Common Preamble

If multiple documents should be typeset consistently because they are part of the same project, for example, use a single preamble containing all of the common packages and definitions. For example, define colours, page layout and general formatting here. Then \input{preamble} in each of the individual files. That way, the documents remain distinct and can be compiled separately but common customisation is managed in a single location.

share|improve this answer

There are also issues like the following:

In Czech typography, one-letter prepositions and conjuctions (v, s, z, k, o, u, a, i) should not be at the end of a line. Tildes are added automatically by the encxvlna package by Zdeněk Wagner and Petr Olšák. It needs the encTeX extension.

Also in Czech typography, for a word containing hyphen it is ideal to break the like at the hyphen, however in that case the hyphen should be repeated on the next line. For this one needs a macro which implements that logic (it is present in new version of babel package and there is also shorthand "= for it). But you still have to manually write "= instead of - at particular places.

My point is that as far as I know, there is no good solution for issues like this. Either one has to manually put additional marks into the text or use specialized TeX magic which is (at least for me) not flexible enough. The last and my favourite option is to write a preprocessor and establish additional level of abstraction. This is however non-trivial and time-consuming.

share|improve this answer

There are some situations in spacing, where the author has to make TeX/LaTeX aware of an exception. Make a difference between 'full stop' and 'full stop after an abbreviation' as in this example:

I like BASIC\@. What about you?

The \@ enforces end-of-sentence period even if the precedent character was a capital letter, it is not part of an acronym. Also, I usually set a fixed space between the number and the unit, when a quantity is given, e.g.:

switching frequency of 1\ MHz

\ inserts a space that cannot be stretched.

share|improve this answer
35  
I prefer using siuntix for typesetting numbers, eg. \SI{1}{\mega\hertz}. That makes it easier to change the style global and consistent. –  Tobi Sep 30 '11 at 12:51
1  
@Tobi: wasn't aware of that package... good idea! :) –  Count Zero Sep 30 '11 at 12:55
10  
@CountZero: Note that a space inserted with \ can be stretched and shrunk. –  mhp Sep 30 '11 at 18:38
3  
@mhp: Thanks, you're right about that one --- still, I don't really understand this. I'll rather post it as a question, so this page will not be cluttered with comments. –  Count Zero Oct 1 '11 at 21:45
1  
I always have trouble remembering the syntax for \@. Isn't there a more verbose but clearer alternative available? I am thinking something such as \dontEndASentenceHere? –  Federico Poloni Oct 31 '12 at 21:52

For ellipses, do not only use \ldots, but also load the ellipsis package. Package description:

This is a simple package that fixes a problem in the way LaTeX handles ellipses: it always puts a tiny bit more space after \dots in text mode than before it, which results in the ellipsis being off-center when used between two words.

\documentclass{article}

% \usepackage{ellipsis}% Remove comment sign and compare

\begin{document}

\Huge

Some text \ldots\ and some more.

\end{document}

Note that ellipsis must be loaded after hyperref. (The ellipsis documentation doesn't mention this, but the hyperref README does.)

share|improve this answer
2  
Also if you use the ellipsis package and want square brackets around the dots you should load the package with the mla option as in \usepackage[mla]{ellipsis}. –  N.N. Sep 29 '11 at 7:15
4  
I prefer another way: use the Unicode ellipsis character '…' (but not in math mode). This ellipsis is just as the font designer wanted, not artificially generated, and this makes text look a bit more consistent. One also can set up a proper sfcode for this character, if using \nonfrenchspacing. –  Andrey Vihrov Sep 29 '11 at 7:32
    
Why do you need to force a space with \ after \ldots? Can you elaborate on that? –  adn Dec 8 '11 at 4:43
    
I know this is a bit old, but: doesn't the ellipsis package provide (or redefine) the \dots command? Why are you then talking about \ldots? Are they somehow related? –  mSSM May 17 '12 at 16:39
    
@mSSM From the LaTeX kernel: \let\ldots\dots. Perhaps I'll include a hint about this in my answer. –  lockstep May 17 '12 at 16:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.