Last active
April 20, 2023 16:49
-
-
Save twhyntie/30ef65b696869f86bf740697ecba7c1c to your computer and use it in GitHub Desktop.
A demonstration of the LaTeX tcolorbox package for writing documentation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% | |
% A demonstration of the tcolorbox package. | |
% | |
% Run with: | |
% $ pdflatex tcolorboxdemo.tex | |
% | |
\documentclass{article} | |
\usepackage{xcolor} | |
\definecolor{grey}{RGB}{0.5,0.5,0.5} | |
\usepackage{tcolorbox} | |
% Warning tcolorbox | |
% #1: tcolorbox options | |
% #2: Box title | |
\newtcolorbox{warningbox}[2][] | |
{ | |
colframe = red!25, | |
colback = red!10, | |
coltitle = red!20!black, | |
title = #2, | |
#1, | |
} | |
% Hint tcolorbox | |
% #1: tcolorbox options | |
% #2: Box title | |
\newtcolorbox{hintbox}[2][] | |
{ | |
colframe = green!25, | |
colback = green!10, | |
coltitle = green!20!black, | |
title = #2, | |
#1, | |
} | |
% Info (information) tcolorbox | |
% #1: tcolorbox options | |
% #2: Box title | |
\newtcolorbox{infobox}[2][] | |
{ | |
colframe = grey!25, | |
colback = grey!10, | |
coltitle = grey!20!black, | |
title = #2, | |
#1, | |
} | |
\begin{document} | |
\begin{hintbox}{Hint} | |
This is a hint. Hint boxes are used for pointing out things that might | |
be useful while carrying out the task being described (particularly | |
where we have received user feedback on a given step!). | |
\end{hintbox} | |
\begin{warningbox}{Warning!} | |
This is a warning. These are used to flag up potential pitfalls or | |
issues you may need to be aware of to avoid making mistakes or doing | |
Something Bad. | |
\end{warningbox} | |
\begin{infobox}{Point of information} | |
This is a point of information. These boxes will generally present | |
things that may not directly relate to the topic being discussed but are | |
nonetheless interesting. | |
\end{infobox} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment