俄语文本中的英语单词连字符

发布于 2024-08-21 03:12:07 字数 1649 浏览 3 评论 0原文

我有多语言 TeX 文档,主要是俄语,但我也在括号中包含了一些英语术语,以使读者熟悉国际术语。例如短语

Два неотъемлемых свойства языка програмирования - синтаксис语法) и семантика语义)。

这仅仅意味着

编程的两个属性 语言是它的语法和语义。

看起来像

Два неотъемлемых свойства языка програмирования --- \textit{синтаксис} (\textit{\selectlanguage{英语}语法\selectlanguage{俄语}}) и \textit{семантика} (\textit{\selectlanguage{英语}语义\selectlanguage{俄语}})。

我还有 \usepackage[english, Russian]{babel}。

该代码看起来太冗长了,因为我需要对每个英语单词使用 \selectlanguage 两次才能使连字起作用。没有这个我会得到几个

溢出\hbox ...

消息,因为 TeX 无法在英文单词出现在行尾时用连字符连接它们。

有更好的解决方案吗?


回应 Alexey Malistov。

MacTeX 发行版有几个 language.dat 文件

  • /usr/local/texlive/2009/texmf-dist/source /generic/babel
  • /usr/local/texlive/2009/texmf-dist/doc/generic/babel
  • /usr/local/texlive/2009/texmf/tex/generic/config
  • /usr/local/texlive/2009/texmf-var /tex/generic/config
  • /usr/local/texlive/2009/texmf-dist/tex/lambda/config

我不确定应该编辑哪一个。可能是前两个之一。它们是相同的

% File    : language.dat
% Purpose : specify which hypenation patterns to load 
%           while running iniTeX 
=USenglish
american ushyphen.tex
=english
UKenglish  ukhyphen.tex
=british
french   frhyphen.tex
dutch    nehyph2.tex
german   dehypht.tex 
ngerman  dehyphn.tex 

,但是哪一个呢?

也没有 initexmf 命令。谷歌搜索后我发现模拟是 updmap-sys。但我不确定...我害怕破坏我的 TeX 安装。请给我正确的方向。

I have multi-lingual TeX document mostly in Russian but I also include some terms in English in brackets too to make the reader familiar with international terminology. For example the phrase

Два неотъемлемых свойства языка
программирования - синтаксис (syntax)
и семантика (semantics).

which simply means

Two attributes of a programming
language are its syntax and semantics.

looks like

Два неотъемлемых свойства языка
программирования ---
\textit{синтаксис}
(\textit{\selectlanguage{english}syntax\selectlanguage{russian}})
и \textit{семантика}
(\textit{\selectlanguage{english}semantics\selectlanguage{russian}}).

Also I have \usepackage[english,russian]{babel}.

The code looks too verbose because I need to use \selectlanguage twice on each English word to make hyphenation work. Without this I get a couple of

Overfull \hbox ...

messages because TeX is not able to hyphen English words when they appear at the ends of the lines.

Is there any better solution?


In response to Alexey Malistov.

MacTeX distribution has a couple of language.dat files

  • /usr/local/texlive/2009/texmf-dist/source/generic/babel
  • /usr/local/texlive/2009/texmf-dist/doc/generic/babel
  • /usr/local/texlive/2009/texmf/tex/generic/config
  • /usr/local/texlive/2009/texmf-var/tex/generic/config
  • /usr/local/texlive/2009/texmf-dist/tex/lambda/config

I'm not sure which one should I edit. Probably one of the first two. They are identical

% File    : language.dat
% Purpose : specify which hypenation patterns to load 
%           while running iniTeX 
=USenglish
american ushyphen.tex
=english
UKenglish  ukhyphen.tex
=british
french   frhyphen.tex
dutch    nehyph2.tex
german   dehypht.tex 
ngerman  dehyphn.tex 

But which one?

Also there is no initexmf command. Googling around I found out that analogue is updmap-sys. But I'm not sure... I'm afraid to spoil my TeX installation. Please, give me the right direction.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

