tikz 中的词汇表、imakeidx 和外部化行为异常

tikz 中的词汇表、imakeidx 和外部化行为异常

我有一个奇怪的问题。我有一份大型文档,其中包含首字母缩略词列表、几个词汇表、图表和一个索引。为了创建首字母缩略词列表和词汇表,我使用了glossaries包。随着pgfplotstikz情节可能需要一些时间,我用\usepgfplotslibrary{external}它来外部化图形创建。最后,我使用imakeidx创建我的索引。目前只有一个索引,但计划创建第二个。索引是我最后添加到文档中的东西。

发生了以下事情:如果我将 添加\printindex[$INDEXNAME]到我的文档中, 的外部化突然pgfplots不起作用。没有为图形创建 pdf,并且在我的原始文档中我收到错误: Package imakeidx Error: Misplaced \printindex。但是,在 MWE 中我收到另一个错误:! No room for a new \write.

在添加之前,\printindex一切都运行正常。此外,如果我禁用外部化或少使用一个词汇表,编译也不会出现任何问题。

这个问题是否与 TeX 中寄存器数量有限有关?我该如何规避这种行为?我以为我已经使用软件包解决了这个问题morewrites以及一个 hackfilecontents此主题


不幸的是 MWE 并非如此

\documentclass{scrreprt}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Header                           %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Compilation: %S - main tex source file name
% 
%   pdflatex %S.tex
%   makeindex -s %S.ist -t %S.slg1 -o %S.syi1 %S.syg1
%   makeindex -s %S.ist -t %S.slg2 -o %S.syi2 %S.syg2
%   ...
%   pdflatex %S.tex
%   pdflatex %S.tex

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Preamble                         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{blindtext}
\usepackage{filecontents}
% http://tex.stackexchange.com/a/312910/44634 for fixing clash between filecontents and morewrites
\newwrite\fcwrite
\makeatletter
\let\zzzz\filec@ntents
\def\filec@ntents{\def\chardef##1\write{\let\reserved@c\fcwrite}\zzzz}
\makeatother
\usepackage[
  acronym,
  toc,
]{glossaries}
\usepackage{imakeidx}
\usepackage{morewrites}
\usepackage{pgfplots}
\usepackage{tabu}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Own glossaries                   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newglossary[slg1]{list1}{syi1}{syg1}{List 1}
\newglossary[slg2]{list2}{syi2}{syg2}{List 2}
\newglossary[slg3]{list3}{syi3}{syg3}{List 3}
\newglossary[slg4]{list4}{syi4}{syg4}{List 4}
\newglossary[slg5]{list5}{syi5}{syg5}{List 5}
\newglossary[slg6]{list6}{syi6}{syg6}{List 6}
\newglossary[slg7]{list7}{syi7}{syg7}{List 7}
\newglossary[slg8]{list8}{syi8}{syg8}{List 8}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Symbols                          %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newglossaryentry{symb:coordinate:xyz:l1}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list1,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l2}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list2,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l3}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list3,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l4}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list4,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l5}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list5,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l6}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list6,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l7}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list7,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l8}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list8,%
  sort        =rlxyz,%
}

\newacronym{GPL}{GPL}{GNU General Public License}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Own styles                       %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\renewcommand*{\glspostdescription}{}

