在vim中,我使用以下命令编译tex文件:
pdflatex\ \-file\-line\-error\ \-shell\-escape\ \-interaction=nonstopmode\ $*\\\|\ grep\ \-P\ ':\\d{1,5}:\ '这有助于将错误输入快速修复窗口(如果不使用vim,请忽略这句话)。唯一的问题是,当文档正在编译时,我希望看到胶乳输出出现在屏幕上(现在grep吞噬了所有输出)。
我该怎么做才能做到这一点?我已经试过把它全部连接到tail上,但都没有用。
This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011) (format=preamble 2011.10.2) 3 OCT 2011 23:16
entering extended mode
\write18 enabled.
file:line:error style messages enabled.
%&-line parsing enabled.
**main.tex
(./main.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2011-07-01, ngerman-x-2011-07-01, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis
h, french, galician, german, ngerman, swissgerman, monogreek, greek, hungarian,
icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, marathi, or
iya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian, kurmanji,
lao, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk, pol
ish, portuguese, romanian, russian, sanskrit, serbian, serbianc, slovak, sloven
ian, spanish, swedish, turkish, turkmen, ukrainian, uppersorbian, welsh, loaded
.
PRECOMILED PREAMBLE LOADED
LaTeX Warning: Overwriting file `./main.bib'.
\openout15 = `main.bib'.
\openout4 = `main.auxlock'.
Package biblatex Info: Trying to load language 'english'...
Package biblatex Info: ... file 'english.lbx' found.
(/usr/local/texlive/2011/texmf-dist/tex/latex/biblatex/lbx/english.lbx
File: english.lbx 2011/07/29 v1.6 biblatex localization
)
Package biblatex Warning: 'babel' detected but 'csquotes' missing.
(biblatex) Loading 'csquotes' recommended.
\@quotelevel=\count451
\@quotereset=\count452
(./main.aux)
\openout1 = `main.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 42.
LaTeX Font Info: ... okay on input line 42.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 42.
LaTeX Font Info: ... okay on input line 42.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 42.
LaTeX Font Info: ... okay on input line 42.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 42.
LaTeX Font Info: ... okay on input line 42.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 42.
LaTeX Font Info: ... okay on input line 42.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 42.
LaTeX Font Info: ... okay on input line 42.
LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 42.
LaTeX Font Info: ... okay on input line 42.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 42.
LaTeX Font Info: Try loading font information for TS1+cmr on input line 42.
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/ts1cmr.fd
File: ts1cmr.fd 1999/05/25 v2.5h Standard LaTeX font definitions
)
LaTeX Font Info: ... okay on input line 42.
Package caption Info: Begin \AtBeginDocument code.
Package caption Info: subfig package 1.2 or 1.3 is loaded.
Package caption Info: float package is loaded.
Package caption Info: hyperref package is loaded.
Package caption Info: wrapfig package is loaded.
Package caption Info: End \AtBeginDocument code.
(/usr/local/texlive/2011/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count453
\scratchdimen=\dimen319
\scratchbox=\box86
\nofMPsegments=\count454
\nofMParguments=\count455
\everyMPshowfont=\toks48
\MPscratchCnt=\count456
\MPscratchDim=\dimen320
\MPnumerator=\count457
\makeMPintoPDFobject=\count458
\everyMPtoPDFconversion=\toks49
) (/usr/local/texlive/2011/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf
(/usr/local/texlive/2011/texmf-dist/tex/latex/oberdiek/grfext.sty
Package: grfext 2010/08/19 v1.1 Managing graphics extensions (HO)
)
Package grfext Info: Graphics extension search list:
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE
G,.JBIG2,.JB2,.eps]
(grfext) \AppendGraphicsExtensions on input line 452.
(/usr/local/texlive/2011/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
e
))
Package biblatex Info: No input encoding detected.
(biblatex) Assuming 'ascii'.
Package biblatex Info: Automatic encoding selection.
(biblatex) Assuming data encoding 'ascii'.
\openout3 = `preamble-blx.bib'.
Package biblatex Info: Trying to load bibliographic data...
Package biblatex Info: ... file 'main.bbl' not found.
No file main.bbl.
Package biblatex Info: Reference section=0 on input line 42.
Package biblatex Info: Reference segment=0 on input line 42.
ABD: EveryShipout initializing macros
\AtBeginShipoutBox=\box87
Package hyperref Info: Link coloring ON on input line 42.
(/usr/local/texlive/2011/texmf-dist/tex/latex/hyperref/nameref.sty
Package: nameref 2010/04/30 v2.40 Cross-referencing by name of section
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/gettitlestring.sty
Package: gettitlestring 2010/12/03 v1.4 Cleanup title references (HO)
)
\c@section@level=\count459
)
LaTeX Info: Redefining \ref on input line 42.
LaTeX Info: Redefining \pageref on input line 42.
LaTeX Info: Redefining \nameref on input line 42.
(./main.out) (./main.out)
\@outlinefile=\write8
\openout8 = `main.out'.
(/usr/local/texlive/2011/texmf-dist/tex/latex/beamer/translator/dicts/translato
r-basic-dictionary/translator-basic-dictionary-English.dict
Dictionary: translator-basic-dictionary, Language: English
)
(/usr/local/texlive/2011/texmf-dist/tex/latex/siunitx/config/siunitx-abbreviati
ons.cfg
File: siunitx-abbreviations.cfg 2011/09/13 v2.3f siunitx: Abbreviated units
)
(/usr/local/texlive/2011/texmf-dist/tex/latex/siunitx/config/siunitx-binary.cfg
File: siunitx-binary.cfg 2011/09/13 v2.3f siunitx: Binary units
)
LaTeX Info: Redefining \microtypecontext on input line 42.
Package microtype Info: Generating PDF output.
Package microtype Info: Character protrusion enabled (level 2).
Package microtype Info: Using default protrusion set `alltext'.
Package microtype Info: Automatic font expansion enabled (level 2),
(microtype) stretch: 20, shrink: 20, step: 1, non-selected.
Package microtype Info: Using default expansion set `basictext'.
Package microtype Info: No tracking.
Package microtype Info: No adjustment of interword spacing.
Package microtype Info: No adjustment of character kerning.
Package microtype Info: Redefining babel's language switching commands.
(/usr/local/texlive/2011/texmf-dist/tex/latex/microtype/mt-cmr.cfg
File: mt-cmr.cfg 2009/11/09 v2.0 microtype config. file: Computer Modern Roman
(RS)
)
\c_siunitx_mathsf_int=\count460
LaTeX Font Info: Try loading font information for U+msa on input line 42.
(/usr/local/texlive/2011/texmf-dist/tex/latex/amsfonts/umsa.fd
File: umsa.fd 2009/06/22 v3.00 AMS symbols A
)
(/usr/local/texlive/2011/texmf-dist/tex/latex/microtype/mt-msa.cfg
File: mt-msa.cfg 2006/02/04 v1.1 microtype config. file: AMS symbols (a) (RS)
)
LaTeX Font Info: Try loading font information for U+msb on input line 42.
(/usr/local/texlive/2011/texmf-dist/tex/latex/amsfonts/umsb.fd
File: umsb.fd 2009/06/22 v3.00 AMS symbols B
)
(/usr/local/texlive/2011/texmf-dist/tex/latex/microtype/mt-msb.cfg
File: mt-msb.cfg 2005/06/01 v1.0 microtype config. file: AMS symbols (b) (RS)
)
LaTeX Font Info: Try loading font information for U+esint on input line 42.
(/usr/local/texlive/2011/texmf-dist/tex/latex/esint/uesint.fd
File: uesint.fd
)
LaTeX Font Info: Try loading font information for U+rsfs on input line 42.
(/usr/local/texlive/2011/texmf-dist/tex/latex/jknapltx/ursfs.fd
File: ursfs.fd 1998/03/24 rsfs font definition file (jk)
)
\c_siunitx_mathtt_int=\count461
./main.tex:47: Undefined control sequence.
l.47 \akaka
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
Package atveryend Info: Empty hook `BeforeClearDocument' on input line 51.
[1{/usr/local/texlive/2011/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
Package atveryend Info: Empty hook `AfterLastShipout' on input line 51.
(./main.aux)
Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 51.
Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 51.
Package rerunfilecheck Info: File `main.out' has not changed.
(rerunfilecheck) Checksum: D41D8CD98F00B204E9800998ECF8427E;0.
Package logreq Info: Writing requests to 'main.run.xml'.
\openout1 = `main.run.xml'.
)
Here is how much of TeX's memory you used:
2167 strings out of 455899
40306 string characters out of 2353312
1131909 words of memory out of 3000000
42382 multiletter control sequences out of 15000+200000
26633 words of font info for 111 fonts, out of 3000000 for 9000
831 hyphenation exceptions out of 8191
36i,6n,45p,773b,1377s stack positions out of 5000i,500n,10000p,200000b,50000s
{/usr/local/texlive/2011/texmf-dist/fonts/enc/dvips/cm-super/cm-super-t1.enc}
</usr/local/texlive/2011/texmf-dist/fonts/type1/public/cm-super/sfrm1000.pfb></
usr/local/texlive/2011/texmf-dist/fonts/type1/public/cm-super/sfrm1200.pfb></us
r/local/texlive/2011/texmf-dist/fonts/type1/public/cm-super/sfrm1728.pfb>
Output written on main.pdf (1 page, 19387 bytes).
PDF statistics:
29 PDF objects out of 1000 (max. 8388607)
22 compressed objects within 1 object stream
2 named destinations out of 1000 (max. 500000)
23053 words of extra memory for PDF output out of 24883 (max. 10000000)Vim只应显示:
main.tex l.47 undefined control sequence然而,我喜欢看到输出,这样我就可以得到一些关于正在编译哪个页面的反馈,等等。
发布于 2011-10-03 18:56:45
您是否尝试过使用errorformat而不是grep来实现输出?C.f.http://vim.wikia.com/wiki/Errorformats。如果设置make命令( http://vim.wikia.com/wiki/Make_制作_更多_有帮助 ),则特别有用。
谢谢你更新的输出,罗米夫。听起来你希望有这样的东西:
set errorformat=%E%f:%l:\ %m%C1.%l\ %Z我不能测试这个,但是根据输出,它似乎是你想要的。
发布于 2011-10-03 23:36:51
您确实应该看看橡胶 (在许多发行版中打包):
related是一个程序,其目的是处理与编译LaTeX文档相关的所有任务。当然,这包括编译文档本身足够多的时间,以便定义所有引用,并运行BibTeX来管理书目引用。还包括自动执行用于生成PostScript文档的dvips,以及使用pdfLaTeX生成PDF文档。
error将隐藏所有的输出(重定向到一个.log文件),并在调用时只显示相关的错误消息。
发布于 2011-10-04 18:16:20
这一切都是关于输出缓冲。
您所面临的问题不在于grep的工作方式,而在于管道的工作方式。或者更准确地说,pdflatex是如何允许管道工作的。它以标准的方式使用管道--这意味着通过管道的输出被缓冲。是pdflatex程序决定了它自己的输出是否可以缓冲。我不确定,但我认为在这个程序的一侧没有标准选项可以告诉它不要缓冲它的重定向输出。
但是,您可以使用stdbuf程序,它充当命令(pdflatex)的包装器,并根据需要调整输出流的字符:
stdbuf -oL pdflatex -file-line-error ... | grep ...或
stdbuf -o0 pdflatex -file-line-error ... | grep ...(剥离转义并修剪命令以提高可读性。)详情请参见man stdbuf。
此外,您还可以欺骗pdflatex (完全无害),让它“认为”输出没有被重定向,从而避免缓冲它的输出。script程序可以用于:
script -c 'pdflatex -file-line-error ... ' | grep ...请注意,这个命令需要整个pdflatex ...命令的引号。
https://unix.stackexchange.com/questions/21969
复制相似问题