攒眉千度 2024-08-28 03:12:07

您可以使用 otherlanguage 环境或 \foreighlanguage 宏,而不是使用 \selectlanguage{} 两次(因为它是一个开关):

\begin{otherlanguage}{english}
   Hello world
\end{otherlanguage}

或者,对于内联更改,如您的示例:

Два неотъемлемых свойства языка программирования --- \emph{синтаксис}
(\foreignlanguage{english}{\emph{syntax}}) и \emph{семантика}
(\foreignlanguage{english}{\emph{semantics}}).

事实上,如果您经常给出英语术语,您可以定义一个宏:

\newcommand{\englishterm}[1]{%
    \foreignlanguage{english}{\emph{#1}}}

Rather than using \selectlanguage{} twice because is a switch, you can use either the otherlanguage environment, or the \foreighlanguage macro:

\begin{otherlanguage}{english}
   Hello world
\end{otherlanguage}

Or, for inline changes like in your example:

Два неотъемлемых свойства языка программирования --- \emph{синтаксис}
(\foreignlanguage{english}{\emph{syntax}}) и \emph{семантика}
(\foreignlanguage{english}{\emph{semantics}}).

In fact, if you often give the english terms, you can define a macro:

\newcommand{\englishterm}[1]{%
    \foreignlanguage{english}{\emph{#1}}}
零度℉ 2024-08-28 03:12:07

您应该结合英语和俄语连字符。
更改文件 language.dat,添加以下内容:

ruseng ruenhyph
=russian
=english

并重新编译所有格式文件:

initexmf --dump

添加

我使用 MikTeX。我不知道你到底需要做什么。我会尝试和实验。

  1. 您应该添加“新语言 ruseng”,其中包含英语和俄语连字符。那么就不需要 \setlanguage 宏了。它对我来说非常有效。我使用俄语和英语单词,不使用 \setlanguage

  2. 您应该重新编译您的格式文件。 MikTeX 提供 initexmf 命令。我确信您的 MacTeX 有类似的命令。

You should combine english and russian hyphens.
Change the file language.dat, adding the following:

ruseng ruenhyph
=russian
=english

And recompile all format files:

initexmf --dump

Add

I use MikTeX. I do not know what you have to do exactly. I would try and experiment.

  1. You should add "new language ruseng" which contains english and russian hypens. Then no \setlanguage macro is needed. It works for me very well. I use russian and english words and do not use \setlanguage.

  2. You should recompile your formats file. MikTeX provides initexmf command. I am sure there is similiar command for your MacTeX.

謌踐踏愛綪 2024-08-28 03:12:07

您可以根据需要在每个英语单词上添加任意连字符 (\-)。

或者,您可以定义自己的环境来处理 textit 和语言选择。

You can add discretionary hyphens (\-) on every english word as appropriate.

Alternatively, you can define your own environment that handles both the textit and the language selection.

暖风昔人 2024-08-28 03:12:07

我相信 \selectlanguage 应该遵循通常的范围规则,这样你就可以将你想要的英语部分括在大括号中,这界定了本地范围:

Два неотъемлемых свойства языка программирования --- \textit{синтаксис} 
({\textit{\selectlanguage{english}syntax}}) и \textit{семантика}
({\textit{\selectlanguage{english}semantics}}).

不过,我现在无法测试这一点,所以如果您发现它不起作用,我会很高兴您告知我这一事实,以便我可以修改或删除此答案。

I believe that \selectlanguage should follow the usual scope rules, so that you can enclose the part you want to be english in braces, which delimit a local scope:

Два неотъемлемых свойства языка программирования --- \textit{синтаксис} 
({\textit{\selectlanguage{english}syntax}}) и \textit{семантика}
({\textit{\selectlanguage{english}semantics}}).

I can't test this right now, though, so if you find that it doesn't work, I would be glad if you informed me of the fact, so that I can modify or delete this answer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文