更改为“et al”时出现“未定义的控制序列”

更改为“et al”时出现“未定义的控制序列”

我对 latex 还很陌生,尝试用 Rmarkdown 和 tinytex 写我的学士论文(我从教授那里得到了一个模板)。我的问题是,我无法将参考书目中的德语 ua 改为拉丁语“et al.”。我试过\DefineBibliographyStrings{ngerman}{andothers={et\addabbrvspace al\adddot}}在序言中这样做,但编译失败,出现错误“!未定义的控制序列。”

先感谢您!

编辑:我的 YAML-Header 看起来像这样

---
geometry: "a4paper,top=2cm,bottom=2cm,left=3.5cm,right=2cm"
fontsize: 12pt
linestretch: 1.5
automark: yes
indent: true
toc: false
classoption:
  - DIV=calc
  - headsepline=true
KOMAoptions:
  - headings=standardclasses
  - DIV=last  
table_caption: true
figure_caption: true
includes:  
  in_header: figure_placement.tex 
link-citations: yes
knit: "bookdown::render_book"
output:
  bookdown::pdf_book:
    includes:
      in_header: tex/praeambel.tex
    keep_tex: yes
    latex_engine: pdflatex
citation_package: biblatex
bibliography: bib/literatur.bib
biblio-style: authoryear
---

我的序言如下:

%% Preamble
%%
%----------------------------------------------------------------------------------------
%   VARIOUS REQUIRED PACKAGES AND CONFIGURATIONS
%----------------------------------------------------------------------------------------



\usepackage{graphicx} % Include graphics
\graphicspath{{img/}} % Specifies the directory where pictures are stored
\usepackage{amsmath}
\usepackage{amssymb,amsthm}
\usepackage{longtable,booktabs,setspace} % Using nice book tables etc.
\usepackage{tabularx} % Better package to handle and create complex tables
\usepackage{url}
\usepackage{hyperref}
\usepackage{lmodern}
\usepackage{float}
\floatplacement{figure}{H}
\usepackage{rotating}




%----------------------------------------------------------------------------------------
%   Fonts and German language and other stuff for data exploration
%----------------------------------------------------------------------------------------
\usepackage{times} % Use the Times font for headings
\usepackage{avant} % Use the Avantgarde font for headings
\usepackage{mathptmx} % Use the Adobe Times Roman as the default text font together with math symbols from the Symbol, Chancery and Computer Modern fonts
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage[main=ngerman, english]{babel} % German language and other
\usepackage[utf8]{inputenc} % Required for including letters with accents
\usepackage[T1]{fontenc} % Used font -> some argue you should use Xelatex... pdflatex is here the prefered engine! (Mac, Linux, Win)
\usepackage[babel, german=quotes]{csquotes} % Using german package for quotes
\usepackage{textcomp} % Package with lots of symbols  
\usepackage[marginal]{footmisc} % Control and customize footnotes
\usepackage[justification=centering, format=hang]{caption} % Package offers customization of captions in floating environments 
\usepackage{ragged2e} % This package provides new commands and environments for setting ragged text
\usepackage{fancyhdr} % Customize the page header and footer in an easy way
\usepackage[toc,page]{appendix} % Include appendix to your document
\usepackage{eurosym} % The European currency symbol for the Euro implemented in METAFONT
\usepackage[printonlyused, withpage]{acronym} % This package ensures that all acronyms used in the text are spelled out in full at least once
\usepackage{blindtext} % You are always wasting time with reading a blindtext 
\usepackage{color}
%\usepackage[svgnames]{xcolor}
%\usepackage{tcolorbox}

%----------------------------------------------------------------------------------------
%   Definitions for the whole project
%----------------------------------------------------------------------------------------
% Defining the rule above and under the title
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} 

% Long quotes in singlespace and small for markdown / pandoc
\expandafter\def\expandafter\quote\expandafter{\quote\singlespacing\small} 

%% Acronym für Abbildung
\addto\captionsngerman{
\renewcommand{\figurename}{Abb.}
\renewcommand{\tablename}{Tab.}}

% Defining color
\definecolor{buw}{RGB}{230,243,205}

% et al. anstatt u.a.
\DefineBibliographyStrings{ngerman}{andothers={et\addabbrvspace al\adddot}}

答案1

使用 Rmarkdown 时,时间安排可能很重要。在处理前言文件时,通过 YAML 文件中的选项加载的包可能可用,也可能不可用。在这种情况下,将命令包装biblatex在 中会有所帮助,这样它们在加载\AtEndPremable时就会执行。biblatex

替换\DefineBibliographyStrings{ngerman}{andothers={et\addabbrvspace al\adddot}}

\AtEndPreamble{%
  \DefineBibliographyStrings{ngerman}{andothers={et\addabbrvspace al\adddot}}%
}

相关内容