I've just added \RequirePackage[l2tabu, orthodox]{nag} to a big document (200+ pages, 100+ images) about computer science. My .log-file was 3119 lines long before, now it is 4349 lines long.

How can I use nag? Should I really go through 4000+ lines and check everything? There is a lot of noise (info messages by other packages) and I miss relevant information (file where the error happened).

Can I assume that the following transformations are safe? Or will quite probably something go wrong if I automatically make these transformations:

  • eqnarray -> align (12 times, seems to be safe)
  • old LaTeX 2.09 commands
    • \bf -> \textbf (27 times)
    • \rm -> \textrm (3 times)
    • \it -> \textit (2 times)
  • center-environment in figure -> \centering (seems to be safe, 164 times)
  • center-environment in table -> \centering (seems to be safe, 13 times)
  • h float specifier -> ht (Latex seems to do this automatically, so I guess it is safe, 42 times)
  • \label in float, but not after \caption -> change order (5 times)
  • \usepackage{a4wide} -> \documentclass[12pt,a4paper,twoside]{diss-report} (this is my current document class. So do I have to change anything?)

Is there a tool that automatically does those transformations?

  • They all seem to be safe (as in "the document will compile"). But some of them (most notably a4wide) will probably change the way your document looks. – T. Verron Jun 5 '13 at 13:28
  • 2
    The order between \label and \caption is more than safe, since putting the label before the caption won't work. See for example tex.stackexchange.com/questions/32325 – T. Verron Jun 5 '13 at 13:30
  • 2
    All of those changes look well worth doing, any text editor ought to be able to do those quite easily. in the case of [h] note changing it to [ht] is not the same as the default recovery that LaTeX will do and it would be better to use [htp] as omitting p makes float placement a lot harder. – David Carlisle Jun 5 '13 at 13:30

All those transformations look like a good idea (although they may change your document, the expected change is for the better) however

\bf should be changed to \bfseries rather than \textbf as the calling syntax for \textbf is different (it takes an argument) similarly the other two letter font commands.

As noted in comments it is better to change [h] to [htp].

When changing eqnarray to align take care to delete one & from each row, the syntax being a&=b rather than a&=&b.

| improve this answer | |
  • Query-replacing "{\bf " with "\textbf{" would work as well. – T. Verron Jun 5 '13 at 14:00
  • I've just seen that it is not [h] but [!h]. Is it also better to write [!htp] instead of [!h]? (By the way, my log message is now only 3582 lines long :-) ) – Martin Thoma Jun 5 '13 at 14:33
  • 2
    @moose yes although you should only rarely need ! If you are habitually using ! something is wrong (it means you are setting constraints then saying to ignore them: better to set the correct constraints in the first place) – David Carlisle Jun 5 '13 at 15:03
  • 4
    @T.Verron Not all uses of \bf will necessarily have a preceding { and not all instances of {\bf may be replaced by \textbf{ as the scope may include multiple paragraphs. – David Carlisle Jun 5 '13 at 15:04

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.