从 acro 包定义不同的 \printacronyms 模板

从 acro 包定义不同的 \printacronyms 模板

我的首字母缩略词表需要以下格式:

在此处输入图片描述

但目前使用 MWE 我有这个:

在此处输入图片描述

我不知道如何将我的首字母缩略词重新排列在三列中,以便首先是缩写形式,然后是长外国形式,然后是长本地形式。

我曾尝试过,DeclareAcroListStyle但就是无法弄清楚。

以下是 MWE:

% !TEX program = xelatex
\documentclass[12pt]{report}

\usepackage{acro}
\usepackage[T1]{fontenc}
\usepackage[croatian]{babel}

\DeclareAcronym{atm}{
    short = ATM,
    long = asinkroni način prijenosa,
    foreign = Asynchronous Transfer Mode,
    foreign-lang = english
}
\DeclareAcronym{isdn}{
    short = ISDN,
    long = digitalna mreža integriranih usluga,
    foreign = Integrated Services Digital Network,
    foreign-lang = english
}

\begin{document}

Blah blah blah \acs{atm}, blah blah blah \acs{isdn}

\printacronyms


\end{document}

答案1

这是一种方法。

表格单元格形成组,这就是我们需要重新定义acro命令的原因。(我将进行更新acro,以便下一个版本无需重新定义即可运行。)

\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[english,croatian]{babel}

\usepackage{acro}
\usepackage{longtable,tabu}

\ExplSyntaxOn
\cs_set_protected:Npn \acro_get_foreign:n #1
  {
    \prop_if_in:NnT \l__acro_foreign_prop {#1}
      {
        \tl_use:N \l__acro_foreign_sep_tl
        \prop_get:NnN \l__acro_foreign_prop {#1} \l__acro_foreign_tl
        \group_begin:
          \tl_use:N \l__acro_foreign_list_format_tl
          {
            \acro_foreign_language:VV
              \l__acro_foreign_lang_tl
              \l__acro_foreign_tl
          }
        \group_end:
      }
  }
\ExplSyntaxOff

\DeclareAcroListStyle{custom}{table}{
  table = longtabu ,
  table-spec = @{}lXX@{} ,
  foreign-sep = &
}
\acsetup{
  list-style = custom ,
  list-long-format = \itshape ,
  list-foreign-format = 
}

\DeclareAcronym{atm}{
    short = ATM,
    long = asinkroni način prijenosa,
    foreign = Asynchronous Transfer Mode,
    foreign-lang = english
}
\DeclareAcronym{isdn}{
    short = ISDN,
    long = digitalna mreža integriranih usluga,
    foreign = Integrated Services Digital Network,
    foreign-lang = english 
}

\begin{document}

Blah blah blah \acs{atm}, blah blah blah \acs{isdn}

\printacronyms

\end{document}

在此处输入图片描述

顺便说一句:使用 XeLaTeX 时不要使用inputencfontenc包,而是使用 fontspec


用“本地”描述替换外国描述需要更多努力:

\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[english,croatian]{babel}

\usepackage{acro}
\usepackage{longtable,tabu}

\ExplSyntaxOn
\cs_set_protected:Npn \acro_get_foreign:n #1
  {
    \prop_if_in:NnT \l__acro_foreign_prop {#1}
      {
        % \tl_use:N \l__acro_foreign_sep_tl
        \prop_get:NnN \l__acro_foreign_prop {#1} \l__acro_foreign_tl
        \group_begin:
          \tl_use:N \l__acro_foreign_list_format_tl
          {
            \acro_foreign_language:VV
              \l__acro_foreign_lang_tl
              \l__acro_foreign_tl
          }
        \group_end:
      }
  }

\cs_set_protected:Npn \__acro_list_entry_long:n #1
  {
    \bool_if:NT \l__acro_foreign_bool
      { \acro_get_foreign:n {#1} }
    \tl_use:N \l__acro_foreign_sep_tl
    \group_begin:
      \bool_if:NT \l__acro_capitalize_list_bool
        { \bool_set_true:N \l__acro_first_upper_bool }
      \acro_write_long:Vf \l__acro_list_long_format_tl
        {
          \prop_if_in:NnTF \l__acro_list_prop {#1}
            { \__acro_get_property:nn {list} {#1} }
            { \__acro_get_property:nn {long} {#1} }
        }
    \group_end:
    \acro_cite_if:nn { \l__acro_citation_all_bool } {#1}
  }
\ExplSyntaxOff

\DeclareAcroListStyle{custom}{table}{
  table = longtabu ,
  table-spec = @{}lXX@{} ,
  foreign-sep = &
}
\acsetup{
  list-style = custom ,
  list-long-format = \itshape ,
  list-foreign-format = 
}

\DeclareAcronym{atm}{
    short = ATM,
    long = asinkroni način prijenosa,
    foreign = Asynchronous Transfer Mode,
    foreign-lang = english
}
\DeclareAcronym{isdn}{
    short = ISDN,
    long = digitalna mreža integriranih usluga,
    foreign = Integrated Services Digital Network,
    foreign-lang = english 
}
\DeclareAcronym{foo}{
  short = foo ,
  long = foo-long
}

\begin{document}

Blah blah blah \acs{atm}, blah blah blah \acs{isdn}, \ac{foo}

\printacronyms

\end{document}

在此处输入图片描述

相关内容