1

I'm trying to speed up my big preamble with many packages by using mylatexformat. And I have lots of errors, the majority of which comes from the glossaries package.

My 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}

The \endofdump command prohibits the "normal" use of Latex, so it should be commented out for normal runs. But it is needed for mylatexformat that should be started from terminal (opened in the same folder as the *.tex file). I've typed the command presented in the makeformat manual in the terminal:

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

where mlt.tex is the name of the *.tex file and also the name of the supposed *.fmt file (-jobname="mlt"). I've got the *.fmt file mlt.fmt, but as I tried to include it (by %&mlt in the very first line of mlt.tex), I've got no result (and so many errors).

I also tried a sample example without glossaries (i.e. many other packages were included, but not this one), and it was successful.

5

let me know how to show this in a more presentable manner.

I love fast efficient combos too. The combo with mylatexformat is tricky but nevertheless amazing. Package documentation seems like a terrible copy of mylatex and needs updating.

I see the glossaries package (with the makeglossaries command) as a dynamic build. So I follow the instructions in: http://www.howtotex.com/tips-tricks/faster-latex-part-iv-use-a-precompiled-preamble/ They recommend packages such as minitoc to be located after the command \endofdump. For me it will be easier to split the work into two separate files. I don't like the idea of un/commenting a line and compiling differently the same file The first file should be precompile with commnad:

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

This name has 3 quote marks only if the document has a space. (But sometimes works for OS systems) The file example1.tex has the following

\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}

Now, the secondfile that does compile the information has the Glossaries combo AFTER A \endofdump. The second file that should only be compiled with the common commands, say pdflatex, but you might want to try makeglossaries for the glossaries to work. [I haven't it try it with a makeindex or 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}

This last example of glossaries file I found somewhere in tex.stackexchange

Since I use hyperref, all glossaries calls should have a hyperlink. You can remove hyperref but then you migth lose all other hyperlinks in the whole document.

Run once, Compile twice and Reboot three times. Done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.