LaTeX forum ⇒ Document Classes"Character table corrupted error" when compiling the dtxtut skeleton package code Topic is solved

Information and discussion about specific document classes and how to create your own document classes.
juliendutant
Posts: 14
Joined: Sat Aug 27, 2016 1:46 pm

"Character table corrupted error" when compiling the dtxtut skeleton package code

Postby juliendutant » Thu Feb 04, 2021 10:30 pm

Hi all,

I'm trying to write a package from .dtx and .ins, following the dtx tutorial. However even when I merely try to compile the skeleton provided, I get a "! Package doc Error: Character table corrupted." I wonder why. My .dtx and .ins are saved in UTF-8; I have tried latin1 and get the same error.

Commands I run:

[cmd]
latex test.ins
latex test.dtx
[/cmd]

The first runs normally, the second throws a "! Package doc Error: Character table corrupted" error. I've tried pdflatex instead, same outcome.

Searching forums I've only found one potential explanation: during compilation some package changes some char's catcode. However in this MWE the only packages loaded are the .sty istelf and the packages loaded by ltxdoc, such as multicol.sty.

I know I could remove the character table, but I suspect the corrupted table is a symptom of hidden issue.

Here are my test.ins and test.dtx files. I'm merely removing the <...> fields of the dtxut example:

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. %%
  2. %% Copyright (C) 2021 by Julien Dutant
  3. %%
  4. %% This file may be distributed and/or modified under the
  5. %% conditions of the LaTeX Project Public License, either
  6. %% version 1.3 of this license or (at your option) any later
  7. %% version. The latest version of this license is in:
  8. %%
  9. %% <!-- m --><a class="postlink" href="http://www.latex-project.org/lppl.txt">http://www.latex-project.org/lppl.txt</a><!-- m -->
  10. %%
  11. %% and version 1.3 or later is part of all distributions of
  12. %% LaTeX version 2005/12/01 or later.
  13. %%
  14.  
  15. \input docstrip.tex
  16. \keepsilent
  17.  
  18. \usedir{tex/latex/test}
  19.  
  20. \preamble
  21.  
  22. This is a generated file.
  23.  
  24. Copyright (C) 2021 by Julien Dutant
  25.  
  26. This file may be distributed and/or modified under the
  27. conditions of the LaTeX Project Public License, either
  28. version 1.3 of this license or (at your option) any later
  29. version. The latest version of this license is in:
  30.  
  31. <!-- m --><a class="postlink" href="http://www.latex-project.org/lppl.txt">http://www.latex-project.org/lppl.txt</a><!-- m -->
  32.  
  33. and version 1.3 or later is part of all distributions of
  34. LaTeX version 2005/12/01 or later.
  35.  
  36. \endpreamble
  37.  
  38. \generate{\file{test.sty}{\from{test.dtx}{package}}}
  39.  
  40. \Msg{*********************************************************}
  41. \Msg{*}
  42. \Msg{* To finish the installation you have to move the}
  43. \Msg{* following file into a directory searched by TeX:}
  44. \Msg{*}
  45. \Msg{* \space\space test.sty}
  46. \Msg{*}
  47. \Msg{* To produce the documentation run the file test.dtx}
  48. \Msg{* through LaTeX.}
  49. \Msg{*}
  50. \Msg{* Happy TeXing!}
  51. \Msg{*********************************************************}
  52.  
  53. \endbatchfile


