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.

I have the following 'test file' in which I am working, works without problems when compiling with '(La/Xe/pdf) TeX' but throws an error when compiling with 'LuaLaTeX':

Package: l3names 2012/09/24 v4230 L3 Namespace for primitives
)
Runaway argument?
! Forbidden control sequence found while scanning use of \next.
<inserted text> 
                \par 
l.66 \reserveinserts
                    {32}
I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.

the file is as follows:

\documentclass{article}
\usepackage{soulutf8}
\usepackage[math]{blindtext}
\usepackage{xwatermark}
%\usepackage[verbose=silent]{microtype}
\usepackage{xcolor}
\usepackage{ifpdf,ifluatex,ifxetex}
\newif\ifxetexorluatex
\ifxetex
  \xetexorluatextrue
\else
  \ifluatex
    \xetexorluatextrue
  \else
    \xetexorluatexfalse
  \fi
\fi
\ifxetexorluatex
    \usepackage[no-math]{fontspec}
    \setmainfont[Ligatures=TeX,RawFeature=+onum]{Linux Libertine O}
    \setsansfont[RawFeature=+pnum]{Linux Biolinum O}
    \newfontfamily{\biolinum}{Linux Biolinum O}
    \newcommand{\bitext}[1]{\biolinum #1}%
    \newwatermark[allpages,fontsize=2.0cm,align=center,color=gray!45,angle=45,xpos=0,ypos=0]{\textbf{\bitext{Preliminar 2012}}}
\else
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage{fourier}
    \usepackage[rm]{libertine} 
    \renewcommand{\sfdefault}{LinuxBiolinumO-LF}
    \newwatermark[allpages,color=gray!45,angle=45,fontfamily=LinuxBiolinumO-OsF,scale=2.5,xpos=0,ypos=0]{Preliminar 2012}
\fi
\begin{document}
\sodef\textss{}{.3em}{0.6em}{0pt}
\noindent
\begin{center}
\textbf{\textss{\large\scshape «Universidad de Concepci\'{o}n»}}
\end{center}
\Blinddocument
\end{document}

Use 'TexLive 2012' in Win32/Linux (updated). Check the documentation of l3names, but it is a 'little' advanced for my level, any suggestions or help would be appreciated. regards Pablo

share|improve this question
add comment

2 Answers

up vote 8 down vote accepted

A minimal example would have been:

\documentclass{article}
\usepackage{xwatermark}
\usepackage{fontspec}
\begin{document}
\end{document}

After analysis the example becomes:

\RequirePackage{catoptions}% loaded by xwatermark
\outer\def\foo{}% outer macro as \reserveinserts
\RequirePackage{capt-of}% package does not matter
\foo
\csname @@end\endcsname % end of job, after the error

Or

\RequirePackage{catoptions}
\outer\def\foo{}
\makeatletter
\ifnextcharTF[{\typeout{yes}}{\typeout{no}}\foo
\@@end

After \RequirePackage[options]{package} there is an additional optional argument for a minimal requested release date. These macros are redefined by package catoptions. However the test for an optional [ not only uses the usual \futurelet, but the next token is also read in as macro argument (\cpt@ifn@xtcharacter). That fails if the next token is an outer macro.

Workaround:

\documentclass{article}
\usepackage{xwatermark}% or catoptions
\makeatletter
\let\org@cpt@ifbrack\cpt@ifbrack
\renewcommand*{\cpt@ifbrack}{\@ifnextchar[}
\makeatother
...
share|improve this answer
    
Thank you very much for the explanation, you are absolutely right, I should have shown an MWE as showing you, in short, nothing but thank the explanation and correction of the problem.. Thanks for all –  Pablo González L Nov 28 '12 at 4:32
    
@Heiko I take it that this is a bug in catoptions, not expl3, so there is nothing for me to do? –  Joseph Wright Nov 28 '12 at 8:03
    
@JosephWright To avoid trouble with catoptions you could add \relax after \RequirePackage{etex} in expl3.sty. –  Heiko Oberdiek Nov 28 '12 at 9:48
1  
@HeikoOberdiek Done in the SVN: will be in next release. –  Joseph Wright Nov 28 '12 at 9:53
    
"For certain applications, however, it is inconvenient that some of the plain macros are outer, in particular macros such as \newskip. One remedy is to redefine them, without the \outer option, which is done for instance in LATEX, but cleverer tricks are possible." - TeX by Topic –  Ahmed Musa Nov 28 '12 at 17:43
add comment

Thanks to Heiko. I will upload an update of catoptions to CTAN. In the meantime here is a patch. The problem wasn't due to a bug: \outer is an odd type that I didn't foresee could appear. Master Heiko knows why I am rather wary of LaTeX kernel's \@ifnextchar.

\documentclass{article}
\usepackage{xwatermark}
\makeatletter
% Copy this to end of catoptions:
\edef\if@let@token@isouter{%
  \unexpanded{\expandafter\if@let@token@isouter@a\meaning\@let@token}%
  \detokenize{outer macro}:\cpt@nil
}
\edef\reserved@a{%
  \def\noexpand\if@let@token@isouter@a##1\detokenize{outer macro}:##2\cpt@nil
}
\reserved@a{\@nameuse{@\ifblankTF{#2}{second}{first}oftwo}}
\def\cpt@ifnextcharacter#1#2#3{%
  \ifcase0%
    \ifcat\noexpand\@let@token\bgroup 1\fi
    \ifcat\noexpand\@let@token\egroup 1\fi
    \if@let@token@isouter{1}{0}\relax
    \let\next\cpt@ifn@xtcharacter
  \else
    \def\next{\endgroup\cpt@ifnextchar}%
  \fi
  \next{#1}{#2}{#3}%
}
% End of patch.
\makeatother
\usepackage{soulutf8}
\usepackage[math]{blindtext}
\usepackage{xcolor}
\usepackage{ifpdf,ifluatex,ifxetex}
\newif\ifxetexorluatex
\ifcase0\ifxetex\else\ifluatex\else 1\fi\fi\relax\xetexorluatextrue\fi
\ifboolTF{xetexorluatex}{%
    \usepackage[no-math]{fontspec}
    \setmainfont[Ligatures=TeX,RawFeature=+onum]{Linux Libertine O}
    \setsansfont[RawFeature=+pnum]{Linux Biolinum O}
    \newfontfamily{\biolinum}{Linux Biolinum O}
    \newcommand{\bitext}[1]{\biolinum #1}%
    \newwatermark[allpages,fontsize=2.0cm,align=center,color=gray!45,
      angle=45,xpos=0,ypos=0]{\textbf{\bitext{Preliminar 2012}}}
}{%
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage{fourier}
    % There is a problem with the option 'rm' for libertine:
    % \usepackage[rm]{libertine}
    \usepackage{libertine}
    \renewcommand{\sfdefault}{LinuxBiolinumO-LF}
    \newwatermark[allpages,color=gray!45,angle=45,
      fontfamily=LinuxBiolinumO-OsF,scale=2.5,xpos=0,ypos=0]{Preliminar 2012}
}%

\begin{document}
\sodef\textss{}{.3em}{0.6em}{0pt}
\begin{center}
\textbf{\textss{\large\scshape «Universidad de Concepci\'{o}n»}}
\end{center}
\noindent\Blinddocument
\end{document}

Here is a fuzz:

\outer\def\foo{}
\iftrue\ifnextcharTF*\relax\relax\foo\fi
\iftrue\ifnextcharTF*\relax\relax\fi
\ifnextcharTF*\relax\relax\iftrue\fi
share|improve this answer
    
The package 'libertine' develops very fast, need change [rm] by [sflf], delete "\renewcommand{\sfdefault}{LinuxBiolinumO-LF}" and change "LinuxBiolinumO-OsF" with "LinuxBiolinumT-OsF", many thanks for the help. –  Pablo González L Nov 29 '12 at 1:24
add comment

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.