4

I have the following latex script:

\newtheorem*{BellOpV}{Definition}
\begin{BellOpV}
$V^{\pi}$ is defined as $T^{\pi}:\mathbb{R}^{|S|} \to \mathbb{R}^{|S|}$. It maps value functions to value functions.

$$(T^{\pi}V^{\pi})(s) = \sum_{a \in A} \pi(a|s) \left[ R(s,a) + \gamma \sum_{s' \in S} P(s' | s,a) V^{\pi}(s') \right]$$
\end{BellOpV}

The \emph{Bellman Operator for $V^{\pi}$} defined before has the following properties:

\begin{enumerate}
\item[]{$V^{\pi}$ is a \emph{fixed point} for $V^{\pi}$ that means that $T^{\pi}V^{\pi} = V^{\pi}$}
\item[]{$T^{\pi}$ is linear}
\item[]{if $0<\gamma<1$ then $T^{\pi}$ is a \emph{maximum-norm contraction}}
\end{enumerate}

The output of my code is the following:

The output of my latex fragment

My question is why from "The Bellman Operator ..." is all shifted on the right? Seems it is part of the definition, which is unwanted. How can I fix this?

3
  • 1
    You are using items without labels. \item[]. You have text, displayed math, another paragraph and a list of items. You should put a period to end the math. If you don't want another paragraph after it, just remove the blank line after the math. Also, don't use double dollar, use \[ \].
    – Sigur
    Oct 22 '16 at 14:57
  • 2
    Welcome to TEX.SE! It would be helpful if you provided a full minimal working example starting with \documentclass{...} and ending with \end{document} instead of code snippets. But apart from that, after the definition a new paragraph is issued. I think this question covers your case. Or simply add \noindent after the definition environment.
    – campa
    Oct 22 '16 at 15:01
  • Since it is after \end{BellOpV} it is not part of definition. Also, note that it is not italicized.
    – Sigur
    Oct 22 '16 at 15:03
5

Your code may be improved in several ways, listed here in no particular order:

  • Don't use $$ to initiate and terminate displaymath mode in a LaTeX document. Instead, use \[ and \]. See the posting Why is \[ ... \] preferable to $$ ... $$? for an in-depth discussion of this matter.

  • Use \colon instead of : in definition.

  • Use an itemize environment instead of an enumerate environment, and terminate each sentence with a period (dot, full stop); after all, they are full English-language sentences.

  • Use \mid instead of | to denote the conditioning events.

  • Typographically speaking, the square brackets generated by \left[ and \right] are too big. Use \biggl[ and \biggr] instead.

  • Finally, if you absolutely, positively must suppress the paragraph indentation for the paragraph that follows the defintion, simply prefix it with a \noindent directive.

enter image description here

\documentclass{article}
\usepackage{amsthm,  % for '\newtheorem*' macro
            amssymb} % for '\mathbb' macro
\newtheorem*{BellOpV}{Definition}
\begin{document}

\begin{BellOpV}
$V^{\pi}$ is defined as $T^{\pi}\colon\mathbb{R}^{|S|} \to \mathbb{R}^{|S|}$. It maps value functions to value functions.
\[
(T^{\pi}V^{\pi})(s) = \sum_{a\in A} \pi(\,a\mid s\,) 
\biggl[ R(s,a) + \gamma \sum_{s'\in S} P(\,s'\mid s,a\,) V^{\pi}(s') \biggr]
\]
\end{BellOpV}

\noindent  % <--- are you sure you really want this?
The \emph{Bellman Operator} for $V^{\pi}$ defined before has the following properties:
\begin{itemize}
\item $V^{\pi}$ is a \emph{fixed point} for $V^{\pi}$, i.e.,  $T^{\pi}V^{\pi} = V^{\pi}$.
\item $T^{\pi}$ is linear.
\item If $0<\gamma<1$ then $T^{\pi}$ is a \emph{maximum-norm contraction}.
\end{itemize}

\end{document}
6
  • I've hit the vote limit :( But this is a fantastic answer
    – Au101
    Oct 22 '16 at 16:00
  • 1
    @Au101 -- Many thanks, from one Star Wars and Harry Potter afficionado to another! :-)
    – Mico
    Oct 22 '16 at 16:04
  • Thanks very much for all your suggestions. Probably you all have a reason to say that it is a "wired" choice to put \noindent, but actually I think that without it the layout is very very ugly. By the way thanks to all of your suggestion again.
    – Sam
    Oct 22 '16 at 17:21
  • "Use \colon instead of : [to separate the function name from the domain]"—this is definitely stylistic; as I'm sure you know, many (most?) authors indeed choose to use the more widely spaced version.
    – wchargin
    Oct 22 '16 at 19:53
  • 1
    Here you are, have a +1 :) Yes I was pleased to see your handle over on SF&F - nice answer on the 'Is Voldemort a liar?' question :)
    – Au101
    Oct 23 '16 at 0:05
3

The phrase “Bellman Operator” is part of the definition! It must appear in it, but earlier.

\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}

