如何将词汇表打印到表格中

如何将词汇表打印到表格中

我想重新排列环境中的单词词汇表放到表格中。我的意思是我想将它们打印到表格中。我想制作三列。在第一列我想要知道名字的内容,\textbf{...}; 在第二列我想要在环境 tipa 中添加文本,[\textipa{...}]以及第三列我希望得到其余的文字,\文本{...}。单词的结构在源代码下。

感谢帮助。

\documentclass[10pt,a6paper]{book}
%46paper
\usepackage[utf8]{inputenc}
\usepackage[main=english, slovak]{babel}
\usepackage[cm]{fullpage}
\usepackage[a6paper, top=15mm, left=10mm, right=10mm, bottom=10mm,foot=5mm,marginparsep=0mm]{geometry}
\usepackage{tipa}
\usepackage{lscape}
\usepackage{listings}
\usepackage{glossaries}

\makeglossaries
\input{txt.txt}

\begin{document}
\catcode`\-=12
\sloppy

{\large
\printglossaries
\glsaddall
}

\end{document}

% structure of words in file txt.txt
%-----------------------------------
\newglossaryentry{accelerator}
{
  name={\textbf{accelerator}},
  description={ [\textipa{@k\textprimstress [email protected]@\super r}]  \textit{the meaning} }
}

答案1

我建议你将 IPA 部分放在单独的字段中,例如字段中symbol。这样可以更轻松地分别布局这两个部分。例如:

\documentclass{book}

\usepackage{tipa}
\usepackage{longtable}
\usepackage{glossaries}

\makeglossaries

\newglossarystyle{ipa}
{%
  % longtable with three columns:
  \renewenvironment{theglossary}%
     {\begin{longtable}{lll}}%
     {\end{longtable}}%
  % no header:
  \renewcommand*{\glossaryheader}{}%
  % no group headings:
  \renewcommand*{\glsgroupheading}[1]{}%
  % main (level 0) entries displayed in a row
  \renewcommand{\glossentry}[2]{%
    % name in bold:
    \glsentryitem{##1}\glstarget{##1}{\textbf{\glossentryname{##1}}} &
    % symbol in square brackets
    [\glossentrysymbol{##1}] &
    % description in italic
    \textit{\glossentrydesc{##1}}\tabularnewline
  }%
  % sub-entries (same as main)
  \renewcommand{\subglossentry}[3]{\glossentry{##2}{##3}}%
  % blank row between groups if nogroupskip=false
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{ & & \tabularnewline}%
  \fi
}

\setglossarystyle{ipa}

\newglossaryentry{accelerator}
{
  name={accelerator},
  symbol={\textipa{@k\textprimstress [email protected]@\super r}},
  description={the meaning}
}

\glsaddall

\begin{document}
\printglossaries

\end{document}

词汇表 加速器 ək'sel.ə.reI.tər 含义

如果您的描述可能太长而无法容纳在一行中,则需要更改列说明符。您必须根据文档计算出最佳宽度。示例:

\documentclass{book}

\usepackage{tipa}
\usepackage{array}
\usepackage{longtable}
\usepackage{glossaries}

\makeglossaries

\newglossarystyle{ipa}
{%
  % longtable with three columns:
  \renewenvironment{theglossary}%
     {\begin{longtable}{ll>{\raggedright}p{.5\linewidth}}}%
     {\end{longtable}}%
  % no header:
  \renewcommand*{\glossaryheader}{}%
  % no group headings:
  \renewcommand*{\glsgroupheading}[1]{}%
  % main (level 0) entries displayed in a row
  \renewcommand{\glossentry}[2]{%
    % name in bold:
    \glsentryitem{##1}\glstarget{##1}{\textbf{\glossentryname{##1}}} &
    % symbol in square brackets
    [\glossentrysymbol{##1}] &
    % description in italic
    \textit{\glossentrydesc{##1}}\tabularnewline
  }%
  % sub-entries (same as main)
  \renewcommand{\subglossentry}[3]{\glossentry{##2}{##3}}%
  % blank row between groups if nogroupskip=false
  \ifglsnogroupskip
    \renewcommand*{\glsgroupskip}{}%
  \else
    \renewcommand*{\glsgroupskip}{ & & \tabularnewline}%
  \fi
}

\setglossarystyle{ipa}

\newglossaryentry{accelerator}
{
  name={accelerator},
  symbol={\textipa{@k\textprimstress [email protected]@\super r}},
  description={the meaning}
}

\glsaddall

\begin{document}
\printglossaries

\end{document}

相关内容