3

I already have a personalization of the "newtheorem" environment, as follows:

   \documentclass[a4paper,10pt]{article}
        \usepackage[latin1]{inputenc}
        \usepackage[T1]{fontenc}
        \usepackage{amsfonts}
        \usepackage{amsmath}
        \usepackage{amssymb}
        \usepackage{amsthm}
        \usepackage{lmodern}
        \usepackage[dvipdfm]{color}
        \usepackage[francais]{babel}
        \usepackage{textcomp}
        \usepackage{framed}
\theoremstyle{definition}
        \newtheorem{definitionT}{Définition}[section]
        \newenvironment{definition}{\begin{leftbar}\begin{definitionT}\par\leavevmode\par\noindent}{\end{definitionT}\end{leftbar}} \begin{document}
    \begin{definition}
    Example
    \end{definition}
    \end{document}

It makes a left vertical black line along my environment "definition" I tried to make the text start at a new line and not to be indented, but it is slighlty indented. How could I get rid of this indentation?

I would like it to look like this:

enter image description here

Thanks in advance for your help

  • 1
    (1) welcome, (2) please provide a full minimal example, containing preamble etc. That makes it a LOT easier to help (update your question with the mwe) – daleif Oct 26 '15 at 22:09
  • 1
    I don't think you can do \newenvironment{def}. – egreg Oct 26 '15 at 22:17
  • @daleif Thanks for your recommendations (and your welcome). I edited my question, adding the preamble and modifying "def" to "definition" (it is "definition" in my .tex file). – MoebiusCorzer Oct 26 '15 at 22:37
  • That is still not a minimal example, it has no body. Basically an mwe is a (in theory) fully compilable document, where others does not have to add anything in order to test the code. – daleif Oct 26 '15 at 22:40
  • You might want to look into the following packages: mdframed or tcolorbox – daleif Oct 26 '15 at 22:40
1

You need \ignorespaces after \noindent; the space you see comes from the end-of-line after \begin{definition}.

\documentclass[a4paper,10pt]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[francais]{babel}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{lmodern}
\usepackage[dvipdfmx]{color} % better than `dvipdfm`
\usepackage{textcomp}
\usepackage{framed}

\theoremstyle{definition}
\newtheorem{definitionT}{Définition}[section]
\newenvironment{definition}
  {\begin{leftbar}%
   \begin{definitionT}%
   \par\mbox{}\par\noindent\ignorespaces}
  {\end{definitionT}%
   \end{leftbar}}

\begin{document}

\begin{definition}
Example
\end{definition}

\end{document}

enter image description here

Without \ignorespaces it looks like this

enter image description here

  • Doesn't that get you into problems if you start your theorem with a blank line in the code? Not that uncommon to see in some of the manuscripts that I edit. – daleif Oct 26 '15 at 23:21
  • @daleif Of course. I just fixed the OP's problem. – egreg Oct 26 '15 at 23:24
  • Then it is just a note for future visitors to this question. – daleif Oct 26 '15 at 23: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.