Text Formattingntheorem | Remove Indentation with Theorem Style "margin"

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
voorneveld
Posts: 15
Joined: Mon Sep 07, 2009 11:18 am

ntheorem | Remove Indentation with Theorem Style "margin"

Post by voorneveld »

In the MWE below, I define an example environment with numbers in the margin. Its first line, however, is indented, rather than starting at the left margin. How to avoid this indentation? My guess \noindent does not work.

Code: Select all

\documentclass{article}

\usepackage{ntheorem}
\theoremstyle{margin}
\theoremheaderfont{\small\bfseries}
\theorembodyfont{\small}
\theoremsymbol{}
\newtheorem{exercise}{}[section]

\begin{document}
\setcounter{section}{1}
\begin{exercise}
\noindent First line.

\noindent Second line.
\end{exercise}
\end{document}
Last edited by Stefan Kottwitz on Tue Apr 10, 2012 3:24 pm, edited 1 time in total.

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

ntheorem | Remove Indentation with Theorem Style "margin"

Post by localghost »

The cause seems to be that in every case there is some space reserved between the name of the theorem and the beginning text. Since you don't give a name to your exercise theorem environment, you have to correct this. Instead of the name just add some negative horizontal space.

Code: Select all

\newtheorem{exercise}{\hspace*{-0.45em}}[section]
The horizontal space is deliberately chosen in a unit that depends on the font size.


Thorsten
voorneveld
Posts: 15
Joined: Mon Sep 07, 2009 11:18 am

Re: ntheorem | Remove Indentation with Theorem Style "margin

Post by voorneveld »

Thank you so much!

Mark
Post Reply