### Complete tcolorbox Theorems Package Setup Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/07-theorems-library.md A comprehensive example showing how to load the tcolorbox theorems package and define multiple theorem types (Theorem, Lemma, Proposition, Proof) with different numbering schemes and styles. ```latex \usepackage[theorems]{tcolorbox} % Theorems (numbered by section) \newtcbtheorem[new/auto counter, new/number within=section]{theorem}{Theorem}{ colback=blue!10, colframe=blue!75, coltitle=white, fonttitle=\bfseries } % Lemmas (same counter as theorems) \newtcbtheorem[ new/use counter from=theorem, new/number within=section ]{lemma}{Lemma}{ colback=purple!10, colframe=purple!75 } % Propositions (separate counter) \newtcbtheorem[ new/auto counter, new/number within=section ]{proposition}{Proposition}{ colback=orange!10, colframe=orange!75 } % Proofs (no numbering) \newtcbtheorem[new/no counter]{proof}{Proof}{ colback=gray!10, colframe=gray!75 } \section{Main Results} \begin{theorem}[Fundamental Theorem] Important theorem here... \end{theorem} \begin{proof} Proof content... \end{proof} \begin{lemma}[Support Lemma] Supporting result... \end{lemma} \begin{proposition}[Corollary] Following from above... \end{proposition} ``` -------------------------------- ### Custom Theorem Formatting Example Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/07-theorems-library.md This example demonstrates extensive customization of a theorem environment, including title format, description appearance, separators, and indentation. ```latex \newtcbtheorem{mytheorem}{MyTheorem}{ colback=yellow!10, colframe=orange!75, theo/format=number-name, theo/description color=red, theo/description font=\itshape, theo/description delimiter left={[}, theo/description delimiter right={]}, theo/separator sign=--- theo/terminator sign=: } \begin{mytheorem}{My Description} Content... \end{mytheorem} % Produces: "1 --- MyTheorem: [My Description]" ``` -------------------------------- ### Defining and Using Numbered and Unnumbered Theorems Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/07-theorems-library.md Example demonstrating how to define a custom theorem environment and use both its numbered and unnumbered (starred) variants. ```latex \newtcbtheorem{observation}{Observation}{ colback=green!10, colframe=green!75 } % Numbered \begin{observation}{First} This is observation 1. \end{observation} % Unnumbered \begin{observation*}{Note} This is an unnumbered observation. \end{observation*} ``` -------------------------------- ### Basic 2x2 Grid Example Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/08-raster-library.md Demonstrates a simple 2x2 grid layout with four colored boxes. Boxes are automatically positioned left-to-right, top-to-bottom. ```latex \begin{tcbraster}[raster columns=2, raster spacing=3mm] \begin{tcolorbox}[colback=red!20] Box 1 \end{tcolorbox} \begin{tcolorbox}[colback=blue!20] Box 2 \end{tcolorbox} \begin{tcolorbox}[colback=green!20] Box 3 \end{tcolorbox} \begin{tcolorbox}[colback=yellow!20] Box 4 \end{tcolorbox} \end{tcbraster} ``` -------------------------------- ### Example License Notice and Statement (LaTeX) Source: https://github.com/t-f-s/tcolorbox/blob/master/LICENSE.txt This is an example of how to include a copyright notice and license statement in a LaTeX file. It specifies the license version, distribution terms, and maintenance status. ```latex %% pig.dtx %% Copyright 2005 M. Y. Name % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. % The latest version of this license is in % http://www.latex-project.org/lppl.txt % and version 1.3 or later is part of all distributions of LaTeX % version 2005/12/01 or later. % % This work has the LPPL maintenance status `maintained'. % % The Current Maintainer of this work is M. Y. Name. % % This work consists of the files pig.dtx and pig.ins % and the derived file pig.sty. ``` -------------------------------- ### Create a Basic tcolorbox Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/INDEX.md Use this to create a simple, unadorned box for content. No special setup is required beyond loading the package. ```latex \begin{tcolorbox} Content \end{tcolorbox} ``` -------------------------------- ### Configure tcolorbox with pgfkeys Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/INDEX.md Illustrates how tcolorbox utilizes pgfkeys for configuration. This example shows a simple key-value assignment, demonstrating the underlying mechanism for setting options. All configuration is managed through this system. ```latex \tcbset{ /key=value } ``` -------------------------------- ### Defining the Work in a Manifest (LaTeX) Source: https://github.com/t-f-s/tcolorbox/blob/master/LICENSE.txt This example shows how to explicitly list all files that constitute the 'Work' for licensing purposes. This helps licensees determine the scope of the licensed material. ```latex % This work consists of all files listed in manifest.txt. ``` -------------------------------- ### Conditional Key Example (LaTeX3 Style) Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/11-configuration-reference.md Demonstrates conditional execution of styles based on whether a parameter is blank or provided. Use this to dynamically set box appearance. ```latex \begin{tcolorbox}[ IfBlankTF={#1}{ colback=gray!10 % If parameter blank }{ colback=blue!10 % If parameter provided } ] Content... \end{tcolorbox} ``` -------------------------------- ### Centered Raster Example Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/08-raster-library.md Illustrates how to center a raster layout within the available space, specifying width and alignment. ```latex \begin{tcbraster}[ raster columns=2, raster width=8cm, raster halign=center, raster spacing=2mm ] \begin{tcolorbox} Content A \end{tcolorbox} \begin{tcolorbox} Content B \end{tcolorbox} \end{tcbraster} ``` -------------------------------- ### Complex Grid Layout Example Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/08-raster-library.md Demonstrates a complex grid layout with multiple columns, rows, spanning boxes, and alternating background colors. ```latex \usepackage[raster]{tcolorbox} \begin{tcbraster}[ raster columns=3, raster rows=3, raster equal height=rows, raster equal skip=3mm, raster width center=14cm, raster every box={colframe=gray!50}, raster odd column={colback=blue!10}, raster even column={colback=green!10} ] % Row 1 \begin{tcolorbox}[colback=red!20, raster multicolumn=2, title=Header] Wide header spanning 2 columns \end{tcolorbox} \begin{tcolorbox} Sidebar \end{tcolorbox} % Row 2-3 \begin{tcolorbox}[title=Main, raster multirow=2] Main content area (spans 2 rows) \end{tcolorbox} \begin{tcolorbox}[title=Info] Additional info \end{tcolorbox} \begin{tcolorbox}[title=Extra] Extra content \end{tcolorbox} % Row 3 \begin{tcolorbox} More content \end{tcolorbox} \end{tcbraster} ``` -------------------------------- ### Nested tcolorbox Example Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/09-advanced-topics.md Demonstrates nesting multiple tcolorboxes within each other. Each box has a title and a distinct background color to visually represent the nesting levels. ```latex \begin{tcolorbox}[title=Outer, colback=blue!10] Outer box content \begin{tcolorbox}[title=Inner, colback=red!10] Inner box content \begin{tcolorbox}[title=Deep, colback=green!10] Deeply nested box \end{tcolorbox} \end{tcolorbox} Back to outer box \end{tcolorbox} ``` -------------------------------- ### Define Numbered Example Boxes Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/03-box-definition-commands.md Create a custom box environment that automatically handles numbering and integrates with document sections. The title can dynamically display the counter value and an optional argument. ```latex \newtcolorbox[new/auto counter, number within=section]{example}[1]{ colback=yellow!10, colframe=orange!50, title={Example \thetcbcounter: #1} } \begin{example}{Creating a theorem} This is example 1.1 \end{example} ``` -------------------------------- ### Enable Syntax Highlighting with 'minted' Library Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/06-libraries-overview.md The 'minted' library integrates with Pygments for professional syntax highlighting. Ensure 'minted' is installed and LaTeX compilation uses '-shell-escape'. ```latex \tcbuselibrary{minted} \begin{tcolorbox}[minted language=python, colback=blue!10] def hello(): print("World") \end{tcolorbox} ``` -------------------------------- ### Tcolorbox with Sharp Corners and Mixed Borders Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/04-styling-options.md Example demonstrating how to create sharp corners and apply different border widths to a tcolorbox. Use `arc=0` for sharp corners and specify `toprule`, `leftrule`, and `boxrule` for border widths. ```latex % Sharp corners \begin{tcolorbox}[arc=0, toprule=2pt, leftrule=2pt, boxrule=1pt] Mixed border styles \end{tcolorbox} ``` -------------------------------- ### Integrate with Minted Package (LaTeX) Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/09-advanced-topics.md Display code with syntax highlighting using the 'minted' package within a tcolorbox. Requires \tcbuselibrary{minted} and the minted package to be installed. ```latex \tcbuselibrary{minted} \begin{tcolorbox}[ minted language=python, colback=yellow!10 ] def hello(): print("World") \end{tcolorbox} ``` -------------------------------- ### Configure tcolorbox Global Settings Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/INDEX.md Sets default options for all tcolorbox environments globally. This example sets the default background color to white, frame color to black, and adds 5mm padding around the box content. These settings apply unless overridden by specific box configurations. ```latex % Set default box options \tcbset{ colback=white, colframe=black, boxsep=5mm } ``` -------------------------------- ### Tcolorbox with Rounded Corners Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/04-styling-options.md Example showing how to create a tcolorbox with smooth rounded corners. Set `arc` to a dimension value and use `auto outer arc` to automatically calculate the outer arc. ```latex % Rounded corners \begin{tcolorbox}[arc=5mm, auto outer arc] Smooth rounded box \end{tcolorbox} ``` -------------------------------- ### Wrap Existing Environment with TColorBox Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/03-box-definition-commands.md Use \tcolorboxenvironment to wrap an existing LaTeX environment with automatic tcolorbox styling. This command installs hooks to apply specified tcolorbox options when the environment begins and ends. ```latex % Wrap the standard "quote" environment \tcolorboxenvironment{quote}{colback=gray!10, colframe=gray!50} \begin{quote} The wrapped quote now has a styled box around it. \end{quote} % Style theorem environments \usepackage{amsmath} \tcolorboxenvironment{equation*}{ colback=blue!10, colframe=blue!50, before skip=\baselineskip } ``` -------------------------------- ### Accessing pgfkeys via Path and tcbset Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/11-configuration-reference.md Demonstrates how to set a tcolorbox option using the full pgfkeys path or the shorthand tcbset command. Also shows how to enable a nested option. ```latex % Access via path \pgfkeyssetvalue{/tcb/colback}{blue!10} % Or via tcbset which assumes /tcb/ \tcbset{colback=blue!10} % Nested paths \tcbset{/tcb/new/auto counter} ``` -------------------------------- ### Create Basic tcolorbox Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/10-quick-reference.md Shows how to create a basic tcolorbox environment with optional title and background/frame colors. Content within the environment is placed inside the box. ```latex \begin{tcolorbox} Simple box content \end{tcolorbox} ``` ```latex \begin{tcolorbox}[title=My Title] Box with title \end{tcolorbox} ``` ```latex \begin{tcolorbox}[colback=blue!20, colframe=blue!50] Colored box \end{tcolorbox} ``` -------------------------------- ### Create Theorem Environments with 'theorems' Library Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/06-libraries-overview.md The 'theorems' library facilitates the creation of theorem-like environments with automatic numbering. Define custom theorem boxes using \newtcolorbox. ```latex \tcbuselibrary{theorems} \newtcolorbox[new/auto counter, new/number within=section]{theorem}[1]{ title={Theorem \thetcbcounterof{theorem}: #1}, colback=blue!10, colframe=blue!75 } \begin{theorem}{Pythagorean} $a^2 + b^2 = c^2$ for right triangles. \end{theorem} ``` -------------------------------- ### Define New Tcolorbox with Auto Counter Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/10-quick-reference.md Defines a new tcolorbox environment that automatically increments a counter for each instance. Use this for sequential numbering of examples or figures. ```latex % Auto-counter \newtcolorbox[]{example}{ title={Example \thetcbcounter} } ``` -------------------------------- ### Define a Basic Theorem Environment Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/07-theorems-library.md Creates a basic theorem environment with custom colors and title formatting. Use this for standard theorem definitions. ```latex \usepackage[theorems]{tcolorbox} \newtcbtheorem[new/auto counter, new/number within=section]{theorem}{Theorem}{ colback=blue!10, colframe=blue!75, coltitle=white, fonttitle=\bfseries, titlerule=0pt, colback=blue!10, title=Theorem~\thetcbcounter } \begin{theorem}{Pythagorean Theorem} For a right triangle with sides $a, b$ and hypotenuse $c$: \[ a^2 + b^2 = c^2 \] \end{theorem} \begin{theorem}{Alternative Form} This form is less common. \end{theorem} % Unnumbered version: \begin{theorem*}{Observation} This observation has no number. \end{theorem*} ``` -------------------------------- ### Core Environments Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/README.md Documentation for the main `tcolorbox` environment, its parameters, behavior, and styling options. ```APIDOC ## tcolorbox Environment ### Description The main `tcolorbox` environment for creating colored and framed boxes. ### Parameters - **Parameter Reference**: Detailed documentation of all available parameters with their defaults and descriptions. - **Styling Options**: Over 40 documented options for customizing the appearance of the boxes. ### Usage Refer to [01-core-environments.md](01-core-environments.md) for detailed usage and examples. ``` -------------------------------- ### Configuration Reference Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/README.md Complete reference for `tcolorbox` configuration using pgfkeys, including all option categories and conditional keys. ```APIDOC ## Configuration Reference (pgfkeys) ### Description An exhaustive reference for configuring `tcolorbox` behavior and appearance using the pgfkeys system. ### Key Areas - **Option Categories**: Covers all 20+ categories of configuration options. - **Conditional Keys**: Support for LaTeX3-style conditional keys. - **Raster-specific Options**: Configuration for the raster library. - **Breakable-specific Options**: Settings for breakable boxes. - **Evaluation Order**: Explanation of how configuration keys are evaluated. ### Usage Refer to [11-configuration-reference.md](11-configuration-reference.md) for the complete pgfkeys reference and examples. ``` -------------------------------- ### Quick Reference Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/README.md A concise cheatsheet for `tcolorbox` syntax, common patterns, and quick access to styling and color options. ```APIDOC ## Quick Reference ### Description A handy cheatsheet summarizing `tcolorbox` syntax, basic box patterns, and quick references for styling, colors, and common options. ### Content - **Syntax**: Quick overview of command and environment syntax. - **Basic Patterns**: Common examples of `tcolorbox` usage. - **Custom Types**: Examples of defining custom box types. - **Color/Styling**: Quick reference for color names and basic styling parameters. - **Sizing/Spacing**: Shortcuts for dimension and spacing options. - **Common Combinations**: Frequently used option combinations. ### Usage Refer to [10-quick-reference.md](10-quick-reference.md) for a fast overview of `tcolorbox` features. ``` -------------------------------- ### Setting tcolorbox Options Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/11-configuration-reference.md Demonstrates how to set configuration options for tcolorbox. Options can be set directly within the environment or command, globally using \tcbset, or as late options applied after initialization. ```latex % Via environment/command \begin{tcolorbox}[key1=value1, key2=value2] Content \end{tcolorbox} % Global setting \tcbset{key1=value1, key2=value2} % Late options (applied after box initialization) \tcbset@late@options{key=value} ``` -------------------------------- ### Integrate with Listings Package (LaTeX) Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/09-advanced-topics.md Use tcolorbox to display code listings with syntax highlighting provided by the 'listings' package. Ensure \tcbuselibrary{listings} is loaded. ```latex \tcbuselibrary{listings} \begin{tcolorbox}[listing engine=listings] \begin{lstlisting}[language=Python] def factorial(n): return 1 if n <= 1 else n * factorial(n-1) \end{lstlisting} \end{tcolorbox} ``` -------------------------------- ### Advanced Breakable tcolorbox with Customization Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/09-advanced-topics.md Configure a breakable tcolorbox with specific styling and break-related options. This example demonstrates setting a title, background and frame colors, and custom rule widths for breaks. ```latex \begin{tcolorbox}[ breakable, title=Long Article, colback=blue!10, colframe=blue!50, toprule break=1pt, bottomrule break=1pt ] \section*{Introduction} Introduction text... \section*{Main Content} Long content that spans multiple pages... \section*{Conclusion} Final thoughts... \end{tcolorbox} ``` -------------------------------- ### Demonstrate tcolorbox Color Inheritance Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/09-advanced-topics.md Colors applied to an outer tcolorbox are inherited by nested boxes unless explicitly overridden. This example shows how the 'colupper' property is inherited while 'colback' is changed in the inner box. ```latex \begin{tcolorbox}[colback=blue!10, colupper=blue!70] Outer box with blue styling \begin{tcolorbox}[colback=red!10] % Only background changes Inherits blue text from parent, but has red background \end{tcolorbox} \end{tcolorbox} ``` -------------------------------- ### Integrate Code Listings with 'listings' Library Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/06-libraries-overview.md Use the 'listings' library for syntax highlighting of source code via the 'listings' package. It supports options like 'listing and comment' for side-by-side code and explanations. ```latex \tcbuselibrary{listings} \begin{tcolorbox}[listing and comment] \begin{lstlisting} def hello(): print("Hello, World!") \end{lstlisting} \end{tcolorbox} ``` -------------------------------- ### Load tcolorbox Package Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/10-quick-reference.md Demonstrates minimal and library-based loading of the tcolorbox package. Use specific libraries for advanced features like skins, breakable content, and theorems. Preset collections like 'many', 'most', and 'all' load multiple libraries. ```latex % Minimal \usepackage{tcolorbox} ``` ```latex % With libraries \usepackage[skins,breakable,theorems]{tcolorbox} ``` ```latex % After loading \tcbuselibrary{listings, raster} ``` ```latex % Preset collections \usepackage[many]{tcolorbox} % raster, skins, breakable, hooks, theorems, fitting \usepackage[most]{tcolorbox} % many + listings, external, magazine, vignette, poster \usepackage[all]{tcolorbox} % most + minted, documentation, xparse ``` -------------------------------- ### Customize Typography and Alignment Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/04-styling-options.md Control font styles with `fonttitle`, `fontupper`, and `fontlower`. Align text horizontally using `halign`, `halign lower`, and `halign title`, and vertically with `valign`. This example demonstrates custom fonts and mixed alignments. ```latex \begin{tcolorbox}[ fonttitle=\bfseries\Large, halign=center, halign lower=right, colupper=white, colback=black ] Centered upper, right-aligned lower \tcblower This is aligned right \end{tcolorbox} ``` -------------------------------- ### Define a Basic Custom Box Type Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/03-box-definition-commands.md Use \newtcolorbox to create a new environment with default styling. Options can be overridden when using the environment. ```latex \newtcolorbox{mybox}{colback=blue!10, colframe=blue!50, title=Default Title} \begin{mybox} Content here... \end{mybox} % Override default title \begin{mybox}[title=Custom Title] Override defaults with optional argument \end{mybox} ``` -------------------------------- ### Configure tcolorbox Per-Layer Defaults Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/INDEX.md Sets default background color for all layers within tcolorbox environments. This example sets the background color to a light blue (10% blue). This applies to all layers unless explicitly changed for a specific box. ```latex % Set per-layer defaults \tcbsetforeverylayer{ colback=blue!10 } ``` -------------------------------- ### Create a Numbered Theorem Environment Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/INDEX.md Define a theorem environment with automatic numbering and custom styling using \newtcbtheorem. This integrates with document structure for cross-referencing. ```latex \newtcbtheorem[new/auto counter]{theorem}{Theorem}{colback=blue!10} \begin{theorem}{Title} Content \end{theorem} ``` -------------------------------- ### tcbox Command Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/02-core-commands.md The \tcbox command creates an inline variant of the tcolorbox environment for typesetting short colored boxes within text flow. It renders boxes using the hbox capture mode and is suitable for keywords, inline examples, or highlighted phrases. ```APIDOC ## tcbox Command ### Description Inline variant of `tcolorbox` environment for typesetting short colored boxes within text flow. Renders boxes using the `hbox` capture mode. ### Syntax ```latex \tcbox[options]{content} ``` ### Parameters #### Path Parameters - **options** (key-value pairs) - Required - Same options as `tcolorbox` environment - **content** (text) - Required - The content to display in the box ### Return Type A horizontal box object suitable for inline placement. ### Behavior The command processes options using `tcbset`, creates a horizontal box with the specified styling, and returns it ready for inline use. Key differences from `tcolorbox` environment: - Always renders as inline content (no page breaking) - Cannot use `\tcblower` macro for lower sections - Must complete on a single line - Suitable for keywords, inline examples, highlighted phrases ### Request Example ```latex The keyword \tcbox[colback=yellow, colframe=orange]{important} needs attention. ``` Styled inline box: ```latex Use \tcbox[skin=enhanced, colback=red!20, colupper=red!70, fontupper=\bfseries]{ERROR} for error messages. ``` ``` -------------------------------- ### Load tcolorbox Package Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/INDEX.md Demonstrates various ways to load the tcolorbox package and its libraries. Use the minimal option for core functionality, or include common libraries like skins, breakable, and theorems. Libraries can also be loaded after the main package. Preset collections offer convenient ways to load multiple libraries at once. ```latex % Minimal (core only) \usepackage{tcolorbox} % With common libraries \usepackage[skins,breakable,theorems]{tcolorbox} % After loading (if needed) \tcbuselibrary{raster, listings} % Preset collections \usepackage[many]{tcolorbox} % Common libraries \usepackage[most]{tcolorbox} % Most libraries \usepackage[all]{tcolorbox} % All libraries ``` -------------------------------- ### Format tcolorbox Counter Value Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/05-counter-and-numbering.md Use \thetcbcounterof to get the formatted representation of a box type's counter, respecting options like 'number within' and 'number format'. This command is useful for displaying counter values in titles or text. The format is determined by the counter's definition. ```latex \newtcolorbox[ new/auto counter, number within=section, number format=\arabic ]{theorem}[1]{ title={Theorem \thetcbcounterof{theorem}: #1} } \section{Basics} \begin{theorem}{Fermat} Content... \end{theorem} The theorem number is: \thetcbcounterof{theorem} ``` -------------------------------- ### Define New Theorem Environment with \NewTcbTheorem Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/07-theorems-library.md Use `\NewTcbTheorem` for safer theorem creation, especially in package code. It requires a name, label, and options for customization. ```latex \NewTcbTheorem{definition}{Definition}{ colback=purple!10, colframe=purple!75 } ``` -------------------------------- ### Libraries Overview Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/README.md Overview of all 19 built-in `tcolorbox` libraries, including their features and loading syntax. ```APIDOC ## Libraries Overview ### Description Provides an overview of the 19 built-in libraries available for `tcolorbox`, detailing their functionalities and how to load them. ### Features - **Library Listing**: Documentation for each of the 19 libraries. - **Loading Syntax**: How to load libraries using ` cbuselibrary`. - **Key Features**: Highlights of what each library offers. - **Presets**: Information on preset collections like `many`, `most`, and `all`. - **Dependencies**: Notes on library dependencies and version checking. ### Usage Refer to [06-libraries-overview.md](06-libraries-overview.md) for a detailed list and descriptions. ``` -------------------------------- ### Define Theorem Environments with Tcolorbox Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/10-quick-reference.md Load the 'theorems' library to create custom theorem environments. You can define new environments with automatic numbering and specific styling. ```latex \tcbuselibrary{theorems} ``` ```latex \newtcbtheorem[new/auto counter, new/number within=section]{theorem}{Theorem}{ ``` ```latex colback=blue!10, ``` ```latex colframe=blue!75 ``` ```latex } ``` ```latex ``` ```latex \begin{theorem}{Name} ``` ```latex Theorem content... ``` ```latex \end{theorem} ``` ```latex ``` ```latex \begin{theorem*}{Unnamed} ``` ```latex Unnumbered variant... ``` ```latex \end{theorem*} ``` -------------------------------- ### Integrate Theorem Environment with List of Theorems Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/07-theorems-library.md Defines a 'Main Theorem' environment that is automatically added to a list of theorems. Use this to generate a ToC for theorems. ```latex \newtcbtheorem[ new/auto counter, new/list inside=lof, new/list type=theorem, new/crefname={theorem}{theorems} ]{maintheorem}{Main Theorem}{ colback=red!10, colframe=red!75 } \begin{maintheorem}[Central Result] Important content here. \end{maintheorem} % Later: \listoftheorems % Lists all maintheorem entries ``` -------------------------------- ### Load tcolorbox Libraries Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/06-libraries-overview.md Use \tcbuselibrary to load specific functionalities. This command must be placed in the preamble before using the library's features. ```latex \tcbuselibrary{library1, library2, ...} ``` -------------------------------- ### Access tcolorbox Configuration Options Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/11-configuration-reference.md Use \\colorlet, \\setlength, and \\def to access configured colors, dimensions, and text macros respectively. Internal macros are prefixed with \\kvtcb@. ```latex % Access colors \colorlet{mycolor}{tcbcolback} % Access dimensions \setlength{\parindent}{\kvtcb@boxsep} % Access text macros \def\mytitle{\kvtcb@title} ``` -------------------------------- ### NewTcbTheorem Command Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/07-theorems-library.md Defines a new theorem environment using \NewDocumentEnvironment for safer theorem creation in LaTeX3. It offers a preferred method for new code due to its safety features. ```APIDOC ## NewTcbTheorem Command Modern LaTeX3 variant using `\NewDocumentEnvironment` for safer theorem creation. ```latex \NewTcbTheorem[]{name}{}{} ``` ### Parameters Same as `\newtcbtheorem`. See above. ### Behavior - Raises error if environment already exists - Safer than `\newtcbtheorem` for package code - Preferred for new code ### Example ```latex \NewTcbTheorem{definition}{Definition}{ colback=purple!10, colframe=purple!75 } ``` ``` -------------------------------- ### tcbsubskin Command Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/02-core-commands.md Factory macro for creating box skin variants from a parent skin with additional styling. ```APIDOC ## tcbsubskin Command Factory macro for creating box skin variants from a parent skin with additional styling. ```latex \tcbsubskin{subskin-name}{parent-skin}{additional-style} ``` ### Parameters | Parameter | Type | Description | |-----------|------|-------------| | `subskin-name` | identifier | Unique name for the new subskin | | `parent-skin` | identifier | Name of the existing skin to inherit from | | `additional-style` | key-value | Additional options that override parent settings | ### Return Type Registers a new skin in the pgfkeys namespace that can be referenced via `skin=subskin-name`. ### Behavior Creates a new skin by composing the parent skin's properties with additional options. The resulting skin: - Inherits all visual properties from parent - Can override specific properties via `additional-style` - Registers as `skin@subskin-name` internally - Can be used with `skin=subskin-name` option in any `tcolorbox` ### Example ```latex % Create "mytheme" skin based on "enhanced" with custom colors \tcbsubskin{mytheme}{enhanced}{colback=blue!10, colframe=blue!50, colupper=blue!80} \begin{tcolorbox}[skin=mytheme, title=Styled Box] Content using the custom skin... \end{tcolorbox} % Create variant of mytheme for highlights \tcbsubskin{highlight}{mytheme}{colback=yellow!10, colframe=orange!50} ``` ### Related - `skin` option (select which skin to use) - Library `skins` (provides base skins like `enhanced`, `jigsaw`) - Custom skin definition via pgfkeys `/tcb/skin@name` ### Source `tcolorbox.sty` lines 219-220 ``` -------------------------------- ### Box Definition Commands Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/README.md Documentation for commands used to define and redefine custom box environments and inline commands. ```APIDOC ## Box Definition Commands ### Description Reference for commands that allow users to define their own custom `tcolorbox` environments and inline commands. ### Commands - `\newtcolorbox`: Define new custom box environments. - `\renewtcolorbox`: Redefine existing custom box environments. - `\newtcbox`: Define new custom inline commands. - `\DeclareTColorBox`, `\NewTColorBox`: Modern variants for defining boxes. - `\tcolorboxenvironment`: Wrap existing LaTeX environments with `tcolorbox` styling. ### Usage Refer to [03-box-definition-commands.md](03-box-definition-commands.md) for complete signatures and parameter documentation. ``` -------------------------------- ### Create a Grid Layout with tcolorbox Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/INDEX.md Arrange multiple tcolorboxes in a grid using the \tcbraster environment. Specify the number of columns and spacing for layout control. ```latex \begin{tcbraster}[raster columns=2, raster spacing=3mm] \begin{tcolorbox} ... \end{tcolorbox} \begin{tcolorbox} ... \end{tcolorbox} \end{tcbraster} ``` -------------------------------- ### Basic tcbraster Environment Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/08-raster-library.md Defines a container for creating grid layouts with automatic positioning of tcolorbox elements. ```latex \begin{tcbraster}[options] \begin{tcolorbox}[...] ... \end{tcolorbox} \begin{tcolorbox}[...] ... \end{tcolorbox} ... \end{tcbraster} ``` -------------------------------- ### Basic tcolorbox Environment Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/01-core-environments.md Use this basic structure for creating a colored and framed text box with a title and main content. Customize colors using `colback` and `colframe` options. ```latex \begin{tcolorbox}[title=My Title, colback=blue!10, colframe=blue!50] This is the main content of the box. \end{tcolorbox} ``` -------------------------------- ### Create Inline tcolorbox Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/10-quick-reference.md Illustrates creating inline boxes using \tcbox for highlighting text or creating small, inline elements. \tcbsubtitle can be used for inline subtitles, and \tcboxverb handles verbatim content. ```latex \tcbox{inline text} ``` ```latex \tcbox[colback=yellow!20]{highlighted} ``` ```latex \tcbsubtitle{Subtitle} ``` ```latex \tcboxverb|\_| % Verbatim: literal backslash ``` -------------------------------- ### Define Custom tcolorbox Types Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/10-quick-reference.md Shows how to define new tcolorbox environments or inline commands for reusable styling. Supports automatic counters for numbered environments and theorems. ```latex % Environment \newtcolorbox{mybox}{colback=blue!10} \begin{mybox} Content... \end{mybox} ``` ```latex % Numbered environment \newtcolorbox[new/auto counter]{examplebox}[1]{ title={Example \thetcbcounter: #1} } \begin{examplebox}{Title} Content... \end{examplebox} ``` ```latex % Inline command \newtcbox{\mycommand}{colback=red!10} \mycommand{inline text} ``` ```latex % Theorem \newtcbtheorem[new/auto counter]{theorem}{Theorem}{ colback=blue!10, colframe=blue!75 } \begin{theorem}{Pythagorean} Content... \end{theorem} ``` -------------------------------- ### tcbtitle Command Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/02-core-commands.md Expands to the current title text with applied formatting (font, color, alignment). ```APIDOC ## tcbtitle Command Macro that expands to the current title text with applied formatting (font, color, alignment). ```latex \tcbtitle ``` ### Parameters None. Expands to the current title content from the enclosing `tcolorbox` environment. ### Return Type Formatted text with applied `tcbcoltitle` color and `fonttitle` font settings. ### Behavior - Expands to empty if no title is set - Applies color `tcbcoltitle` and font `fonttitle` - Inserts before/after title hooks when available - Used internally by the box drawing system - Can be called within `before title`, `after title` code to access current title ### Example ```latex \begin{tcolorbox}[title=My Title, before title={[}, after title={]}] Content... \end{tcolorbox} % Display current title manually: \begin{tcolorbox}[code={\def\tcbtitletext{Custom}}] \tcbtitle \end{tcolorbox} ``` ### Related - `title` option (sets title text) - `detach title` / `attach title` options (control title handling) - `fonttitle` option (title font) - `coltitle` option (title color) ### Source `tcolorbox.sty` lines 235-236 ``` -------------------------------- ### Core Commands Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/README.md Reference for core `tcolorbox` commands including `\tcbox`, `\tcbsubtitle`, `\tcbtitle`, `\tcbsubskin`, `\tcboxverb`, and `\tcbsidebyside`. ```APIDOC ## Core tcolorbox Commands ### Description Provides reference for essential `tcolorbox` commands used for creating various types of boxes and elements. ### Commands - `\tcbox`: Inline variant for creating boxes within text. - `\tcbsubtitle`: Macro for styling subtitles within boxes. - `\tcbtitle`: Macro for styling titles within boxes. - `\tcbsubskin`: Command for creating custom box skins. - `\tcboxverb`: Inline box for verbatim content. - `\tcbsidebyside`: Environment for creating two-column layouts within boxes. ### Usage Refer to [02-core-commands.md](02-core-commands.md) for detailed syntax and examples. ``` -------------------------------- ### Styling Options Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/README.md Detailed reference for all styling options available in `tcolorbox`, covering colors, typography, dimensions, borders, and more. ```APIDOC ## Styling Options Reference ### Description Comprehensive documentation of all styling options for `tcolorbox`, enabling detailed customization of box appearance. ### Option Categories - **Colors**: Background, frame, and text colors. - **Transparency**: Opacity control for all box sections. - **Typography**: Font settings, alignment, and text styles. - **Dimensions**: Width, height, and margin adjustments. - **Borders and Corners**: Rules, arcs, and corner radius. - **Visibility**: Control over the visibility of box elements. - **Layout**: Advanced options like side-by-side arrangements and height adjustments. - **Spacing**: Vertical spacing before and after boxes. - **Skins**: Selection and customization of box skins. - **Content Hooks**: Mechanisms for inserting content at specific points. ### Usage Refer to [04-styling-options.md](04-styling-options.md) for a complete list and detailed explanations. ``` -------------------------------- ### Theorems Library Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/README.md Documentation for the `theorems` library, enabling the creation of theorem-like environments with `tcolorbox`. ```APIDOC ## Theorems Library ### Description Details on using the `theorems` library to create theorem, definition, and other mathematical or logical environments with `tcolorbox`. ### Commands - `\newtcbtheorem`: Command to define new theorem environments. - Variants for different theorem types. ### Features - **Formatting**: Options for customizing the appearance of theorem boxes. - **Numbering**: Support for section-based numbering and unnumbered variants. - **Integration**: Seamless integration with lists and document structure. ### Usage Refer to [07-theorems-library.md](07-theorems-library.md) for setup examples and detailed options. ``` -------------------------------- ### Theorem Formatting Options Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/07-theorems-library.md Customization options for theorem environments, controlling title format, description styling, separators, terminators, and indentation. ```APIDOC ## Theorem Formatting Options ### Title Formatting The following options control how theorem names and numbers appear: | Option | Type | Description | |--------|------|-------------| | `theo/format=name-number` | — | Name followed by number | | `theo/format=number-name` | — | Number followed by name | | `theo/format=name` | — | Name only (no number) | | `theo/format=number` | — | Number only (no name) | ### Description Formatting | Option | Type | Default | Description | |--------|------|---------|-------------| | `theo/description color` | color | `black` | Color of the theorem description (title) | | `theo/description font` | font | — | Font for description text | | `theo/description delimiter left` | char | `(` | Character before description | | `theo/description delimiter right` | char | `)` | Character after description | ### Separator and Terminator | Option | Type | Default | Description | |--------|------|---------|-------------| | `theo/separator sign` | char | `:` | Separates name/number from description | | `theo/terminator sign` | char | `.` | Ends the title line | ### Indentation | Option | Type | Default | Description | |--------|------|---------|-------------| | `theo/hanging indent` | dimension | `auto` | Indentation of wrapped lines | ### Example: Custom Formatting ```latex \newtcbtheorem{mytheorem}{MyTheorem}{ colback=yellow!10, colframe=orange!75, theo/format=number-name, theo/description color=red, theo/description font=\itshape, theo/description delimiter left={[}, theo/description delimiter right={]}, theo/separator sign=--- theo/terminator sign=: } \begin{mytheorem}{My Description} Content... \end{mytheorem} % Produces: "1 --- MyTheorem: [My Description]" ``` ``` -------------------------------- ### Load tcolorbox Libraries as Document Options Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/06-libraries-overview.md Libraries can be loaded directly as options to the document class. This is equivalent to using \tcbuselibrary after loading the tcolorbox package. ```latex \documentclass[listings, skins]{article} \usepackage{tcolorbox} ``` ```latex \usepackage{tcolorbox} \tcbuselibrary{listings, skins} ``` -------------------------------- ### Define Multiple Theorem/Lemma Boxes Sharing a Counter Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/10-quick-reference.md Sets up 'theorem' and 'lemma' tcbtheorem environments that share the same counter, automatically numbered within sections. This allows for interleaved numbering of theorems and lemmas. ```latex \newtcbtheorem[ new/auto counter, new/number within=section ]{theorem}{Theorem}{colback=blue!10} \newtcbtheorem[ new/use counter from=theorem, new/number within=section ]{lemma}{Lemma}{colback=green!10} % Both use same counter: Theorem 1, Lemma 2, Theorem 3, etc. ``` -------------------------------- ### Common pgfkeys Styling Options Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/10-quick-reference.md Shows common pgfkeys options for styling tcolorbox. 'every box/.append style' modifies all elements, while 'code' executes LaTeX code. ```latex % Common styles [every box/.append style={colframe=black}] [code={\def\myvar{value}}] ``` -------------------------------- ### Fit Content within Boxes with tcolorbox fitting Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/06-libraries-overview.md Use the `fitting` library to automatically scale content to fit within specified box dimensions. The `fit to height` option and `fit algorithm` like `squeeze center` are demonstrated. ```latex \tcbuselibrary{fitting} \begin{tcolorbox}[fit to height=3cm, fit algorithm=squeeze center] Content will be scaled to fit within 3cm height \end{tcolorbox} ``` -------------------------------- ### Set Semi-transparent Background Color Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/04-styling-options.md Use `colback` to set the background color and `opacityback` to control its transparency. Values for `opacityback` range from 0.0 (fully transparent) to 1.0 (fully opaque). ```latex \begin{tcolorbox}[colback=red!50, opacityback=0.5] Semi-transparent red background \end{tcolorbox} ``` -------------------------------- ### Define a Custom Tcolorbox Skin Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/04-styling-options.md Create a custom skin by subclassing an existing skin using `\tcbsubskin`. This allows for custom colors and appearance modifications. Ensure the `skins` library is loaded. ```latex % Requires skins library \tcbuselibrary{skins} \tcbsubskin{mystyle}{enhanced}{ colback=blue!20, colframe=blue!70, shadow=none } \begin{tcolorbox}[skin=mystyle] Styled with custom skin \end{tcolorbox} ``` -------------------------------- ### Dimension Arithmetic in pgfkeys Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/10-quick-reference.md Illustrates how to perform dimension arithmetic directly within pgfkeys for tcolorbox. This allows for dynamic sizing based on other dimensions. ```latex % Dimension arithmetic [width=\linewidth-2cm] [add to width=5mm] ``` -------------------------------- ### Apply Visual Styles with 'skins' Library Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/06-libraries-overview.md Load the 'skins' library to apply predefined visual appearance templates (skins) to tcolorbox environments. Skins like 'enhanced' offer rounded corners and subtle shadows. ```latex \tcbuselibrary{skins} \begin{tcolorbox}[skin=enhanced, colback=blue!20] Styled with enhanced skin \end{tcolorbox} ``` -------------------------------- ### 3x3 Grid with Equal Heights Source: https://github.com/t-f-s/tcolorbox/blob/master/_autodocs/08-raster-library.md Creates a 3x3 grid where all boxes have equal height, using a loop for box generation and uniform spacing. ```latex \begin{tcbraster}[ raster columns=3, raster rows=3, raster equal height=all, raster equal skip=5mm ] \foreach \i in {1,...,9}{ \begin{tcolorbox}[colback=blue!10] Box \i \end{tcolorbox} } \end{tcbraster} ```