(这个问题接着如何使用 xetex 模拟 \pdfstartlink 和 \pdfendlink?)
笔记:我用了最后一个TikZ/PGF 的 CVS 版本。
使用xelatex
,我想在 tikz 节点中创建注释。以下 MWE 显示了我的问题:第二个开关(通过 TikZ)很糟糕。
\documentclass{article}
\usepackage{ocg-p}
\usepackage{tikz}
\def\mypdfstartlink#1{%
\special{pdf:bann << /Subtype /Link /Border [1 1 1] /A << #1 >> >>}%
}
\def\mypdfendlink{%
\special{pdf:eann}%
}
\long\def\switchocg#1#2{%
\leavevmode%
\mypdfstartlink{ /S/SetOCGState /State %
[/Toggle \csname OCGpdfobj#1\endcsname\space] }%
#2%
\mypdfendlink%
}
\begin{document}
\begin{ocg}{ocg 1}{ocg1}{1}
Some text...
\end{ocg}
\switchocg{ocg1}{text switch}
\tikz\node{\switchocg{ocg1}{tikz switch}};
\end{document}
\listfiles 的结果:
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
ocg-p.sty 2012/12/01 v0.3 Optional Content Group in a PDF document
eso-pic.sty 2010/10/06 v2.0c eso-pic (RN)
atbegshi.sty 2011/10/05 v1.16 At begin shipout hook (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)
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
xcolor.sty 2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
xetex.def 2009/11/22 v0.94 LaTeX color/graphics driver for XeTeX (RRM/JK)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
tikz.sty 2012/08/29 v2.10-cvs (rcs-revision 1.100)
pgf.sty 2008/01/15 v2.10-cvs (rcs-revision 1.12)
pgfrcs.sty 2010/11/07 v2.10-cvs (rcs-revision 1.25)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfcore.sty 2010/04/11 v2.10-cvs (rcs-revision 1.7)
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
pgfsys.sty 2012/03/30 v2.10-cvs (rcs-revision 1.38)
pgfsys.code.tex
pgfsyssoftpath.code.tex 2008/07/18 (rcs-revision 1.7)
pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
pgfcore.code.tex
pgfcomp-version-0-65.sty 2007/07/03 v2.10-cvs (rcs-revision 1.7)
pgfcomp-version-1-18.sty 2007/07/23 v2.10-cvs (rcs-revision 1.1)
pgffor.sty 2012/08/27 v2.10-cvs (rcs-revision 1.22)
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
tikz.code.tex
答案1
我无法重现 XeTeX 3.1415926-2.4-0.9998(MiKTeX 2.9)的问题:
添加\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)
ocg-p.sty 2012/12/01 v0.3 Optional Content Group in a PDF document
eso-pic.sty 2010/10/06 v2.0c eso-pic (RN)
atbegshi.sty 2011/10/05 v1.16 At begin shipout hook (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)
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
xcolor.sty 2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
xetex.def 2009/11/22 v0.94 LaTeX color/graphics driver for XeTeX (RRM/JK)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
tikz.sty 2010/10/13 v2.10 (rcs-revision 1.76)
pgf.sty 2008/01/15 v2.10 (rcs-revision 1.12)
pgfrcs.sty 2010/10/25 v2.10 (rcs-revision 1.24)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfcore.sty 2010/04/11 v2.10 (rcs-revision 1.7)
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 2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
pgfsys.sty 2010/06/30 v2.10 (rcs-revision 1.37)
pgfsys.code.tex
pgfsyssoftpath.code.tex 2008/07/18 (rcs-revision 1.7)
pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
pgfcore.code.tex
pgfcomp-version-0-65.sty 2007/07/03 v2.10 (rcs-revision 1.7)
pgfcomp-version-1-18.sty 2007/07/23 v2.10 (rcs-revision 1.1)
pgffor.sty 2010/03/23 v2.10 (rcs-revision 1.18)
pgfkeys.sty
pgfkeys.code.tex
pgffor.code.tex
tikz.code.tex
***********