Home > Back-end >  ! Undefined control sequence. error when knitting R markdown with \newtcolorbox
! Undefined control sequence. error when knitting R markdown with \newtcolorbox

Time:09-13

I'm trying to figure out how to incorporate a colored box into an R Markdown document. Unfortunately when I try to knit the document to a PDF I continue to get the same Error.

! Undefined control sequence. l.112 \newtcolorbox {mybox}{colback=red!5!white,colframe=red!75!black}

Error: LaTeX failed to compile box.tex. See https://yihui.org/tinytex/r/#debugging for >debugging tips. See box.log for more info. Execution halted

Here's my code below.

---
title: "box"
output: pdf_document
pdf_document:
  extra_dependencies: ['color', 'framed', 'tcolorbox']
---
\newtcolorbox{mybox}{colback=red!5!white,colframe=red!75!black}

\begin{mybox}
This is my own box.
\end{mybox}

I've tried a few versions of this basic idea. I've called the packages using

in_header: 
    - \usepackage{color}
    - \usepackage{framed}
    - \usepackage{tcolorbox}

and

header_includes: "document.tex" 

with the packages in the document as well as including the \newtcolorbox{}{} command in the preamble in all of these scenarios

Here's the .log file:

This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex 2022.9.7)  12 SEP 2022 14:55
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**box.tex
(./box.tex
LaTeX2e <2022-06-01> patch level 5
L3 programming layer <2022-08-30> (c:/texlive/2022/texmf-dist/tex/latex/base/ar
ticle.cls
Document Class: article 2021/10/04 v1.4n Standard LaTeX document class
(c:/texlive/2022/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2021/10/04 v1.4n Standard LaTeX file (size option)
)
\c@part=\count185
\c@section=\count186
\c@subsection=\count187
\c@subsubsection=\count188
\c@paragraph=\count189
\c@subparagraph=\count190
\c@figure=\count191
\c@table=\count192
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen138
) (c:/texlive/2022/texmf-dist/tex/latex/amsmath/amsmath.sty
Package: amsmath 2022/04/08 v2.17n AMS math features
\@mathmargin=\skip49
For additional information on amsmath, use the `?' option.
(c:/texlive/2022/texmf-dist/tex/latex/amsmath/amstext.sty
Package: amstext 2021/08/26 v2.01 AMS text
(c:/texlive/2022/texmf-dist/tex/latex/amsmath/amsgen.sty
File: amsgen.sty 1999/11/30 v2.0 generic functions
\@emptytoks=\toks16
\ex@=\dimen139
)) (c:/texlive/2022/texmf-dist/tex/latex/amsmath/amsbsy.sty
Package: amsbsy 1999/11/29 v1.2d Bold Symbols
\pmbraise@=\dimen140
) (c:/texlive/2022/texmf-dist/tex/latex/amsmath/amsopn.sty
Package: amsopn 2022/04/08 v2.04 operator names
)
\inf@bad=\count193
LaTeX Info: Redefining \frac on input line 234.
\uproot@=\count194
\leftroot@=\count195
LaTeX Info: Redefining \overline on input line 399.
LaTeX Info: Redefining \colon on input line 410.
\classnum@=\count196
\DOTSCASE@=\count197
LaTeX Info: Redefining \ldots on input line 496.
LaTeX Info: Redefining \dots on input line 499.
LaTeX Info: Redefining \cdots on input line 620.
\Mathstrutbox@=\box51
\strutbox@=\box52
LaTeX Info: Redefining \big on input line 722.
LaTeX Info: Redefining \Big on input line 723.
LaTeX Info: Redefining \bigg on input line 724.
LaTeX Info: Redefining \Bigg on input line 725.
\big@size=\dimen141
LaTeX Font Info:    Redeclaring font encoding OML on input line 743.
LaTeX Font Info:    Redeclaring font encoding OMS on input line 744.
\macc@depth=\count198
LaTeX Info: Redefining \bmod on input line 905.
LaTeX Info: Redefining \pmod on input line 910.
LaTeX Info: Redefining \smash on input line 940.
LaTeX Info: Redefining \relbar on input line 970.
LaTeX Info: Redefining \Relbar on input line 971.
\c@MaxMatrixCols=\count199
\dotsspace@=\muskip16
\c@parentequation=\count266
\dspbrk@lvl=\count267
\tag@help=\toks17
\row@=\count268
\column@=\count269
\maxfields@=\count270
\andhelp@=\toks18
\eqnshift@=\dimen142
\alignsep@=\dimen143
\tagshift@=\dimen144
\tagwidth@=\dimen145
\totwidth@=\dimen146
\lineht@=\dimen147
\@envbody=\toks19
\multlinegap=\skip50
\multlinetaggap=\skip51
\mathdisplay@stack=\toks20
LaTeX Info: Redefining \[ on input line 2953.
LaTeX Info: Redefining \] on input line 2954.
) (c:/texlive/2022/texmf-dist/tex/latex/amsfonts/amssymb.sty
Package: amssymb 2013/01/14 v3.01 AMS font symbols
(c:/texlive/2022/texmf-dist/tex/latex/amsfonts/amsfonts.sty
Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support
\symAMSa=\mathgroup4
\symAMSb=\mathgroup5
LaTeX Font Info:    Redeclaring math symbol \hbar on input line 98.
LaTeX Font Info:    Overwriting math alphabet `\mathfrak' in version `bold'
(Font)                  U/euf/m/n --> U/euf/b/n on input line 106.
)) (c:/texlive/2022/texmf-dist/tex/latex/lm/lmodern.sty
Package: lmodern 2015/05/01 v1.6.1 Latin Modern Fonts
LaTeX Font Info:    Overwriting symbol font `operators' in version `normal'
(Font)                  OT1/cmr/m/n --> OT1/lmr/m/n on input line 22.
LaTeX Font Info:    Overwriting symbol font `letters' in version `normal'
(Font)                  OML/cmm/m/it --> OML/lmm/m/it on input line 23.
LaTeX Font Info:    Overwriting symbol font `symbols' in version `normal'
(Font)                  OMS/cmsy/m/n --> OMS/lmsy/m/n on input line 24.
LaTeX Font Info:    Overwriting symbol font `largesymbols' in version `normal'
(Font)                  OMX/cmex/m/n --> OMX/lmex/m/n on input line 25.
LaTeX Font Info:    Overwriting symbol font `operators' in version `bold'
(Font)                  OT1/cmr/bx/n --> OT1/lmr/bx/n on input line 26.
LaTeX Font Info:    Overwriting symbol font `letters' in version `bold'
(Font)                  OML/cmm/b/it --> OML/lmm/b/it on input line 27.
LaTeX Font Info:    Overwriting symbol font `symbols' in version `bold'
(Font)                  OMS/cmsy/b/n --> OMS/lmsy/b/n on input line 28.
LaTeX Font Info:    Overwriting symbol font `largesymbols' in version `bold'
(Font)                  OMX/cmex/m/n --> OMX/lmex/m/n on input line 29.
LaTeX Font Info:    Overwriting math alphabet `\mathbf' in version `normal'
(Font)                  OT1/cmr/bx/n --> OT1/lmr/bx/n on input line 31.
LaTeX Font Info:    Overwriting math alphabet `\mathsf' in version `normal'
(Font)                  OT1/cmss/m/n --> OT1/lmss/m/n on input line 32.
LaTeX Font Info:    Overwriting math alphabet `\mathit' in version `normal'
(Font)                  OT1/cmr/m/it --> OT1/lmr/m/it on input line 33.
LaTeX Font Info:    Overwriting math alphabet `\mathtt' in version `normal'
(Font)                  OT1/cmtt/m/n --> OT1/lmtt/m/n on input line 34.
LaTeX Font Info:    Overwriting math alphabet `\mathbf' in version `bold'
(Font)                  OT1/cmr/bx/n --> OT1/lmr/bx/n on input line 35.
LaTeX Font Info:    Overwriting math alphabet `\mathsf' in version `bold'
(Font)                  OT1/cmss/bx/n --> OT1/lmss/bx/n on input line 36.
LaTeX Font Info:    Overwriting math alphabet `\mathit' in version `bold'
(Font)                  OT1/cmr/bx/it --> OT1/lmr/bx/it on input line 37.
LaTeX Font Info:    Overwriting math alphabet `\mathtt' in version `bold'
(Font)                  OT1/cmtt/m/n --> OT1/lmtt/m/n on input line 38.
) (c:/texlive/2022/texmf-dist/tex/generic/iftex/iftex.sty
Package: iftex 2022/02/03 v1.0f TeX engine tests
) (c:/texlive/2022/texmf-dist/tex/latex/base/fontenc.sty
Package: fontenc 2021/04/29 v2.0v Standard LaTeX package
LaTeX Font Info:    Trying to load font information for T1 lmr on input line 11
2.
(c:/texlive/2022/texmf-dist/tex/latex/lm/t1lmr.fd
File: t1lmr.fd 2015/05/01 v1.6.1 Font defs for Latin Modern
)) (c:/texlive/2022/texmf-dist/tex/latex/base/inputenc.sty
Package: inputenc 2021/02/14 v1.3d Input encoding file
\inpenc@prehook=\toks21
\inpenc@posthook=\toks22
) (c:/texlive/2022/texmf-dist/tex/latex/base/textcomp.sty
Package: textcomp 2020/02/02 v2.0n Standard LaTeX package
) (c:/texlive/2022/texmf-dist/tex/latex/upquote/upquote.sty
Package: upquote 2012/04/19 v1.3 upright-quote and grave-accent glyphs in verba
tim
) (c:/texlive/2022/texmf-dist/tex/latex/microtype/microtype.sty
Package: microtype 2022/06/23 v3.0f Micro-typographical refinements (RS)
(c:/texlive/2022/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2022/05/29 v1.15 key=value parser (DPC)
\KV@toks@=\toks23
) (c:/texlive/2022/texmf-dist/tex/latex/etoolbox/etoolbox.sty
Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count271
)
\MT@toks=\toks24
\MT@tempbox=\box53
\MT@count=\count272
LaTeX Info: Redefining \noprotrusionifhmode on input line 1045.
LaTeX Info: Redefining \leftprotrusion on input line 1046.
LaTeX Info: Redefining \rightprotrusion on input line 1056.
LaTeX Info: Redefining \textls on input line 1234.
\MT@outer@kern=\dimen148
LaTeX Info: Redefining \textmicrotypecontext on input line 1858.
\MT@listname@count=\count273
(c:/texlive/2022/texmf-dist/tex/latex/microtype/microtype-pdftex.def
File: microtype-pdftex.def 2022/06/23 v3.0f Definitions specific to pdftex (RS)

LaTeX Info: Redefining \lsstyle on input line 900.
LaTeX Info: Redefining \lslig on input line 900.
\MT@outer@space=\skip52
)
Package microtype Info: Loading configuration file microtype.cfg.
(c:/texlive/2022/texmf-dist/tex/latex/microtype/microtype.cfg
File: microtype.cfg 2022/06/23 v3.0f microtype main configuration file (RS)
)) (c:/texlive/2022/texmf-dist/tex/latex/parskip/parskip.sty
Package: parskip 2021-03-14 v2.0h non-zero parskip adjustments
(c:/texlive/2022/texmf-dist/tex/latex/kvoptions/kvoptions.sty
Package: kvoptions 2022-06-15 v3.15 Key value format for package options (HO)
(c:/texlive/2022/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty
Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
) (c:/texlive/2022/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty
Package: kvsetkeys 2019/12/15 v1.18 Key value parser (HO)
))) (c:/texlive/2022/texmf-dist/tex/latex/xcolor/xcolor.sty
Package: xcolor 2022/06/12 v2.14 LaTeX color extensions (UK)
(c:/texlive/2022/texmf-dist/tex/latex/graphics-cfg/color.cfg
File: color.cfg 2016/01/02 v1.6 sample color configuration
)
Package xcolor Info: Driver file: pdftex.def on input line 227.
(c:/texlive/2022/texmf-dist/tex/latex/graphics-def/pdftex.def
File: pdftex.def 2020/10/05 v1.2a Graphics/color driver for pdftex
) (c:/texlive/2022/texmf-dist/tex/latex/graphics/mathcolor.ltx)
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1353.
Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1357.
Package xcolor Info: Model `RGB' extended on input line 1369.
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1371.
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1372.
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1373.
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1374.
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1375.
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1376.
) (c:/texlive/2022/texmf-dist/tex/latex/geometry/geometry.sty
Package: geometry 2020/01/02 v5.9 Page Geometry
(c:/texlive/2022/texmf-dist/tex/generic/iftex/ifvtex.sty
Package: ifvtex 2019/10/25 v1.7 ifvtex legacy package. Use iftex instead.
)
\Gm@cnth=\count274
\Gm@cntv=\count275
\c@Gm@tempcnt=\count276
\Gm@bindingoffset=\dimen149
\Gm@wd@mp=\dimen150
\Gm@odd@mp=\dimen151
\Gm@even@mp=\dimen152
\Gm@layoutwidth=\dimen153
\Gm@layoutheight=\dimen154
\Gm@layouthoffset=\dimen155
\Gm@layoutvoffset=\dimen156
\Gm@dimlist=\toks25
) (c:/texlive/2022/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty
Package: fancyvrb 2022/06/06 4.5 verbatim text (tvz,hv)
\FV@CodeLineNo=\count277
\FV@InFile=\read2
\FV@TabBox=\box54
\c@FancyVerbLine=\count278
\FV@StepNumber=\count279
\FV@OutFile=\write3
) (c:/texlive/2022/texmf-dist/tex/latex/framed/framed.sty
Package: framed 2011/10/22 v 0.96: framed or shaded text with page breaks
\OuterFrameSep=\skip53
\fb@frw=\dimen157
\fb@frh=\dimen158
\FrameRule=\dimen159
\FrameSep=\dimen160
) (c:/texlive/2022/texmf-dist/tex/latex/graphics/graphicx.sty
Package: graphicx 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR)
(c:/texlive/2022/texmf-dist/tex/latex/graphics/graphics.sty
Package: graphics 2022/03/10 v1.4e Standard LaTeX Graphics (DPC,SPQR)
(c:/texlive/2022/texmf-dist/tex/latex/graphics/trig.sty
Package: trig 2021/08/11 v1.11 sin cos tan (DPC)
) (c:/texlive/2022/texmf-dist/tex/latex/graphics-cfg/graphics.cfg
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: pdftex.def on input line 107.
)
\Gin@req@height=\dimen161
\Gin@req@width=\dimen162
) (c:/texlive/2022/texmf-dist/tex/latex/bookmark/bookmark.sty
Package: bookmark 2020-11-06 v1.29 PDF bookmarks (HO)
(c:/texlive/2022/texmf-dist/tex/latex/hyperref/hyperref.sty
Package: hyperref 2022-06-20 v7.00s Hypertext links for LaTeX
(c:/texlive/2022/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty
Package: pdftexcmds 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO
)
(c:/texlive/2022/texmf-dist/tex/generic/infwarerr/infwarerr.sty
Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO)
)
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
) (c:/texlive/2022/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty
Package: kvdefinekeys 2019-12-19 v1.6 Define keys (HO)
) (c:/texlive/2022/texmf-dist/tex/generic/pdfescape/pdfescape.sty
Package: pdfescape 2019/12/09 v1.15 Implements pdfTeX's escape features (HO)
) (c:/texlive/2022/texmf-dist/tex/latex/hycolor/hycolor.sty
Package: hycolor 2020-01-27 v1.10 Color options for hyperref/bookmark (HO)
) (c:/texlive/2022/texmf-dist/tex/latex/letltxmacro/letltxmacro.sty
Package: letltxmacro 2019/12/03 v1.6 Let assignment for LaTeX macros (HO)
) (c:/texlive/2022/texmf-dist/tex/latex/auxhook/auxhook.sty
Package: auxhook 2019-12-17 v1.6 Hooks for auxiliary files (HO)
) (c:/texlive/2022/texmf-dist/tex/latex/hyperref/nameref.sty
Package: nameref 2022-05-17 v2.50 Cross-referencing by name of section
(c:/texlive/2022/texmf-dist/tex/latex/refcount/refcount.sty
Package: refcount 2019/12/15 v3.6 Data extraction from label references (HO)
) (c:/texlive/2022/texmf-dist/tex/generic/gettitlestring/gettitlestring.sty
Package: gettitlestring 2019/12/15 v1.6 Cleanup title references (HO)
)
\c@section@level=\count280
)
\@linkdim=\dimen163
\Hy@linkcounter=\count281
\Hy@pagecounter=\count282
(c:/texlive/2022/texmf-dist/tex/latex/hyperref/pd1enc.def
File: pd1enc.def 2022-06-20 v7.00s Hyperref: PDFDocEncoding definition (HO)
Now handling font encoding PD1 ...
... no UTF-8 mapping file for font encoding PD1
) (c:/texlive/2022/texmf-dist/tex/generic/intcalc/intcalc.sty
Package: intcalc 2019/12/15 v1.3 Expandable calculations with integers (HO)
) (c:/texlive/2022/texmf-dist/tex/generic/etexcmds/etexcmds.sty
Package: etexcmds 2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO)
)
\Hy@SavedSpaceFactor=\count283
(c:/texlive/2022/texmf-dist/tex/latex/hyperref/puenc.def
File: puenc.def 2022-06-20 v7.00s Hyperref: PDF Unicode definition (HO)
Now handling font encoding PU ...
... no UTF-8 mapping file for font encoding PU
)
Package hyperref Info: Option `unicode' set `true' on input line 4045.
Package hyperref Info: Hyper figures OFF on input line 4162.
Package hyperref Info: Link nesting OFF on input line 4167.
Package hyperref Info: Hyper index ON on input line 4170.
Package hyperref Info: Plain pages OFF on input line 4177.
Package hyperref Info: Backreferencing OFF on input line 4182.
Package hyperref Info: Implicit mode ON; LaTeX internals redefined.
Package hyperref Info: Bookmarks ON on input line 4408.
\c@Hy@tempcnt=\count284
(c:/texlive/2022/texmf-dist/tex/latex/url/url.sty
\Urlmuskip=\muskip17
Package: url 2013/09/16  ver 3.4  Verb mode for urls, etc.
)
LaTeX Info: Redefining \url on input line 4746.
\XeTeXLinkMargin=\dimen164
(c:/texlive/2022/texmf-dist/tex/generic/bitset/bitset.sty
Package: bitset 2019/12/09 v1.3 Handle bit-vector datatype (HO)
(c:/texlive/2022/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty
Package: bigintcalc 2019/12/15 v1.5 Expandable calculations on big integers (HO
)
))
\Fld@menulength=\count285
\Field@Width=\dimen165
\Fld@charsize=\dimen166
Package hyperref Info: Hyper figures OFF on input line 6024.
Package hyperref Info: Link nesting OFF on input line 6029.
Package hyperref Info: Hyper index ON on input line 6032.
Package hyperref Info: backreferencing OFF on input line 6039.
Package hyperref Info: Link coloring OFF on input line 6044.
Package hyperref Info: Link coloring with OCG OFF on input line 6049.
Package hyperref Info: PDF/A mode OFF on input line 6054.
(c:/texlive/2022/texmf-dist/tex/latex/base/atbegshi-ltx.sty
Package: atbegshi-ltx 2021/01/10 v1.0c Emulation of the original atbegshi
package with kernel methods
)
\Hy@abspage=\count286
\c@Item=\count287
\c@Hfootnote=\count288
)
Package hyperref Info: Driver (autodetected): hpdftex.
(c:/texlive/2022/texmf-dist/tex/latex/hyperref/hpdftex.def
File: hpdftex.def 2022-06-20 v7.00s Hyperref driver for pdfTeX
(c:/texlive/2022/texmf-dist/tex/latex/base/atveryend-ltx.sty
Package: atveryend-ltx 2020/08/19 v1.0a Emulation of the original atveryend pac
kage
with kernel methods
)
\Fld@listcount=\count289
\c@bookmark@seq@number=\count290
(c:/texlive/2022/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty
Package: rerunfilecheck 2022-07-10 v1.10 Rerun checks for auxiliary files (HO)
(c:/texlive/2022/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty
Package: uniquecounter 2019/12/15 v1.4 Provide unlimited unique counter (HO)
)
Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 2
85.
)
\Hy@SectionHShift=\skip54
) (c:/texlive/2022/texmf-dist/tex/latex/bookmark/bkm-pdftex.def
File: bkm-pdftex.def 2020-11-06 v1.29 bookmark driver for pdfTeX (HO)
\BKM@id=\count291
)) (c:/texlive/2022/texmf-dist/tex/latex/xurl/xurl.sty
Package: xurl 2022/01/09 v 0.10 modify URL breaks
) (c:/texlive/2022/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def
File: l3backend-pdftex.def 2022-08-30 L3 backend support: PDF output (pdfTeX)
\l__color_backend_stack_int=\count292
\l__pdf_internal_box=\box55
) (./box.aux)
\openout1 = `box.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 109.
LaTeX Font Info:    ... okay on input line 109.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 109.
LaTeX Font Info:    ... okay on input line 109.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 109.
LaTeX Font Info:    ... okay on input line 109.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 109.
LaTeX Font Info:    ... okay on input line 109.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 109.
LaTeX Font Info:    ... okay on input line 109.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 109.
LaTeX Font Info:    ... okay on input line 109.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 109.
LaTeX Font Info:    ... okay on input line 109.
LaTeX Font Info:    Checking defaults for PD1/pdf/m/n on input line 109.
LaTeX Font Info:    ... okay on input line 109.
LaTeX Font Info:    Checking defaults for PU/pdf/m/n on input line 109.
LaTeX Font Info:    ... okay on input line 109.
LaTeX Info: Redefining \microtypecontext on input line 109.
Package microtype Info: Applying patch `item' on input line 109.
Package microtype Info: Applying patch `toc' on input line 109.
Package microtype Info: Applying patch `eqnum' on input line 109.
Package microtype Info: Applying patch `footnote' on input line 109.
Package microtype Info: Generating PDF output.
Package microtype Info: Character protrusion enabled (level 2).
Package microtype Info: Using protrusion set `basicmath'.
Package microtype Info: Automatic font expansion enabled (level 2),
(microtype)             stretch: 20, shrink: 20, step: 1, non-selected.
Package microtype Info: Using default expansion set `alltext-nott'.
LaTeX Info: Redefining \showhyphens on input line 109.
Package microtype Info: No adjustment of tracking.
Package microtype Info: No adjustment of interword spacing.
Package microtype Info: No adjustment of character kerning.
(c:/texlive/2022/texmf-dist/tex/latex/microtype/mt-cmr.cfg
File: mt-cmr.cfg 2013/05/19 v2.2 microtype config. file: Computer Modern Roman 
(RS)
) (c:/texlive/2022/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count293
\scratchdimen=\dimen167
\scratchbox=\box56
\nofMPsegments=\count294
\nofMParguments=\count295
\everyMPshowfont=\toks26
\MPscratchCnt=\count296
\MPscratchDim=\dimen168
\MPnumerator=\count297
\makeMPintoPDFobject=\count298
\everyMPtoPDFconversion=\toks27
) (c:/texlive/2022/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty
Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4
85.
(c:/texlive/2022/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
e
))
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
*geometry* verbose mode - [ preamble ] result:
* driver: pdftex
* paper: <default>
* layout: <same size as paper>
* layoutoffset:(h,v)=(0.0pt,0.0pt)
* modes: 
* h-part:(L,W,R)=(72.26999pt, 469.75502pt, 72.26999pt)
* v-part:(T,H,B)=(72.26999pt, 650.43001pt, 72.26999pt)
* \paperwidth=614.295pt
* \paperheight=794.96999pt
* \textwidth=469.75502pt
* \textheight=650.43001pt
* \oddsidemargin=0.0pt
* \evensidemargin=0.0pt
* \topmargin=-37.0pt
* \headheight=12.0pt
* \headsep=25.0pt
* \topskip=10.0pt
* \footskip=30.0pt
* \marginparwidth=65.0pt
* \marginparsep=11.0pt
* \columnsep=10.0pt
* \skip\footins=9.0pt plus 4.0pt minus 2.0pt
* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \@twocolumnfalse
* \@twosidefalse
* \@mparswitchfalse
* \@reversemarginfalse
* (1in=72.27pt=25.4mm, 1cm=28.453pt)

Package hyperref Info: Link coloring OFF on input line 109.
LaTeX Font Info:    Trying to load font information for OT1 lmr on input line 1
11.
(c:/texlive/2022/texmf-dist/tex/latex/lm/ot1lmr.fd
File: ot1lmr.fd 2015/05/01 v1.6.1 Font defs for Latin Modern
)
LaTeX Font Info:    Trying to load font information for OML lmm on input line 1
11.
(c:/texlive/2022/texmf-dist/tex/latex/lm/omllmm.fd
File: omllmm.fd 2015/05/01 v1.6.1 Font defs for Latin Modern
)
LaTeX Font Info:    Trying to load font information for OMS lmsy on input line 
111.
(c:/texlive/2022/texmf-dist/tex/latex/lm/omslmsy.fd
File: omslmsy.fd 2015/05/01 v1.6.1 Font defs for Latin Modern
)
LaTeX Font Info:    Trying to load font information for OMX lmex on input line 
111.
(c:/texlive/2022/texmf-dist/tex/latex/lm/omxlmex.fd
File: omxlmex.fd 2015/05/01 v1.6.1 Font defs for Latin Modern
)
LaTeX Font Info:    External font `lmex10' loaded for size
(Font)              <12> on input line 111.
LaTeX Font Info:    External font `lmex10' loaded for size
(Font)              <8> on input line 111.
LaTeX Font Info:    External font `lmex10' loaded for size
(Font)              <6> on input line 111.
LaTeX Font Info:    Trying to load font information for U msa on input line 111
.
(c:/texlive/2022/texmf-dist/tex/latex/amsfonts/umsa.fd
File: umsa.fd 2013/01/14 v3.01 AMS symbols A
) (c:/texlive/2022/texmf-dist/tex/latex/microtype/mt-msa.cfg
File: mt-msa.cfg 2006/02/04 v1.1 microtype config. file: AMS symbols (a) (RS)
)
LaTeX Font Info:    Trying to load font information for U msb on input line 111
.
(c:/texlive/2022/texmf-dist/tex/latex/amsfonts/umsb.fd
File: umsb.fd 2013/01/14 v3.01 AMS symbols B
) (c:/texlive/2022/texmf-dist/tex/latex/microtype/mt-msb.cfg
File: mt-msb.cfg 2005/06/01 v1.0 microtype config. file: AMS symbols (b) (RS)
)
! Undefined control sequence.
l.112 \newtcolorbox
                   {mybox}{colback=red!5!white,colframe=red!75!black} 
Here is how much of TeX's memory you used:
 13597 strings out of 475075
 214898 string characters out of 5783002
 590886 words of memory out of 5000000
 34777 multiletter control sequences out of 15000 600000
 491563 words of font info for 59 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 74i,4n,81p,1000b,382s stack positions out of 10000i,1000n,20000p,200000b,200000s

!  ==> Fatal error occurred, no output PDF file produced!

CodePudding user response:

You can use the following hierarchy in the header:

---
title: "box"
output: 
  pdf_document:
    extra_dependencies: ['color', 'framed', 'tcolorbox']
---
\newtcolorbox{mybox}{colback=red!5!white,colframe=red!75!black}

\begin{mybox}
This is my own box.
\end{mybox}

or with actual latex syntax:

---
title: "box"
output: 
  pdf_document
header-includes: 
  - \usepackage{framed}
  - \usepackage{tcolorbox}
---
\newtcolorbox{mybox}{colback=red!5!white,colframe=red!75!black}

\begin{mybox}
This is my own box.
\end{mybox}

(no real need to load color; tcolorbox will load pgf, which loads xcolor, which in turns automatically loads color. And if that's not enough, rmarkdowns also automatically loads xcolor)

  • Related