test.dtx

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. % \iffalse meta-comment
  2. %
  3. % Copyright (C) 2021 by Julien Dutant
  4. % -----------------------------------
  5. %
  6. % This file may be distributed and/or modified under the
  7. % conditions of the LaTeX Project Public License, either version 1.3
  8. % of this license or (at your option) any later version.
  9. % The latest version of this license is in:
  10. %
  11. % <!-- m --><a class="postlink" href="http://www.latex-project.org/lppl.txt">http://www.latex-project.org/lppl.txt</a><!-- m -->
  12. %
  13. % and version 1.3 or later is part of all distributions of LaTeX
  14. % version 2005/12/01 or later.
  15. %
  16. % \fi
  17. %
  18. % \iffalse
  19. %<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
  20. %<package>\ProvidesPackage{test}
  21. %<package> [2021/02/03 v0.1 test dtx file]
  22. %
  23. %<*driver>
  24. \documentclass{ltxdoc}
  25. \usepackage{test}
  26. \EnableCrossrefs
  27. \CodelineIndex
  28. \RecordChanges
  29. \begin{document}
  30. \DocInput{test.dtx}
  31. \end{document}
  32. %</driver>
  33. % \fi
  34. %
  35. % \CheckSum{0}
  36. %
  37. % \CharacterTable
  38. % {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
  39. % 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
  40. % Digits \0\1\2\3\4\5\6\7\8\9
  41. % Exclamation \! Double quote \" Hash (number) \#
  42. % Dollar \$ Percent \% Ampersand \&
  43. % Acute accent \' Left paren \( Right paren \)
  44. % Asterisk \* Plus \+ Comma \,
  45. % Minus \- Point \. Solidus \/
  46. % Colon \: Semicolon \; Less than \<<
  47. % Equals \= Greater than \>> Question mark \?
  48. % Commercial at \@ Left bracket \[ Backslash \\
  49. % Right bracket \] Circumflex \^ Underscore \_
  50. % Grave accent \` Left brace \{ Vertical bar \|
  51. % Right brace \} Tilde \~}
  52. %
  53. %
  54. % \changes{v1.0}{2021/02/03}{Initial version}
  55. %
  56. % \GetFileInfo{test.sty}
  57. %
  58. % \DoNotIndex{<list of control sequences>}
  59. %
  60. % \title{The \textsf{test} package\thanks{This document
  61. % corresponds to \textsf{test}~\fileversion,
  62. % dated \filedate.}}
  63. % \author{Julien Dutant \\ \texttt{julien.dutant@kcl.ac.uk}}
  64. %
  65. % \maketitle
  66. %
  67. % \begin{abstract}
  68. % Put text here.
  69. % \end{abstract}
  70. %
  71. % \section{Introduction}
  72. %
  73. % Put text here.
  74. %
  75. % \section{Usage}
  76. %
  77. % \DescribeMacro{\YOURMACRO}
  78. % Put description of |\YOURMACRO| here.
  79. %
  80. % \DescribeEnv{YOURENV}
  81. % Put description of |YOURENV| here.
  82. %
  83. % \StopEventually{\PrintIndex}
  84. %
  85. % \section{Implementation}
  86. %
  87. % \begin{macro}{\YOURMACRO}
  88. % Put explanation of |\YOURMACRO|'s implementation here.
  89. % \begin{macrocode}
  90. \newcommand{\YOURMACRO}{}
  91. % \end{macrocode}
  92. % \end{macro}
  93. %
  94. % \begin{environment}{YOURENV}
  95. % Put explanation of |YOURENV|'s implementation here.
  96. % \begin{macrocode}
  97. \newenvironment{YOURENV}{}{}
  98. % \end{macrocode}
  99. % \end{environment}
  100. %
  101. % \Finale
  102. \endinput


Finally, the output log.

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=latex 2020.10.20) 4 FEB 2021 20:03
  2. entering extended mode
  3. restricted \write18 enabled.
  4. %&-line parsing enabled.
  5. **test.dtx
  6. (./test.dtx
  7. LaTeX2e <2020-02-02> patch level 5
  8. L3 programming layer <2020-03-06>
  9. (/usr/local/texlive/2020/texmf-dist/tex/latex/base/ltxdoc.cls
  10. Document Class: ltxdoc 2019/09/16 v2.0y Standard LaTeX documentation class
  11. (/usr/local/texlive/2020/texmf-dist/tex/latex/base/article.cls
  12. Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
  13. (/usr/local/texlive/2020/texmf-dist/tex/latex/base/size10.clo
  14. File: size10.clo 2019/12/20 v1.4l Standard LaTeX file (size option)
  15. )
  16. \c@part=\count167
  17. \c@section=\count168
  18. \c@subsection=\count169
  19. \c@subsubsection=\count170
  20. \c@paragraph=\count171
  21. \c@subparagraph=\count172
  22. \c@figure=\count173
  23. \c@table=\count174
  24. \abovecaptionskip=\skip47
  25. \belowcaptionskip=\skip48
  26. \bibindent=\dimen134
  27. )
  28. (/usr/local/texlive/2020/texmf-dist/tex/latex/base/doc.sty
  29. Package: doc 2019/12/16 v2.1l Standard LaTeX documentation package (FMi)
  30. \c@StandardModuleDepth=\count175
  31. \guard@level=\count176
  32. \MacrocodeTopsep=\skip49
  33. \MacroIndent=\dimen135
  34. \macro@cnt=\count177
  35. \MacroTopsep=\skip50
  36. \index@excludelist=\toks15
  37.  
  38. (/usr/local/texlive/2020/texmf-dist/tex/latex/tools/multicol.sty
  39. Package: multicol 2019/12/09 v1.8y multicolumn formatting (FMi)
  40. \c@tracingmulticols=\count178
  41. \mult@box=\box45
  42. \multicol@leftmargin=\dimen136
  43. \c@unbalance=\count179
  44. \c@collectmore=\count180
  45. \doublecol@number=\count181
  46. \multicoltolerance=\count182
  47. \multicolpretolerance=\count183
  48. \full@width=\dimen137
  49. \page@free=\dimen138
  50. \premulticols=\dimen139
  51. \postmulticols=\dimen140
  52. \multicolsep=\skip51
  53. \multicolbaselineskip=\skip52
  54. \partial@page=\box46
  55. \last@line=\box47
  56. \maxbalancingoverflow=\dimen141
  57. \mult@rightbox=\box48
  58. \mult@grightbox=\box49
  59. \mult@gfirstbox=\box50
  60. \mult@firstbox=\box51
  61. \@tempa=\box52
  62. \@tempa=\box53
  63. \@tempa=\box54
  64. \@tempa=\box55
  65. \@tempa=\box56
  66. \@tempa=\box57
  67. \@tempa=\box58
  68. \@tempa=\box59
  69. \@tempa=\box60
  70. \@tempa=\box61
  71. \@tempa=\box62
  72. \@tempa=\box63
  73. \@tempa=\box64
  74. \@tempa=\box65
  75. \@tempa=\box66
  76. \@tempa=\box67
  77. \@tempa=\box68
  78. \@tempa=\box69
  79. \@tempa=\box70
  80. \@tempa=\box71
  81. \@tempa=\box72
  82. \@tempa=\box73
  83. \@tempa=\box74
  84. \@tempa=\box75
  85. \@tempa=\box76
  86. \@tempa=\box77
  87. \@tempa=\box78
  88. \@tempa=\box79
  89. \@tempa=\box80
  90. \@tempa=\box81
  91. \@tempa=\box82
  92. \@tempa=\box83
  93. \@tempa=\box84
  94. \@tempa=\box85
  95. \@tempa=\box86
  96. \@tempa=\box87
  97. \@tempa=\box88
  98. \c@minrows=\count184
  99. \c@columnbadness=\count185
  100. \c@finalcolumnbadness=\count186
  101. \last@try=\dimen142
  102. \multicolovershoot=\dimen143
  103. \multicolundershoot=\dimen144
  104. \mult@nat@firstbox=\box89
  105. \colbreak@box=\box90
  106. \mc@col@check@num=\count187
  107. )
  108. \IndexMin=\dimen145
  109. \c@IndexColumns=\count188
  110. \GlossaryMin=\dimen146
  111. \c@GlossaryColumns=\count189
  112. \check@sum=\count190
  113. \bslash@cnt=\count191
  114. \wrong@table=\toks16
  115. \c@CodelineNo=\count192
  116. )) (./test.sty
  117. Package: test 2021/02/03 v0.1 test dtx file
  118. )
  119. \@indexfile=\write3
  120. \openout3 = `test.idx'.
  121.  
  122.  
  123. Writing index file test.idx
  124. \@glossaryfile=\write4
  125. \openout4 = `test.glo'.
  126.  
  127. Writing glossary file test.glo
  128. (/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-dvips.def
  129. File: l3backend-dvips.def 2020-03-12 L3 backend support: dvips
  130. \l__pdf_internal_box=\box91
  131. \g__pdf_backend_object_int=\count193
  132. \l__pdf_backend_content_box=\box92
  133. \l__pdf_backend_model_box=\box93
  134. \g__pdf_backend_annotation_int=\count194
  135. \g__pdf_backend_link_int=\count195
  136. \g__pdf_backend_link_sf_int=\count196
  137. )
  138. No file test.aux.
  139. \openout1 = `test.aux'.
  140.  
  141. LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 29.
  142. LaTeX Font Info: ... okay on input line 29.
  143. LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 29.
  144. LaTeX Font Info: ... okay on input line 29.
  145. LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 29.
  146. LaTeX Font Info: ... okay on input line 29.
  147. LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 29.
  148. LaTeX Font Info: ... okay on input line 29.
  149. LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 29.
  150. LaTeX Font Info: ... okay on input line 29.
  151. LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 29.
  152. LaTeX Font Info: ... okay on input line 29.
  153. LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 29.
  154. LaTeX Font Info: ... okay on input line 29.
  155. Package doc Info: Made | a short reference for \verb on input line 29.
  156. (./test.dtx
  157.  
  158. ! Package doc Error: Character table corrupted.
  159.  
  160. See the doc package documentation for explanation.
  161. Type H <return> for immediate help.
  162. ...
  163.  
  164. l.51 % Right brace \} Tilde \~}
  165.  
  166. ? x
  167.  
  168. Here is how much of TeX's memory you used:
  169. 736 strings out of 480609
  170. 11438 string characters out of 5903655
  171. 248825 words of memory out of 5000000
  172. 16698 multiletter control sequences out of 15000+600000
  173. 532338 words of font info for 24 fonts, out of 8000000 for 9000
  174. 1141 hyphenation exceptions out of 8191
  175. 33i,1n,27p,224b,86s stack positions out of 5000i,500n,10000p,200000b,80000s
  176. No pages of output.


Any help much appreciated!

User avatar
Ijon Tichy
Posts: 415
Joined: Mon Dec 24, 2018 10:12 am

Postby Ijon Tichy » Fri Feb 05, 2021 9:43 am

Less than should be \< not \<<. Same for Greater than.

BTW: \CharacterTable was used decades ago, when the main internet file transfer protocol was ftp. If you forgot to use ftp in binary mode, character corruption could happen. But ftp is almost dead (because it is insecure) and if it is still used binary mode is usually the default and even in text mode character conversion is not used any longer. So \CharacterTable should not be needed any longer, at least if you encode your dtx files either US-ASCII or UTF8. AFAIK, For this reason, LaTeX Team does not use \Character Table for their dtx files.

juliendutant
Posts: 14
Joined: Sat Aug 27, 2016 1:46 pm

Postby juliendutant » Fri Feb 05, 2021 3:21 pm

Brillant, thanks! The < and > get doubled when copying/pasting the code and I hadn't noticed it.

I saw somewhere that even if there's no risk of file transfer corruption keeping the Char table might help catch some bugs - but I can't find the link anymore.


Return to “Document Classes”

Who is online

Users browsing this forum: No registered users and 5 guests