⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spec.tex

📁 用于公式编辑
💻 TEX
📖 第 1 页 / 共 2 页
字号:
%\emph{key} argument with several examples.
索引的内容通过命令
\begin{lscommand}
  \ci{index}\verb|{|\emph{key}\verb|}|
\end{lscommand}
\noindent 指定,这里~\emph{key}~是索引项的关键词。你可以在需要被索引的地方
加入这条命令。表~\ref{index}~举例解释了~\emph{key}~参数用法。

%\begin{table}[!tp]
%\caption{Index Key Syntax Examples.}
%\label{index}
%\begin{center}
%\begin{tabular}{@{}lll@{}}
%  \textbf{Example} &\textbf{Index Entry} &\textbf{Comment}\\\hline
%  \rule{0pt}{1.05em}\verb|\index{hello}| &hello, 1 &Plain entry\\
%\verb|\index{hello!Peter}|   &\hspace*{2ex}Peter, 3 &Subentry under `hello'\\
%\verb|\index{Sam@\textsl{Sam}}|     &\textsl{Sam}, 2& Formatted entry\\
%\verb|\index{Lin@\textbf{Lin}}|     &\textbf{Lin}, 7& Same as above\\
%\verb.\index{Jenny|textbf}.     &Jenny, \textbf{3}& Formatted page number\\
%\verb.\index{Joe|textit}.     &Joe, \textit{5}& Same as above
%\end{tabular}
%\end{center}
%\end{table}
\begin{table}[!tp]
\caption{索引关键词格式示例。} \label{index}
\begin{center}
\begin{tabular}{@{}lll@{}}
  \textbf{示例} &\textbf{索引项} &\textbf{注解}\\\hline
  \rule{0pt}{1.05em}\verb|\index{hello}| &hello, 1 & 普通格式的索引项\\
\verb|\index{hello!Peter}|   &\hspace*{2ex}Peter, 3 & `hello'下的子项\\
\verb|\index{Sam@\textsl{Sam}}|     &\textsl{Sam}, 2& 定义索引项的格式\\
\verb|\index{Lin@\textbf{Lin}}|     &\textbf{Lin}, 7& 同上\\
\verb.\index{Jenny|textbf}.     &Jenny, \textbf{3}& 定义页码的格式\\
\verb.\index{Joe|textit}.     &Joe, \textit{5}& 同上
\end{tabular}
\end{center}
\end{table}

%When the input file is processed with \LaTeX{}, each \verb|\index|
%command writes an appropriate index entry together with the current
%page number to a special file. The file has the same name as the
%\LaTeX{} input file, but a different extension (\verb|.idx|). This
%\texttt{.idx} file can then be processed with the \texttt{makeindex}
%program.
当~\LaTeX{}~处理输入文档时,每个~\verb|\index|~命令都会将适当的索引项
和当前页码写入一个特殊的文件中。这个文件的名字和~\LaTeX{}~输入文档相同,
但具有不同的扩展名后缀~(\verb|.idx|)。这个~\texttt{.idx}~文件需要用
~\texttt{makeindex}~程序来处理。

%\begin{lscommand}
%  \texttt{makeindex} \emph{filename}
%\end{lscommand}
%The \texttt{makeindex} program generates a sorted index with the same base
%file name, but this time with the extension \texttt{.ind}. If now the
%\LaTeX{} input file is processed again, this sorted index gets
%included into the document at the point where \LaTeX{} finds
%\begin{lscommand}
%  \ci{printindex}
%\end{lscommand}
\begin{lscommand}
  \texttt{makeindex} \emph{filename}
\end{lscommand}
\texttt{makeindex}~程序生成一个与源文件同名的排序索引文件,
这个文件使用~\texttt{.ind}~为扩展名。当再次用~\LaTeX{}~处理源文件时,
这个排序的索引文件将被包含到源文件中
\begin{lscommand}
  \ci{printindex}
\end{lscommand}
\noindent 命令出现的位置。

%The \pai{showidx} package which comes with \LaTeXe{} prints out all
%index entries in the left margin of the text. This is quite useful for
%proofreading a document and verifying the index.
\LaTeXe{}~附带的宏包~\pai{showidx}~可以在正文的左边打印出索引项。
这个功能在校对文档和索引项时十分有用。

