设置 \IfLanguage 的语言

设置 \IfLanguage 的语言

我在序言中

\RequirePackage{cleveref}
% Set names with both of the following
%   \crefname{environmentname}{singular}{plural}, to be used mid-sentence
%   \Crefname{environmentname}{singular}{plural}, to be used at the beginning of a sentence
\IfLanguageName{english}{
    \crefname{table}{table}{tables}
    \Crefname{table}{Table}{Tables}
    \crefname{figure}{figure}{figures}
    \Crefname{figure}{Figure}{Figures}
    \crefname{equation}{equation}{equations}
    \Crefname{equation}{Equation}{Equations}
    \crefname{paragraph}{paragraph}{paragraphs}
    \Crefname{paragraph}{Paragraph}{Paragraphs}
    \crefname{subparagraph}{subparagraph}{subparagraphs}
    \Crefname{subparagraph}{Subparagraph}{Subparagraphs}
}{}
\IfLanguageName{ngerman}{
    \crefname{table}{Tabelle}{Tabellen}
    \Crefname{table}{Tabelle}{Tabellen}
    \crefname{figure}{Abbildung}{Abbildungen}
    \Crefname{figure}{Abbildung}{Abbildungen}
    \crefname{equation}{Gleichung}{Gleichungen}
    \Crefname{equation}{Gleichung}{Gleichungen}
    \crefname{paragraph}{Abschnitt}{Abschnitte}
    \Crefname{paragraph}{Abschnitt}{Abschnitte}
    \crefname{subparagraph}{Unterabschnitt}{Unterabschnitte}
    \Crefname{subparagraph}{Unterabschnitt}{Unterabschnitte}
}{}

\begin{document}我写完之后\selectlanguage{english},我的第一行是\documentclass[article, english]{llncs},但是当我使用 时cleveref,仍然使用德语。我做错了什么?我需要更改什么?


以下是 MWE:

\documentclass{article}

\RequirePackage[english,ngerman]{babel}
\RequirePackage{iflang}
\RequirePackage{cleveref}
\IfLanguageName{ngerman}{
    \crefname{table}{Tabelle}{Tabellen}
    \Crefname{table}{Tabelle}{Tabellen}
    \crefname{figure}{Abbildung}{Abbildungen}
    \Crefname{figure}{Abbildung}{Abbildungen}
    \crefname{equation}{Gleichung}{Gleichungen}
    \Crefname{equation}{Gleichung}{Gleichungen}
    \crefname{paragraph}{Abschnitt}{Abschnitte}
    \Crefname{paragraph}{Abschnitt}{Abschnitte}
    \crefname{subparagraph}{Unterabschnitt}{Unterabschnitte}
    \Crefname{subparagraph}{Unterabschnitt}{Unterabschnitte}
}{}
\IfLanguageName{english}{
    \crefname{table}{table}{tables}
    \Crefname{table}{Table}{Tables}
    \crefname{figure}{figure}{figures}
    \Crefname{figure}{Figure}{Figures}
    \crefname{equation}{equation}{equations}
    \Crefname{equation}{Equation}{Equations}
    \crefname{paragraph}{paragraph}{paragraphs}
    \Crefname{paragraph}{Paragraph}{Paragraphs}
    \crefname{subparagraph}{subparagraph}{subparagraphs}
    \Crefname{subparagraph}{Subparagraph}{Subparagraphs}
}{}

\setcounter{secnumdepth}{5}

\begin{document}

\selectlanguage{english}

First ref: \cref{sec:one}

Second ref: \cref{sec:two}

\section{One 1}
\label{sec:one}

\paragraph{Two}
\label{sec:two}

\end{document}

我知道这\selectlanguage{english}已经太晚了,最后\RequirePackage[english,ngerman]{babel}选择的语言是最后一个。有没有办法选择英语,而不操纵序言?

相关内容