csvsimple pdflatex 挂起且无错误

csvsimple pdflatex 挂起且无错误

以下最小示例,使用csvsimple挂起而没有任何错误。

\documentclass[a4paper,11pt]{article}
\usepackage{csvsimple}
\begin{document}
\begin{tabular}{ll}
  a & b\\
  \hline
\csvreader[head to column names,separator=semicolon]{program.csv}{}
          {\titre & \speaker \\}
\end{tabular}
\end{document}

文件内容program.csv

id;date;start;end;type;salle;titre;description;speaker;docid;extra
111245;2019-10-01;09:00:00;10:00:00;discours;;prof;;this is a title;;

运行pdflatex上面的例子我得到:

$ pdflatex test.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Arch Linux) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2018-12-01>
(/usr/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size11.clo))
(/usr/share/texmf-dist/tex/latex/csvsimple/csvsimple.sty
(/usr/share/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
(/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex)))
(/usr/share/texmf-dist/tex/latex/base/ifthen.sty)
(/usr/share/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/share/texmf-dist/tex/latex/tools/shellesc.sty))
No file test.aux.
)
*
! Emergency stop.
<*> test.tex

!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on test.log.

程序在第 行挂起*,此时我使用 Ctrl-D 退出程序。日志文件包含:

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Arch Linux) (preloaded format=pdflatex 2019.8.25)  28 SEP 2019 19:01
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**test.tex
(./test.tex
LaTeX2e <2018-12-01>
(/usr/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size11.clo
File: size11.clo 2018/09/03 v1.4i 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
)
(/usr/share/texmf-dist/tex/latex/csvsimple/csvsimple.sty
Package: csvsimple 2016/07/01 version 1.20 LaTeX CSV file processing

(/usr/share/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
(/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
\pgfkeys@pathtoks=\toks14
\pgfkeys@temptoks=\toks15

(/usr/share/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex
\pgfkeys@tmptoks=\toks16
)))
(/usr/share/texmf-dist/tex/latex/base/ifthen.sty
Package: ifthen 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
)
(/usr/share/texmf-dist/tex/latex/etoolbox/etoolbox.sty
Package: etoolbox 2018/08/19 v2.5f e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count88
)
(/usr/share/texmf-dist/tex/latex/tools/shellesc.sty
Package: shellesc 2016/06/07 v0.02a unified shell escape interface for LaTeX
Package shellesc Info: Restricted shell escape enabled on input line 69.
)
\csv@file=\read1
\c@csvinputline=\count89
\c@csvrow=\count90
\c@csvcol=\count91
\csv@out=\write3
)
No file test.aux.
\openout1 = `test.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <10.95> on input line 4.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <8> on input line 4.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <6> on input line 4.
)
*
! Emergency stop.
<*> test.tex

End of file on the terminal!


Here is how much of TeX's memory you used:
 1530 strings out of 492623
 31556 string characters out of 6135669
 93181 words of memory out of 5000000
 5500 multiletter control sequences out of 15000+600000
 6379 words of font info for 23 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 40i,6n,46p,786b,240s stack positions out of 5000i,500n,10000p,200000b,80000s
!  ==> Fatal error occurred, no output PDF file produced!

知道可能是什么问题吗?

答案1

问题在于有一列称为\end,因此head to column names您最终需要重新定义\end。因此,\end{tabular}不再起作用,也不起作用\end{document}

如果您重命名该列,或者像下面的示例一样手动指定宏,它可以正常工作。

\documentclass[a4paper,11pt]{article}
\usepackage{csvsimple}
\begin{document}
\begin{tabular}{ll}
  a & b\\
  \hline
\csvreader[separator=semicolon]{program.csv}{titre=\titre,speaker=\speaker}
          {\titre & \speaker\\}
\end{tabular}
\end{document}

相关内容