詞彙表和 mylatexformat 不相容?

詞彙表和 mylatexformat 不相容?

我正在嘗試使用 mylatexformat 來加速帶有許多軟體包的大型序言。我有很多錯誤,其中大部分來自詞彙表包。

我的MWE:

\documentclass[11pt,onecolumn,twoside,draft,titlepage,fleqn,a4paper,openright]{book} 
\usepackage{titlesec}
\usepackage{longtable}
\usepackage{makeidx}
\usepackage[nonumberlist, acronym, toc, section, shortcuts, nopostdot, nogroupskip]{glossaries}
\renewcommand*{\arraystretch}{1.3}  % sets the line indent in glossaries
\setlength{\glsdescwidth}{12.5cm}   
\setlength\LTleft{0pt}
\endofdump

\newglossary[slg]{symbols}{syi}{syg}{Nomenclature}
\newglossary[ilg]{indices}{iyi}{iyg}{List of indices}
\makeglossaries

\newacronym{ECD}{ECD}{equivalent circuit diagram}
\newacronym{RES}{RES}{renewable energy source}
\newglossaryentry{Rx1}
{
  name={\ensuremath{R_{x1}}},
  description={Equivalent series resistance},
  sort=Rx1, type=symbols
}
\newglossaryentry{ref}
{
  name={*},
  description={Indicates reference value},
  sort=ref, type=indices
}

\begin{document}
\glsaddall                                
\printglossary[type=\acronymtype, style=long, title=List of Abbreviations and Acronyms]
\printglossary[type=symbols, style=long, title=Nomenclature]
\printglossary[type=indices, style=long, title=List of indices]

\section*{Sample}
\begin{longtable}{ll}
Some & Text
\end{longtable}
\gls{ref}, \gls{ECD}, \gls{Rx1}
\end{document}

\endofdump 指令禁止「正常」使用 Latex,因此正常運作時應將其註解掉。但 mylatexformat 需要它,應從終端啟動(在與 *.tex 檔案相同的資料夾中開啟)。我已經在終端機中輸入了 makeformat 手冊中提供的命令:

etex -initialize -save-size=20000 -stack-size=20000 -jobname="mlt" "&pdflatex" mylatexformat.ltx """mlt.tex"""

其中 mlt.tex 是 *.tex 檔案的名稱,也是假設的 *.fmt 檔案的名稱 (-jobname="mlt")。我已經得到了 *.fmt 檔案 mlt.fmt,但是當我嘗試包含它時(透過 mlt.tex 的第一行中的 %&mlt),我沒有得到任何結果(以及很多錯誤)。

我還嘗試了一個沒有術語表的範例(即包含了許多其他包,但沒有這個),並且它是成功的。

答案1

讓我知道如何以更美觀的方式展示這一點。

我也喜歡快速有效的組合。與 mylatexformat 的組合很棘手,但仍然令人驚嘆。包文檔似乎是 mylatex 的糟糕副本,需要更新。

我將詞彙表包(使用 makeglossaries 命令)視為動態構建。所以我按照以下說明進行操作: http://www.howtotex.com/tips-tricks/faster-latex-part-iv-use-a-precompiled-preamble/ 他們建議將 minitoc 等軟體包放在命令之後\轉儲結束。對我來說,將工作分成兩個單獨的文件會更容易。我不喜歡取消/註釋一行並以不同方式編譯同一文件的想法第一個文件應該使用 commnad 進行預編譯:

pdftex -ini -jobname="fastformat" "&pdflatex" mylatexformat.ltx """example with a space.tex"""

該名稱有 3 個引號除非該文件有一個空格。 (但有時適用於作業系統)檔案 example1.tex 具有以下內容

\documentclass{article}
% Add here more pacakges
\usepackage{hyperref}
% add here those packages after hyperref

% 'saves' everything above into one precompiled preamble
\endofdump
%% or
%\csname endofdump\endcsname

% No glossaries needed here. You could though. They shouldn't be read

\begin{document}
\noindent
Hola.
This shouldn't be read either on the precompilation
It does work if you comment the endofdump command 
and compile normally with pdflatex
Done
\end{document}

現在,編譯資訊的第二個檔案在 A 之後具有詞彙表組合\轉儲結束。第二個檔案只能使用常用命令進行編譯,例如 pdflatex,但您可能想要嘗試 makeglossaries 以使詞彙表正常工作。 [我還沒有用 makeindex 或 xindy 嘗試過。

%&fastformat
% the name above should match the name on the precompilation.

\endofdump
%add packages taht have problem with mylatexformat
%\usepackage{minitoc}

\usepackage[acronym]{glossaries}
\makeglossaries
\input{dictionary} % dictionary.tex is the file with glossary and acronyms

\begin{document}
\noindent
First use \gls{api}\    subsequent \gls{api}
\newpage


\printglossary[type=\acronymtype]
%%% \newpage just to demonstrate that links are correct
\newpage
\printglossary[type=main]

\end{document}

我在 tex.stackexchange 中找到了最後一個術語表文件範例

由於我使用 hyperref,所有術語表呼叫都應該有一個超連結。您可以刪除 hyperref,但隨後您可能會遺失整個文件中的所有其他超連結。

運行一次,編譯兩次,重啟三次。完畢

相關內容