%\section{Fancy Headers}
%\label{sec:fancy}
\section{定制页眉和页脚}
\label{sec:fancy}

%The \pai{fancyhdr} package,\footnote{Available from
%  \texttt{CTAN:/tex-archive/macros/latex/contrib/supported/fancyhdr}.} written by
%Piet van Oostrum, provides a few simple commands which allow you to
%customize the header and footer lines of your document.  If you look
%at the top of this page, you can see a possible application of this
%package.
Piet van Oostrum~编写的~\pai{fancyhdr}~宏包\footnote{可以在
  \texttt{CTAN:/tex-archive/macros/latex/contrib/supported/fancyhdr}得到。},
提供了一些简单的命令使得我们可以定制文档的页眉和页脚。看一眼本页的顶部,
你就能发现这个宏包的用处。

%\begin{figure}[!htbp]
%\begin{lined}{\textwidth}
%\begin{verbatim}
%\documentclass{book}
%\usepackage{fancyhdr}
%\pagestyle{fancy}
%% with this we ensure that the chapter and section
%% headings are in lowercase.
%\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
%\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
%\fancyhf{}  % delete current setting for header and footer
%\fancyhead[LE,RO]{\bfseries\thepage}
%\fancyhead[LO]{\bfseries\rightmark}
%\fancyhead[RE]{\bfseries\leftmark}
%\renewcommand{\headrulewidth}{0.5pt}
%\renewcommand{\footrulewidth}{0pt}
%\addtolength{\headheight}{0.5pt} % make space for the rule
%\fancypagestyle{plain}{%
%   \fancyhead{} % get rid of headers on plain pages
%   \renewcommand{\headrulewidth}{0pt} % and the line
%}
%\end{verbatim}
%\end{lined}
%\caption{Example \pai{fancyhdr} Setup.} \label{fancyhdr}
%\end{figure}
\begin{figure}[!htbp]
\begin{lined}{\textwidth}
\begin{verbatim}
\documentclass{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
% with this we ensure that the chapter and section
% headings are in lowercase.
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{}  % delete current setting for header and footer
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt} % make space for the rule
\fancypagestyle{plain}{%
   \fancyhead{} % get rid of headers on plain pages
   \renewcommand{\headrulewidth}{0pt} % and the line
}
\end{verbatim}
\end{lined}
\caption{\pai{fancyhdr}~设置实例。} \label{fancyhdr}
\end{figure}


%The tricky problem when customising headers and footers is to get
%things like running section and chapter names in there. \LaTeX{}
%accomplishes this with a two-stage approach. In the header and footer
%definition, you use the commands \ci{rightmark} and \ci{leftmark} to
%represent the current section and chapter heading, respectively.
%The values of these two commands are overwritten whenever a chapter or
%section command is processed.
定制页眉和页脚时最棘手的事情莫过于得到每个页面所属的章节名称了。
\LaTeX{}~通过两个步骤来完成这个任务。在定义页眉和页脚时,你可以使用
~\ci{rightmark}~命令来代表当前的节名,使用~\ci{leftmark}~来代表当前的章名。
这两个命令的值将在处理~chapter~或者~section~命令时被赋值。

%For ultimate flexibility, the \verb|\chapter| command and its friends
%do not redefine \ci{rightmark} and \ci{leftmark} themselves, they call
%yet another command called \ci{chaptermark}, \ci{sectionmark} or
%\ci{subsectionmark} which is responsible for redefining \ci{rightmark}
%and \ci{leftmark}.
为了获得最大的灵活性,~\verb|\chapter|~等命令并不直接对~\ci{rightmark}~和
~\ci{leftmark}~进行重新定义,而是通过调用~\ci{chaptermark}~命令或者
~\ci{sectionmark}、\ci{subsectionmark}~来定义~\ci{rightmark}~和
~\ci{leftmark}。

%So, if you wanted to change the look of the chapter
%name in the header line, you simply have to ``renew'' the \ci{chaptermark}
%command. \cih{sectionmark}\cih{subsectionmark}
因此,如果你想修改页眉上显示的章名的话,只需要简单地重新定义
~\ci{chaptermark}命令。\cih{sectionmark}\cih{subsectionmark}


