8

Suppose I have written a very long document using \usepackage[T1]{fontenc}; then I remove the line to revert to the default OT1 encoding (or vice versa.) Now I want to know if anything's changed in the output, without trying to do it by eye over 180 pages.

As far as I know, the typeable ASCII characters which correspond to different characters in T1 vs. OT1 are |, <, >, and ". (Also different are {, }, _, and \, but these have special meaning to TeX, so as far as I know you have to use a macro to get them in the output, which should always work regardless of encoding.)

Is it true that the only differences in the content of the output (disregarding the appearance of the font, hyphenation, etc.) when changing the font encoding are where |, <, >, or " are used in the source outside math mode?

And, is there any tool which can find all such occurrences?

The tricky part of such a tool would be figuring what's math mode and what isn't! Also, for my case, it would be really great if it could disregard TikZ constructs using |, <, >, or " (e.g. the quotes syntax), but not actual text within a tikzpicture.

  • grep sed and gawk. But the details will be specific to the way you've coded the document. The more consistent your coding, the easier it will be for you to create suitable regular expressions for searching. If your code is all over the place, the 'find' function of your editor will likely be quicker. – cfr Apr 9 '15 at 1:37
  • @cfr: If there's already a tool to parse text mode vs. math mode, using it would surely be preferable to attempting to recreate one using regular expressions, which is in any case doomed to fail. – Nick Matteo Apr 9 '15 at 2:34
  • Whether or not it is 'doomed to fail' depends on your code, as I said. But it depends on there being sufficient regularity to make it worth the trouble. – cfr Apr 9 '15 at 2:43
7

There should never be any of |<>" in text input whatever the encoding so the problem should not arise. Perhaps the simplest test would be to add \showoutput then search or \OT1.* >

for example

\documentclass{article}
\showoutput
\begin{document}

<a>

\end{document}

Then the lines

....\OT1/cmr/m/n/10 <

....\OT1/cmr/m/n/10 >

In the log highlight the problem <> in OT1 encoded font.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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