\newglossarystyle{myacronymstyle}{%
  \renewenvironment{theglossary}%
    {\begin{longtabu} to \linewidth {lX}}%
    {\end{longtabu}}%
  \renewcommand*{\glossaryheader}{}%
  \renewcommand*{\glsgroupskip}{\tabularnewline}%
  \renewcommand*{\glossaryentryfield}[5]{%
    \glsentryitem{##1}\glstarget{##1}{##2} 
      & ##3\glspostdescription ##5\\
  }
}

\newglossarystyle{myglostyle}{%
  \renewcommand*{\glsclearpage}{}%
  \renewenvironment{theglossary}%
    {\begin{longtabu} to \linewidth {cX}}%
    {\end{longtabu}}%
  % Header line
  \renewcommand*{\glossaryheader}{%
    \textbf{Symbol} & \textbf{Description}%
    \tabularnewline%
    \tabularnewline%
    \endhead%
    \endfoot%
  }%
  \renewcommand*{\glsgroupskip}{\tabularnewline}
  \renewcommand*{\glossentry}[1]{%
    \glsentryitem{##1}
    \glstarget{##1}{\glossentrysymbol{##1}} &
    \glossentrydesc{##1}        %& % Description
    \tabularnewline%
  }%
}

\makeglossaries

% ---------------------------
% Setup
% ---------------------------

\indexsetup{%
  level=\chapter*,%
  toclevel=chapter,%
}

\newcommand{\idxKeywordName}{Keyword}

\makeindex[%
  name=\idxKeywordName,%
  title=\idxKeywordName{} index,
  intoc,
]

% ---------------------------
% Externalization
% ---------------------------

\pgfplotsset{compat=1.15}
\usepgfplotslibrary{external}
\tikzexternalize[%
  mode=convert with system call,%
  shell escape=-enable-write18,% Use for MiKTeX
]
\tikzsetexternalprefix{ZZZ_TikZ/}
\tikzset{%
  external/system call={%
    pdflatex \tikzexternalcheckshellescape -halt-on-error %
    -interaction=batchmode -jobname "\image" "\texsource"% && %
    %convert -density 600 -transparent white "\image.pdf" "\image.png"
  }
}
\tikzexternaldisable

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document                         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\clearpage
\chapter*{List of Symbols}

\setglossarysection{section}
\addcontentsline{toc}{chapter}{List of Symbols}

\printglossary[type=list1,style=myglostyle,nonumberlist]
\printglossary[type=list2,style=myglostyle,nonumberlist]
\printglossary[type=list3,style=myglostyle,nonumberlist]
\printglossary[type=list4,style=myglostyle,nonumberlist]
\printglossary[type=list5,style=myglostyle,nonumberlist]
\printglossary[type=list6,style=myglostyle,nonumberlist]
\printglossary[type=list7,style=myglostyle,nonumberlist]
\printglossary[type=list8,style=myglostyle,nonumberlist]

% Acronyms
\setglossarysection{chapter}
\printglossary[type=\acronymtype,style=myacronymstyle,nonumberlist]

\glsaddall

\chapter{First chapter}

Index entry 1\index[\idxKeywordName]{Entry 1}. \blindtext[1]

\begin{figure}[htbp]
  \centering
  \tikzexternalenable
  \tikzsetnextfilename{Test}
  \begin{tikzpicture}
    \node (image) at (0,0) {\includegraphics[width=0.5\linewidth]{example-image-a}};
  \end{tikzpicture}
  \tikzexternaldisable
  \caption{A figure}
  \label{fig:Figure}
\end{figure}

\blindtext[1]

\chapter{Second chapter}

Index entry 2\index[\idxKeywordName]{Entry 2}. \blindtext[4]

\printindex[\idxKeywordName]

\end{document}

如果出现以下情况则不会出错:

  • \tikzexternalenable、\tikzsetnextfilename 和 \tikzexternaldisable 被注释掉
  • \printindex 未使用
  • 属于 list8 的所有内容都被注释掉了

更新

我通过与“不太 MWE”的文档进行比较,在原始文档中找到了错误的原因。但是,我不知道到底是什么原因造成的。

如果我把imakeidx序言中与此相关的部分,尤其是\makeindex[...]

\indexsetup{%
  level=\chapter*,%
  toclevel=chapter,%
}

\newcommand{\idxKeywordName}{Keyword}

\makeindex[%
  name=\idxKeywordName,%
  title=\idxKeywordName{} index,
  intoc,
]

在外化部分之前pgfplots

\pgfplotsset{compat=1.15}
\usepgfplotslibrary{external}
\tikzexternalize[%
  mode=convert with system call,%
  shell escape=-enable-write18,% Use for MiKTeX
]
\tikzsetexternalprefix{ZZZ_TikZ/}
\tikzset{%
  external/system call={%
    pdflatex \tikzexternalcheckshellescape -halt-on-error %
    -interaction=batchmode -jobname "\image" "\texsource"% && %
    %convert -density 600 -transparent white "\image.pdf" "\image.png"
  }
}
\tikzexternaldisable

一切正常,外部图形也正确创建。如果我切换序言中的位置,则不会创建任何外部图形,并且会出现上述错误Package imakeidx Error: Misplaced \printindex

知道为什么会发生这种情况吗?


这有效

\documentclass{scrreprt}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Header                           %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Compilation: %S - main tex source file name
% 
%   pdflatex %S.tex
%   makeindex -s %S.ist -t %S.slg1 -o %S.syi1 %S.syg1
%   makeindex -s %S.ist -t %S.slg2 -o %S.syi2 %S.syg2
%   ...
%   pdflatex %S.tex
%   pdflatex %S.tex

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Preamble                         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{blindtext}
\usepackage{filecontents}
% http://tex.stackexchange.com/a/312910/44634 for fixing clash between filecontents and morewrites
\newwrite\fcwrite
\makeatletter
\let\zzzz\filec@ntents
\def\filec@ntents{\def\chardef##1\write{\let\reserved@c\fcwrite}\zzzz}
\makeatother
\usepackage[
  acronym,
  toc,
]{glossaries}
\usepackage{imakeidx}
\usepackage{morewrites}
\usepackage{pgfplots}
\usepackage{scrwfile}
\usepackage{tabu}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Own glossaries                   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newglossary[slg1]{list1}{syi1}{syg1}{List 1}
\newglossary[slg2]{list2}{syi2}{syg2}{List 2}
\newglossary[slg3]{list3}{syi3}{syg3}{List 3}
\newglossary[slg4]{list4}{syi4}{syg4}{List 4}
\newglossary[slg5]{list5}{syi5}{syg5}{List 5}
\newglossary[slg6]{list6}{syi6}{syg6}{List 6}
\newglossary[slg7]{list7}{syi7}{syg7}{List 7}
\newglossary[slg8]{list8}{syi8}{syg8}{List 8}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Symbols                          %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newglossaryentry{symb:coordinate:xyz:l1}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list1,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l2}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list2,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l3}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list3,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l4}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list4,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l5}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list5,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l6}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list6,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l7}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list7,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l8}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list8,%
  sort        =rlxyz,%
}

