Text FormattingLeft border for Definitions, Examples, Proofs, etc

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
sman
Posts: 9
Joined: Wed Apr 29, 2009 9:08 pm

Left border for Definitions, Examples, Proofs, etc

Post by sman »

Hello,

I am using \newtheorem{mdef}[equation]{Definition} for definitions, examples and proofs. To emphasise these text blocks in a large text document, I am trying to implement a thick border on the left side of this text block. Is there any possibility to simply draw a gray thick line vertically next to a \begin{mdef}...\end{mdef} block?
I have tried to use pdfcomments, I do not understand a word how to use it. I tried changebars, but it is getting to float-errors all the time. Are you having any simple example for a left border without reading wide documentations without any useful code?
Thank you in advance!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Left border for Definitions, Examples, Proofs, etc

Post by gmedina »

Hi,

you can use the leftbar environment provided by the framed package to design a new environment combining the leftbar and mdef environments:

Code: Select all

\documentclass{book}
\usepackage{amsthm}
\usepackage{framed}

\newtheorem{mdef}[equation]{Definition}
\newenvironment{mydef}
  {\begin{leftbar}\begin{mdef}}
  {\end{mdef}\end{leftbar}}

\begin{document}

\begin{mydef}
dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text
\end{mydef}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Left border for Definitions, Examples, Proofs, etc

Post by localghost »

A similar issue has already been discussed here some time ago [1]. The presented solution provides also the possibility to color the rule.

[1] View topic: ruled margins


Best regards
Thorsten
Post Reply