
catdvi にどのような入力を与えても、「プリアンブルで始まっていません」という同じエラーが発生します。
簡潔にするために、プロジェクト全体をここに投稿する代わりに、例だけを貼り付けます。
\documentclass[a4paper,12pt]{article}
\begin{document}
This is the first paragraph of a typical document. It is
produced in a `12~point' size. A \emph{point} is a unit
of length used by printers. One point is approximately
$1/72$~inch. In a `12~point' font the height of the
parentheses is 12~points (i.e. about $1/6$~inch) and the
letter~`m' is about 12 points long.
This is the second paragraph of the document. There are
also `10 point' and `11 point' styles available in LaTeX.
The required size is specified in the `documentstyle'
command. If no such size is specified then the 10~point
size is assumed.
\end{document}
何が起こっているのか誰か知っていますか?
編集: ああ、申し訳ありません。catdvi は LaTeX の標準だと思っていました。次の Wiki ページで見つけました:https://en.m.wikibooks.org/wiki/LaTeX/Export_To_Other_Formats「プレーンテキストに変換」の下にあります。
答え1
catdvi
dvi
名前に が含まれるほとんどのコマンドラインユーティリティと同様に、は TeX ファイルではなく DVI ファイルで動作します。したがって、 catdvi
(またはdvi2tty
)を使用して TeX ファイルからテキストを抽出したい場合は、まずlatex
(ない pdflatex
) を実行して DVI ファイルを生成します。その後、生成された DVI ファイルに対してcatdvi
(またはdvi2tty
) を実行してプレーンテキストに変換できます。
detex
TeX ファイルからテキストを抽出するようなユーティリティは他にもあります。ただし、結果はcatdvi
またはとは異なりますdvi2tty
。
ちなみに、PDF をプレーンテキストに変換するプログラムもあります (例:pandoc
または ) pdftotext
。