\newacronym{GPL}{GPL}{GNU General Public License}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Own styles                       %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\renewcommand*{\glspostdescription}{}

\newglossarystyle{myacronymstyle}{%
  \renewenvironment{theglossary}%
    {\begin{longtabu} to \linewidth {lX}}%
    {\end{longtabu}}%
  \renewcommand*{\glossaryheader}{}%
  \renewcommand*{\glsgroupskip}{\tabularnewline}%
  \renewcommand*{\glossaryentryfield}[5]{%
    \glsentryitem{##1}\glstarget{##1}{##2} 
      & ##3\glspostdescription ##5\\
  }
}

\newglossarystyle{myglostyle}{%
  \renewcommand*{\glsclearpage}{}%
  \renewenvironment{theglossary}%
    {\begin{longtabu} to \linewidth {cX}}%
    {\end{longtabu}}%
  % Header line
  \renewcommand*{\glossaryheader}{%
    \textbf{Symbol} & \textbf{Description}%
    \tabularnewline%
    \tabularnewline%
    \endhead%
    \endfoot%
  }%
  \renewcommand*{\glsgroupskip}{\tabularnewline}
  \renewcommand*{\glossentry}[1]{%
    \glsentryitem{##1}
    \glstarget{##1}{\glossentrysymbol{##1}} &
    \glossentrydesc{##1}        %& % Description
    \tabularnewline%
  }%
}

\makeglossaries

% ---------------------------
% Setup
% ---------------------------

\indexsetup{%
  level=\chapter*,%
  toclevel=chapter,%
}

\newcommand{\idxKeywordName}{Keyword}

\makeindex[%
  name=\idxKeywordName,%
  title=\idxKeywordName{} index,
  intoc,
]

% ---------------------------
% Externalization
% ---------------------------
% THIS MUST COME AFTER \makeindex[...] from above to avoid error

\pgfplotsset{compat=1.15}
\usepgfplotslibrary{external}
\tikzexternalize[%
  mode=convert with system call,%
  shell escape=-enable-write18,% Use for MiKTeX
]
\tikzsetexternalprefix{ZZZ_TikZ/}
\tikzset{%
  external/system call={%
    pdflatex \tikzexternalcheckshellescape -halt-on-error %
    -interaction=batchmode -jobname "\image" "\texsource"% && %
    %convert -density 600 -transparent white "\image.pdf" "\image.png"
  }
}
\tikzexternaldisable

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document                         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\clearpage
\chapter*{List of Symbols}

\setglossarysection{section}
\addcontentsline{toc}{chapter}{List of Symbols}

\printglossary[type=list1,style=myglostyle,nonumberlist]
\printglossary[type=list2,style=myglostyle,nonumberlist]
\printglossary[type=list3,style=myglostyle,nonumberlist]
\printglossary[type=list4,style=myglostyle,nonumberlist]
\printglossary[type=list5,style=myglostyle,nonumberlist]
\printglossary[type=list6,style=myglostyle,nonumberlist]
\printglossary[type=list7,style=myglostyle,nonumberlist]
\printglossary[type=list8,style=myglostyle,nonumberlist]

% Acronyms
\setglossarysection{chapter}
\printglossary[type=\acronymtype,style=myacronymstyle,nonumberlist]

\glsaddall

\chapter{First chapter}

Index entry 1\index[\idxKeywordName]{Entry 1}. \blindtext[1]

\begin{figure}[htbp]
  \centering
  \tikzexternalenable
  \tikzsetnextfilename{Test}
  \begin{tikzpicture}
    \node (image) at (0,0) {\includegraphics[width=0.5\linewidth]{example-image-a}};
  \end{tikzpicture}
  \tikzexternaldisable
  \caption{A figure}
  \label{fig:Figure}
\end{figure}

\blindtext[1]

\chapter{Second chapter}

Index entry 2\index[\idxKeywordName]{Entry 2}. \blindtext[4]

\printindex[\idxKeywordName]

\end{document}

这不起作用

\documentclass{scrreprt}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Header                           %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Compilation: %S - main tex source file name
% 
%   pdflatex %S.tex
%   makeindex -s %S.ist -t %S.slg1 -o %S.syi1 %S.syg1
%   makeindex -s %S.ist -t %S.slg2 -o %S.syi2 %S.syg2
%   ...
%   pdflatex %S.tex
%   pdflatex %S.tex

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Preamble                         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{blindtext}
\usepackage{filecontents}
% http://tex.stackexchange.com/a/312910/44634 for fixing clash between filecontents and morewrites
\newwrite\fcwrite
\makeatletter
\let\zzzz\filec@ntents
\def\filec@ntents{\def\chardef##1\write{\let\reserved@c\fcwrite}\zzzz}
\makeatother
\usepackage[
  acronym,
  toc,
]{glossaries}
\usepackage{imakeidx}
\usepackage{morewrites}
\usepackage{pgfplots}
\usepackage{scrwfile}
\usepackage{tabu}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Own glossaries                   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newglossary[slg1]{list1}{syi1}{syg1}{List 1}
\newglossary[slg2]{list2}{syi2}{syg2}{List 2}
\newglossary[slg3]{list3}{syi3}{syg3}{List 3}
\newglossary[slg4]{list4}{syi4}{syg4}{List 4}
\newglossary[slg5]{list5}{syi5}{syg5}{List 5}
\newglossary[slg6]{list6}{syi6}{syg6}{List 6}
\newglossary[slg7]{list7}{syi7}{syg7}{List 7}
\newglossary[slg8]{list8}{syi8}{syg8}{List 8}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Symbols                          %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newglossaryentry{symb:coordinate:xyz:l1}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list1,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l2}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list2,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l3}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list3,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l4}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list4,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l5}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list5,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l6}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list6,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l7}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list7,%
  sort        =rlxyz,%
}

