4

After some search for errors, I have defined the following little example to show my issue.

The command perltex can nicely translate the following document:

\documentclass{article}

\usepackage{amssymb}
%\usepackage{fourier}
\usepackage{perltex}

\perlnewcommand\simplycopy[1]{
    return $_[0];
}

\begin{document}
    This works: $\mathbb{N}$

    This does not when using fourier: $\simplycopy{\mathbb{N}}$
\end{document}

Mind that the use of the fourier package has been commented out. If I want to use fourier, however, by changing two lines to be

%\usepackage{amssymb}
\usepackage{fourier}

I get an error

! LaTeX Error: Bad math environment delimiter.

See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ...

l.1 \math @bb {N}\endinput ?

Apparently, perltex runs into a problem with some internally used font macro name \math@bb.

Am I doing something wrong or is this a bug in perltex or maybe in fourier?

The automatically generated lgpl-file contains the following data:

############################### PERL CODE ################################
sub latex_simplycopy {
return $_[0];
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LATEX RESULT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


############################### PERL CODE ################################
latex_simplycopy ('\\math@bb  {N}');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LATEX RESULT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\math@bb  {N}

so I can see that perltex has added an @ character to the original macro input \mathbb{N}, and this may be related to the problem.

1 Answers1

4

The fourier package does

\AtBeginDocument{\let\mathbb\math@bb}

which sort of works, but not really. See When to use \LetLtxMacro?

\documentclass{article}
\usepackage{fourier}
\usepackage{letltxmacro}

\makeatletter
\AtBeginDocument{\LetLtxMacro\mathbb\math@bb}
\makeatother

\usepackage{perltex}

\perlnewcommand\simplycopy[1]{return $_[0];}

\begin{document}

This works: $\mathbb{N}$

This works too: $\simplycopy{\mathbb{N}}$

\end{document}

enter image description here

egreg
  • 1,121,712