算法列表以德语显示

算法列表以德语显示

我正在尝试将算法列表添加到我的论文中,但我面临的问题是,它是唯一以德语出现的算法列表,而且我得到的不是Liste der AlgorithmenList of Algorithms我需要文档类中的德语选项,因为我也在用德语写摘要。我该如何解决这个问题?

图表列表和表格列表以英文显示!

代码:

\documentclass[
    english,
    german,
    11pt,
    twoside,
    a4paper,
    BCOR8.25mm,
    DIV10,
    headsepline,
    footsepline
]{scrbook}

\usepackage{graphicx}
\usepackage{listings}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\usepackage{babel} 
\begin{document}

\selectlanguage{english}
\frontmatter


\begin{table}[h]
\centering
\scalebox{0.8}{
\begin{tabular}{ |l|l|l|l|l|l|l|l|} 
\hline
behaviour\_id & mac & stop\_name & stop\_distance & speed & direction & route & created\_at \\
\hline
1 &10:X5:J0:06:B6:U8 & Arsenal  & 45 & 18 & Piccadilly & 9 & 2015-10-03 11:02:13 \\
\hline
\hline
\end{tabular}}
 \caption{Arrivaletime table after injection.}
\end{table}

\bigbreak

\begin{algorithm}[H]
\SetAlgoLined
\KwData{mac}
\KwResult{Status 202.}

find $behaviour\_id$ of the last $stop\_name$ with $stop\_distance < 60 $ and this mac in the behaviour table;\\
get 6 records with the same $stop\_name$ after the found $behaviour\_id$;\\
int $speedAverage$ = calculate the speed average of these records;\\
\If{$speedAverage < 6$}{
  delete data for this mac from the bus plus  behaviour tables; \\            return $status = 202$;
}

\caption{Detection algorithm - Deleting.}
\label{alg: status200}
\end{algorithm}


    \appendix


        \listoffigures

        \listoftables
        \listofalgorithms
        \lstlistoflistings

\end{document}

答案1

\begin{document}快速修复:尝试像这样手动设置名称

\renewcommand*\listalgorithmcfname{List of Algorithms}

但也许更好的办法是从文档类中删除该german选项(以及该english选项),然后手动处理德语摘要中的每个“德语”内容。如果您的论文只有一两页是德语,我不会将该选项添加到整个文档类,因为它会影响整个文档(包括一些软件包的一些未知副作用,正如您已经发现的那样)。

因此,我认为您应该使用语言选项babel(或其他需要本地化德语描述/样式/行为等的包),而不是整个文档类。如果需要,您可以在德语摘要之前将摘要名称覆盖为“Zusammenfassung”。

这样,您就不必覆盖 algorithm2e 包的任何内部内容。

\documentclass[
    11pt,
    twoside,
    a4paper,
    BCOR8.25mm,
    DIV10,
    headsepline,
    footsepline
]{scrbook}

\usepackage{scrhack}
\usepackage{graphicx}
\usepackage{listings}
\usepackage[ngerman,english]{babel} 

\usepackage[linesnumbered,ruled,vlined]{algorithm2e}

\begin{document}

\selectlanguage{english}
\frontmatter

\begin{table}[h]
\centering
\scalebox{0.8}{
\begin{tabular}{ |l|l|l|l|l|l|l|l|} 
\hline
behaviour\_id & mac & stop\_name & stop\_distance & speed & direction & route & created\_at \\
\hline
1 &10:X5:J0:06:B6:U8 & Arsenal  & 45 & 18 & Piccadilly & 9 & 2015-10-03 11:02:13 \\
\hline
\hline
\end{tabular}}
 \caption{Arrivaletime table after injection.}
\end{table}

\bigbreak

\begin{algorithm}[H]
\SetAlgoLined
\KwData{mac}
\KwResult{Status 202.}

find $behaviour\_id$ of the last $stop\_name$ with $stop\_distance < 60 $ and this mac in the behaviour table;\\
get 6 records with the same $stop\_name$ after the found $behaviour\_id$;\\
int $speedAverage$ = calculate the speed average of these records;\\
\If{$speedAverage < 6$}{
  delete data for this mac from the bus plus  behaviour tables; \\            return $status = 202$;
}

\caption{Detection algorithm - Deleting.}
\label{alg: status200}
\end{algorithm}

    \appendix

        \listoffigures

        \listoftables
        \listofalgorithms
        \lstlistoflistings

\end{document}

答案2

正确的做法是

\addto\captionsenglish{\SetAlgorithmName{Algorithm}{Algorithm}{List of Algorithms}}

因为您正在使用babel

\documentclass[
    english,
    german,
    11pt,
    twoside,
    a4paper,
    BCOR8.25mm,
    DIV10,
    headsepline,
    footsepline
]{scrbook}

\usepackage{graphicx}
\usepackage{listings}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\usepackage{babel}
\addto\captionsenglish{\SetAlgorithmName{Algorithm}{Algorithm}{List of Algorithms}}
\begin{document}

\selectlanguage{english}
\frontmatter


\begin{table}[h]
\centering
\scalebox{0.8}{
\begin{tabular}{ |l|l|l|l|l|l|l|l|}
\hline
behaviour\_id & mac & stop\_name & stop\_distance & speed & direction & route & created\_at \\
\hline
1 &10:X5:J0:06:B6:U8 & Arsenal  & 45 & 18 & Piccadilly & 9 & 2015-10-03 11:02:13 \\
\hline
\hline
\end{tabular}}
 \caption{Arrivaletime table after injection.}
\end{table}

\bigbreak

\begin{algorithm}[H]
\SetAlgoLined
\KwData{mac}
\KwResult{Status 202.}

find $behaviour\_id$ of the last $stop\_name$ with $stop\_distance < 60 $ and this mac in the behaviour table;\\
get 6 records with the same $stop\_name$ after the found $behaviour\_id$;\\
int $speedAverage$ = calculate the speed average of these records;\\
\If{$speedAverage < 6$}{
  delete data for this mac from the bus plus  behaviour tables; \\            return $status = 202$;
}

\caption{Detection algorithm - Deleting.}
\label{alg: status200}
\end{algorithm}


    \appendix


        \listoffigures

        \listoftables
        \listofalgorithms
        \lstlistoflistings

\end{document}

在此处输入图片描述

相关内容