




























































































Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Prepara tus exámenes
Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Prepara tus exámenes con los documentos que comparten otros estudiantes como tú en Docsity
Encuentra los documentos específicos para los exámenes de tu universidad
Estudia con lecciones y exámenes resueltos basados en los programas académicos de las mejores universidades
Responde a preguntas de exámenes reales y pon a prueba tu preparación
Consigue puntos base para descargar
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Comunidad
Pide ayuda a la comunidad y resuelve tus dudas de estudio
Ebooks gratuitos
Descarga nuestras guías gratuitas sobre técnicas de estudio, métodos para controlar la ansiedad y consejos para la tesis preparadas por los tutores de Docsity
saber utilizar el comando tcolorbox en el texto cientifico como latex
Tipo: Apuntes
1 / 548
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!





























































































tcolorbox 6.2.
tcolorbox
tcolorbox 6.2.
tcolorbox 6.2.0 tcolorbox 6.2.
Thomas F. Sturm
Cover code % \usepackage{incgraph} \begin{inctext} \begin{tikzpicture} \definecolorseries{boxcol}{rgb}{last}{blue}{red} \resetcolorseries[28]{boxcol} \coordinate (A) at (0,0); \coordinate (B) at (21,29.7); \path[use as bounding box] (A) rectangle coordinate (C) (B); \node[transform shape,xslant=0.7,rotate=-10,xshift=0cm] at (C) { % \BeginAccSupp{method=plain,ActualText={}} % \begin{tcbraster}[raster columns=4,title=tcolorbox \version, fonttitle=\small\bfseries,raster width=50cm] \foreach \b in {1,...,28} {\begin{tcolorbox}[enhanced, watermark text= \thetcbrasternum , colframe=boxcol!30!white, colback=boxcol!25!white!30!white, colbacktitle=boxcol!!+!50!black!30!white, colupper=black!30!white]\lipsum[2]\end{tcolorbox}} \end{tcbraster} % \EndAccSupp{} % }; \node at (C) { % \begin{tcbitemize}[title=tcolorbox \version,fonttitle=\small\bfseries, enhanced jigsaw,opacityback=0.5,opacitybacktitle=0.75, halign=center,valign=center,arc=5mm, raster width=16cm,raster column skip=8mm,raster halign=center, raster force size=false, raster row 1/.style={height=6cm}, raster row 2/.style={width=6cm,height=4cm}, raster column 1/.style={flushright title, frame style={left color=yellow!50!black,right color=green!50!black}, title style={left color=yellow!50!blue,right color=blue!50!green!50!black}, interior style={left color=yellow!70,right color=green!70}, underlay={\draw[line width=6mm,line cap=round,black!60] ([shift={(0.4,-0.15)}]frame.north east) --([shift={(0.4,0.15)}]frame.south east); }}, raster column 2/.style={ frame style={left color=green!50!black,right color=yellow!50!black}, title style={left color=blue!50!green!50!black,right color=yellow!50!blue}, interior style={left color=green!70,right color=yellow!70}}] \tcbitem [fontupper=\Huge\bfseries,sharp corners=east, underlay={\draw[line width=6mm,line cap=round,black!60] ([shift={(0.4,0.30)}]frame.north east)-- coordinate(A) +(0,0.2); \drawline width=1mm,line cap=round,black!60 -- +(30:1.5cm); \drawline width=1mm,line cap=round,black!60 -- +(150:1.5cm);}] tcolorbox \tcbitem [fontupper=\large\bfseries,sharp corners=west] Manual for\ version\ \version\(\datum) \tcbitem [sharp corners=northeast] \tcbitem [sharp corners=northwest] Thomas F.~Sturm \end{tcbitemize} % }; \end{tikzpicture} \end{inctext}
The package originates from the first edition of my book « LATEX– Einführung in das Textsatzsys- tem » [19] in about 2006. For the LATEX examples and tutorials given there, I wanted to have accentuated and colored boxes to display source code and compiled text in combination. Since, in my opinion, this type of boxes is also quite useful to highlight definitions and theorems, I applied them for my lecture notes in mathematics [20–22] as well. With this package, you are invited to apply these boxes for similar projects.
The breaking news for version 2.00 was the support for breakable boxes. This feature allows new applications of the package without affecting the core package too much if you do not need boxes to break automatically. With version 2.20, the often requested “side by side” mode for listings has been added. With version 3.00, boxed titles are introduced together with improved customization options for overlays, underlays, finishes, and own code extensions.
Since the first public release in 2011, I received a lot of feedback from all over the world. I want to thank all who wrote me for supporting this package by sending bug reports and ideas for new or better features.
Typically, tcolorbox will be installed as part of a major LATEX distribution and there is nothing special to do for a user.
If you intend to make a local installation by hand , see the README file of the tcolorbox package for some hints. The short story is: you have to install not only tcolorbox.sty, but also all *.code.tex files in the local texmf tree.
The base package tcolorbox loads the packages pgf [23], verbatim [18], etoolbox [7], and environ [17]. tcolorbox itself is loaded in the usual manner in the preamble:
\usepackage{tcolorbox}
The package takes option keys in the key-value syntax. Alternatively, you may use these keys later in the preamble with \tcbuselibrary→^ P. 9^ (see there). For example, the key to typeset listings is:
\usepackage[listings]{tcolorbox}
/tcb/library/xparse ( LIB xparse )
Loads the package xparse and is considered a legacy library kept for compatibility; see Section 24 from page 479.
/tcb/library/external (^) ( LIB external )
Provides externalization support for stand-alone document snippets, see Section 25 on page 480.
/tcb/library/documentation ( LIB documentation )
Provides additional macros for typesetting LATEX documentations which are described in Section 26 from page 492.
/tcb/library/many (style, no value)
Loads the libraries LIB skins , LIB breakable , LIB raster , LIB hooks , LIB theorems , and LIB^ fitting. Use this shortcut, if you want to use all features of^ tcolorbox^ with exception of typesetting listings and using the specialized LIB documentation library.
/tcb/library/most (style, no value)
Loads all libraries except LIB minted , LIB documentation , and LIB xparse. Use this shortcut, if you want to use all features of tcolorbox with exception of using the minted package and using the specialized LIB documentation library.
/tcb/library/all (style, no value)
Loads all libraries. Use this shortcut only, if you intend to use the LIB documentation library.
Package tcolorbox
Basic Features
Base package
Advanced Features
LIB^ breakable LIB^ external LIB^ fitting LIB^ hooks LIB^ magazine LIB^ poster LIB^ raster LIB^ skins LIB^ theorems LIB^ vignette
Advanced Listings
LIB^ listings LIB^ listingsutf
LIB^ minted
Documentation
LIB^ documentation
Legacy
LIB^ xparse
tcolorbox Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, ve- stibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, ma- gna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices biben- dum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.
/tcb/width→^ P. 40 /tcb/height→^ P. 59
/tcb/before→^ P. 89, /tcb/before skip→^ P. 91
/tcb/after→^ P. 89, /tcb/after skip→^ P. 91
/tcb/left skip→^ P. 92 /tcb/grow to left by→^ P. 98
/tcb/right skip→^ P. 92 /tcb/grow to right by→^ P. 98
tcolorbox
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.
Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi auctor lorem non justo. Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus. Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna, vitae ornare odio metus a mi. Morbi ac orci et nisl hendrerit mollis. Suspendisse ut massa. Cras nec ante. Pellentesque a nulla. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam tincidunt urna. Nulla ullamcorper vestibulum turpis. Pellentesque cursus luctus mauris.
/tcb/toprule→^ P. 41 /tcb/toptitle→^ P. 48^ /tcb/boxsep→^ P. 45 /tcb/bottomtitle→^ P. 49 /tcb/boxsep→^ P. 45 /tcb/titlerule→^ P. 42^ /tcb/boxsep
→ P. 45 /tcb/top→^ P. 48
/tcb/middle→^ P. 49^ /tcb/boxsep→^ P. 45 /tcb/middle→^ P. 49 /tcb/boxsep→^ P. 45
/tcb/bottomrule→^ P. 41^
/tcb/bottom /tcb/boxsep→^ P. 45 → P. 49
/tcb/leftrule→^ P. 41
/tcb/boxsep→^ P. 45 /tcb/left→^ P. 45
/tcb/rightrule→^ P. 41
/tcb/boxsep→^ P. 45 /tcb/right→^ P. 46
\tcbset {⟨ options ⟩}
Sets options for every following tcolorbox→^ P. 12^ inside the current TEX group. By default, this does not apply to nested boxes, see Section 4.16 on page 105. For example, the colors of the boxes may be defined for the whole document by this:
\tcbset {colback=red!5!white,colframe=red!75!black}
\tcbsetforeverylayer {⟨ options ⟩}
Sets options for every following tcolorbox→^ P. 12^ inside the current TEX group. In contrast to \tcbset, this does also apply to nested boxes, see Section 4.16 on page 105. Technically, the ⟨ options ⟩ are appended to the default values for every tcolorbox which are applied by /tcb/reset→^ P. 122. You should not use this macro, if you are not completely sure that you want to have the ⟨ options ⟩ also for boxes in boxes (in boxes in boxes... ).
\tcbset {colback=green!10!white} \tcbsetforeverylayer {colframe=red!75!black}
\begin{tcolorbox}[title=All options for this box] This is a tcolorbox.\par\medskip \begin{tcolorbox}[title=Nested box] Note that this nested box has a red frame but no green background. \end{tcolorbox} \end{tcolorbox} \bigskip
\begin{tcolorbox}[reset] Options given with | \tcbsetforeverylayer | survive a |reset|. \end{tcolorbox}
All options for this box This is a tcolorbox.
Nested box Note that this nested box has a red frame but no green background.
Options given with \tcbsetforeverylayer survive a reset.
\tcbox [⟨ options ⟩]{⟨ box content ⟩}
Creates a colored box which is fitted to the width of the given ⟨ box content ⟩. In principle, most ⟨ options ⟩ for a tcolorbox→^ P. 12^ can be used for \tcbox with some restrictions. A \tcbox cannot have a lower part and cannot be broken.
\tcbset {colframe=blue!50!black,colback=white,colupper=red!50!black, fonttitle=\bfseries,nobeforeafter,center title}
Text \tcbox [tcbox raise base]{Hello World}\hfill % \tcbox [left=0mm,right=0mm,top=0mm,bottom=0mm,boxsep=0mm, toptitle=0.5mm,bottomtitle=0.5mm,title=My table]{ % \arrayrulecolor{blue!50!black}\renewcommand{\arraystretch}{1.2} % \begin{tabular}{r|c|l} One & Two & Three \\hline\hline Men & Mice & Lions \\hline Upper & Middle & Lower \end{tabular}}\hfill % \tcbox [colback=blue!85!black, left=0mm,right=0mm,top=0mm,bottom=0mm,boxsep=1mm,arc=0mm,boxrule=0.5pt, title=My picture]{ % \includegraphics[width=5cm]{Basilica_5.png}}
Text Hello World
My table One Two Three Men Mice Lions Upper Middle Lower
My picture
% \usepackage{tikz} \tcbset {colframe=blue!50!black,colback=white,colupper=red!50!black, fonttitle=\bfseries,center title}
% Fixed width box \begin{tcolorbox}Hello\World!\end{tcolorbox}
% Fitted width box (like hbox or makebox) \tcbox {Hello\World!}
% Fitted width box (using a TikZ node) \tcbox [tikznode]{Hello\World!}
Hello World!
HelloWorld!
Hello World!
\NewTColorBox [⟨ init options ⟩]{⟨ name ⟩}{⟨ specification ⟩}{⟨ options ⟩}
Creates a new environment ⟨ name ⟩ based on tcolorbox→^ P. 12. Basically, \NewTColorBox operates like \NewDocumentEnvironment. This means, the new environment ⟨ name ⟩ is constructed with the given argument ⟨ specification ⟩. An error is issued if an environment with ⟨ name ⟩ has already been defined. The ⟨ options ⟩ are given to the underlying tcolorbox→^ P. 12. Note that /tcb/savedelimiter→^ P. 32^ is set to the given ⟨ name ⟩ automatically. The ⟨ init options ⟩ allow setting up automatic numbering, see Section 5 from page 127.
% counter from previous example \NewTColorBox [use counter from=pabox]{mybox}{ O{red} m d"" !O{} } {enhanced,colframe=#1!75!black,colback=#1!5!white, fonttitle=\bfseries,title={ \thetcbcounter ~#2}, IfValueT={#3}{watermark text={#3}},#4}
\begin{mybox}{My title} This is a tcolorbox. \end{mybox} \begin{mybox}[blue]{My title} This is a tcolorbox. \end{mybox}
\begin{mybox}[green]{My title}"My Watermark" This is a tcolorbox. \end{mybox}
\begin{mybox}[yellow]{My title}[colbacktitle=yellow!50!white,coltitle=black] This is a tcolorbox. \end{mybox}
\begin{mybox}[purple]{My title}"All together"[coltitle=yellow] This is a tcolorbox. \end{mybox}
3.2 My title This is a tcolorbox.
3.3 My title This is a tcolorbox.
My Watermark
3.4 My title This is a tcolorbox.
3.5 My title This is a tcolorbox.
All together
3.6 My title This is a tcolorbox.
\RenewTColorBox [⟨ init options ⟩]{⟨ name ⟩}{⟨ specification ⟩}{⟨ options ⟩}
Operates like \NewTColorBox→^ P. 16, but based on \RenewDocumentEnvironment instead of \NewDocumentEnvironment. An existing environment is redefined.
\ProvideTColorBox [⟨ init options ⟩]{⟨ name ⟩}{⟨ specification ⟩}{⟨ options ⟩}
Operates like \NewTColorBox→^ P. 16, but based on \ProvideDocumentEnvironment instead of \NewDocumentEnvironment. The environment ⟨ name ⟩ is only created if it is not already defined.
\DeclareTColorBox [⟨ init options ⟩]{⟨ name ⟩}{⟨ specification ⟩}{⟨ options ⟩}
Operates like \NewTColorBox→^ P. 16, but based on \DeclareDocumentEnvironment instead of \NewDocumentEnvironment. The new environment is always created, irrespective of an already existing environment with the same name.
\newtcbox [⟨ init options ⟩]{\⟨ name ⟩}[⟨ number ⟩][⟨ default ⟩]{⟨ options ⟩}
Creates a new macro \⟨ name ⟩ based on \tcbox→^ P. 14. Basically, \newtcbox operates like \newcommand. The new macro \⟨ name ⟩ optionally takes ⟨ number ⟩+1 arguments, where ⟨ default ⟩ is the default value for the optional first argument. The ⟨ options ⟩ are given to the underlying tcbox. The ⟨ init options ⟩ allow setting up automatic numbering, see Section 5 from page 127.
\newtcbox {\mybox}{colback=red!5!white, colframe=red!75!black}
\mybox{This is my own box.}
This is my own box.
\newtcbox {\mybox}[1]{colback=red!5!white, colframe=red!75!black,fonttitle=\bfseries, title={#1}}
\mybox{Hello there}{This is my own box.}
Hello there This is my own box.
\newtcbox {\mybox}[2][]{colback=red!5!white, colframe=red!75!black,fonttitle=\bfseries, title={#2},#1} \mybox[colback=yellow]{Hello there} % {This is my own box.}
Hello there This is my own box.
Definition in the preamble: % counter from previous example \newtcbox [use counter from=pabox]{\pbbox}[2][]{ % colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries, title=( \thetcbcounter ) #2,#1}
\pbbox[colback=yellow]{Hello there} % {This is my own box.}
(3.7) Hello there This is my own box.
\newtcbox {\mybox}[1][red]{on line, arc=0pt,outer arc=0pt,colback=#1!10!white,colframe=#1!50!black, boxsep=0pt,left=1pt,right=1pt,top=2pt,bottom=2pt, boxrule=0pt,bottomrule=1pt,toprule=1pt} \newtcbox {\xmybox}[1][red]{on line, arc=7pt,colback=#1!10!white,colframe=#1!50!black, before upper={\rule[-3pt]{0pt}{10pt}},boxrule=1pt, boxsep=0pt,left=6pt,right=6pt,top=2pt,bottom=2pt}
The \mybox[green]{quick} brown \mybox{fox} \mybox[blue]{jumps} over the \mybox[green]{lazy} \mybox{dog}.\par The \xmybox[green]{quick} brown \xmybox{fox} \xmybox[blue]{jumps} over the \xmybox[green]{lazy} \xmybox{dog}.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
\renewtcbox [⟨ init options ⟩]{\⟨ name ⟩}[⟨ number ⟩][⟨ default ⟩]{⟨ options ⟩}
Operates like \newtcbox→^ P. 19, but based on \renewcommand instead of \newcommand. An existing macro is redefined.
\NewTCBox [⟨ init options ⟩]{\⟨ name ⟩}{⟨ specification ⟩}{⟨ options ⟩}
Creates a new command \⟨ name ⟩ based on \tcbox→^ P. 14. Basically, \NewTCBox operates like \NewDocumentCommand. This means, the new command \⟨ name ⟩ is constructed with the given argument ⟨ specification ⟩. An error is issued if \⟨ name ⟩ has already been defined. The ⟨ options ⟩ are given to the underlying \tcbox→^ P. 14. Note that /tcb/savedelimiter→^ P. 32^ is set to the given ⟨ name ⟩ automatically. The ⟨ init options ⟩ allow setting up automatic numbering, see Section 5 from page 127.
% counter from previous example \NewTCBox [use counter from=pabox]{\mybox}{ s m s } { nobeforeafter,colback=red!5!white,colframe=red!75!black, title={#2 (Box \thetcbcounter )},fonttitle=\bfseries, IfBooleanT={#1}{enhanced,drop shadow}, IfBooleanT={#3}{colbacktitle=red!50!white} }
\mybox{Bird}{This is my first box.} \hfill \mybox{Tree}{This is my second box.} \par\bigskip \mybox{Bike}{This is my third box.} \hfill \mybox{City}{This is my fourth box.}
Bird (Box 3.8) This is my first box.
Tree (Box 3.9) This is my second box.
Bike (Box 3.10) This is my third box.
City (Box 3.11) This is my fourth box.
\RenewTCBox [⟨ init options ⟩]{\⟨ name ⟩}{⟨ specification ⟩}{⟨ options ⟩}
Operates like \NewTCBox, but based on \RenewDocumentCommand instead of \NewDocumentCommand. An existing command is redefined.
\ProvideTCBox [⟨ init options ⟩]{\⟨ name ⟩}{⟨ specification ⟩}{⟨ options ⟩}
Operates like \NewTCBox, but based on \ProvideDocumentCommand instead of \NewDocumentCommand. The command \⟨ name ⟩ is only created if it is not already defined.
\DeclareTCBox [⟨ init options ⟩]{\⟨ name ⟩}{⟨ specification ⟩}{⟨ options ⟩}
Operates like \NewTCBox, but based on \DeclareDocumentCommand instead of \NewDocumentCommand. The new command is always created, irrespective of an already existing command with the same name.