下列的这关于设置日语-英语词汇表的问题(实际上是日语-法语词汇表,但这不会有太大变化),我需要为这个词汇表定义一种新样式。目前,这altlong4col-booktabs
似乎是最接近我想要的结果。但是,我需要添加一些更改:
- 删除“页面列表”列,
- 重命名标题,
- 将第一列(“符号”)加粗,
- 并反转“描述”和“符号”列的位置。
以下是我目前所拥有的:
\documentclass[a4paper, 12pt]{article}
\usepackage{xunicode}
\usepackage{polyglossia}
\usepackage{xeCJK}
\usepackage[automake, style=index, nonumberlist]{glossaries-extra}
\usepackage{glossary-longbooktabs}
\setmainlanguage{french}
\setCJKmainfont{AozoraMinchoRegular.ttf}
\makeglossaries
\glossarystyle{altlong4col-booktabs}
%syntax: \newterm[options]{romaji}{original}{translation}
\newcommand{\newterm}[4][]{%
\newglossaryentry{#2}{%
name={#2},% romanized version
symbol={#3},% original
description={#4},% translation
#1% extra options
}%
}
\newcommand{\glsxtrpostlinkgeneral}{%
\ifdefempty\glscustomtext
{%
\glsxtrifwasfirstuse
{%
\ifglshassymbol{\glslabel}{\space(\glsaccesssymbol{\glslabel},
«~\glsaccessdesc{\glslabel}~»)}{}%
}%
{}%
}%
{}%
}
% use \emph in the document (but not in the glossary)
\renewcommand*{\glsxtrregularfont}[1]{\emph{#1}}
\newterm{bakumatsu}{幕末}{fin du shogunat}
\begin{document}
The \gls{bakumatsu} era.
Next use: \gls{bakumatsu}.
\printglossary[title=Glossaire des termes japonais]
\end{document}
这将打印以下结果:
我该如何继续?
答案1
以下样式可创建三列词汇表。(您仍需要加载glossary-longbooktabs
定义\glspatchLToutput
,并加载booktabs
和longtable
。)
\newglossarystyle{romaji}{%
\glspatchLToutput
\renewenvironment{theglossary}%
{\begin{longtable}{>{\raggedright}p{.33\textwidth}p{.33\textwidth}>{\raggedright}p{.33\textwidth}}}%
{\end{longtable}}%
% Table header:
\renewcommand*{\glossaryheader}{\toprule\bfseries Transcription en
caractères latins (\emph{rōmaji}) &
\bfseries Ecriture japonaise &
\bfseries Traduction\tabularnewline\midrule\endhead\bottomrule\endfoot}%
% No letter group headings:
\renewcommand*{\glsgroupheading}[1]{}%
% Top-level (no parent) entries:
% (#1 is the entry's label)
% (#2 is the numberlist which is ignored here)
\renewcommand{\glossentry}[2]{%
% Romanized name (in bold):
\glsentryitem{##1}\glstarget{##1}{\textbf{\glossentryname{##1}}} &
% Original Japanese:
\glossentrysymbol{##1} &
% Translation:
\glossentrydesc{##1}\tabularnewline
}%
% Sub-level (has parent) entries (just do the same as top-level):
\renewcommand{\subglossentry}[3]{\glossentry{##2}{##3}}%
% Gap between letter groups (governed by nogroupskip package option):
\ifglsnogroupskip
\renewcommand*{\glsgroupskip}{}%
\else
\renewcommand*{\glsgroupskip}{ & & & \tabularnewline}%
\fi
}
使用\setglossarystyle
而不是弃用的\glossarystyle
:
\setglossarystyle{romaji}
或者使用style
中的键\printglossary
(这将本地化引入的补丁\glspatchLToutput
):
\printglossary[title=Glossaire des termes japonais,style=romaji]
我使用以下方法使所有三列的宽度相等:
\begin{longtable}{>{\raggedright}p{.33\textwidth}p{.33\textwidth}>{\raggedright}p{.33\textwidth}}
您可能需要调整这些设置。
如果我将上述样式添加到您问题的代码中(并用我电脑上安装的字体替换 CJK 字体),我会得到: