我的代码如下:
\documentclass{book}
\usepackage{tcolorbox}%
\begin{document}
\begin{tcolorbox}[enhanced, title=Mytitle, attach boxed title to top
center={yshift=-3mm,yshifttext=-1mm},boxed title
style={size=small,colback=blue}]
This is my own box with a mandatory title
and options.
\end{tcolorbox}
\end{document}
运行 LaTeX 时出现一些错误,我已将日志文件粘贴在下面:
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9.6210) (preloaded format=latex 2017.11.30) 18 DEC 2017 15:45
entering extended mode
**./test.tex
(test.tex
LaTeX2e <2017/01/01> patch level 1
Babel <3.9r> and hyphenation patterns for 76 language(s) loaded.
("C:\Program Files\MiKTeX 2.9\tex\latex\base\book.cls"
Document Class: book 2014/09/29 v1.4h Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex\latex\base\bk10.clo"
File: bk10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@chapter=\count80
\c@section=\count81
\c@subsection=\count82
\c@subsubsection=\count83
\c@paragraph=\count84
\c@subparagraph=\count85
\c@figure=\count86
\c@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
("C:\Program Files\MiKTeX 2.9\tex\latex\tcolorbox\tcolorbox.sty"
Package: tcolorbox 2016/11/18 version 3.96 text color boxes
("C:\Program Files\MiKTeX 2.9\tex\latex\pgf\basiclayer\pgf.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\pgf\utilities\pgfrcs.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\utilities\pgfutil-common.tex"
\pgfutil@everybye=\toks14
\pgfutil@tempdima=\dimen103
\pgfutil@tempdimb=\dimen104
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\utilities\pgfutil-common-lists.te
x")) ("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\utilities\pgfutil-latex.def"
\pgfutil@abb=\box26
("C:\Program Files\MiKTeX 2.9\tex\latex\ms\everyshi.sty"
Package: everyshi 2001/05/15 v3.00 EveryShipout Package (MS)
))
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\utilities\pgfrcs.code.tex"
Package: pgfrcs 2015/08/07 v3.0.1a (rcs-revision 1.31)
))
Package: pgf 2015/08/07 v3.0.1a (rcs-revision 1.15)
("C:\Program Files\MiKTeX 2.9\tex\latex\pgf\basiclayer\pgfcore.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\keyval.sty"
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks15
)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
Package: graphics 2016/10/09 v1.0u Standard LaTeX Graphics (DPC,SPQR)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\trig.sty"
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics-cfg\graphics.cfg"
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: dvips.def on input line 99.
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics-def\dvips.def"
File: dvips.def 2016/07/10 v3.1a Driver-dependent file (DPC,SPQR)
))
\Gin@req@height=\dimen105
\Gin@req@width=\dimen106
)
("C:\Program Files\MiKTeX 2.9\tex\latex\pgf\systemlayer\pgfsys.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\systemlayer\pgfsys.code.tex"
Package: pgfsys 2014/07/09 v3.0.1a (rcs-revision 1.48)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\utilities\pgfkeys.code.tex"
\pgfkeys@pathtoks=\toks16
\pgfkeys@temptoks=\toks17
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\utilities\pgfkeysfiltered.code.te
x"
\pgfkeys@tmptoks=\toks18
))
\pgf@x=\dimen107
\pgf@y=\dimen108
\pgf@xa=\dimen109
\pgf@ya=\dimen110
\pgf@xb=\dimen111
\pgf@yb=\dimen112
\pgf@xc=\dimen113
\pgf@yc=\dimen114
\w@pgf@writea=\write3
\r@pgf@reada=\read1
\c@pgf@counta=\count88
\c@pgf@countb=\count89
\c@pgf@countc=\count90
\c@pgf@countd=\count91
\t@pgf@toka=\toks19
\t@pgf@tokb=\toks20
\t@pgf@tokc=\toks21
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\systemlayer\pgf.cfg"
File: pgf.cfg 2008/05/14 (rcs-revision 1.7)
)
Driver file for pgf: pgfsys-dvips.def
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\systemlayer\pgfsys-dvips.def"
File: pgfsys-dvips.def 2014/07/09 (rcs-revision 1.25)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\systemlayer\pgfsys-common-postscr
ipt.def"
File: pgfsys-common-postscript.def 2008/10/01 (rcs-revision 1.22)
\pgf@objectcount=\count92
)))
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\systemlayer\pgfsyssoftpath.code.t
ex"
File: pgfsyssoftpath.code.tex 2013/09/09 (rcs-revision 1.9)
\pgfsyssoftpath@smallbuffer@items=\count93
\pgfsyssoftpath@bigbuffer@items=\count94
)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\systemlayer\pgfsysprotocol.code.t
ex"
File: pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
)) (X:\localtexmf\tex\latex\standard\xcolor.sty
Package: xcolor 2016/05/11 v2.12 LaTeX color extensions (UK)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics-cfg\color.cfg"
File: color.cfg 2016/01/02 v1.6 sample color configuration
)
Package xcolor Info: Driver file: dvips.def on input line 225.
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1349.
Package xcolor Info: Model `RGB' extended on input line 1365.
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1367.
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1368.
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1369.
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1370.
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1371.
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1372.
)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\basiclayer\pgfcore.code.tex"
Package: pgfcore 2010/04/11 v3.0.1a (rcs-revision 1.7)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\math\pgfmath.code.tex"
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\math\pgfmathcalc.code.tex"
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\math\pgfmathutil.code.tex")
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\math\pgfmathparser.code.tex"
\pgfmath@dimen=\dimen115
\pgfmath@count=\count95
\pgfmath@box=\box27
\pgfmath@toks=\toks22
\pgfmath@stack@operand=\toks23
\pgfmath@stack@operation=\toks24
)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\math\pgfmathfunctions.code.tex"
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\math\pgfmathfunctions.basic.code.
tex")
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\math\pgfmathfunctions.trigonometr
ic.code.tex")
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\math\pgfmathfunctions.random.code
.tex")
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\math\pgfmathfunctions.comparison.
code.tex")
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\math\pgfmathfunctions.base.code.t
ex")
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\math\pgfmathfunctions.round.code.
tex")
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\math\pgfmathfunctions.misc.code.t
ex")
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\math\pgfmathfunctions.integerarit
hmetics.code.tex")))
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\math\pgfmathfloat.code.tex"
\c@pgfmathroundto@lastzeros=\count96
))
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\basiclayer\pgfcorepoints.code.tex
"
File: pgfcorepoints.code.tex 2013/10/07 (rcs-revision 1.27)
\pgf@picminx=\dimen116
\pgf@picmaxx=\dimen117
\pgf@picminy=\dimen118
\pgf@picmaxy=\dimen119
\pgf@pathminx=\dimen120
\pgf@pathmaxx=\dimen121
\pgf@pathminy=\dimen122
\pgf@pathmaxy=\dimen123
\pgf@xx=\dimen124
\pgf@xy=\dimen125
\pgf@yx=\dimen126
\pgf@yy=\dimen127
\pgf@zx=\dimen128
\pgf@zy=\dimen129
)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\basiclayer\pgfcorepathconstruct.c
ode.tex"
File: pgfcorepathconstruct.code.tex 2013/10/07 (rcs-revision 1.29)
\pgf@path@lastx=\dimen130
\pgf@path@lasty=\dimen131
)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\basiclayer\pgfcorepathusage.code.
tex"
File: pgfcorepathusage.code.tex 2014/11/02 (rcs-revision 1.24)
\pgf@shorten@end@additional=\dimen132
\pgf@shorten@start@additional=\dimen133
)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\basiclayer\pgfcorescopes.code.tex
"
File: pgfcorescopes.code.tex 2015/05/08 (rcs-revision 1.46)
\pgfpic=\box28
\pgf@hbox=\box29
\pgf@layerbox@main=\box30
\pgf@picture@serial@count=\count97
)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\basiclayer\pgfcoregraphicstate.co
de.tex"
File: pgfcoregraphicstate.code.tex 2014/11/02 (rcs-revision 1.12)
\pgflinewidth=\dimen134
)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\basiclayer\pgfcoretransformations
.code.tex"
File: pgfcoretransformations.code.tex 2015/08/07 (rcs-revision 1.20)
\pgf@pt@x=\dimen135
\pgf@pt@y=\dimen136
\pgf@pt@temp=\dimen137
)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\basiclayer\pgfcorequick.code.tex"
File: pgfcorequick.code.tex 2008/10/09 (rcs-revision 1.3)
)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\basiclayer\pgfcoreobjects.code.te
x"
File: pgfcoreobjects.code.tex 2006/10/11 (rcs-revision 1.2)
)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\basiclayer\pgfcorepathprocessing.
code.tex"
File: pgfcorepathprocessing.code.tex 2013/09/09 (rcs-revision 1.9)
)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\basiclayer\pgfcorearrows.code.tex
"
File: pgfcorearrows.code.tex 2015/05/14 (rcs-revision 1.43)
\pgfarrowsep=\dimen138
)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\basiclayer\pgfcoreshade.code.tex"
File: pgfcoreshade.code.tex 2013/07/15 (rcs-revision 1.15)
\pgf@max=\dimen139
\pgf@sys@shading@range@num=\count98
) ("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\basiclayer\pgfcoreimage.code.te
x"
File: pgfcoreimage.code.tex 2013/07/15 (rcs-revision 1.18)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\basiclayer\pgfcoreexternal.code.t
ex"
File: pgfcoreexternal.code.tex 2014/07/09 (rcs-revision 1.21)
\pgfexternal@startupbox=\box31
))
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\basiclayer\pgfcorelayers.code.tex
"
File: pgfcorelayers.code.tex 2013/07/18 (rcs-revision 1.7)
)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\basiclayer\pgfcoretransparency.co
de.tex"
File: pgfcoretransparency.code.tex 2013/09/30 (rcs-revision 1.5)
)
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\basiclayer\pgfcorepatterns.code.t
ex"
File: pgfcorepatterns.code.tex 2013/11/07 (rcs-revision 1.5)
)))
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\modules\pgfmoduleshapes.code.tex"
File: pgfmoduleshapes.code.tex 2014/03/21 (rcs-revision 1.35)
\pgfnodeparttextbox=\box32
) ("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\modules\pgfmoduleplot.code.tex"
File: pgfmoduleplot.code.tex 2015/08/03 (rcs-revision 1.13)
)
("C:\Program Files\MiKTeX 2.9\tex\latex\pgf\compatibility\pgfcomp-version-0-65.
sty"
Package: pgfcomp-version-0-65 2007/07/03 v3.0.1a (rcs-revision 1.7)
\pgf@nodesepstart=\dimen140
\pgf@nodesepend=\dimen141
)
("C:\Program Files\MiKTeX 2.9\tex\latex\pgf\compatibility\pgfcomp-version-1-18.
sty"
Package: pgfcomp-version-1-18 2007/07/23 v3.0.1a (rcs-revision 1.1)
)) ("C:\Program Files\MiKTeX 2.9\tex\latex\tools\verbatim.sty"
Package: verbatim 2014/10/28 v1.5q LaTeX2e package for verbatim enhancements
\every@verbatim=\toks25
\verbatim@line=\toks26
\verbatim@in@stream=\read2
)
("C:\Program Files\MiKTeX 2.9\tex\latex\environ\environ.sty"
Package: environ 2014/05/04 v0.3 A new way to define environments
("C:\Program Files\MiKTeX 2.9\tex\latex\trimspaces\trimspaces.sty"
Package: trimspaces 2009/09/17 v1.1 Trim spaces around a token list
)
\@envbody=\toks27
)
("C:\Program Files\MiKTeX 2.9\tex\latex\etoolbox\etoolbox.sty"
Package: etoolbox 2017/01/02 v2.4 e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count99
)
\tcb@titlebox=\box33
\tcb@upperbox=\box34
\tcb@lowerbox=\box35
\tcb@phantombox=\box36
\c@tcbbreakpart=\count100
\c@tcblayer=\count101
\tcolorbox@number=\count102
\tcb@temp=\box37
\tcb@temp=\box38
\tcb@temp=\box39
\tcb@temp=\box40
\tcb@out=\write4
\tcb@record@out=\write5
)
No file test.aux.
\openout1 = `test.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
ABD: EveryShipout initializing macros
! Package pgfkeys Error: I do not know the key '/tcb/enhanced' and I am going t
o ignore it. Perhaps you misspelled it.
See the pgfkeys package documentation for explanation.
Type H <return> for immediate help.
...
l.7 style={size=small,colback=blue}]
?
! Package pgfkeys Error: I do not know the key '/tcb/attach boxed title to top
center', to which you passed 'yshift=-3mm,yshifttext=-1mm', and I am going to i
gnore it. Perhaps you misspelled it.
See the pgfkeys package documentation for explanation.
Type H <return> for immediate help.
...
l.7 style={size=small,colback=blue}]
?
! Package pgfkeys Error: I do not know the key '/tcb/boxed title style', to whi
ch you passed 'size=small,colback=blue', and I am going to ignore it. Perhaps y
ou misspelled it.
See the pgfkeys package documentation for explanation.
Type H <return> for immediate help.
...
l.7 style={size=small,colback=blue}]
?
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <7> on input line 7.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line 7.
[1
] (test.aux) )
Here is how much of TeX's memory you used:
9917 strings out of 493330
204034 string characters out of 3139091
247655 words of memory out of 3000000
13325 multiletter control sequences out of 15000+200000
3993 words of font info for 15 fonts, out of 3000000 for 9000
1141 hyphenation exceptions out of 8191
54i,5n,73p,825b,444s stack positions out of 5000i,500n,10000p,200000b,50000s
Output written on test.dvi (1 page, 6716 bytes).
请告诉我哪里出了问题以及如何解决?
答案1
您需要库skins
才能使其工作。tcolorbox 手册甚至根据库分为不同的部分。如果您想避免查找正确库的麻烦,您也可以使用该most
选项加载它。
\documentclass{book}
\usepackage[skins]{tcolorbox}%
\begin{document}
\begin{tcolorbox}[enhanced, title=Mytitle, attach boxed title to top
center={yshift=-3mm,yshifttext=-1mm},boxed title
style={size=small,colback=blue}]
This is my own box with a mandatory title
and options.
\end{tcolorbox}
\end{document}