\newglossaryentry{symb:coordinate:xyz:l8}{%
  symbol      ={\ensuremath{x$,$y$,$z}},%
  name        ={},%
  description ={Entry},%
  type        =list8,%
  sort        =rlxyz,%
}

\newacronym{GPL}{GPL}{GNU General Public License}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Own styles                       %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\renewcommand*{\glspostdescription}{}

\newglossarystyle{myacronymstyle}{%
  \renewenvironment{theglossary}%
    {\begin{longtabu} to \linewidth {lX}}%
    {\end{longtabu}}%
  \renewcommand*{\glossaryheader}{}%
  \renewcommand*{\glsgroupskip}{\tabularnewline}%
  \renewcommand*{\glossaryentryfield}[5]{%
    \glsentryitem{##1}\glstarget{##1}{##2} 
      & ##3\glspostdescription ##5\\
  }
}

\newglossarystyle{myglostyle}{%
  \renewcommand*{\glsclearpage}{}%
  \renewenvironment{theglossary}%
    {\begin{longtabu} to \linewidth {cX}}%
    {\end{longtabu}}%
  % Header line
  \renewcommand*{\glossaryheader}{%
    \textbf{Symbol} & \textbf{Description}%
    \tabularnewline%
    \tabularnewline%
    \endhead%
    \endfoot%
  }%
  \renewcommand*{\glsgroupskip}{\tabularnewline}
  \renewcommand*{\glossentry}[1]{%
    \glsentryitem{##1}
    \glstarget{##1}{\glossentrysymbol{##1}} &
    \glossentrydesc{##1}        %& % Description
    \tabularnewline%
  }%
}

\makeglossaries

% ---------------------------
% Externalization
% ---------------------------
% THIS MUST COME AFTER \makeindex[...] to avoid error

\pgfplotsset{compat=1.15}
\usepgfplotslibrary{external}
\tikzexternalize[%
  mode=convert with system call,%
  shell escape=-enable-write18,% Use for MiKTeX
]
\tikzsetexternalprefix{ZZZ_TikZ/}
\tikzset{%
  external/system call={%
    pdflatex \tikzexternalcheckshellescape -halt-on-error %
    -interaction=batchmode -jobname "\image" "\texsource"% && %
    %convert -density 600 -transparent white "\image.pdf" "\image.png"
  }
}
\tikzexternaldisable

% ---------------------------
% Setup
% ---------------------------

\indexsetup{%
  level=\chapter*,%
  toclevel=chapter,%
}

\newcommand{\idxKeywordName}{Keyword}

\makeindex[%
  name=\idxKeywordName,%
  title=\idxKeywordName{} index,
  intoc,
]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document                         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\clearpage
\chapter*{List of Symbols}

\setglossarysection{section}
\addcontentsline{toc}{chapter}{List of Symbols}

\printglossary[type=list1,style=myglostyle,nonumberlist]
\printglossary[type=list2,style=myglostyle,nonumberlist]
\printglossary[type=list3,style=myglostyle,nonumberlist]
\printglossary[type=list4,style=myglostyle,nonumberlist]
\printglossary[type=list5,style=myglostyle,nonumberlist]
\printglossary[type=list6,style=myglostyle,nonumberlist]
\printglossary[type=list7,style=myglostyle,nonumberlist]
\printglossary[type=list8,style=myglostyle,nonumberlist]

% Acronyms
\setglossarysection{chapter}
\printglossary[type=\acronymtype,style=myacronymstyle,nonumberlist]

\glsaddall

\chapter{First chapter}

Index entry 1\index[\idxKeywordName]{Entry 1}. \blindtext[1]

\begin{figure}[htbp]
  \centering
  \tikzexternalenable
  \tikzsetnextfilename{Test}
  \begin{tikzpicture}
    \node (image) at (0,0) {\includegraphics[width=0.5\linewidth]{example-image-a}};
  \end{tikzpicture}
  \tikzexternaldisable
  \caption{A figure}
  \label{fig:Figure}
\end{figure}

\blindtext[1]

\chapter{Second chapter}

Index entry 2\index[\idxKeywordName]{Entry 2}. \blindtext[4]

\printindex[\idxKeywordName]

\end{document}

相关内容