# Styling amsthm theorem using thmtools

I'm trying to stylize my definitions/examples etc. a bit to have a more simple overview once finished. Im specifically trying to achieve this: But don't really know how to achieve it. I can only think of a thin vertically stretched box aligned to the left of the whole environment but failed at implementing it since I'm fairly new to tex.

MWE:

\pdfminorversion=7

\documentclass[a4paper, 12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage{amsmath, amsthm, amssymb, amsfonts}
\usepackage{thmtools}
\usepackage{lipsum}

% Theorem styles
\newtheoremstyle{customDefinition}
{}            % Space above, empty = usual value'
{}            % Space below
{\itshape}    % Body font
{}            % Indent amount (empty = no indent, \parindent = para indent)
{}            % Punctuation after thm head
{\newline}    % Space after thm head: \newline = linebreak
{Definition \thmnumber{#2}\thmname{\hfill#1}}   % Thm head spec

\begin{document}
\theoremstyle{customDefinition}
\newtheorem{definition}{Matrix}[section]
\begin{definition}
\lipsum[2]
\end{definition}
\end{document}

• amsmath has nothing to do with theorems; you mean amsthm. Please fix the title. Apr 13 '19 at 20:54

I propose this code entirely based on thmtools and the leftbar environment from the framed package:

\pdfminorversion=7

\documentclass[a4paper, 12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[showframe]{geometry} % showframe only for checking purpose. Remove for production.
\usepackage[svgnames]{xcolor}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{thmtools}
\usepackage{lipsum}

\usepackage{framed}
\colorlet{rulecolour}{DarkOrange}
\renewenvironment{leftbar}{%
\def\FrameCommand{{\color{rulecolour}\vrule width 3pt} \hspace{10pt}}%
{\endMakeFramed}

notefont=\sffamily\bfseries,%
notebraces={}{},%
bodyfont=\sffamily\itshape,%
postfoothook=\end{leftbar},%
]{customDefinition}
\declaretheorem[style=customDefinition, numberwithin=section]{definition}

\begin{document}

\setcounter{section}{4}
\begin{definition}[Matrix]
\lipsum[2]
\end{definition}

\end{document}
`

• You're welcome. Note that it should break across pages if necessary, but I didn't test it Apr 13 '19 at 19:37
• Maybe remove the showfram so others dont get confused Apr 13 '19 at 20:20
• It was there only to check every thing was placed as expected. I'll a word about it. Apr 13 '19 at 20:25