我尝试了不同的解决方案,但没有结果,我在 texstudio 上配置了 arara 以便能够使用命名包。
\usepackage[refpage,intoc,italian]{nomencl}
\makenomenclature
\renewcommand{\pagedeclaration}[1]{.\quad #1}
\usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
\item[\bfseries
\ifstrequal{#1}{P}{Physics Constants}{%
\ifstrequal{#1}{N}{Number Sets}{%
\ifstrequal{#1}{O}{Other Symbols}{}}}%
]}
我打算建立一个包含我个人命令的命名系统,我的def.tex文件
来自文件我的def.tex我可以挑选一些有用的术语定义,我将把它们插入到诺门特克斯文件如:
\mbox{}
\nomenclature[O]{$\ui$}{Velocità $i$-esima }
\nomenclature[O]{$\uij$}{....... $i$-esima }
\nomenclature[O]{$\uijj$}{....... $i$-esima }
我想包括在命名法中不仅包括符号的含义,还包括我在乳胶上用来表示它的命令的文本,也就是说,我希望它是:
\mbox{}
\nomenclature[O]{$\ui$}{Velocità $i$-esima \verb|\ui|}
\nomenclature[O]{$\uij$}{....... $i$-esima \verb|\uij|}
\nomenclature[O]{$\uijj$}{....... $i$-esima \verb|\uijj|}
这是可能的吗?你有什么建议吗?
谢谢
---------------------更新-----------------------------
最小示例:
% arara: pdflatex: { draft: true }
% arara: nomencl: {style: 'nomencl.ist'}
% arara: pdflatex: { synctex: true }
% arara: pdflatex: { synctex: true }
\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{array,booktabs}% http://ctan.org/pkg/{array,booktabs}
\usepackage{xparse}
%%---------------------nomenclatura-----------------------------------
\usepackage[refpage,intoc,italian]{nomencl}
\makenomenclature
\renewcommand{\pagedeclaration}[1]{.\quad #1}
\usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
\item[\bfseries
\ifstrequal{#1}{P}{Physics Constants}{%
\ifstrequal{#1}{N}{Number Sets}{%
\ifstrequal{#1}{O}{Other Symbols}{}}}%
]}
% This will add the units
%----------------------------------------------------------------------
\newcommand{\nomunit}[1]{%
\renewcommand{\nomentryend}{\hspace*{\fill}#1}}
\newrobustcmd{\cs}[1]{\texttt{\textbackslash #1}}
%%-------------fine nomenc--------------------------------------------
\newcommand{\ui}{\ensuremath{u_{i}}} %% u i-esima scalare
\newcommand{\uij}{\ensuremath{u_{i,j}}} %% u j-esima scalare
\newcommand{\uijj}{\ensuremath{u_{i,jj}}} %% u j-esima scalare
%\input{mydef}
\begin{document}
\begin{table}[h]
\renewcommand{\arraystretch}{1.75}
\begin{tabular}{lcccc}
\hline
Simbolo & Significato & Comando\\ \hline
\ui & Velocità $i$-esima & \verb|\ui| \\
\uij & Velocità $i$-esima & \verb|\uij| \\
\uijj & Velocità $i$-esima & \verb|\uijj| \\
\hline
\end{tabular}
\end{table}
This is a minimal working example and I would like to write: \\
$\ui$ \qquad Velocità $i$-esima \qquad \verb|\ui|
\\
\printnomenclature
\mbox{}
\nomenclature[O]{$\ui$}{Velocità $i$-esima \cs{\ui}}
\nomenclature[O]{$\uij$}{Velocità $i$-esima }
\nomenclature[O]{$\uijj$}{Velocità $i$-esima}
\printnomenclature
\end{document}
答案1
您应该\cs
像这样使用:\cs{ui}
而不是\cs{\ui}
,我还包含了一个稍微不同的实现,\cs
它给出了一个正确的反斜杠:
\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{array,booktabs}% http://ctan.org/pkg/{array,booktabs}
\usepackage{xparse}
%%---------------------nomenclatura-----------------------------------
\usepackage[refpage,intoc,italian]{nomencl}
\makenomenclature
\renewcommand{\pagedeclaration}[1]{.\quad #1}
\usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
\item[\bfseries
\ifstrequal{#1}{P}{Physics Constants}{%
\ifstrequal{#1}{N}{Number Sets}{%
\ifstrequal{#1}{O}{Other Symbols}{}}}%
]}
% This will add the units
%----------------------------------------------------------------------
\newcommand{\nomunit}[1]{%
\renewcommand{\nomentryend}{\hspace*{\fill}#1}}
\makeatletter
% quick and dirty method to get the correct backslash
\edef\mybackslash{\expandafter\@gobble\string\\}
\makeatother
\newrobustcmd{\cs}[1]{\texttt{\mybackslash #1}}
%%-------------fine nomenc--------------------------------------------
\newcommand{\ui}{\ensuremath{u_{i}}} %% u i-esima scalare
\newcommand{\uij}{\ensuremath{u_{i,j}}} %% u j-esima scalare
\newcommand{\uijj}{\ensuremath{u_{i,jj}}} %% u j-esima scalare
%\input{mydef}
\begin{document}
\begin{table}[h]
\renewcommand{\arraystretch}{1.75}
\begin{tabular}{lcccc}
\hline
Simbolo & Significato & Comando\\ \hline
\ui & Velocità $i$-esima & \verb|\ui| \\
\uij & Velocità $i$-esima & \verb|\uij| \\
\uijj & Velocità $i$-esima & \verb|\uijj| \\
\hline
\end{tabular}
\end{table}
This is a minimal working example and I would like to write: \\
$\ui$ \qquad Velocità $i$-esima \qquad \verb|\ui|
\\
\printnomenclature
\mbox{}
\nomenclature[O]{$\ui$}{Velocità $i$-esima \cs{ui}}
\nomenclature[O]{$\uij$}{Velocità $i$-esima \cs{uij}}
\nomenclature[O]{$\uijj$}{Velocità $i$-esima \cs{uijj}}
\printnomenclature
\end{document}