我需要创建 60 份包含俄语-英语短语的文档。我有纯文本格式的这些短语。每份文档包含大约 200 个句子,看起来应该像这样:
有一条规则,即每个组 [Rus-Eng] 应该在同一页面上。为此,我想在每个短语后使用此代码:
\pagebreak[2] %It indicates the location where the page might break
因此,我正在考虑以这种方式完成这项工作:
\documentclass[11pt]{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
\usepackage{setspace}
\usepackage{fontspec}
\setmainfont{Arial}
\usepackage{hyphenat}% Hyphenation rules
\hyphenation{ма-те-ма-ти-ка вос-ста-нав-ли-вать}% Hyphenation rules
\begin{spacing}{1.25}
\usepackage{color}
\definecolor{light-gray}{gray}{0.60}
\setlength\parindent{0pt}
\begin{document}
\textbf{Андрей будет визажистом.} \\
\emph{\color{light-gray}\textit{Andrei will be a visagiste.}}
\pagebreak[2] %It indicates the location where the page might break
Будет ли Андрей стилистом? \\
\emph{\color{light-gray}\textit{Will Andrei be a stylist?}}
\pagebreak[2]%It indicates the location where the page might break
Нет, Андрей не будет стилистом. \\
\emph{\color{light-gray}\textit{No, Andrei will not be a stylist.}}
\pagebreak[2] %It indicates the location where the page might break
Будет ли Андрей парикмахером? \\
\emph{\color{light-gray}\textit{Will Andrei be a barber?}}
\pagebreak[2] %It indicates the location where the page might break
Нет, и парикмахером он тоже не будет. Андрей будет визажистом. \\
\emph{\color{light-gray}\textit{No, he will not be a barber too. Andrei will be a visagiste.}}
\pagebreak[2] %It indicates the location where the page might break
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bigskip % A vertical interval equal an empty line.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\textbf{Он будет жить в Санкт-Петербурге.} \\
\emph{\color{light-gray}\textit{He will live in Saint-Petersburg.}}
\pagebreak[2]%It indicates the location where the page might break
Будет ли Андрей жить в Москве? \\
\emph{\color{light-gray}\textit{Will Andrei live in Moscow?}}
\pagebreak[2] %It indicates the location where the page might break
Нет, он не будет жить в Москве. Он будет жить в Санкт-Петербурге. \\
\emph{\color{light-gray}\textit{No, he will not live in Moscow. He will live in Saint-Petersburg.}}
\pagebreak[2] %It indicates the location where the page might break
% ...
% About 200 sentences more
% ...
\end{spacing}
\end{document}
但是我需要在每个文档中复制粘贴很多内容。这会花费很多时间。有什么方法可以优化它吗?也许可以制作一个模板来将其应用于所有文档?
答案1
这将使每个翻译保持在同一页上,并能适应换行符。我提供\settrans[bold?]{}{}
作为载体。
已编辑,将所有格式都放在宏定义中。由于第一行(西里尔文)有时会加粗,因此我为提供了一个可选参数\settrans
,这样任何可选参数都会使西里尔文加粗。
\documentclass[11pt]{article}
\usepackage{stackengine}
\renewcommand\stacktype{S}
\renewcommand\stackalignment{l}
\newcommand\settrans[3][\relax]{%
\ifx\relax#1\let\tmp\relax\else\let\tmp\textbf\fi%
\stackunder[0pt]{\parbox{\textwidth}{\strut\tmp{#2}\strut}}{%
\parbox{\textwidth}{\strut\emph{\color{light-gray}\textit{#3}}\strut}}\par\smallskip}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
\usepackage{setspace}
\usepackage{fontspec}
\setmainfont{Arial}
\usepackage{hyphenat}% Hyphenation rules
\hyphenation{ма-те-ма-ти-ка вос-ста-нав-ли-вать}% Hyphenation rules
\begin{spacing}{1.25}
\usepackage{color}
\definecolor{light-gray}{gray}{0.60}
\setlength\parindent{0pt}
\begin{document}
\settrans[b]{Андрей будет визажистом.}
{Andrei will be a visagiste.}
\settrans{Будет ли Андрей стилистом?}
{Will Andrei be a stylist?}
\settrans{Нет, Андрей не будет стилистом.}
{No, Andrei will not be a stylist.}
\settrans{Будет ли Андрей парикмахером?}
{Will Andrei be a barber?}
\settrans{Нет, и парикмахером он тоже не будет. Андрей будет визажистом.}
{No, he will not be a barber too. Andrei will be a visagiste.}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bigskip % A vertical interval equal an empty line.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\settrans[b]{Он будет жить в Санкт-Петербурге.}
{He will live in Saint-Petersburg.}
\settrans{Будет ли Андрей жить в Москве?}
{Will Andrei live in Moscow?}
\settrans{Нет, он не будет жить в Москве. Он будет жить в Санкт-Петербурге.}
{No, he will not live in Moscow. He will live in Saint-Petersburg.}
\settrans{Нет, он не будет жить в Москве. Он будет жить в Санкт-Петербурге.
Нет, он не будет жить в Москве. Он будет жить в Санкт-Петербурге.}
{No, he will not live in Moscow. He will live in Saint-Petersburg.
No, he will not live in Moscow. He will live in Saint-Petersburg.}
% ...
% About 200 sentences more
% ...
\end{spacing}
\end{document}