从另一个文件插入单个文档中的段落

从另一个文件插入单个文档中的段落

我有一份需要翻译成其他语言的文档。我打算将翻译内容写在不同的文本文件中,并加上标记段落,这样我就可以将其包含在原始 LaTex 框架的正确位置。该怎么做?

我读了管理单个文档的多个翻译通过从文件中提取翻译,从单个乳胶源创建多种语言版本

问题和我的一样,但答案没有考虑将翻译放在不同的文本文件中。谢谢

编辑 看来我的问题不太清楚。也许我的英语表达不好。抱歉。

以下是最小乳胶文档的示例:

\documentclass[paper=a5,fontsize=10pt]{scrbook}
\usepackage[T1]{fontenc}
...etc...
% a command to read the <language>.txt (translations)
\begin{document}
\paragraph{tag01} %% from the file italiano.txt
\paragraph{tag01} %% from the file italiano.txt
\begin{document}

---- 翻译文件 文件:spanish.txt

[tag01]
Los t\'{e}rminos en swahili utilizados en esta gu\'{i}a deben leerse de la siguiente manera
[tag02]
\textbf{Cada} sociedad en la tierra tiene tradiciones que se transmiten de generaci\'{o}n en generaci\'{o}n

文件:italiano.txt

[tag01]
I termini swahili utilizzati in questa quida si pronunciano come segue
[tag02]
\textbf{Ogni} societ ha tradizione che si tramettono da generazione a generazione

答案1

由于您尚未收到回复,我将从一个非常简单的系统开始,该系统不需要 > if this>then that来自您的第一个链接。(这对于导入来说会更好用datatools

它基于每种语言都有自己的文件夹,并且每个短语都很简单地放在自己的文件中(这种方式效率不高,我通常不建议使用单独的文件夹,也不会以这种方式浪费磁盘存储空间,但它很快而且只是有点脏,请参阅我的评论)

\documentclass[paper=a5,fontsize=10pt]{scrbook}
\usepackage[T1]{fontenc}
%...etc...
% a command to read the </languagefolder/><###.txt> (one numbered translation per file)
\newcommand{\lang}{Spanish} % consider changing ``lang'' to an obscure word as it is very common, see next comment
\newcommand{\load}{./\lang/} % do not use ``read'' in place of ``load'' as it is already assigned (even load may clash with other packages)

% Since this is a **1 language at a time** solution I have kept it simple, 
% however you could define Dual languages by adding an alternative to \Load such as  
%\newcommand{\getES}{./Spanish/}  
%\newcommand{\getIT}{./Italian/}  
%...etc... and use \getES001.txt is equavent to \getIT001.txt but may also need \LangES and \LangIT for main body text

\begin{document}


% Example 3 from the file /language/###.txt' where 003.txt just contains Hello World in each language but see comment as ``Hello World'' may be better
\textbf {English ``Hello World'', is in \lang }NOTE\% if we do not use a brace around $\backslash$lang itself
then the imediately folowing space is lost so needs a $\sim$ (tilde) when a space is required before next word. See the last example.\newline
\par \textbf{``\input{\load003.txt}''} NOTE\% there is NO space after mundo'' in the text file but one gets inserted when input. So quotes should be applied in the txt file\newline

\par The Swahili terms used in this guide are pronounced as follows in \lang:- 
\par \input{\load001.txt} \newline

And  the {\lang} for ``Every society on earth has traditions that are transmitted from generation to generation'' is ``
\input{\load002.txt}''\newline %see comment above about use of quotes

Fin
\end{document}

在此处输入图片描述 为了更好地使用您请求的标签,请catchfilebetweentags查看 https://tex.stackexchange.com/a/4952/170109

相关内容