我仍在将我的 pdflatex 代码转换为 XeLaTeX。
最小情况
\documentclass{article}
% The Question -environment works with these two lines
% \usepackage{amsfonts, amssymb, textcomp, mathtools, xparse}
% \usepackage[T4, OT1]{fontenc}
% http://tex.stackexchange.com/q/213457/13173
\usepackage{mathtools, xparse} % load mathtools before loading fontspec
% amsmath never needed with mathtools
\usepackage{amsfonts, amssymb, textcomp} % not sure if these are necessary
% http://tex.stackexchange.com/a/213430/13173
\usepackage{polyglossia} % also loads package fontspec
\setmainfont{Minion Pro} % or whatever OTF you have on your system
\setmainlanguage{english} % loads language hyphenation rules and such
\usepackage{unicode-math} % if you also need maths
\setmathfont{Cambria Math} % or whatever math OTF you have on your system
\usepackage[framemethod=tikz]{mdframed}
% Problem here
% This environment do not work with the above packages
\mdfdefinestyle{ans}{
linecolor=cyan,
backgroundcolor=yellow!20,
frametitlebackgroundcolor=green!40,
frametitlerule=true
}
\newcounter{question}[section]%
\setcounter{question}{0}
\newenvironment{question}[1]{%
\refstepcounter{question}%
\begin{mdframed}[style=ans,frametitle={Question: #1}]
}{%
\end{mdframed}%
}%
\begin{document}
\begin{question}
{Is this Lorem Ipsun?}
Yes, it is.
\end{question}
\end{document}
其中框架-package 似乎是用 pdflatex 设计的,因为它可以与 (7) 和 (8) 两行一起使用。
奇怪的错误
这表明新的软件包不理解我在 Question 环境中使用的语法。
错误和警告是这样的
*************************************************
* unicode-math warning: "mathtools-overbracket"
*
* Using \overbracket and \underbracke from `mathtools' package.
*
* Use \Uoverbracket and \Uunderbracke for original `unicode-math' definition.
*************************************************
ABD: EveryShipout initializing macros
./test.tex:41: Too many }'s.
\endmdf@lrbox ->\color@endgroup \egroup
l.41 \end{question}
Package mdframed Warning: The environment is empty
(mdframed) on input line 41.
./test.tex:41: Extra \endgroup.
\color@endgroup ->\endgraf \endgroup
l.41 \end{question}
./test.tex:41: LaTeX Error: \begin{document} ended by \end{mdframed}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.41 \end{question}
./test.tex:41: Extra \endgroup.
<recently read> \endgroup
l.41 \end{question}
./test.tex:41: LaTeX Error: \begin{document} ended by \end{question}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.41 \end{question}
./test.tex:41: Extra \endgroup.
<recently read> \endgroup
l.41 \end{question}
[1] (/Users/masi/Desktop/.texpadtmp/test.aux) )
(see the transcript file for additional information)
Output written on /Users/masi/Desktop/.texpadtmp/test.pdf (1 page).
SyncTeX written on /Users/masi/Desktop/.texpadtmp/test.synctex.gz.
Transcript written on /Users/masi/Desktop/.texpadtmp/test.log.
输出\listfiles
*File List*
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
mathtools.sty 2013/02/12 v1.13 mathematical typesetting tools
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
calc.sty 2007/08/22 v4.3 Infix arithmetic (KKT,FJ)
mhsetup.sty 2010/01/21 v1.2a programming setup (MH)
amsmath.sty 2013/01/14 v2.14 AMS math features
amstext.sty 2000/06/29 v2.01
amsgen.sty 1999/11/30 v2.0
amsbsy.sty 1999/11/29 v1.2d
amsopn.sty 1999/12/14 v2.01 operator names
xparse.sty 2013/12/31 v4634 L3 Experimental document command parser
expl3.sty 2014/01/07 v4646 L3 Experimental code bundle wrapper
l3names.sty 2014/01/04 v4640 L3 Namespace for primitives
l3bootstrap.sty 2014/01/04 v4640 L3 Experimental bootstrap code
etex.sty 1998/03/26 v2.0 eTeX basic definition package (PEB)
l3basics.sty 2014/01/04 v4642 L3 Basic definitions
l3expan.sty 2014/01/04 v4642 L3 Argument expansion
l3tl.sty 2013/12/27 v4625 L3 Token lists
l3seq.sty 2013/12/14 v4623 L3 Sequences and stacks
l3int.sty 2013/08/02 v4583 L3 Integers
l3quark.sty 2013/12/14 v4623 L3 Quarks
l3prg.sty 2014/01/04 v4642 L3 Control structures
l3clist.sty 2013/07/28 v4581 L3 Comma separated lists
l3token.sty 2013/08/25 v4587 L3 Experimental token manipulation
l3prop.sty 2013/12/14 v4623 L3 Property lists
l3msg.sty 2013/07/28 v4581 L3 Messages
l3file.sty 2013/10/13 v4596 L3 File and I/O operations
l3skip.sty 2013/07/28 v4581 L3 Dimensions and skips
l3keys.sty 2013/12/08 v4614 L3 Experimental key-value interfaces
l3fp.sty 2014/01/04 v4642 L3 Floating points
l3box.sty 2013/07/28 v4581 L3 Experimental boxes
l3coffins.sty 2013/12/14 v4624 L3 Coffin code layer
l3color.sty 2012/08/29 v4156 L3 Experimental color support
l3luatex.sty 2013/07/28 v4581 L3 Experimental LuaTeX-specific functions
l3candidates.sty 2014/01/06 v4643 L3 Experimental additions to l3kernel
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
amsfonts.sty 2013/01/14 v3.01 Basic AMSFonts support
amssymb.sty 2013/01/14 v3.01 AMS font symbols
textcomp.sty 2005/09/27 v1.99g Standard LaTeX package
ts1enc.def 2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
polyglossia.sty 2013/06/27 v1.33.4 Babel replacement for XeLaTeX and LuaTeX
etoolbox.sty 2011/01/03 v2.1 e-TeX tools for LaTeX
makecmds.sty 2009/09/03 v1.0a extra command making commands
xkeyval.sty 2012/10/14 v2.6b package option processing (HA)
xkeyval.tex 2012/10/14 v2.6b key=value parser (HA)
fontspec.sty 2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX
fontspec-patches.sty 2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTe
X
fixltx2e.sty 2006/09/13 v1.1m fixes to LaTeX
fontspec-xetex.sty 2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX
fontenc.sty
eu1enc.def 2010/05/27 v0.1h Experimental Unicode font encodings
eu1lmr.fd 2009/10/30 v1.6 Font defs for Latin Modern
xunicode.sty 2011/09/09 v0.981 provides access to latin accents and many oth
er characters in Unicode lower plane
eu1lmss.fd 2009/10/30 v1.6 Font defs for Latin Modern
graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
xetex.def 2013/04/29 v0.96 LaTeX color/graphics driver for XeTeX (RRM/JK)
fontspec.cfg
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
gloss-english.ldf polyglossia: module for english
unicode-math.sty 2013/05/04 v0.7e Unicode maths in XeLaTeX and LuaLaTeX
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
l3keys2e.sty 2013/12/31 v4634 LaTeX2e option processing using LaTeX3 keys
catchfile.sty 2011/03/01 v1.6 Catch the contents of a file (HO)
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/error messages (HO)
ltxcmds.sty 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
etexcmds.sty 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
fix-cm.sty 2006/09/13 v1.1m fixes to LaTeX
ts1enc.def 2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
filehook.sty 2011/10/12 v0.5d Hooks for input files
unicode-math-xetex.sty
unicode-math-table.tex
mdframed.sty 2013/07/01 1.9b: mdframed
kvoptions.sty 2011/06/30 v3.11 Key value format for package options (HO)
kvsetkeys.sty 2012/04/25 v1.16 Key value parser (HO)
zref-abspage.sty 2012/04/04 v2.24 Module abspage for zref (HO)
zref-base.sty 2012/04/04 v2.24 Module base for zref (HO)
kvdefinekeys.sty 2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
auxhook.sty 2011/03/04 v1.3 Hooks for auxiliary files (HO)
atbegshi.sty 2011/10/05 v1.16 At begin shipout hook (HO)
needspace.sty 2010/09/12 v1.3d reserve vertical space
color.sty 1999/02/16
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
tikz.sty 2013/12/13 v3.0.0 (rcs-revision 1.142)
pgf.sty 2013/12/18 v3.0.0 (rcs-revision 1.14)
pgfrcs.sty 2013/12/20 v3.0.0 (rcs-revision 1.28)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfcore.sty 2010/04/11 v3.0.0 (rcs-revision 1.7)
pgfsys.sty 2013/11/30 v3.0.0 (rcs-revision 1.47)
pgfsys.code.tex
pgfsyssoftpath.code.tex 2013/09/09 (rcs-revision 1.9)
pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
xcolor.sty 2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
pgfcore.code.tex
pgfcomp-version-0-65.sty 2007/07/03 v3.0.0 (rcs-revision 1.7)
pgfcomp-version-1-18.sty 2007/07/23 v3.0.0 (rcs-revision 1.1)
pgffor.sty 2013/12/13 v3.0.0 (rcs-revision 1.25)
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
tikz.code.tex
md-frame-1.mdf 2013/07/01\ 1.9b: md-frame-1
t3cmr.fd 2001/12/31 TIPA font definitions
***********
)
(see the transcript file for additional information)
Output written on /Users/masi/Desktop/.texpadtmp/test.pdf (1 page).
SyncTeX written on /Users/masi/Desktop/.texpadtmp/test.synctex.gz.
Transcript written on /Users/masi/Desktop/.texpadtmp/test.log.
如何在 mdframed 中将此问题环境从 pdflatex 转换为 XeLaTeX?
答案1
如果我更改 Minion pro(我没有),它会在 texlive 2014 中正常运行。如果我添加,\listfiles
我会得到下面的列表(这就是为什么将其作为答案发布,以格式化列表:
*File List*
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
mathtools.sty 2014/07/16 v1.15 mathematical typesetting tools
keyval.sty 2014/05/08 v1.15 key=value parser (DPC)
calc.sty 2007/08/22 v4.3 Infix arithmetic (KKT,FJ)
mhsetup.sty 2010/01/21 v1.2a programming setup (MH)
amsmath.sty 2013/01/14 v2.14 AMS math features
amstext.sty 2000/06/29 v2.01
amsgen.sty 1999/11/30 v2.0
amsbsy.sty 1999/11/29 v1.2d
amsopn.sty 1999/12/14 v2.01 operator names
xparse.sty 2014/09/15 v5423 L3 Experimental document command parser
expl3.sty 2014/09/15 v5423 L3 programming layer (loader)
expl3-code.tex 2014/09/15 v5423 L3 programming layer
etex.sty 1998/03/26 v2.0 eTeX basic definition package (PEB)
l3unicode-data.def 2014/08/12 v5276 L3 Unicode data
l3xdvipdfmx.def
amsfonts.sty 2013/01/14 v3.01 Basic AMSFonts support
amssymb.sty 2013/01/14 v3.01 AMS font symbols
textcomp.sty 2005/09/27 v1.99g Standard LaTeX package
ts1enc.def 2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
polyglossia.sty 2014/05/21 v1.33.5 Babel replacement for XeLaTeX and LuaTeX
etoolbox.sty 2011/01/03 v2.1 e-TeX tools for LaTeX
makecmds.sty 2009/09/03 v1.0a extra command making commands
xkeyval.sty 2014/05/25 v2.7 package option processing (HA)
xkeyval.tex 2014/05/25 v2.7 key=value parser (HA)
fontspec.sty 2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTeX
fontspec-patches.sty 2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTe
X
fontspec-xetex.sty 2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTeX
fontenc.sty
eu1enc.def 2010/05/27 v0.1h Experimental Unicode font encodings
eu1lmr.fd 2009/10/30 v1.6 Font defs for Latin Modern
xunicode.sty 2011/09/09 v0.981 provides access to latin accents and many oth
er characters in Unicode lower plane
eu1lmss.fd 2009/10/30 v1.6 Font defs for Latin Modern
graphicx.sty 2014/04/25 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
xetex.def 2014/07/25 v4.03 LaTeX color/graphics driver for XeTeX (RRM/JK)
fontspec.cfg
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
gloss-english.ldf polyglossia: module for english
unicode-math.sty 2014/06/30 v0.7f Unicode maths in XeLaTeX and LuaLaTeX
l3keys2e.sty 2014/09/15 v5423 LaTeX2e option processing using LaTeX3 keys
catchfile.sty 2011/03/01 v1.6 Catch the contents of a file (HO)
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/error messages (HO)
ltxcmds.sty 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
etexcmds.sty 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
fix-cm.sty 2014/08/30 v1.1s fixes to LaTeX
ts1enc.def 2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
filehook.sty 2011/10/12 v0.5d Hooks for input files
unicode-math-xetex.sty
unicode-math-table.tex
mdframed.sty 2013/07/01 1.9b: mdframed
kvoptions.sty 2011/06/30 v3.11 Key value format for package options (HO)
kvsetkeys.sty 2012/04/25 v1.16 Key value parser (HO)
zref-abspage.sty 2012/04/04 v2.24 Module abspage for zref (HO)
zref-base.sty 2012/04/04 v2.24 Module base for zref (HO)
kvdefinekeys.sty 2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
auxhook.sty 2011/03/04 v1.3 Hooks for auxiliary files (HO)
atbegshi.sty 2011/10/05 v1.16 At begin shipout hook (HO)
needspace.sty 2010/09/12 v1.3d reserve vertical space
color.sty 1999/02/16
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
tikz.sty 2013/12/13 v3.0.0 (rcs-revision 1.142)
pgf.sty 2013/12/18 v3.0.0 (rcs-revision 1.14)
pgfrcs.sty 2013/12/20 v3.0.0 (rcs-revision 1.28)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfcore.sty 2010/04/11 v3.0.0 (rcs-revision 1.7)
pgfsys.sty 2013/11/30 v3.0.0 (rcs-revision 1.47)
pgfsys.code.tex
pgfsyssoftpath.code.tex 2013/09/09 (rcs-revision 1.9)
pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
xcolor.sty 2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
pgfcore.code.tex
pgfcomp-version-0-65.sty 2007/07/03 v3.0.0 (rcs-revision 1.7)
pgfcomp-version-1-18.sty 2007/07/23 v3.0.0 (rcs-revision 1.1)
pgffor.sty 2013/12/13 v3.0.0 (rcs-revision 1.25)
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
tikz.code.tex
md-frame-1.mdf 2013/07/01\ 1.9b: md-frame-1
t3cmr.fd 2001/12/31 TIPA font definitions
***********