1. 程式人生 > 其它 >LaTeX實現帶中文的術語表

LaTeX實現帶中文的術語表

技術標籤:LaTeXlatex

LaTeX實現帶中文的術語表

使用nomencl巨集包時,術語表只有兩個entry——label和description。如果要增加第三個entry,比如中文術語,該如何實現?

方法1:使用\nomentryend命令

一個簡單的方法是通過使用\nomentryend命令將中文術語新增到第二個entry中,即

% 術語表加入中文項
\newcommand{\nomchinese}[1]
{
    \renewcommand{\nomentryend}{\hspace*{\fill}\makebox[4cm][l]{#1}}
}

正文中使用時按照如下格式:

% 帶中文的術語
\nomenclature{CCD}{charge-coupled device\nomchinese{電荷耦合器件}}

效果如下:
在這裡插入圖片描述

但是這種方法在術語較長時不能自動換行,排版不美觀:
在這裡插入圖片描述

方法2

如果要實現換行,思路是將中英文description設定為\parbox表格形式,再打包放入\nomenclature的第二個引數中。完整程式碼如下:

\documentclass{article}

% 巨集包
\usepackage{nomencl}
\usepackage[UTF8]{ctex}

% 更改術語表標題並居中顯示
\renewcommand{\nomname}{\makebox[\linewidth]{縮寫、符號清單、術語表}}

% 方法1中文術語表(不能自動換行)
%\newcommand{\nomchinese}[1]
%{
%	\renewcommand{\nomentryend}{\hspace*{\fill}\makebox[4.5cm][l]{#1}}
%}

% 方法2中文術語表
\newcommand{\nomdescrchn}[1]{
    \hfill\parbox[t]{4.5cm}{#1}\ignorespaces
}
\newcommand{\nomdescr}[1]{
    \parbox[t]{8cm}{\raggedright#1}
}
\newcommand{\nomchn}[4][]{
    \nomenclature[#1]{#2}{
        \nomdescr{#3}
        \nomdescrchn{#4}
    }
}

% 生成術語表
\makenomenclature

\begin{document}
	
正文文字

% 術語(方法1)
%\nomenclature{CCDCCD}{charge-coupled device charge-coupled device charge-coupled device \nomchinese{電荷耦合器件電荷耦合器件}}
%\nomenclature{CCD}{charge-coupled device \nomchinese{電荷耦合器件}}

% 術語(方法2)
\nomchn{CCDCCD}{charge-coupled device charge-coupled device charge-coupled device}{電荷耦合器件電荷耦合器件電荷耦合器件}
\nomchn{CCD}{charge-coupled device}{電荷耦合器件}

% 顯示術語表
\printnomenclature[2cm]

\end{document}

效果如下:
在這裡插入圖片描述
參考:
1.Nomenclature Having Two or More descriptions and Units for a symbol
2.How to achieve nomenclature entries like: symbol, Description, Dimension and unit, etc?