从 LaTeX 包加载单个符号

发布于 2024-07-24 16:35:49 字数 456 浏览 5 评论 0原文

当使用 MnSymbol 包时,pdflatex 会给出两个字体警告:

LaTeX Font Warning: Encoding 'OMS' has changed to 'U' for symbol font
(Font)              'symbols' in the math version 'normal' on input line 120.

LaTeX Font Info:    Overwriting symbol font 'symbols' in version 'normal'
(Font)                  OMS/cmsy/m/n --> U/MnSymbolF/m/n on input line 120.

事实证明,这可能是由于与 AMSSymb 包发生冲突。

由于我只需要包中的几个符号:有没有一种方法可以从包中加载一个符号,而不是全部?

When using the MnSymbol package, pdflatex gives two font warnings:

LaTeX Font Warning: Encoding 'OMS' has changed to 'U' for symbol font
(Font)              'symbols' in the math version 'normal' on input line 120.

LaTeX Font Info:    Overwriting symbol font 'symbols' in version 'normal'
(Font)                  OMS/cmsy/m/n --> U/MnSymbolF/m/n on input line 120.

It turns out that this is probably due to a clash with the AMSSymb package.

Since I need just a few symbols from the package: is there a way to load one symbol from a package, in stead of all?

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

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

发布评论

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

评论(3

欲拥i 2024-07-31 16:35:49

我是这样解决这个问题的:

从综合乳胶符号文档源下载 perl 脚本“makefakeMnSymbol”:
http://mirror.ctan.org/info/symbols/compressive/source/ makefakeMnSymbol

接下来,在命令行执行 chmod +x makefakeMnSymbol 使其可执行。 然后,

./makefakeMnSymbol `kpsewhich MnSymbol.sty` > fakeMnSymbol.sty

在选择的 texmf 目录(全局或本地)中运行 Put fakeMnSymbol.sty,然后运行 ​​texhash

如果您现在放入

\usepackage{fakeMnSymbol}

序言,则现在可以使用任何 MnSymbol,例如 \powerset 加上前缀如 \MNSpowerset

非常感谢 Scott Pakin 的这个 hack...以及他的全面的符号指南...


这个 hack 在下标/上标中的符号方面存在问题。 解决方法是查看 fakeMnSymbol.sty 源来查找所需符号的加载字体及其编号。 这是我的序言之一中的示例,其中我使用 MnSymbol 覆盖内置 \boxminus

\usepackage[]{fakeMnSymbol}
\DeclareSymbolFont{mnsymbolc}{U}{MnSymbolC}{m}{n}
\let\boxminus=\undefined
\DeclareMathSymbol{\boxminus}{2}{mnsymbolc}{112}

Here's how I solved this:

Download the perl script "makefakeMnSymbol" from the comprehensive latex symbol document source:
http://mirror.ctan.org/info/symbols/comprehensive/source/makefakeMnSymbol

Next, at command line do chmod +x makefakeMnSymbol to make it executable. Then, run

./makefakeMnSymbol `kpsewhich MnSymbol.sty` > fakeMnSymbol.sty

Put fakeMnSymbol.sty in a texmf directory of choice (global or local), and run texhash

If you now put

\usepackage{fakeMnSymbol}

in your preamble, you can now use any MnSymbol, like \powerset by prefixing it like \MNSpowerset

Big thanks to Scott Pakin for this hack... and for his comprehensive symbol guide...


This hack has problems with symbols in subscripts/superscripts. A work-around is to use look at the fakeMnSymbol.sty source to find which font the symbol you want was loaded from, along with its number. Here's an example from one of my preambles where I override the built-in \boxminus with an MnSymbol:

\usepackage[]{fakeMnSymbol}
\DeclareSymbolFont{mnsymbolc}{U}{MnSymbolC}{m}{n}
\let\boxminus=\undefined
\DeclareMathSymbol{\boxminus}{2}{mnsymbolc}{112}
平定天下 2024-07-31 16:35:49

这些警告无需担心。 事实上,在下一个 LaTeX 版本中它们将消失(请参阅 原始错误报告)。 然而,没有预计到达时间。

此外,这是否真的有可能影响文档的排版?

没有。

有什么办法可以防止这种情况发生吗?

可以在加载包之前修补 LaTeX 警告消息代码,然后在之后再次恢复它(这是我过去在自己的包中所做的),但作为用户,我只是学会忽略警告。

These warnings are nothing to worry about. In fact, in the next LaTeX release they'll disappear (see the original bug report). No ETA on that, however.

Moreover, is there any real chance this affects the typesetting of the document?

Nope.

is there any way to prevent this?

Can patch the LaTeX warning message code before loading the package, and then restore it again afterwards (this is what I've done in the past in my own packages), but as a user I'd just learn to ignore the warning.

烟若柳尘 2024-07-31 16:35:49

以下内容可能会有所帮助。 这是我必须添加的代码,以便从 MnSymbol 包中获取 \bigominus 符号。

\DeclareFontFamily{U}{MnSymbolF}{}<br>
\DeclareSymbolFont{mnsymbols}{U}{MnSymbolF}{m}{n}<br>
\DeclareFontShape{U}{MnSymbolF}{m}{n}{<br>
    <-6>  MnSymbolF5<br>
   <6-7>  MnSymbolF6<br>
   <7-8>  MnSymbolF7<br>
   <8-9>  MnSymbolF8<br>
   <9-10> MnSymbolF9<br>
  <10-12> MnSymbolF10<br>
  <12->   MnSymbolF12}{}<br>
\DeclareMathSymbol{\bigominus}{\mathop}{mnsymbols}{55}

The following might help. This is the code I had to add in order to get just the \bigominus symbol out of the MnSymbol package.

\DeclareFontFamily{U}{MnSymbolF}{}<br>
\DeclareSymbolFont{mnsymbols}{U}{MnSymbolF}{m}{n}<br>
\DeclareFontShape{U}{MnSymbolF}{m}{n}{<br>
    <-6>  MnSymbolF5<br>
   <6-7>  MnSymbolF6<br>
   <7-8>  MnSymbolF7<br>
   <8-9>  MnSymbolF8<br>
   <9-10> MnSymbolF9<br>
  <10-12> MnSymbolF10<br>
  <12->   MnSymbolF12}{}<br>
\DeclareMathSymbol{\bigominus}{\mathop}{mnsymbols}{55}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文