原始解决方案

原始解决方案

我需要用两种语言写一篇文章。此代码

\begin{document}

\author{Author Name 1}
\author{Author Name 2}

\affil[1]{Affiliation of the Author 1}
\affil[2]{Affiliation of the Author 2}

\title{Title in Russian}
\date{}

\maketitle
\thispagestyle{firststyle}

\renewcommand{\abstractname}{}
\begin{abstract}
\label{firstpage}
\noindent \textbf{Аннотация:} Abstract in Russian.\par
\vspace{10pt}
\noindent \textbf{Ключевые слова:} keywords in Russian.
\end{abstract}

\section{First section}
Text of the article
\end{document}

就文章的俄语部分而言,它已经完成了。考虑到我无法重复、和命令,我该如何完成其​​余部分(直到英文摘要和\author关键词\title\maketitle

添加。感谢评论!我听从了 Jon 的建议并使用了这个titling包。现在代码如下所示:

\documentclass[12pt,a4paper]{article}
\usepackage{cmap}                   
\usepackage{mathtext}               
\usepackage[T2A]{fontenc}           
\usepackage[utf8]{inputenc}         
\usepackage[english,russian]{babel} 
\usepackage{indentfirst}
\frenchspacing
\usepackage{authblk} 
\usepackage{titling} 
\begin{document}
\preauthor{\large}
\DeclareRobustCommand{\authoring}{
    \begin{center}
        Автор1\textsuperscript{i}, Автор2\textsuperscript{ii} \par
        \vspace{20pt}
        \textsuperscript{i}Место работы Автора1 \\
        \textsuperscript{ii}Место работы Автора1 \\
    \end{center}}
    \author{\authoring}
    \postauthor{\par}

\title{Название\thanks{ссылка на грант}}
\date{}
\maketitle

\renewcommand{\abstractname}{}
\begin{abstract}
\label{firstpage}
    \noindent \textbf{Аннотация:} Abstract in Russian.\par
    \vspace{10pt}
    \noindent \textbf{Ключевые слова:} keywords in Russian.
\end{abstract}

    \section{Первый раздел} Text of the article

\preauthor{\large}
\DeclareRobustCommand{\authoring}{
    \begin{center}
        Author1\textsuperscript{i}, Author2\textsuperscript{ii} \par
        \vspace{20pt}
        \textsuperscript{i}Affiliation of Author1 \\
        \textsuperscript{ii}Affiliation of Author2 \\
    \end{center}}
    \author{\authoring}
    \postauthor{\par}

\title{Title in English}
\date{}

\maketitle

\renewcommand{\abstractname}{}  
\begin{abstract}
    \noindent \textbf{Abstract:} Abstract in English.\par
    \vspace{10pt}
    \noindent \textbf{Keywords:} keyword1, keyword2, \dots.
\end{abstract}
\end{document}

这段代码成功了。但是,不知为何,最后一页的脚注与第一页相同,也就是我\thanks在俄文标题的命令后面添加的文本。有什么方法可以将其从最后一页中删除吗?

答案1

原始解决方案

使用该titling包可以进行以下操作:

\documentclass[12pt,a4paper]{article}

% Needed for cyrillic
\usepackage[T2A]{fontenc}           
\usepackage[utf8]{inputenc}         
\usepackage[english,russian]{babel} 

\usepackage{titling} 

\newcommand{\nothanks}{\protect\stepcounter{footnote}}

\begin{document}

% Save initial \@thanks
\makeatletter
\let\@initialthanks\@thanks
\makeatother

\title{Название\thanks{ссылка на грант}}
\author{Автор1\thanks{Место работы Автора1} \and Автор2\thanks{Место работы Автора2}}
\date{}

\maketitle

\renewcommand{\abstractname}{}
\begin{abstract}
\label{firstpage}
    \noindent \textbf{Аннотация:} Abstract in Russian.\par
    \vspace{10pt}
    \noindent \textbf{Ключевые слова:} keywords in Russian.
\end{abstract}


\section{Первый раздел} Text of the article

% Reinitialize \@thanks
\makeatletter
\let\@thanks\@initialthanks
\makeatother

\title{Title in English \nothanks}
\author{Author1\thanks{Affilation of Author1} \and Author2\thanks{Affilation of Author2}}
\date{}

\maketitle

\renewcommand{\abstractname}{}  
\begin{abstract}
    \noindent \textbf{Abstract:} Abstract in English.\par
    \vspace{10pt}
    \noindent \textbf{Keywords:} keyword1, keyword2, \dots.
\end{abstract}
\end{document}

背后的想法是保存原始(空)形式\@thanks并将其用于重新初始化。

\thanks如果英文版和俄文版的数字相同,则此方法可行。否则,符号可能会有所不同。(例如,如果英文标题中缺少,则 Author1 的脚注符号将变为 *)。为了解决这个问题,我定义了调整脚注符号的\thanks命令。\nothanks

改进的解决方案

为了得到一个更容易理解的 tex-File,可以使用上面描述的原则来定义命令\doubleauthor\doubletitle\doubledate\doublemaketitle。 MWE 变成:

\documentclass[12pt,a4paper]{article}

% Packages
\usepackage[T2A]{fontenc}           
\usepackage[utf8]{inputenc}         
\usepackage[english,russian]{babel} 

\usepackage{titling} % Control over the typesetting of the \maketitle command
\usepackage{xparse} % A generic document command parser

% New commands
\NewDocumentCommand{\doubleauthor}{mg}{%
    \newcommand{\authorA}{#1}
    \IfNoValueTF{#2}{\newcommand{\authorB}{#1}}{\newcommand{\authorB}{#2}}
}
\NewDocumentCommand{\doubletitle}{mg}{%
    \newcommand{\titleA}{#1}
    \IfNoValueTF{#2}{\newcommand{\titleB}{#1}}{\newcommand{\titleB}{#2}}
}
\NewDocumentCommand{\doubledate}{mg}{%
    \newcommand{\dateA}{#1}
    \IfNoValueTF{#2}{\newcommand{\dateB}{#1}}{\newcommand{\dateB}{#2}}
}

\makeatletter
\let\@initialthanks\@thanks
\newcommand{\doublemaketitle}[1]{%
    \let\@thanks\@initialthanks
    \ifcase#1\relax\or
        \title{\titleA}
        \author{\authorA}
        \date{\dateA}
    \or
        \title{\titleB}
        \author{\authorB}
        \date{\dateB}
    \fi
    \maketitle
}
\makeatother

\newcommand{\nothanks}{\protect\stepcounter{footnote}}

% Title info
\doubletitle{азвание\thanks{ссылка на грант}}{Title in English \nothanks}
\doubleauthor{втор1\thanks{Место работы Автора1} \and Автор2\thanks{Место работы Автора2}}{Author1\thanks{Affilation of Author1} \and Author2\thanks{Affilation of Author2}}
\doubledate{}

\begin{document}

\doublemaketitle{1}
Russian content.

\doublemaketitle{2}
English content.

\end{document}

新定义的命令可以按如下方式使用:

  • \doubleauthor{Author for both versions of titling}
  • \doubleauthor{Author for first version}{Author for second version}
  • \doubletitle\doubledate表现为\doubleauthor
  • \doublemaketitle{i}使用 i=1 或 i=2 打印标题的指定版本。

备注:命令\thanks和可在和\nothanks的两个参数中使用。\doubleauthor\doubletitle

相关内容