# Change font size and style in custom environment

I am using a textbook template from tstextbook. This template has several custom environments (e.g. theorem, exercise etc.) which are outlined in a box and have title styling.

    \newenvironment{boxtheorem}
{\begin{tcolorbox}
[enhanced jigsaw,breakable,pad at break*=1mm,
colback=black!5,colframe=tsorange]}
{\end{tcolorbox}}

\newtheoremstyle{styletheorem}
{0pt}{0pt}{\normalfont}{0pt}{\small\bf\sffamily\color{tsorange}}{\;}{0.25em}
{\small\sffamily\color{tsorange}\thmname{#1}
\nobreakspace\thmnumber{\@ifnotempty{#1}{}\@upn{#2}}
\thmnote{\nobreakspace\the\thm@notefont\sffamily\bfseries\color{black} (#3) \newline}}

\theoremstyle{styletheorem}
\newtheorem{envtheorem}{Derivation}[chapter]

\newenvironment{theorem}
{\begin{boxtheorem}\begin{envtheorem}}
{\end{envtheorem}\end{boxtheorem}}


This environment looks something like this:

I want to essentially copy this environment which will serve as a "historical figure" section where a small picture of a person and bio will be displayed. I have found that wrapfigure doesn't work well inside environments, but I think I have found a workaround using minipage.

Now I have the following code for my custom environment:

\newenvironment{boxhistory}
{\begin{tcolorbox}
[enhanced jigsaw,breakable,pad at break*=1mm,
colback=tsgrey1!50,boxrule=0pt,frame hidden]}
{\end{tcolorbox}}

\newtheoremstyle{stylehistory}
{0pt}{0pt}{\normalfont}{0pt}{\small\bf\sffamily\color{black}}{\;}{0.25em}
{\small\sffamily\color{black}\thmname{#1}
\thmnote{\nobreakspace\the\thm@notefont\sffamily\bfseries\color{black} #3 \newline}}

\theoremstyle{stylehistory}
\newtheorem{envhistory}{Historical Figure:}[chapter]

\newenvironment{history}
{\begin{boxhistory}\begin{envhistory}}
{\end{envhistory}\end{boxhistory}}


Wrapping the environment in minipage gets the figure wrapping to work:

\begin{history}[Pavel Cherenkov]
\begin{minipage}{\linewidth}
\begin{wrapfigure}{l}{0.28\textwidth}
\centering
\end{wrapfigure}
\footnotesize Cherenkov was born in 1904 to Alexey Cherenkov and Mariya Cherenkova in the small village of Novaya Chigla. This town is in present-day Voronezh Oblast, Russia.

In 1928, he graduated from the Department of Physics and Mathematics of Voronezh State University. In 1930, he took a post as a senior researcher in the Lebedev Physical Institute. That same year he married Maria Putintseva, daughter of A.M. Putintsev, a Professor of Russian Literature. They had a son, Alexey, and a daughter, Yelena.

Cherenkov was promoted to section leader, and in 1940 was awarded the degree of Doctor of Physico-Mathematical Sciences. In 1953, he was confirmed as Professor of Experimental Physics. Starting in 1959, he headed the institute's photo-meson processes laboratory. He remained a professor for fourteen years. In 1970, he became an Academician of the USSR Academy of Sciences.

Cherenkov died in Moscow on January 6, 1990, and was buried in Novodevichy Cemetery.
\end{minipage}
\end{history}


And it looks something like this:

My questions are the following:

1. How can I get the text inside the box to be small, something like \footnotesize but defined in the environment?
2. How can I get natural indentation? I want each paragraph to indent.
3. How can I increase the spacing between the title and first line?

I would like these changes to be defined in the environment if possible. A bonus would be a better way to get word wrap around the figure to work in the environment. Thanks for any suggestions!

Here is the complete code:

%% tstextbook.cls
%% Copyright 2016 Typesetters.se
%
% 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.
%   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 is a free LaTeX text book template from Typesetters.se.
% See tstextbook.tex for an example of how to use this class.

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{tstextbook}[2017/02/19 Free LaTeX text book template from Typesetters.se]

% Language
%--------------------------------------------------------------------------
%\RequirePackage[swedish]{babel}
\RequirePackage[utf8]{inputenc}

% Geometry
%--------------------------------------------------------------------------
\RequirePackage[top=2.5cm,bottom=2.5cm,left=3cm,right=3cm,
marginparwidth=1.1cm,marginparsep=2mm]{geometry}
%\geometry{asymmetric}

% Fonts
%--------------------------------------------------------------------------
\RequirePackage{kpfonts}

% Colors
%--------------------------------------------------------------------------
\RequirePackage{xcolor}
\definecolor{tssteelblue}{RGB}{70,130,180}
\definecolor{tsorange}{RGB}{255,138,88}
\definecolor{tsblue}{RGB}{23,74,117}
\definecolor{tsforestgreen}{RGB}{21,122,81}
\definecolor{tsyellow}{RGB}{255,185,88}
\definecolor{tsgrey}{RGB}{226,236,217}
\definecolor{tsgrey1}{RGB}{208,206,206}

% Graphics
%--------------------------------------------------------------------------
\RequirePackage{graphicx}
\graphicspath{{images/}}
\RequirePackage{tikz}
\RequirePackage[pages=some]{background}
\backgroundsetup{scale=1,color=black,opacity=1.0,angle=0,
contents={\includegraphics[width=\paperwidth,height=\paperheight]{cover_cloud_chamber}}}
\usepackage[font=small,labelfont=bf]{caption}

% Header and footer styling
%--------------------------------------------------------------------------
\RequirePackage{fancyhdr}
\fancyhf{}
\renewcommand{\footrulewidth}{0pt}

% Section styling
%--------------------------------------------------------------------------
\RequirePackage{sectsty}
\sectionfont{\sf\color{tssteelblue}\sectionrule{0ex}{0pt}{-1ex}{1pt}}
\reversemarginpar
\@mparswitchfalse%

% Chapter styling
%--------------------------------------------------------------------------
\makeatletter

% Numbered chapters (with minitoc)
\begin{tikzpicture}[remember picture,overlay]
\node at (current page.north west)
{
\begin{tikzpicture}[remember picture,overlay]
% Background image
\node[anchor=north west,inner sep=0pt] at (0,0)
\draw[anchor=west, inner sep=0pt] (-0.1cm,-1.5cm) node
[black,
ultra thick,
fill=tsorange!10,
fill opacity=.6,
inner sep=10pt]
(0,0)
{\parbox[t][1.6cm][t]{\paperwidth}
{\huge\bfseries\sffamily\flushleft\thechapter. #1}};
% Chapter contents
\draw[anchor=west,inner sep=0pt] (8.8cm,-7cm) node
[tssteelblue,
ultra thick,
fill=white,
fill opacity=.8,
draw=tssteelblue,
draw opacity=1,
line width=1.5pt,
rounded corners,
inner sep=0pt]
(0,0)
{\hspace{1cm}\parbox[t][][t]{11cm}
{\vspace{-0.5cm}\huge\bfseries\sffamily\flushleft
\textcolor{black}{\sffamily\minitoc}}};
\end{tikzpicture}
};
\end{tikzpicture}
\vspace{7.5cm}
}

% Unnumbered chapters (without minitoc)
\begin{tikzpicture}[remember picture,overlay]
\node at (current page.north west)
{
\begin{tikzpicture}[remember picture,overlay]
% Background image
\node[anchor=north west,inner sep=0pt] at (0,0)
\draw[anchor=west,inner sep=0pt] (-0.1cm,-1.5cm) node
[black,
ultra thick,
fill=tsorange!10,
fill opacity=.6,
inner sep=10pt]
(0,0)
{\parbox[t][1.6cm][t]{\paperwidth}
{\huge\bfseries\sffamily\flushleft #1}};
\end{tikzpicture}
};
\end{tikzpicture}
\vspace{8cm}
}

% Minitoc styling
%--------------------------------------------------------------------------
\RequirePackage{minitoc}
\setcounter{minitocdepth}{1}
\dominitoc[n]
\nomtcrule
\nomtcpagenumbers
\renewcommand{\mtifont}{\large\sffamily}
\renewcommand{\mtcfont}{\small\sffamily}
\renewcommand{\mtcSfont}{\small\sffamily}
\renewcommand{\mtcSSfont}{\small\sffamily}
\renewcommand{\mtcSSSfont}{\small\sffamily}

%--------------------------------------------------------------------------
\RequirePackage{titletoc}
\setcounter{tocdepth}{1}

\titlecontents{chapter}[0cm]
{\color{tssteelblue}\contentslabel[\Large\thecontentslabel]{1.25cm}}{}
{\color{tssteelblue}\normalsize\sffamily\bfseries
\;\titlerule*[.5pc]{.}\;\thecontentspage}

\titlecontents{section}[0cm]
{\contentslabel[\thecontentslabel]{1.25cm}}{}
{\sffamily\hfill\color{black}\thecontentspage}[]

% Front matter
%--------------------------------------------------------------------------
\newcommand{\tsbook}[9]{

\pagestyle{empty}

\def\@tstitle{#1}
\def\@tsauthor{#2}
\def\@tscoverdesign{#3}
\def\@tsyear{#4}
\def\@tsartno{#5}
\def\@tsisbn{#6}
\def\@tsedition{#7}
\def\@tspublished{#8}
\def\@tsprinted{#9}

% Title page
\BgThispage
\begin{center}
\null
\smallskip

\color{white}
\sffamily

%\Huge
%\textsc{\@tstitle}

%\bigskip
%\smallskip

%\LARGE
%\textsc{\@tsauthor} %\\[1em]
\end{center}
%\Large
%\textsc{\@tspublished}
%\end{center}

\pagebreak

\null
\vfill
\begin{flushleft}
Copyright \copyright \ \@tsyear \ \@tsauthor \\
\vspace{5mm}
\textbf{Copying prohibited} \\
\vspace{5mm}
All rights reserved. No part of this publication may be reproduced
or transmitted in any form or by any means, electronic or
mechanical, including photocopying and recording, or by any
information storage or retrieval system, without the prior written
permission of the author.\\
%\vspace{5mm}
%Art. No \@tsartno \\
%ISBN \@tsisbn \\
%Edition \@tsedition \\
\vspace{5mm}
Cover image by \@tscoverdesign \\
%Printed in \@tsprinted
\end{flushleft}

\tableofcontents

\cleardoublepage
\pagestyle{fancy}
\thispagestyle{empty}
}

% Boxes for theorems
%--------------------------------------------------------------------------
\newenvironment{boxtheorem}
{\begin{tcolorbox}
[enhanced jigsaw,breakable,pad at break*=1mm,
colback=black!5,colframe=tsorange]}
{\end{tcolorbox}}

\newenvironment{boxdefinition}
{\begin{tcolorbox}
[enhanced jigsaw,breakable,pad at break*=1mm,
colback=yellow!10!white,boxrule=0pt,frame hidden,
borderline west={1.5mm}{-2mm}{tsforestgreen}]}
{\end{tcolorbox}}

{\begin{tcolorbox}
[enhanced jigsaw,breakable,pad at break*=1mm,
colback=tsyellow!20,boxrule=0pt,frame hidden]}
{\end{tcolorbox}}

\newenvironment{boxquestion}
{\begin{tcolorbox}
[enhanced jigsaw,breakable,pad at break*=1mm,
colback=tsorange!25,boxrule=0pt,frame hidden]}
{\end{tcolorbox}}

\newenvironment{boxhomework}
{\begin{tcolorbox}
[enhanced jigsaw,breakable,pad at break*=1mm,
colback=tsblue!10,boxrule=0pt,frame hidden]}
{\end{tcolorbox}}

\newenvironment{boxexample}
{\begin{tcolorbox}
[enhanced jigsaw,breakable,pad at break*=1mm,
colback=tsforestgreen!10,boxrule=0pt,frame hidden]}
{\end{tcolorbox}}

\newenvironment{boxsolution}
{\begin{tcolorbox}
[enhanced jigsaw,breakable,pad at break*=1mm,
colback=tsforestgreen!10,boxrule=0pt,frame hidden]}
{\end{tcolorbox}}

\newenvironment{boxhistory}
{\begin{tcolorbox}
[enhanced jigsaw,breakable,pad at break*=1mm,
colback=tsgrey1!50,boxrule=0pt,frame hidden]}
{\end{tcolorbox}}

% Styling of theorems
%--------------------------------------------------------------------------
\RequirePackage{amsthm}
\usepackage{enumitem}

\newtheoremstyle{styletheorem}
{0pt}{0pt}{\normalfont}{0pt}{\small\bf\sffamily\color{tsorange}}{\;}{0.25em}
{\small\sffamily\color{tsorange}\thmname{#1}
\nobreakspace\thmnumber{\@ifnotempty{#1}{}\@upn{#2}}
\thmnote{\nobreakspace\the\thm@notefont\sffamily\bfseries\color{black} (#3) \newline}}

\newtheoremstyle{styledefinition}
{0pt}{0pt}{\normalfont}{0pt}{\small\bf\sffamily\color{black}}{\;}{0.25em}
{\small\sffamily\color{tsforestgreen}\thmname{#1}
\nobreakspace\thmnumber{\@ifnotempty{#1}{}\@upn{#2}}
\thmnote{\nobreakspace\the\thm@notefont\sffamily\bfseries\color{black} (#3) \newline}}

\newtheoremstyle{styleexercise}
{0pt}{0pt}{\normalfont}{0pt}{\small\bf\sffamily\color{black}}{\;}{0.25em}
{\small\sffamily\color{black}\thmname{#1}
\nobreakspace\thmnumber{\@ifnotempty{#1}{}\@upn{#2}}
\thmnote{\nobreakspace\the\thm@notefont\sffamily\bfseries\color{black} (#3) \newline}}

\newtheoremstyle{styleexercise1}
{0pt}{0pt}{\normalfont}{0pt}{\small\bf\sffamily\color{black}}{\;}{0.25em}
{\small\sffamily\color{black}\thmname{#1}
%\nobreakspace\thmnumber{\@ifnotempty{#1}{}\@upn{#2}}
\thmnote{\nobreakspace\the\thm@notefont\sffamily\bfseries\color{black} (#3) \newline}}

\newtheoremstyle{styleexercise2}
{0pt}{0pt}{\normalfont}{0pt}{\small\bf\sffamily\color{black}}{\;}{0.25em}
{\small\sffamily\color{black}\thmname{#1}
%\nobreakspace\thmnumber{\@ifnotempty{#1}{}\@upn{#2}}
\thmnote{\nobreakspace\the\thm@notefont\sffamily\bfseries\color{black} (#3)}}

\newtheoremstyle{stylehistory}
{0pt}{0pt}{\normalfont}{0pt}{\small\bf\sffamily\color{black}}{\;}{0.25em}
{\small\sffamily\color{black}\thmname{#1}
%\nobreakspace\thmnumber{\@ifnotempty{#1}{}\@upn{#2}}
\thmnote{\nobreakspace\the\thm@notefont\sffamily\bfseries\color{black} #3 \newline}}

\theoremstyle{styledefinition}
\newtheorem{envdefinition}{Definition}[chapter]
\theoremstyle{styletheorem}
\newtheorem{envtheorem}{Derivation}[chapter]
\newtheorem{envlemma}{Lemma}[chapter]
\theoremstyle{styleexercise1}
\newtheorem{envquestion}{Question:}[chapter]
\theoremstyle{styleexercise}
\newtheorem{envhomework}{Homework Exercise}[chapter]
\newtheorem{envexample}{Example}[chapter]
\theoremstyle{stylehistory}
\newtheorem{envhistory}{Historical Figure:}[chapter]

% Environments for theorems
%--------------------------------------------------------------------------
\newenvironment{definition}
{\begin{boxdefinition}\begin{envdefinition}}
{\end{envdefinition}\end{boxdefinition}}

\newenvironment{theorem}
{\begin{boxtheorem}\begin{envtheorem}}
{\end{envtheorem}\end{boxtheorem}}

\newenvironment{corollary}
{\begin{boxtheorem}\begin{envtheorem}}
{\end{envtheorem}\end{boxtheorem}}

\newenvironment{lemma}
{\begin{boxtheorem}\begin{envlemma}}
{\end{envlemma}\end{boxtheorem}}

\newenvironment{question}
{\begin{boxquestion}\begin{envquestion}}
{\end{envquestion}\end{boxquestion}}

\newenvironment{homework}
{\begin{boxhomework}\begin{envhomework}}
{\end{envhomework}\end{boxhomework}}

\newenvironment{example}
{\begin{boxexample}\begin{envexample}}
{\end{envexample}\end{boxexample}}

\newenvironment{solution}
{\begin{boxsolution}\begin{envsolution}}
{\end{envsolution}\end{boxsolution}}

\newenvironment{history}
{\begin{boxhistory}\begin{envhistory}}
{\end{envhistory}\end{boxhistory}}

% Other environments
%--------------------------------------------------------------------------
\newenvironment{summary}
{\hspace{10pt}\par\small\it
\begin{list}{}{\leftmargin=35pt\rightmargin=25pt}
{\end{list}\vspace{-0.5cm}}

\newenvironment{remark}
{\vspace{0.5cm}\noindent\small\it
\marginpar{\vspace{-6mm}\includegraphics[width=1.0cm]{idea}}}
{\vspace{0.5cm}}

% Bibliography
%--------------------------------------------------------------------------
\RequirePackage[backend=biber]{biblatex}

% Index
%--------------------------------------------------------------------------
\RequirePackage{makeidx}
\makeindex

% Packages for mathematics and algorithms
%--------------------------------------------------------------------------
\RequirePackage{algorithm}
\RequirePackage{algpseudocode}
\RequirePackage{xfrac}
\RequirePackage{mathtools}
\RequirePackage{wasysym}
\RequirePackage{siunitx}
\newcommand\bmmax{2}
\RequirePackage{bm}
\usepackage{cases}
\usepackage{wrapfig}
\usepackage{cutwin}

% Other useful packages
%--------------------------------------------------------------------------
\RequirePackage{blindtext}
\RequirePackage[most]{tcolorbox}
\RequirePackage{booktabs}
\RequirePackage{url}

\documentclass{tstextbook}
\begin{document}

A charged particle moving with uniform velocity can NOT generate radiation in a vacuum.  However, when a charged particle moves in a dielectric medium with refractive index $\textit{n}$, it becomes possible to irradiate!  This was indeed discovered experimentally by the Russian physicist, Pavel Cherenkov in 1934, and later explained theoretically by Ilya Tamm and Igor Frank in 1937. They received the Nobel Prize for this discovery in 1958.
\begin{history}[Pavel Cherenkov]
\begin{minipage}{\linewidth}
\begin{wrapfigure}{l}{0.28\textwidth}
\centering
\end{wrapfigure}
Cherenkov was born in 1904 to Alexey Cherenkov and Mariya Cherenkova in the small village of Novaya Chigla. This town is in present-day Voronezh Oblast, Russia.

In 1928, he graduated from the Department of Physics and Mathematics of Voronezh State University. In 1930, he took a post as a senior researcher in the Lebedev Physical Institute. That same year he married Maria Putintseva, daughter of A.M. Putintsev, a Professor of Russian Literature. They had a son, Alexey, and a daughter, Yelena.

Cherenkov was promoted to section leader, and in 1940 was awarded the degree of Doctor of Physico-Mathematical Sciences. In 1953, he was confirmed as Professor of Experimental Physics. Starting in 1959, he headed the institute's photo-meson processes laboratory. He remained a professor for fourteen years. In 1970, he became an Academician of the USSR Academy of Sciences.

Cherenkov died in Moscow on January 6, 1990, and was buried in Novodevichy Cemetery.
\end{minipage}
\end{history}
\end{document}

• Welcome to TeX.SE! Can you please make your code snippet be compilable? Then we do not have to guess what you are doing ... Oct 13 at 22:59
• @Mensch sorry, I added the complete code! Oct 13 at 23:09