由于某种原因,Texshop 拒绝排版我的索引 idx 文件。我正在使用 Mac 和 .ltx 文件
这是我的代码:
% XeLaTeX can use any Mac OS X font. See the setromanfont command below.
% Input to XeLaTeX is full Unicode, so Unicode characters can be typed directly into the source.
% The next lines tell TeXShop to typeset with xelatex, and to open and save the source with Unicode encoding.
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[11pt]{book}
\usepackage{ledmac}
\usepackage{fancyhdr}
\pagestyle{myheadings}
\usepackage{hanging}
\textheight = 180.5 mm
\textwidth = 108.5 mm
\pagenumbering{arabic}
\usepackage{amsmidx}
\makeindex{nominum}
\makeindex{rerum}
\input{style}
\raggedbottom
\newcommand*{\LeftWidth}{3.0cm}%
\newcommand*{\RightWidth}{\dimexpr\linewidth-\LeftWidth-2em\relax}%
\newcommand{\AlignedBrace}[2]{%
\medskip\par\noindent%
\parbox{\LeftWidth}{\raggedleft\textbf{#1}\strut~}%
$\left\{~\parbox{\RightWidth}{\strut\textit{#2}\strut}\right.$%
}%
%\usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots.
%\geometry{a4paper} % ... or a4paper or a5paper or ...
%\geometry{landscape} % Activate for for rotated page geometry
%\usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath}
%\renewcommand %These two commands are for double-spacing
%\baselinestretch{2}
% Will Robertson's fontspec.sty can be used to simplify font choices.
% To experiment, open /Applications/Font Book to examine the fonts provided on Mac OS X,
% and change "Hoefler Text" to any of these choices.
\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Brill}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Gill Sans}
\setmonofont[Scale=MatchLowercase]{Andale Mono}
\frenchspacing
\begin{document}
.............................
\backmatter
\Printindex{nominum}{Index nominum}
\Printindex{rerum}{Index rerum}
\end{document}
这是我得到的日志文件:
This is XeTeXk, Version 3.141592-2.2-0.996 (Web2C 7.5.6)
%&-line parsing enabled.
entering extended mode
(./medlyeM2.ltx
LaTeX2e <2005/12/01>
Babel <v3.8h> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, arabic, basque, bulgarian, coptic, welsh, czech, slovak, german, ng
erman, danish, esperanto, spanish, catalan, galician, estonian, farsi, finnish,
french, greek, monogreek, ancientgreek, croatian, hungarian, interlingua, ibyc
us, indonesian, icelandic, italian, latin, mongolian, dutch, norsk, polish, por
tuguese, pinyin, romanian, russian, slovenian, uppersorbian, serbian, swedish,
turkish, ukenglish, ukrainian, loaded.
(/usr/local/texlive/2007/texmf-dist/tex/latex/base/book.cls
Document Class: book 2005/09/16 v1.4f Standard LaTeX document class
(/usr/local/texlive/2007/texmf-dist/tex/latex/base/bk11.clo))
(/usr/local/texlive/2007/texmf-dist/tex/latex/ledmac/ledmac.sty
(/usr/local/texlive/2007/texmf-dist/tex/latex/ledmac/ledpatch.sty))
(/usr/local/texlive/2007/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty)
(/usr/local/texlive/2007/texmf-dist/tex/latex/hanging/hanging.sty)
(./amsmidx.sty
! LaTeX Error: \printindex undefined.
! LaTeX Error: \indexchap undefined.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.108 \renewcommand{\indexchap}
答案1
这是您想要的文档的精简版;您只需在其上运行 XeLaTeX,索引就会自动编译和生成。
\documentclass[11pt]{book}
\usepackage{imakeidx}
\makeindex[name=nominum,title=Index nominum,intoc]
\makeindex[name=rerum,title=Index rerum,intoc]
\usepackage{fontspec}
\setromanfont[Ligatures=TeX]{Brill}
\setsansfont[Scale=MatchLowercase,Ligatures=TeX]{Gill Sans}
\setmonofont[Scale=MatchLowercase]{Andale Mono}
\frenchspacing
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{Title}
Here we mention the name of a famous mathematician, Carl Friedrich
Gauss\index[nominum]{Gauss, Carl Friedrich} who is very well known
for his work in mathematics\index[rerum]{mathematics} and
physics\index[rerum]{physics}
\backmatter
\printindex[nominum]
\printindex[rerum]
\end{document}
目录
第一章页数
“名义指数”
“索引”
答案2
该\printindex
命令在包中定义makeindex
,因此您需要添加
\usepackage{makeindex}
您(或您的 IDE)还需要在 LaTeX 运行后运行 makeindex 程序来生成索引,然后再次运行 latex 来排版索引。
\indexchap
我无法帮助你,你的代码正在尝试关于定义它但它没有被定义,也许你只是需要\newcommand
而不是\renewcommand
或者也许你打算加载一些定义它的包?