8

Today, the generation of one of my dtx files stopped with the error:

! Undefined control sequence.
\UseTextAccent ...up \@firstofone \let \@curr@enc
                                              \cf@encoding \@use@text@en...

As I have not changed the files for more than two months now, but updated my MiKTeX last week (and listened carefully to @Ulrike Fischer reporting on kernel changes at the last DANTE meeting), I gladly found out rather quickly, that the new LaTeX kernel (2018/04/01) is responsible for that. Using pdflatex '\UseRawInputEncoding \input{FILENAME.dtx}' as stated in the LaTeX news document, everything runs smoothly.

I then started preparing a MWE, which led to \newunicodechar from the same called package causing the problem:

% \iffalse meta-comment
%<*internal>
\iffalse
%</internal>
%<*internal>
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
  \expandafter\begingroup
\fi
%</internal>
%<*install>
\input docstrip.tex
\keepsilent
\askforoverwritefalse
\generate{
  \file{\jobname.cls}{\from{\jobname.dtx}{class}}
}
%</install>
%<install>\endbatchfile
%<*internal>
\generate{
  \file{\jobname.ins}{\from{\jobname.dtx}{install}}
}
\ifx\fmtname\nameofplainTeX
  \expandafter\endbatchfile
\else
  \expandafter\endgroup
\fi
%</internal>
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{testclass.dtx}
%</driver>
%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<class>\ProvidesClass{testclass}
%<*class>
    [2018/04/16 v1.0 A LaTeX class]
%</class>
%<*driver>
\documentclass{ltxdoc}
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage[ngerman]{babel}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{0}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
    %   Right brace   \}     Tilde         \~}
% \GetFileInfo{\jobname.dtx}
% \DoNotIndex{\newcommand,\newenvironment}
%
% \title{A test class}
% \author{Martin Sievers}
%
% \maketitle
%
% \StopEventually{^^A
%  \PrintChanges
% }
%
% \section{Implementation}
%    \begin{macrocode}
%<*class>
%    \end{macrocode}
%    \begin{macrocode}
\LoadClass{minimal}
%    \end{macrocode}
%    \begin{macrocode}
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage[english]{babel}
\RequirePackage{newunicodechar}
\newunicodechar{⸗}{\hyphen}
%    \end{macrocode}
%    \begin{macrocode}
%</class>
%    \end{macrocode}
% \Finale
\endinput

However, putting everything into a simple LaTeX file does not result in the same error. So, there must be more about it ...

Is this a foreseeable problem caused by the change to UTF8 as the new standard encoding of files? The dtx file is encoded as UTF8 and as you can see there is always an inputenc entry using the utf8 option as well.

  • 2
    There was a commit on the LaTeX2e git (github.com/latex3/latex2e/commit/…) that changed something for docstrip following github.com/latex3/latex2e/issues/34. I don't think that version has been released, the changes certainly have not made it to my MikTeX yet (updated this morning). – moewe Apr 16 '18 at 13:20
  • github.com/latex3/latex2e/issues/34 Also mentions putting \UseRawInputEncoding at the top of the .ins file to solve this. For me that generates an unknown control sequence, though when running the .dtx with pdfTeX. And I get Unicode character not set up for use when running with pdfLaTeX. – moewe Apr 16 '18 at 13:30
  • @moewe That's the answer ('the team are still covering a few cases'): do you want to post something? – Joseph Wright Apr 16 '18 at 13:57
  • 2
    @JosephWright Well, if someone who actually knows what is going on can give an answer with a workaround that works out of the box in this case, that is probably preferable to my answer just linking to the issue on GitHub. – moewe Apr 16 '18 at 14:08
  • @JosephWright Should this problem be solved in PL4? Part of it seems to be resolved, but I still get Unicode character ⸗ (U+2E17) not set up for use with LaTeX. despite/in the \newunicodechar. – moewe May 5 '18 at 14:15
2

With current (2018,2019) releases

The posted code produces the error

! Package inputenc Error: Unicode char ⸗ (U+2E17)
(inputenc)                not set up for use with LaTeX.

The problem is that the newunicodechar package is loaded and used to declare this character in the generated class file, but the typeset documentation is not using this class and so latex can not typeset this line:

\newunicodechar{⸗}{\hyphen}

You can declare a setting for this character in the typeset document, the standard fonts don't really have a suitable character so I just used - here.

This is as posted in the question, with the addition of

\DeclareUnicodeCharacter{2E17}{-}

% \iffalse meta-comment
%<*internal>
\iffalse
%</internal>
%<*internal>
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
  \expandafter\begingroup
\fi
%</internal>
%<*install>
\input docstrip.tex
\keepsilent
\askforoverwritefalse
\generate{
  \file{\jobname.cls}{\from{\jobname.dtx}{class}}
}
%</install>
%<install>\endbatchfile
%<*internal>
\generate{
  \file{\jobname.ins}{\from{\jobname.dtx}{install}}
}
\ifx\fmtname\nameofplainTeX
  \expandafter\endbatchfile
\else
  \expandafter\endgroup
\fi
%</internal>
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{testclass.dtx}
%</driver>
%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<class>\ProvidesClass{testclass}
%<*class>
    [2018/04/16 v1.0 A LaTeX class]
%</class>
%<*driver>
\documentclass{ltxdoc}
\RequirePackage[utf8]{inputenc}
\DeclareUnicodeCharacter{2E17}{-}
\RequirePackage[T1]{fontenc}
\RequirePackage[ngerman]{babel}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{0}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
    %   Right brace   \}     Tilde         \~}
% \GetFileInfo{\jobname.dtx}
% \DoNotIndex{\newcommand,\newenvironment}
%
% \title{A test class}
% \author{Martin Sievers}
%
% \maketitle
%
% \StopEventually{^^A
%  \PrintChanges
% }
%
% \section{Implementation}
%    \begin{macrocode}
%<*class>
%    \end{macrocode}
%    \begin{macrocode}
\LoadClass{minimal}
%    \end{macrocode}
%    \begin{macrocode}
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage[english]{babel}
\RequirePackage{newunicodechar}
\newunicodechar{⸗}{\hyphen}
%    \end{macrocode}
%    \begin{macrocode}
%</class>
%    \end{macrocode}
% \Finale
\endinput

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.