另一个 breqn 问题。使用 cprotect 包时,标题中会出现多余的字母

另一个 breqn 问题。使用 cprotect 包时,标题中会出现多余的字母

为什么只有在添加包裹时才会在以下标题中打印多余的字母breqn,以及如何删除它们?

这显示了 texlive 2016 中的 pdflatex 和 lualatex

\documentclass[11pt,notitlepage]{article}

\usepackage{amsmath,mathtools}
\usepackage{breqn} %problem goes away when not using this. But I need this.

\usepackage{cprotect}
\begin{document}
\cprotect\title{\verb|1_Linear_products\1.2(a+bx)^m(c+dx)^n|}
\author{me}
\maketitle

test
\end{document}

输出为

Mathematica 图形

我尝试了发布在为什么 luatex-plus-breqn 在显示数学模式下会输出四倍的文本 但它并没有解决这个问题。

我必须在标题中使用逐字逐句。故事很长,但没有其他办法。这是由于所用标题的性质。

除此之外,一切都正常,但我想摆脱掉最后出现的那些多余的字符。

以下是完整的输出以及所用文件的列表

title_math>lualatex foo.tex
This is LuaTeX, Version 0.95.0 (TeX Live 2016) 
 restricted system commands enabled.
(./foo.tex
LaTeX2e <2017/01/01> patch level 3
(using write cache: /home/me/.texlive2016/texmf-var/luatex-cache/generic)(using
 read cache: /usr/local/texlive/2016/texmf-var/luatex-cache/generic /home/me/.t
exlive2016/texmf-var/luatex-cache/generic)
luaotfload | main : initialization completed in 0.148 seconds
Babel <3.9r> and hyphenation patterns for 1 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size11.clo(load luc: /home/m
e/.texlive2016/texmf-var/luatex-cache/generic/fonts/otl/lmroman10-regular.luc))
) (/usr/local/texlive/2016/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2016/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2016/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2016/texmf-dist/tex/latex/mathtools/mathtools.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/tools/calc.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/mathtools/mhsetup.sty))
(/usr/local/texlive/2016/texmf-dist/tex/latex/breqn/breqn.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(/usr/local/texlive/2016/texmf-dist/tex/latex/l3kernel/l3pdfmode.def))
(/usr/local/texlive/2016/texmf-dist/tex/latex/breqn/flexisym.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/breqn/cmbase.sym)
(/usr/local/texlive/2016/texmf-dist/tex/latex/breqn/mathstyle.sty)))
(/usr/local/texlive/2016/texmf-dist/tex/latex/cprotect/cprotect.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/ifthen.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/bigfoot/suffix.sty)) (./foo.aux)
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-def/luatex.def
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)
(/usr/local/texlive/2016/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
))))(load luc: /home/me/.texlive2016/texmf-var/luatex-cache/generic/fonts/otl/l
mroman17-regular.luc) (./foo-1.cpt(load luc: /home/me/.texlive2016/texmf-var/lu
atex-cache/generic/fonts/otl/lmmono12-regular.luc))
Overfull \hbox (28.50626pt too wide) in paragraph at lines 1--11
 []\TU/lmtt/m/n/17.28 1_Linear_products\1.2(a+bx)^m(c+dx)^n\TU/lmr/m/n/17.28 ^^
E^^L 
(load luc: /home/me/.texlive2016/texmf-var/luatex-cache/generic/fonts/otl/lmrom
an12-regular.luc) [1{/usr/local/texlive/2016/texmf-var/fonts/map/pdftex/updmap/
pdftex.map}] (./foo.aux)

 *File List*
 article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size11.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
 amsmath.sty    2016/11/05 v2.16a AMS math features
 amstext.sty    2000/06/29 v2.01 AMS text
  amsgen.sty    1999/11/30 v2.0 generic functions
  amsbsy.sty    1999/11/29 v1.2d Bold Symbols
  amsopn.sty    2016/03/08 v2.02 operator names
mathtools.sty    2015/11/12 v1.18 mathematical typesetting tools
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
    calc.sty    2014/10/28 v4.3 Infix arithmetic (KKT,FJ)
 mhsetup.sty    2010/01/21 v1.2a programming setup (MH)
   breqn.sty    2017/01/27 v0.98e Breaking equations
   expl3.sty    2017/04/01 L3 programming layer (loader) 
expl3-code.tex    2017/04/01 L3 programming layer 
l3pdfmode.def    2017/03/18 v L3 Experimental driver: PDF mode
flexisym.sty    2017/01/27 v0.98e Make math characters macros
  cmbase.sym    2007/12/19 v0.92
mathstyle.sty    2017/01/27 0.98e Tracking mathstyle implicitly
cprotect.sty    2011/01/27 v1.0e (Bruno Le Floch)
  ifthen.sty    2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
  suffix.sty    2006/07/15 1.5a Variant command support
graphicx.sty    2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2016/10/09 v1.0u Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
  luatex.def    2017/01/12 v0.01h Graphics/Color for luaTeX
infwarerr.sty    2016/05/16 v1.4 Providing info/warning/error messages (HO)
 ltxcmds.sty    2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
supp-pdf.mkii
 ***********

)
(see the transcript file for additional information)
 646 words of node memory still in use:
   6 hlist, 2 vlist, 2 rule, 21 glue, 1 kern, 16 attribute, 55 glue_spec, 16 at
tribute_list, 1 write nodes
   avail lists: 2:55,3:9,4:3,5:10,6:65,7:63,8:3,9:20,10:2
</usr/local/texlive/2016/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.
otf></usr/local/texlive/2016/texmf-dist/fonts/opentype/public/lm/lmroman12-regu
lar.otf></usr/local/texlive/2016/texmf-dist/fonts/opentype/public/lm/lmroman17-
regular.otf></usr/local/texlive/2016/texmf-dist/fonts/opentype/public/lm/lmmono
12-regular.otf>
Output written on foo.pdf (1 page, 9835 bytes).
Transcript written on foo.log.
title_math>

答案1

软件包在扫描分隔符时cprotect假设(不知道 Bruno 为什么选择这个)。但是,将其更改为。只需在执行时恢复默认设置即可。\catcode`^=7^^E^^Lbreqn\catcode`^=12\maketitle

这种行为并不意外。这两个软件包的手册中都有正确的记录。

布雷克

在此处输入图片描述

保护

在此处输入图片描述

我根本不建议使用它breqn。它引入了与其他软件包的很多不兼容性,并且有很多特殊情况需要处理。在即将推出的版本中ConTeXt MKIV 将引入公式自动换行功能这可能会更加健壮,因为解析是在 Lua 级别完成的,从而避免与 catcode 等混淆。

\documentclass[11pt,notitlepage]{article}

\usepackage{amsmath,mathtools}
\usepackage{breqn} %problem goes away when not using this. But I need this.

\usepackage{cprotect}
\begin{document}
\cprotect\title{\verb|1_Linear_products\1.2(a+bx)^m(c+dx)^n|}
\author{me}
{\catcode`^=7 \maketitle}

test
\end{document}

在此处输入图片描述

相关内容