Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

My question is similar to this and this. I would like to have the theorem number in the left margin (0.6em spacing to the main text) and the Name 'Theorem' should be justified to the main text. The solution should made with the amsthmpackage, because I've made my very specific proof environment with \renewenvironment from amsthm.

\documentclass[12pt,a4paper]{article}
\usepackage[ngerman]{babel}
\usepackage{lipsum,lmodern,libertine}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{amsthm}
\newtheoremstyle{mystyle}
{\topsep}               %space above
{\topsep}               %space below
{}                      %bodyfont
{}                      %indent
{\bfseries}             %headfont
{}                      %punctuation
{0.6em}                 %space after head
{#2 #1 #3}              %theoremheadspec
\theoremstyle{mystyle}
\newtheorem{theorem}{Theorem}

\begin{document}
\lipsum[1] 

\begin{theorem}
Let $f\colon [a,b]\to\mathbb{R}$ be continious and let $F$ be an antiderivative of $f$, then
\begin{align*}
\int_a^b f(x)\,\mathrm{d}x=F(b)-F(a).
\end{align*}
\end{theorem}

\end{document}

This looks like

enter image description here

But it should look like this (this was made with the ntheorem package):

this was made with ntheorem

share|improve this question
1  
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. –  karlkoeller Jan 24 at 19:11
1  
Have you read this post: tex.stackexchange.com/q/59244/10898 –  azetina Jan 24 at 19:11

1 Answer 1

up vote 7 down vote accepted

It sounds like you want the \llap command for left overlap

{\llap{#2 }#1 #3}              %theoremheadspec

Here's a complete MWE to play with.

% arara: pdflatex
\documentclass[12pt,a4paper]{article}
\usepackage{amsmath,amssymb}
\usepackage{lipsum}
\usepackage{amsthm}
\newtheoremstyle{mystyle}
{\topsep}               %space above
{\topsep}               %space below
{}                      %bodyfont
{}                      %indent
{\bfseries}             %headfont
{}                      %punctuation
{0.6em}                 %space after head
{\llap{#2 }#1 #3}              %theoremheadspec
\theoremstyle{mystyle}
\newtheorem{theorem}{Theorem}

\begin{document}
\lipsum[1] 

\begin{theorem}
Let $f\colon [a,b]\to\mathbb{R}$ be continious and let $F$ be an antiderivative of $f$, then
\begin{align*}
\int_a^b f(x)\,\mathrm{d}x=F(b)-F(a).
\end{align*}
\end{theorem}

\end{document}
share|improve this answer
    
No fair! You won me by a few seconds :-) –  azetina Jan 24 at 19:15
    
@azetina if it makes you feel better, that's happened to me a lot on the site :) –  cmhughes Jan 24 at 19:16
    
I could imagine. ;-) –  azetina Jan 24 at 19:17
3  
Since the OP wants 0.6em I'd say \llap{#2\hspace{.6em}} –  karlkoeller Jan 24 at 19:20
    
@karlkoeller nice catch- thanks –  cmhughes Jan 24 at 21:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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