%Figure~\ref{fancyhdr} shows a possible setup for the \pai{fancyhdr}
%package which makes the headers look about the same as they look in
%this booklet. In any case I suggest you fetch the documentation for
%the package at the address mentioned in the footnote.
图~\ref{fancyhdr}~显示了如何配置~\pai{fancyhdr}~来得到和本文相似的页眉。
无论如何我还是建议你先阅读一下宏包所带的文档。


%\section{The Verbatim Package}
\section{Verbatim~宏包}

%Earlier in this book, you got to know the \ei{verbatim}
%\emph{environment}.  In this section, you are going to learn about the
%\pai{verbatim} \emph{package}. The \pai{verbatim} package is basically
%a re-implementation of the \ei{verbatim} environment, which works around
%some of the limitations of the original \ei{verbatim} environment.
%This by itself is not spectacular, but with the implementation of the
%\pai{verbatim} package, there was also new functionality added, and
%this is the reason I am mentioning the package here. The \pai{verbatim}
%package provides the
在本文的前面部分你已经知道了~\ei{verbatim}~\emph{环境}。在这一节中,
你将学会使用~\pai{verbatim}~\emph{宏包}。~\pai{verbatim}~宏包重新
实现了~\ei{verbatim}~环境,并解决了原来的~\ei{verbatim}~环境的一些限制。
这本身并没有什么特别的,但~\pai{verbatim}~宏包还实现了一些新增的功能,
这才是我在这里提到这个宏包的原因。~\pai{verbatim}~宏包提供了

\begin{lscommand}
  \ci{verbatiminput}\verb|{|\emph{filename}\verb|}|
\end{lscommand}

%\noindent command which allows you to include raw ASCII text into your
%document as if it was inside a \ei{verbatim} environment.
\noindent
命令,这个命令允许你把一个~ASCII~码的文本文件包含到你的文档中来,
就好像它们是在~\ei{verbatim}~环境中一样。

%As the \pai{verbatim} package is part of the `tools' bundle, you
%should find it preinstalled on most systems. If you want to know more
%about this package, make sure to read \cite{verbatim}
\pai{verbatim}~宏包是~`tools'~宏包集的一部分,大多数的系统中都预装了这个宏包。
如果你想更多地了解这个宏包,可以阅读~\cite{verbatim}。


%\section{Downloading and Installing \LaTeX{} Packages}
\section{下载并安装~\LaTeX{}~宏包}

