管道 \write18 指令和 ltxguide

管道 \write18 指令和 ltxguide

以下作品在article

\documentclass[a4paper]{article}
\title{Foo}
\author{Me}
\begin{document}
\input{|"echo foo bar | grep foo"}
\end{document}

相反\input,這也有效:

\immediate\write18{echo foo bar | grep foo > /tmp/test.txt}
\input{/tmp/test.txt}
\immediate\write18{rm /tmp/test.txt}

然而,這似乎不適用於該類別ltxguide(這兩個選項都不是)。第二個,\write18當沒有管道時(即只是echo foo bar > /tmp/test.txt),第一個根本不起作用,也沒有管道。

如何在ltxguide課堂上使用管道?

我遇到的錯誤\input{|"echo foo bar | grep foo"}ltxguide

! Undefined control sequence.
\GenericError  ...                                
                                                    #4  \errhelp \@err@     ...
l.17 \input{|"echo foo bar | grep foo"}

答案1

班級ltxguide

% Make |...| a synonym for \verb|...|.
\RequirePackage{shortvrb}
\MakeShortVerb{\|}

只需添加您的文檔序言

\DeleteShortVerb{\|}

相關內容