为什么 Werner 著名的源代码在 TeXworks 中会出现如此多错误?

为什么 Werner 著名的源代码在 TeXworks 中会出现如此多错误?

我尝试排版沃纳著名的密码有哪些命令可以控制水平间距?,并且出现很多错误。

我在 Windows 10 上运行 TeXworks 版本 0.6.2(travis-ci)[r.7ecce17,2017.04.29 12:23]。

味道 错误 渲染?
pdfLaTeX 16 是的
LuaLaTeX 16 是的
西拉特克斯 16 是的

显然,其中存在着某种模式,但是到底发生了什么呢?

为什么添加可以\usepackage{amsmath}纠正许多这些错误?

沃纳使用什么软件/设置来正确排版他的文件?

顺便说一句,我认为沃纳的回答是对这些命令的精彩总结。

以下是日志文件的内容:

This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018/W32TeX (preloaded format=pdflatex 2018.9.7)  1 JUN 2021 19:39
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**werner_pdfLaTeX.tex
(./werner_pdfLaTeX.tex
LaTeX2e <2018-04-01> patch level 5
(c:/texlive/2018/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(c:/texlive/2018/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count80
\c@section=\count81
\c@subsection=\count82
\c@subsubsection=\count83
\c@paragraph=\count84
\c@subparagraph=\count85
\c@figure=\count86
\c@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(c:/texlive/2018/texmf-dist/tex/latex/geometry/geometry.sty
Package: geometry 2018/04/16 v5.8 Page Geometry
 
(c:/texlive/2018/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks14
)
(c:/texlive/2018/texmf-dist/tex/generic/oberdiek/ifpdf.sty
Package: ifpdf 2017/03/15 v3.2 Provides the ifpdf switch
)
(c:/texlive/2018/texmf-dist/tex/generic/oberdiek/ifvtex.sty
Package: ifvtex 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
Package ifvtex Info: VTeX not detected.
)
(c:/texlive/2018/texmf-dist/tex/generic/ifxetex/ifxetex.sty
Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional
)
\Gm@cnth=\count88
\Gm@cntv=\count89
\c@Gm@tempcnt=\count90
\Gm@bindingoffset=\dimen103
\Gm@wd@mp=\dimen104
\Gm@odd@mp=\dimen105
\Gm@even@mp=\dimen106
\Gm@layoutwidth=\dimen107
\Gm@layoutheight=\dimen108
\Gm@layouthoffset=\dimen109
\Gm@layoutvoffset=\dimen110
\Gm@dimlist=\toks15
)
No file werner_pdfLaTeX.aux.
\openout1 = `werner_pdfLaTeX.aux'.
 
LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
*geometry* verbose mode - [ preamble ] result:
* driver: pdftex
* paper: <default>
* layout: <same size as paper>
* layoutoffset:(h,v)=(0.0pt,0.0pt)
* modes:
* h-part:(L,W,R)=(72.26999pt, 469.75502pt, 72.26999pt)
* v-part:(T,H,B)=(72.26999pt, 650.43001pt, 72.26999pt)
* \paperwidth=614.295pt
* \paperheight=794.96999pt
* \textwidth=469.75502pt
* \textheight=650.43001pt
* \oddsidemargin=0.0pt
* \evensidemargin=0.0pt
* \topmargin=-37.0pt
* \headheight=12.0pt
* \headsep=25.0pt
* \topskip=10.0pt
* \footskip=30.0pt
* \marginparwidth=65.0pt
* \marginparsep=11.0pt
* \columnsep=10.0pt
* \skip\footins=9.0pt plus 4.0pt minus 2.0pt
* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \@twocolumnfalse
* \@twosidefalse
* \@mparswitchfalse
* \@reversemarginfalse
* (1in=72.27pt=25.4mm, 1cm=28.453pt)
 
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <7> on input line 10.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <5> on input line 10.
! Missing $ inserted.
<inserted text>
                $
l.13   \verb|a\!b|                     & a\!
                                            b \quad $a\!b$ \\
?
! Missing $ inserted.
<inserted text>
                $
l.13 ...\!b|                     & a\!b \quad $a\!
                                                  b$ \\
?
! Missing $ inserted.
<inserted text>
                $
l.15   \verb|a\:b|                     & a\:
                                            b \quad $a\:b$ \\
?
! Missing $ inserted.
<inserted text>
                $
l.15 ...\:b|                     & a\:b \quad $a\:
                                                  b$ \\
?
! Missing $ inserted.
<inserted text>
                $
l.16   \verb|a\>b|                     & a\>
                                            b \quad $a\>b$ \\
?
! Missing $ inserted.
<inserted text>
                $
l.16 ...\>b|                     & a\>b \quad $a\>
                                                  b$ \\
?
! Undefined control sequence.
l.17 ...erb|a\medspace b|             & a\medspace
                                                   b \quad $a\medspace b$ \\
?
! Undefined control sequence.
l.17 ...          & a\medspace b \quad $a\medspace
                                                   b$ \\
?
! Undefined control sequence.
l.18 ...|a\negmedspace b|          & a\negmedspace
                                                   b \quad $a\negmedspace b$ \\
 
?
! Undefined control sequence.
l.18 ...    & a\negmedspace b \quad $a\negmedspace
                                                   b$ \\
?
! Missing $ inserted.
<inserted text>
                $
l.19   \verb|a\;b|                     & a\;
                                            b \quad $a\;b$ \\
?
! Missing $ inserted.
<inserted text>
                $
l.19 ...\;b|                     & a\;b \quad $a\;
                                                  b$ \\
?
! Undefined control sequence.
l.20 ...b|a\thickspace b|           & a\thickspace
                                                   b \quad $a\thickspace b$ \\
?
! Undefined control sequence.
l.20 ...      & a\thickspace b \quad $a\thickspace
                                                   b$ \\
?
! Undefined control sequence.
l.21 ...\negthickspace b|        & a\negthickspace
                                                   b \quad $a\negthickspace ...
 
?
! Undefined control sequence.
l.21 ...& a\negthickspace b \quad $a\negthickspace
                                                   b$ \\
?
[1
 
{c:/texlive/2018/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./werner_pdfLaTeX.aux) )
Here is how much of TeX's memory you used:
733 strings out of 492641
10020 string characters out of 6133132
83645 words of memory out of 5000000
4687 multiletter control sequences out of 15000+600000
3808 words of font info for 15 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
24i,13n,32p,178b,205s stack positions out of 5000i,500n,10000p,200000b,80000s
<c:/texlive/2018/texmf-dist/fonts/type1/public/amsfont
s/cm/cmmi10.pfb><c:/texlive/2018/texmf-dist/fonts/type1/public/amsfonts/cm/cmr1
0.pfb><c:/texlive/2018/texmf-dist/fonts/type1/public/amsfonts/cm/cmtt10.pfb>
Output written on werner_pdfLaTeX.pdf (1 page, 39415 bytes).
PDF statistics:
20 PDF objects out of 1000 (max. 8388607)
13 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)

答案1

对于我来说,使用当前版本的 LaTeX 编译该示例没有错误。查看答案的修订历史我们发现 2020 年 10 月发布的 LaTeX 发生了很大变化,一些间距命令从内核移到了amsmath内核(另请参阅 LaTeX 新闻中的公告https://www.latex-project.org/news/latex2e-news/ltnews32.pdf,第 5 页和https://github.com/latex3/latex2e/issues/303作为背景)。

您的 LaTeX 版本较旧,因此您应该参考之前的答案修订版(https://tex.stackexchange.com/revisions/74354/8),尽管加载amsmath也可能有助于解决大多数问题。

相关内容