Forgot a \protected (and tested it without uncommenting the cmap
package...). Please try again with the attached version.

On Fri, Feb 05, 2021 at 06:59:08AM +0900, Norbert Preining wrote:
> > Could you please test the attached version of cmap.sty before I upload
> 
> (/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmr.fd)<<ot1.cmap>>
> ! You can't use `[unknown command code! (0, 1)]' after \the.
> <recently read> notexpanded: font@name
> 
> l.5           \begin{tabular}
>                            {c}
> ? X
> 
> Norbert
> 
> --
> PREINING Norbert                              https://www.preining.info
> Fujitsu Research Labs  +  IFMGA Guide + TU Wien + TeX Live + Debian Dev
> GPG: 0x860CDC13   fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13
> _______________________________________________
> Latex-team mailing list
> [email protected]
> https://lists.dante.de/mailman/listinfo/latex-team
% Copyright (c) 2003-2021 Vladimir Volovich <[email protected]>
% cmap package -- download CMap files into PDF
%   to make "search" and "copy-and-paste" functions work properly
% You may distribute and/or modify this program under the terms of LPPL
% the program consists of cmap.sty and 
{t1,t2a,t2b,t2c,t5,ot1,ot1tt,lae,lfe}.cmap
% Usage: put \usepackage{cmap} immediately after the \documentclass line
% Thanks to:
%   Han The Thanh
%   Maxim I. Tishin
%   Petr Sojka
%   Werner Lemberg
%   Oleg Katsitadze

\ProvidesPackage{cmap}[2021/02/04 v1.0j CMap support: searchable PDF]

\DeclareOption{resetfonts}{%
  \@for\reserved@a:=%
    OT1/cmr/m/n/5,OT1/cmr/m/n/7,OT1/cmr/m/n/10,%
    OML/cmm/m/it/5,OML/cmm/m/it/7,OML/cmm/m/it/10,%
    OMS/cmsy/m/n/5,OMS/cmsy/m/n/7,OMS/cmsy/m/n/10,%
    OMX/cmex/m/n/10%
  \do{%
    \expandafter\let\csname\reserved@a\endcsname\relax
  }%
}
\ProcessOptions

\@ifundefined{pdffontattr}{%
% The cmap package can be used only with pdflatex,
% but not with ordinary latex
  \PackageWarningNoLine{cmap}{pdftex not detected - exiting}%
  \endinput
}\relax
\ifnum\pdfoutput<1
  \PackageWarningNoLine{cmap}{pdftex in DVI mode - exiting}
  \expandafter\endinput
\fi

\edef\reserved@a{\noexpand\in@{,fontenc.sty,}{\@filelist}}% enc.def
\reserved@a
\ifin@
\PackageWarningNoLine{cmap}{fontenc already loaded - some fonts may be 
unprocessed}
\fi
%\@ifpackageloaded{babel}{%
%\PackageWarningNoLine{cmap}{babel already loaded - some fonts may be 
unprocessed}%
%}\relax

\@ifundefined{pdfnobuiltintounicode}{%
  \@ifundefined{pdfgentounicode}\relax{
    \pdfgentounicode=0
  }%
  \protected\def\cmap@nobuiltintounicode{%
    \expandafter\@gobble\the
  }%
}{%
  \let\cmap@nobuiltintounicode\pdfnobuiltintounicode
}

\def\extract@font{%
  \get@external@font
  \global\expandafter\font\font@name\external@font\relax
  \font@name\relax
  \cmap@hook
  \csname\f@encoding+\f@family\endcsname
  \csname\curr@fontshape\endcsname
  \relax
}
\def\cmap@load{%
  
\edef\reserved@f{\lowercase{\def\noexpand\reserved@f{\cmap@[email protected]}}}%
  \reserved@f
  \IfFileExists{\reserved@f}{%
    \immediate\pdfobj stream
      %attr {/Type /CIDFile}
      file {\reserved@f}%
    \expandafter\xdef\csname cmap@set@\cmap@f@encoding\endcsname{%
      \cmap@nobuiltintounicode\noexpand\font@name
      \noexpand\expandafter\pdffontattr\noexpand\font@name{/ToUnicode 
\the\pdflastobj\space 0 R}}%
  }{%
    \global\expandafter\let\csname cmap@set@\cmap@f@encoding\endcsname\empty
  }%
}
\def\cmap@test@tt{%
  \ifdim\fontdimen3\font@name=\z@
    \ifdim\fontdimen4\font@name=\z@
      \begingroup
        \ifdim\fontcharwd\font@name`\i=\fontcharwd\font@name`\w
          \edef\reserved@f{\lowercase{\def\noexpand\reserved@f{\cmap@f@encoding 
tt.cmap}}}%
          \reserved@f
          \IfFileExists{\reserved@f}{\xdef\cmap@f@encoding{\cmap@f@encoding 
tt}}\relax
        \fi
      \endgroup
    \fi
  \fi
}
\def\cmap@hook{%
  \@ifundefined{CJK@plane}{%
    \edef\cmap@f@encoding{\f@encoding}%
  }{%
    \edef\cmap@f@encoding{\f@encoding\CJK@plane}%
  }%
  \cmap@test@tt
  \@ifundefined{cmap@set@\cmap@f@encoding}{\cmap@load}\relax
  \csname cmap@set@\cmap@f@encoding\endcsname
}

\endinput

Reply via email to