| 1 |
% \iffalse |
| 2 |
% callouts-box.dtx |
| 3 |
% -------------------------------------- |
| 4 |
% Documented LaTeX source for the callouts-box package |
| 5 |
% -------------------------------------- |
| 6 |
%<*driver> |
| 7 |
\documentclass{ltxdoc} |
| 8 |
\usepackage{makeidx} |
| 9 |
\usepackage{callouts-box} |
| 10 |
\makeindex |
| 11 |
\begin{document} |
| 12 |
|
| 13 |
\title{The \texttt{callouts-box} Package\\ |
| 14 |
\smallskip |
| 15 |
\small Version 1.1\\ |
| 16 |
\small Date: 2025/03/14} |
| 17 |
\author{Julien Dujardin} |
| 18 |
\date{14/03/2025} |
| 19 |
|
| 20 |
\maketitle |
| 21 |
\tableofcontents |
| 22 |
|
| 23 |
\section{Introduction} |
| 24 |
The \texttt{callouts-box} package provides a collection of visually appealing, structured callout boxes for \LaTeX{} documents. These boxes are useful for highlighting important information such as warnings, errors, notes, and success messages. The package is built on top of \texttt{tcolorbox} for highly customizable, breakable callout boxes and \texttt{xcolor} for predefined color schemes. |
| 25 |
|
| 26 |
\begin{notebox}[Note] |
| 27 |
This package simplifies the creation of callout boxes in \LaTeX{} documents, making them more readable and visually structured. |
| 28 |
\end{notebox} |
| 29 |
|
| 30 |
\section{Installation} |
| 31 |
To install the \texttt{callouts-box} package, place the following files in your \LaTeX{} directory: |
| 32 |
\begin{itemize} |
| 33 |
\item \texttt{callouts-box.sty} (Core functionality and environment definitions) |
| 34 |
\item \texttt{callouts-box-colors.sty} (Predefined color definitions for callouts) |
| 35 |
\end{itemize} |
| 36 |
Then, include the package in your document preamble: |
| 37 |
\begin{verbatim} |
| 38 |
\usepackage{callouts-box} |
| 39 |
\end{verbatim} |
| 40 |
|
| 41 |
\section{Usage} |
| 42 |
The package provides four predefined callout box environments: |
| 43 |
\DescribeEnv{warningbox} |
| 44 |
\DescribeEnv{errorbox} |
| 45 |
\DescribeEnv{notebox} |
| 46 |
\DescribeEnv{successbox} |
| 47 |
Each environment takes an optional argument for the box title. If no title is provided, a default title is used. |
| 48 |
|
| 49 |
\begin{verbatim} |
| 50 |
\begin{warningbox}[Custom Warning Title] |
| 51 |
This is a warning message. |
| 52 |
\end{warningbox} |
| 53 |
|
| 54 |
\begin{errorbox} |
| 55 |
This is an error message. |
| 56 |
\end{errorbox} |
| 57 |
|
| 58 |
\begin{notebox}[Important Note] |
| 59 |
This is a note. |
| 60 |
\end{notebox} |
| 61 |
|
| 62 |
\begin{successbox} |
| 63 |
This is a success message. |
| 64 |
\end{successbox} |
| 65 |
\end{verbatim} |
| 66 |
|
| 67 |
\subsection{Basic Examples} |
| 68 |
Here are some examples of how to use the predefined callout boxes: |
| 69 |
|
| 70 |
\begin{warningbox}[Custom Warning Title] |
| 71 |
This is a warning message. |
| 72 |
\end{warningbox} |
| 73 |
|
| 74 |
\begin{errorbox} |
| 75 |
This is an error message. |
| 76 |
\end{errorbox} |
| 77 |
|
| 78 |
\begin{notebox}[Important Note] |
| 79 |
This is a note. |
| 80 |
\end{notebox} |
| 81 |
|
| 82 |
\begin{successbox} |
| 83 |
This is a success message. |
| 84 |
\end{successbox} |
| 85 |
|
| 86 |
\subsection{Advanced Examples} |
| 87 |
You can nest callout boxes inside each other: |
| 88 |
\begin{warningbox}[Outer Warning] |
| 89 |
This is an outer warning message. |
| 90 |
|
| 91 |
\begin{notebox}[Nested Note] |
| 92 |
This is a nested note inside a warning. |
| 93 |
\end{notebox} |
| 94 |
\end{warningbox} |
| 95 |
|
| 96 |
You can add equations, lists, or images inside callout boxes: |
| 97 |
\begin{successbox}[Success with Equation] |
| 98 |
The famous Pythagorean theorem: |
| 99 |
\[ |
| 100 |
a^2 + b^2 = c^2 |
| 101 |
\] |
| 102 |
\end{successbox} |
| 103 |
|
| 104 |
\begin{notebox}[Note with List] |
| 105 |
Key points to remember: |
| 106 |
\begin{itemize} |
| 107 |
\item Callout boxes can contain lists. |
| 108 |
\item They can also include images. |
| 109 |
\end{itemize} |
| 110 |
\end{notebox} |
| 111 |
|
| 112 |
\subsection{Customization} |
| 113 |
Users can modify the visual appearance of callout boxes by editing \texttt{callouts-box-colors.sty} or overriding the \texttt{tcbset} settings in their document. |
| 114 |
More documentation can be found at : https://ctan.org/pkg/tcolorbox. |
| 115 |
|
| 116 |
\subsubsection{Code exemle} |
| 117 |
|
| 118 |
To adjust layout settings, use the \texttt{tcbset} command: |
| 119 |
\begin{verbatim} |
| 120 |
{ |
| 121 |
\tcbset{ |
| 122 |
boxsettings/.style={ |
| 123 |
boxrule=2pt, arc=20pt, |
| 124 |
left=10pt, right=10pt, top=10pt, bottom=10pt, |
| 125 |
boxsep=10pt, before skip=15pt, after skip=15pt, |
| 126 |
breakable, before upper={\ignorespaces}, |
| 127 |
boxrule=2pt, arc=8pt, |
| 128 |
colframe=black, colback=yellow!10, |
| 129 |
} |
| 130 |
} |
| 131 |
|
| 132 |
\begin{notebox}[Style Note] |
| 133 |
Style Note |
| 134 |
\end{notebox} |
| 135 |
} |
| 136 |
\end{verbatim} |
| 137 |
|
| 138 |
\subsubsection{Result} |
| 139 |
|
| 140 |
{ |
| 141 |
\tcbset{ |
| 142 |
boxsettings/.style={ |
| 143 |
boxrule=2pt, arc=20pt, |
| 144 |
left=10pt, right=10pt, top=10pt, bottom=10pt, |
| 145 |
boxsep=10pt, before skip=15pt, after skip=15pt, |
| 146 |
breakable, before upper={\ignorespaces}, |
| 147 |
boxrule=2pt, arc=8pt, |
| 148 |
colframe=black!10, colback=yellow!10, |
| 149 |
} |
| 150 |
} |
| 151 |
|
| 152 |
\begin{notebox}[Test Note] |
| 153 |
Note with custom style |
| 154 |
\end{notebox} |
| 155 |
} |
| 156 |
|
| 157 |
|
| 158 |
\section{License} |
| 159 |
This package is distributed under the \LaTeX{} Project Public License (LPPL), version 1.3 or later. For more details, see the \texttt{LICENSE} file. |
| 160 |
|
| 161 |
\PrintIndex |
| 162 |
|
| 163 |
\end{document} |
| 164 |
%</driver> |
| 165 |
% \fi |
| 166 |
|
| 167 |
% -------------------------------------- |
| 168 |
% Package Code |
| 169 |
% -------------------------------------- |
| 170 |
% \iffalse |
| 171 |
%<*package> |
| 172 |
\NeedsTeXFormat{LaTeX2e} |
| 173 |
\ProvidesPackage{callouts-box}[2025/03/14 v1.1 Styled callout boxes] |
| 174 |
|
| 175 |
\RequirePackage{xcolor} |
| 176 |
\RequirePackage{tcolorbox} |
| 177 |
\tcbuselibrary{breakable} |
| 178 |
\RequirePackage{callouts-box-colors} |
| 179 |
|
| 180 |
\tcbset{ |
| 181 |
boxsettings/.style={ |
| 182 |
boxrule=1pt, rounded corners=all, arc=5pt, |
| 183 |
left=5pt, right=5pt, top=5pt, bottom=5pt, |
| 184 |
boxsep=5pt, before skip=10pt, after skip=10pt, |
| 185 |
breakable, before upper={\ignorespaces}, |
| 186 |
} |
| 187 |
} |
| 188 |
|
| 189 |
% Define callout box environments |
| 190 |
\NewTColorBox{warningbox}{ O{Warning} }{ |
| 191 |
colframe=warning-border, colback=warning-content, |
| 192 |
coltitle=warning-text, fonttitle=\bfseries, |
| 193 |
coltext=warning-text, title={#1}, boxsettings, |
| 194 |
} |
| 195 |
|
| 196 |
\NewTColorBox{errorbox}{ O{Error} }{ |
| 197 |
colframe=error-border, colback=error-content, |
| 198 |
coltitle=error-text, fonttitle=\bfseries, |
| 199 |
coltext=error-text, title={#1}, boxsettings, |
| 200 |
} |
| 201 |
|
| 202 |
\NewTColorBox{notebox}{ O{Note} }{ |
| 203 |
colframe=note-border, colback=note-content, |
| 204 |
coltitle=note-text, fonttitle=\bfseries, |
| 205 |
coltext=note-text, title={#1}, boxsettings, |
| 206 |
} |
| 207 |
|
| 208 |
\NewTColorBox{successbox}{ O{Success} }{ |
| 209 |
colframe=success-border, colback=success-content, |
| 210 |
coltitle=success-text, fonttitle=\bfseries, |
| 211 |
coltext=success-text, title={#1}, boxsettings, |
| 212 |
} |
| 213 |
%</package> |
| 214 |
% \fi |
| 215 |
|
| 216 |
% -------------------------------------- |
| 217 |
% Colors Package Code |
| 218 |
% -------------------------------------- |
| 219 |
% \iffalse |
| 220 |
%<*colors> |
| 221 |
\ProvidesPackage{callouts-box-colors}[2025/03/14 v1.1 Predefined colors for callouts-box] |
| 222 |
\RequirePackage{xcolor} |
| 223 |
|
| 224 |
% Define colors for callout boxes |
| 225 |
\definecolor{warning-title}{HTML}{FAE2A0} |
| 226 |
\definecolor{warning-content}{HTML}{FFFCF4} |
| 227 |
\definecolor{warning-text}{HTML}{5C4813} |
| 228 |
\definecolor{warning-border}{HTML}{FAE2A0} |
| 229 |
|
| 230 |
\definecolor{error-title}{HTML}{FAA0A0} |
| 231 |
\definecolor{error-content}{HTML}{FFF4F4} |
| 232 |
\definecolor{error-text}{HTML}{5C1313} |
| 233 |
\definecolor{error-border}{HTML}{FAA0A0} |
| 234 |
|
| 235 |
\definecolor{note-title}{HTML}{A3A0FA} |
| 236 |
\definecolor{note-content}{HTML}{F4F6FF} |
| 237 |
\definecolor{note-text}{HTML}{1E135C} |
| 238 |
\definecolor{note-border}{HTML}{A3A0FA} |
| 239 |
|
| 240 |
\definecolor{success-title}{HTML}{91DF96} |
| 241 |
\definecolor{success-content}{HTML}{F7FFF4} |
| 242 |
\definecolor{success-text}{HTML}{104F20} |
| 243 |
\definecolor{success-border}{HTML}{91DF96} |
| 244 |
%</colors> |
| 245 |
% \fi |