Latex 中的特殊名称

发布于 2024-08-25 23:35:41 字数 71 浏览 1 评论 0原文

在我的英语论文乳胶文件中,如何提及以下非英语单词:François、École Fédérale?

谢谢和问候!

In my english thesis latex file, how to mention the following non English words: François, École Fédérale?

Thanks and regards!

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

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

发布评论

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

评论(2

泛泛之交 2024-09-01 23:35:41

传统的方法是使用重音添加宏:(

Fran\c{c}ois
\'Ecole F\'ed\'erale

也可以编写 Fran\c{}coisFran\c cois\c< /code> 宏不使用参数;大括号或空格只是让 LaTeX 看到正确的宏名称的技巧。)

否则,请尝试以下操作:

\usepackage[utf8]{inputenc}

并使用 UTF-8 编码直接键入重音符号。

字体和连字符存在许多或多或少微妙的问题。

The traditional way is to use the accent-adding macros:

Fran\c{c}ois
\'Ecole F\'ed\'erale

(You can also write Fran\c{}cois or Fran\c cois; the \c macro uses no parameter; the braces or space are just a trick to allow LaTeX to see the proper macro name.)

Otherwise, try this:

\usepackage[utf8]{inputenc}

and type the accents directly, with UTF-8 encoding.

There are a host of more-or-less subtle issues with fonts and hyphenation.

莫相离 2024-09-01 23:35:41

如果您不采用 UTF8 inputenc 路线,但发现自己编写了很多这些名称,我建议为它们定义宏。最简单的,你可以说

\newcommand\Francois{Fran\c cois}

but then you need to be sure to use it as such: \Francois{} so that any spaces afterwards don't get gobbled.

另一方面,以下技术也非常有效(尽管我不能将其归功于发明 - 我最初在 Philip Taylor 在 BachoTeX 2009 的简短演讲中看到它):

\makeatletter
\let\latex@less<
\catcode`<13
\def<{\ifmmode\latex@less\else\expandafter\find@name\fi}
\def\find@name#1>{\@nameuse{name.#1}}
\def\DefineName#1#2{\@namedef{name.#1}{#2}}
\makeatother

定义特殊名称

\DefineName{Francois}{Fran\c cois}
\DefineName{Ecole Federale}{\'Ecole F\'ed\'erale}

现在您可以使用例如和 稍后您可以在文本中使用它们,

I ran into <Francois> at the <Ecole Federale> the other day.

您可以使您的标签(纯 ASCII 版本)成为您想要的任何内容 - 它们实际上不必与正确重音的名称相关。


EDIT: in response to the issue that misspelled names don't produce errors, you can change the definition of \find@name to

\def\find@name#1>{\ifcsname name.#1\endcsname
  \@nameuse{name.#1}%
\else
  \@latex@warning{Undefined name #1}%
\fi}

请注意,\@latex@warning{...} 可以更改为\@latex@error{...}\@eha,它会更强烈地抱怨。或者,如果您想假装是(或实际上是)一个包,您可以使用 \Package(Warning|Error){} 代替 \@latex@( warning|error) 并且它不会再假装是内置的 LaTeX 错误。

If you don't go the UTF8 inputenc route, and yet find yourself writing a lot of these names, I'd suggest defining macros for them. At the simplest, you can say

\newcommand\Francois{Fran\c cois}

but then you need to be sure to use it as such: \Francois{} so that any spaces afterwards don't get gobbled.

On the other hand, the following technique works pretty well too (though I can't take credit for inventing it - I saw it originally in a short talk at BachoTeX 2009 by Philip Taylor):

\makeatletter
\let\latex@less<
\catcode`<13
\def<{\ifmmode\latex@less\else\expandafter\find@name\fi}
\def\find@name#1>{\@nameuse{name.#1}}
\def\DefineName#1#2{\@namedef{name.#1}{#2}}
\makeatother

Now you can define special names using, e.g.

\DefineName{Francois}{Fran\c cois}
\DefineName{Ecole Federale}{\'Ecole F\'ed\'erale}

and later on you can use them in text with

I ran into <Francois> at the <Ecole Federale> the other day.

You can make your tags (the plain ASCII versions) be whatever you want - they don't have to actually be related to the properly accented names.


EDIT: in response to the issue that misspelled names don't produce errors, you can change the definition of \find@name to

\def\find@name#1>{\ifcsname name.#1\endcsname
  \@nameuse{name.#1}%
\else
  \@latex@warning{Undefined name #1}%
\fi}

Note that \@latex@warning{...} can be changed to \@latex@error{...}\@eha and it will complain more forcefully. Or if you want to pretend to be (or actually be) a package you can use \Package(Warning|Error){<package name>} in place of \@latex@(warning|error) and it won't pretend to be a built-in LaTeX error anymore.

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