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: Example 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.



\documentclass[a4paper, 12pt]{article}

\usepackage{amsmath, amsthm, amssymb, amsfonts}

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

  • 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:


\documentclass[a4paper, 12pt]{article}

\usepackage[showframe]{geometry} % showframe only for checking purpose. Remove for production.
\usepackage{amsmath, amsthm, amssymb}

  \def\FrameCommand{{\color{rulecolour}\vrule width 3pt} \hspace{10pt}}%
  \MakeFramed {\advance\hsize-\width \FrameRestore}}%

 \declaretheorem[style=customDefinition, numberwithin=section]{definition}




enter image description here

  • You're welcome. Note that it should break across pages if necessary, but I didn't test it
    – Bernard
    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.
    – Bernard
    Apr 13 '19 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.