\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english, russian]{babel}
\usepackage[T1, T2A]{fontenc}
\begin{document}
\begin{abstract}
Это вводный абзац в начале документа.
\end{abstract}
Этот текст будет на русском языке. Это демонстрация того, что символы кириллицы
в сгенерированном документе (Compile to PDF) отображаются правильно.
Для этого Вы должны установить нужный язык (russian)
и необходимую кодировку шрифта (T2A).
\selectlanguage{english}
This text will be in English. The elements within this
block of text will also be set in the right language.
\begin{abstract}
A brief description of the main subject to be
explained in the entire document.
\end{abstract}
\selectlanguage{russian}
Кириллические символы также могут быть использованы в математическом режиме.
\begin{equation}
S_\textup{ис} = S_{123}
\end{equation}
\end{document}
我正在使用上述代码通过 miktex -> pdf latex 生成文档。但文档并未生成。
这就是我在日志文件中得到的内容。 https://pastebin.com/cgU2pYLG
这就是我在控制台得到的结果
Microsoft Windows [Version 10.0.16299.1029]
(c) 2017 Microsoft Corporation. All rights reserved.
C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator>C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator\LatexToPDF.bat
C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator>CD C:\KBData\NGworkspace\Branch\Out\Print\PDF\miktex\bin
C:\KBData\NGworkspace\Branch\Out\Print\PDF\miktex\bin>pdflatex --output-directory="C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator" --file-line-error --interaction=nonstopmode "C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator\report.tex"
This is pdfTeX, Version 3.1415926-2.3-1.40.12 (MiKTeX 2.9)
entering extended mode
(C:/Users/kesarkas/AppData/Local/Temp/ReportGenerator/report.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, afrikaans, ancientgreek, ar
abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic,
croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga
lician, german, german-x-2009-06-19, greek, gujarati, hindi, hungarian, iceland
ic, indonesian, interlingua, irish, italian, kannada, kurmanji, lao, latin, lat
vian, lithuanian, malayalam, marathi, mongolian, mongolianlmc, monogreek, ngerm
an, ngerman-x-2009-06-19, nynorsk, oriya, panjabi, pinyin, polish, portuguese,
romanian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, swis
sgerman, tamil, telugu, turkish, turkmen, ukenglish, ukrainian, uppersorbian, u
senglishmax, welsh, loaded.
(C:\KBData\NGworkspace\Branch\Out\Print\PDF\tex\latex\base\article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(C:\KBData\NGworkspace\Branch\Out\Print\PDF\tex\latex\base\size10.clo))
(C:\KBData\NGworkspace\Branch\Out\Print\PDF\tex\latex\base\inputenc.sty
(C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator\utf8.def
(C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator\t1enc.dfu)
(C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator\ot1enc.dfu)
(C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator\omsenc.dfu)))
(C:\KBData\NGworkspace\Branch\Out\Print\PDF\tex\generic\babel\babel.sty
*************************************
* Local config file bblopts.cfg used
*
(C:\KBData\NGworkspace\Branch\Out\Print\PDF\tex\latex\00miktex\bblopts.cfg)
(C:\KBData\NGworkspace\Branch\Out\Print\PDF\tex\generic\babel\english.ldf
(C:\KBData\NGworkspace\Branch\Out\Print\PDF\tex\generic\babel\babel.def))
(C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator\russianb.ldf
Package babel Warning: No Cyrillic font encoding has been loaded so far.
(babel) A font encoding should be declared before babel.
(babel) Default `T2A' encoding will be loaded on input line 74.
(C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator\t2aenc.def
(C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator\t2aenc.dfu))))
(C:\KBData\NGworkspace\Branch\Out\Print\PDF\tex\latex\base\fontenc.sty
(C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator\t1enc.def)
(C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator\t2aenc.def)
(C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator\t2acmr.fd)pdflatex: The font creation utility could not be found.
pdflatex: Data: miktex-maketfm.exe
C:\KBData\NGworkspace\Branch\Out\Print\PDF\miktex\bin>
答案1
你调用 pdflatex 的方法是错误的。(我把它拆分开来做备注):
C:\KBData\NGworkspace\Branch\Out\Print\PDF\miktex\bin>pdflatex
您不应该在 bin 文件夹中启动 pdflatex。正确的做法是切换到文档文件夹并从那里调用 pdflatex
C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator> pdflatex
--output-directory="C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator"
您正在尝试将文件输出到文档的文件夹,如果您正确调用 pdflatex,则这是不必要的。
"C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator\report.tex"
你永远不应该传递绝对路径给 pdflatex 正确的方法是
report
所以正确的做法是
C:\Users\kesarkas\AppData\Local\Temp\ReportGenerator> pdflatex --file-line-error --interaction=nonstopmode report
如果报告未找到 pdflatex,则应添加
C:\KBData\NGworkspace\Branch\Out\Print\PDF\miktex\bin
到您的 Windows PATH 变量。