三种不同语言的关键词?

三种不同语言的关键词?

有没有办法让关键词自动转换为不同的语言,就像摘要一样。我创建了关键词命令,但它不会改变,因为语言更改始终是英语或其他语言

\documentclass[12pt,a4paper,notitlepage]{report}

\usepackage[utf8]{inputenc}

\usepackage[arabic,english,french]{babel}

%%%%%%%%%%%Abstract :::

\renewenvironment{abstract}
{\quotation{\bfseries\centering\abstractname} \\[\dimexpr-\baselineskip+1mm+2pt] \rule{\linewidth}{0.2pt}\\[\dimexpr-\baselineskip+1.5mm+3pt]\rule{\linewidth {3pt}\medskip }{\par\noindent\rule{\linewidth}{2.9pt}\\[\dimexpr-\baselineskip+1mm+1pt]\rule{\linewidth}{0.2pt}\endquotation}

% Keywords command

\providecommand{\keywords}[1]
{\par\hspace{\parindent}\small\textbf{\bfseries\centering Keywords :} #1 }

\begin{document}

\begin{abstract}
\par Abstract in French
\end{abstract}

\keywords{un, deux, trois, quatre}  % <------ the result wanted is: mot-clé :

\bigskip

\begin{otherlanguage}{english} 

\begin{abstract}
\par Abstract in English
\end{abstract}

\keywords{one, two, three, four}

\end{otherlanguage}

\bigskip

\begin{otherlanguage}{arabic} 

\begin{abstract}
\par ملخص بالعربية
\end{abstract}

\keywords{واحد, اثنين, ثلاتة,اربعة.} % <------ the result wanted is:
.الكلمات المفتاحية : واحد, اثنين, ثلاتة,اربعة

\end{otherlanguage}

\end{document}

答案1

类似这样的操作可以简化输入:

\documentclass[12pt,a4paper,notitlepage]{report}

\usepackage[utf8]{inputenc}
\usepackage[LAE,LFE,T1]{fontenc}

\usepackage[arabic,english,french]{babel}

\addto\captionsenglish{\renewcommand{\keywordsname}{Keywords}}
\addto\captionsfrench{\renewcommand{\keywordsname}{Mots-clés}}
\addto\captionsarabic{\renewcommand{\keywordsname}{اثنين, ثلاتة,اربع}}

\providecommand{\keywordsname}{Keywords}

\newif\ifotherlanguage

% Abstract
\renewenvironment{abstract}[1][]
 {%
  \if\relax\detokenize{#1}\relax\else
    \otherlanguagetrue
    \begin{otherlanguage}{#1}%
  \fi
  \begin{quotation}
  {\bfseries\centering\abstractname\par}
  \vspace{\dimexpr-\baselineskip+1mm+2pt}
  \noindent\rule{\linewidth}{0.2pt}\\[\dimexpr-\baselineskip+1.5mm+3pt]
  \noindent\rule{\linewidth}{3pt}
  \medskip
 }
 {%
  \par
  \noindent\rule{\linewidth}{2.9pt}\\[\dimexpr-\baselineskip+1mm+1pt]
  \noindent\rule{\linewidth}{0.2pt}
  \end{quotation}%
  \ifotherlanguage
    \end{otherlanguage}
  \fi
 }

% Keywords command

\providecommand{\keywords}{}
\renewcommand{\keywords}[2][]{%
  \par
  \if\relax\detokenize{#1}\relax\else\begin{otherlanguage}{#1}\fi
  \small\centering
  \textbf{\keywordsname:} #2\par
  \if\relax\detokenize{#1}\relax\else\end{otherlanguage}\fi
}

\begin{document}

\begin{abstract}
Abstract in French
\end{abstract}

\keywords{un, deux, trois, quatre}  % <------ the result wanted is: mot-clé :

\bigskip

\begin{abstract}[english]
Abstract in English
\end{abstract}

\keywords[english]{one, two, three, four}

\bigskip

\begin{abstract}[arabic]
ملخص بالعربية
\end{abstract}

\keywords[arabic]{واحد, اثنين, ثلاتة,اربعة.} 

\end{document}

在此处输入图片描述

相关内容