%Most \LaTeX{} installations come with a large set of pre-installed
%style packages, but there are many more available on the net. The main
%place to look for style package on the Internet is CTAN (\verb|http://www.ctan.org/|).
大多数的~\LaTeX{}~安装都带有大量预装的样式宏包,但还有很多可以在网上得到。
在互联网寻找样式宏包的一个主要的地方就是~CTAN(\verb|http://www.ctan.org/|)。

%Packages, such as, \pai{geometry}, \pai{hyphenat}, and many
%others, are typically made up of two files: a file with the extension
%\texttt{.ins} and another with the extension \texttt{.dtx}. Often
%there will be a \texttt{readme.txt} with a brief description of the
%package. You should of course read this file first.
各种宏包的源文件,例如~\pai{geometry}~,~\pai{hyphenat}~等等,一般来说都包含
两个文件:一个扩展名为~\texttt{.ins},另一个扩展名为~\texttt{.dtx}。
此外,通常会有一个~\texttt{readme.txt}~对宏包进行简要的说明。你应该先阅读这个文件。

%In any event, once you have copied the package files onto your
%machine, you still have to process them in a way that (a) your
%\TeX\ distribution knows about the new style package and (b) you get
%the documentation.  Here's how you do the first part:
无论如何,一旦你得到了宏包的源文件,你还要对它们进行处理使得~(a)~
你的~\TeX{}~系统知道这个新的宏包,~(b)~生成说明文档。下面是第一部分的步骤:

%\begin{enumerate}
%\item Run \LaTeX{} on the \texttt{.ins} file. This will
%  extract a \texttt{.sty} file.
%\item Move the \texttt{.sty} file to a place where your distribution
%  can find it. Usually this is in your \texttt{\ldots/\emph{localtexmf}/tex/latex}
%  subdirectory (Windows or OS/2 users should feel free to change the
%  direction of the slashes).
%\item Refresh your distribution's file-name database. The command
%  depends on the \LaTeX-Distribution you use:
%  teTeX, fpTeX -- \texttt{texhash}; web2c -- \texttt{maktexlsr};
%  MikTeX -- \texttt{initexmf -update-fndb} or use the GUI.
%\end{enumerate}
\begin{enumerate}
\item 对~\texttt{.ins}~文件运行~\LaTeX{}~命令。这将会产生一个~\texttt{.sty}~文件。
\item 把~\texttt{.sty}~文件移到系统能找到的地方。通常是在~
      \texttt{\ldots/\emph{localtexmf}/tex/latex}~子目录下(Windows~或者~OS/2~用户应该改变斜线为反斜线)。
\item 刷新系统的文件名数据库。具体的命令取决于你使用的~\LaTeX{}~系统:
      ~teTeX, fpTeX -- \texttt{texhash}; web2c -- \texttt{maktexlsr};
      MikTeX -- \texttt{initexmf -update-fndb}~或者使用图形界面。
\end{enumerate}

%\noindent Now you can extract the documentation from the
%\texttt{.dtx} file:
\noindent 现在你可以从~\texttt{.dtx}~文件生成说明文档:

%\begin{enumerate}
%\item Run \LaTeX\ on the \texttt{.dtx} file.  This will generate a
%  \texttt{.dvi} file. Note that you may have to run \LaTeX\
%  several times before it gets the cross-references right.
%\item Check to see if \LaTeX\ has produced a \texttt{.idx} file
%  among the various files you now have.
%  If you do not see this file, then you may proceed to
%  step~\ref{step:final}.
%\item In order to generate the index, type the following:\\
%        \fbox{\texttt{makeindex -s gind.ist \textit{name}}}\\
%        (where \textit{name} stands for the main-file name without any
%    extension).
% \item Run \LaTeX\ on the \texttt{.dtx} file once again. \label{step:next}
%
%\item Last but not least, make a \texttt{.ps} or \texttt{.pdf}
%  file to increase your reading pleasure.\label{step:final}
%
%\end{enumerate}
\begin{enumerate}
\item 对~\texttt{.dtx}~文件运行~\LaTeX{}~命令。这会生成一个~\texttt{.dvi}~文件。
      注意你可能需要多次运行~\LaTeX{}~命令来正确处理交叉引用。
\item 检查一下~\LaTeX{}~命令是否产生了~\texttt{.idx}~文件。如果没发现这个文件,
      你就可以执行第~\ref{step:final}~步了。
\item 为了生成索引,敲入命令:\\
      \fbox{\texttt{makeindex -s gind.ist \textit{name}}}\\
      (这里~\textit{name}~表示不带扩展名的主文件名)。
\item 再次对~\texttt{.dtx}~文件运行~\LaTeX{}~命令。\label{step:next}
\item 最后一步但不是必需的,生成~\texttt{.ps}~文件或者~\texttt{.pdf}~文件以方便阅读。\label{step:final}

\end{enumerate}

%Sometimes you will see that a \texttt{.glo} (glossary) file has
%been produced. Run the following command between
%step~\ref{step:next} and~\ref{step:final}:
有时你会看见生成了一个~\texttt{.glo}(glossary)~文件。在第~\ref{step:next}~步和第~\ref{step:final}~步之间
运行下面的命令:

\noindent\texttt{makeindex -s gglo.ist -o \textit{name}.gls \textit{name}.glo}

%\noindent Be sure to run \LaTeX\ on the \texttt{.dtx} one last
%time before moving on to step~\ref{step:final}.
\noindent 确认在执行第~\ref{step:final}~步前最后对~\texttt{.dtx}~文件运行一遍~\LaTeX{}~命令。


%%% Local Variables:
%%% mode: latex
%%% TeX-master: "lshort"
%%% End:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -