I'm using package lineno for proofreading of my documents. So I usually have something like the following MWE:



\usepackage{ifthen}           % to use if then else
\newboolean{korrektur}        % for proofreading: true/false
 \setboolean{korrektur}{true} % choose one, comment the other

% What we need for proofreading
\ifthenelse{\boolean{korrektur}}% proofreading wanted?
{% YES:
  \usepackage{showframe}          % shows type area
  \usepackage{lineno}             % numbers lines
  \pagewiselinenumbers            % lines per page
{% NO:
% error if lineno was used before:
  \typeout{***** Please delete .aux files if you get errors! *****}
% What to add here so that I get no errors?  %<=================


Run it two times. Everything should be well, blindtext is numbered.

Now please move the % sign from line 8 (false) to line 7 (true).

Because we had had the run before there is an .aux-file, including lines with the macro \@LN.

If you compile now you will get the following error message (and some more):

***** Please delete .aux files if you get errors! *****
! Undefined control sequence.
l.2 \@LN

Question: Is it possible to add in line 20 (see %<===========) something to get rid of the error messages? Something that resets the meaning of macro \@LN?


Note that the error involving \@LN reports the macro to possibly take 2 arguments. This is confirmed from within lineno.sty:

                 \csname LN@P#2C\@LN@column\expandafter\endcsname
                 \csname LN@PO#2\endcsname

So, just add


at the "base level" in your preamble (for example, just after \documentclass{article}). This will define \@LN (the missing macro) only if it is not already defined. Since the package defines \@LN via \def, it will be redefined if lineno is loaded.

If you which to provide this command within another command (like within the false clause of your conditional), then you need to place the \makeatletter...\makeatother pair outside the main conditional:

  {% YES:
  }{% NO:

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.