\theoremstyle{definition}
\newtheorem*{definition}{Definition}

\begin{document}

\begin{definition}
The \emph{Bellman Operator for $V^{\pi}$} is defined as 
$T^{\pi}\colon\mathbb{R}^{|S|} \to \mathbb{R}^{|S|}$ by
\[
(T^{\pi}V^{\pi})(s) = 
\sum_{a \in A} \pi(a|s) \Bigl[ 
  R(s,a) + \gamma \sum_{s' \in S} P(s' \mid s,a) V^{\pi}(s')
\Bigr]
\]
It maps value functions to value functions.
\end{definition}

The Bellman operator for $V^{\pi}$ defined above has the following properties:
\begin{itemize}
\item $V^{\pi}$ is a \emph{fixed point} for $V^{\pi}$, which means 
      that $T^{\pi}V^{\pi} = V^{\pi}$;
\item $T^{\pi}$ is linear;
\item if $0<\gamma<1$ then $T^{\pi}$ is a \emph{maximum-norm contraction}.
\end{itemize}

\end{document}

You may not want the line \theoremstyle{definition} before defining the definition environment; in this case the text will be italicized, except for the argument of \emph which would be in upright type. Usually definitions are typeset in upright type and only the defined term is in italics.

Points to note:

  1. Never leave a blank line before a display

  2. Think twice before leaving a blank line after a display, which means starting a new paragraph

  3. Never use $$

  4. The clause “It maps…” should go after the definition

  5. The text about the properties is a new paragraph, so it should be indented

  6. There's absolutely no need to use \newtheorem in front of every such environment

  7. The enumerate or itemize environment should not have a blank line in front of it, because it's introduced by a clause

  8. It's “which means”, not “that means”

Here's the rendering.

enter image description here

If you feel that \mid leaves too wide a space around the |, at least use \,|\, (and better define a macro).

By the way, I can't make sense of such a definition; please, check the part $V^{\pi}$ is a \emph{fixed point} for $V^{\pi}$, because it doesn't seem to mean anything sensible.

3
  • Good to know that you have some misgivings about the contents as well. I had the exact same misgivings but -- not being a mathematician myself (though I'm quite familiar with Bellman's equation and contraction mappings...) -- chose to constrain my answer to the the purely typographic issues... E.g, I'm pretty sure the sentence in the first \item should read "$V^{\pi}$ is a \emph{fixed point} for $T^{\pi}$".
    – Mico
    Oct 22 '16 at 18:27
  • 1
    Shouldn't there be period/full stop after the display equation?
    – StrongBad
    Oct 22 '16 at 20:11
  • 1
    using amsthm, it's assumed that any theorem-class environment ends with a paragraph break, so the next line of text is indented. other theorem packages may differ. Oct 22 '16 at 20:50
1

This is paragraph indentation. Just remove the blank line between \end{BellOpV} and The \emph{Bellman Operator for $V^{\pi}$}....

Comment aside: never use $$ ... $$ with LaTeX. This is plain TeX syntax and yields bad spacing. Use \[ ... \] instead.

1
  • Removing the blank line won't work. The end of the definition issues a new paragraph by itself.
    – campa
    Oct 22 '16 at 15:14
0

I solved in the following way:

\newtheorem{BellOpV}{Definition}
\AfterEndEnvironment{BellOpV}{\noindent\ignorespaces}
3
  • 1
    Are you sure that you want the line below it always non indented? If it is a new paragraph, it should be indented!
    – Sigur
    Oct 22 '16 at 15:21
  • @Sigur: That is debatable, as there is a vertical skip.
    – Bernard
    Oct 22 '16 at 17:22
  • Would this even work in the OPs case because of the blank line before The... ?
    – daleif
    Oct 22 '16 at 17:26

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.