summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/tcolorbox/tcolorbox-example.tex
blob: 3359233dee9daf56c24037848fec2bd4d59ac208 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
%% The LaTeX package tcolorbox - version 2.20 (2013/04/17)
%% tcolorbox-example.tex: an example for tcolorbox
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2013 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% 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 `author-maintained'.
%%
%% This work consists of all files listed in README
%%
\documentclass{article}
\usepackage{tikz,lipsum}
\usepackage[listings,theorems,skins,breakable]{tcolorbox}

\begin{document}

%----------------------------------------------------------
\section{Colored boxes}

\begin{tcolorbox}[colback=red!5!white,colframe=red!75!black]
  My box.
\end{tcolorbox}

\begin{tcolorbox}[colback=blue!5!white,colframe=blue!75!black,title=My title]
  My box with my title.
\end{tcolorbox}

\begin{tcolorbox}[colback=green!5!white,colframe=green!75!black]
  Upper part of my box.
  \tcblower
  Lower part of my box.
\end{tcolorbox}

\begin{tcolorbox}[colback=yellow!5!white,colframe=yellow!75!black,title=My title]
  I can do this also with a title.
  \tcblower
  Lower part of my box.
\end{tcolorbox}

\begin{tcolorbox}[colback=yellow!10!white,colframe=red!75!black,lowerbox=invisible,
  savelowerto=\jobname_ex.tex]
  Now, we play hide and seek. Where is the lower part?
  \tcblower
  I'm invisible until you find me.
\end{tcolorbox}

\begin{tcolorbox}[colback=yellow!10!white,colframe=red!75!black,title=Here I am]
  \input{\jobname_ex.tex}
\end{tcolorbox}


\begin{tcolorbox}[colback=blue!50!white,colframe=blue!25!black,coltext=yellow,
    fontupper=\Large\bfseries,arc=6mm,boxrule=2mm,boxsep=5mm]
  Funny settings.
\end{tcolorbox}


\clearpage
%----------------------------------------------------------
\section{\LaTeX-Examples}

\begin{tcblisting}{colback=red!5!white,colframe=red!75!black}
This is a \LaTeX\ example:
\begin{equation}
\sum\limits_{i=1}^n i = \frac{n(n+1)}{2}.
\end{equation}
\end{tcblisting}


\begin{tcblisting}{colback=red!5!white,colframe=red!75!black,listing side text,
  title=Side by side,fonttitle=\bfseries}
This is a \LaTeX\ example:
\begin{equation}
\sum\limits_{i=1}^n i = \frac{n(n+1)}{2}.
\end{equation}
\end{tcblisting}


%----------------------------------------------------------
\section{Theorems}

\newcounter{mytheorem}[section]
\def\themytheorem{\thesection.\arabic{mytheorem}}

\tcbmaketheorem{theo}{Theorem}{fonttitle=\bfseries\upshape, fontupper=\slshape,
     arc=0mm, colback=blue!5!white,colframe=blue!75!black}{mytheorem}{theorem}

\begin{theo}{Summation of Numbers}{summation}
  For all natural number $n$ it holds:
  \begin{equation}
  \tcbhighmath{\sum\limits_{i=1}^n i = \frac{n(n+1)}{2}.}
  \end{equation}
\end{theo}

We have given Theorem \ref{theorem:summation} on page \pageref{theorem:summation}.


%----------------------------------------------------------
\section{Watermarks}

\begin{tcolorbox}[enhanced,watermark graphics=Basilica_5.png,
  watermark opacity=0.3,watermark zoom=0.9,
  colback=green!5!white,colframe=green!75!black,
  fonttitle=\bfseries, title=Box with a watermark picture]
  Here, you see my nice box with a picture as a watermark.
  This picture is automatically resized to fit the dimensions
  of my box. Instead of a picure, some text could be used or
  arbitrary graphical code. See the documentation for more options.
\end{tcolorbox}

%----------------------------------------------------------
\section{Breakable Boxes}
\begin{tcolorbox}[enhanced,breakable,
  colback=blue!5!white,colframe=blue!75!black,title=Breakable box,
  watermark color=white,watermark text=\Roman{tcbbreakpart}]
  \lipsum[1-18]
\end{tcolorbox}

\end{document}