2

So, this is my code, that i'm using for displaying theorems in Latex.

\documentclass{article}
\usepackage [utf8x] {inputenc}
\usepackage [T2A] {fontenc}
\usepackage[russian,english]{babel}
\usepackage{amsmath, amssymb}
\usepackage{amsthm}
\parindent=0cm
\newtheoremstyle{myLovelyTheorem}% name
{}%         Space above, empty = `usual value'
{}%         Space below
{}% Body font
{\parindent}%        Indent amount (empty = no indent, \parindent = para indent)
{\bfseries}% Thm head font
{.}%        Punctuation after thm head
{\newline}% Space after thm head: \newline = linebreak
{}%         Thm head spec
\theoremstyle{myLovelyTheorem}
\newtheorem{thm}{Theorem}[section]
\newtheorem*{prf}{Proof}
\newtheorem*{lem}{Lemma}

And when i'm write something like this:

\begin{document}
    \begin{thm}
            text here
    \end{lem}

I get theorems, proofs, lems like this:

So, i haven't space after my theorem starts. I mean i havent space like if i using \par instead \newline, but if i write \par it's getting me mistake.

All code:

\documentclass{article}
\usepackage [utf8x] {inputenc}
\usepackage [T2A] {fontenc}
\usepackage[russian,english]{babel}
\usepackage{amsmath, amssymb}
\usepackage{amsthm}
\parindent=0cm
\newtheoremstyle{myLovelyTheorem}% name
{}%         Space above, empty = `usual value'
{}%         Space below
{}% Body font
{\parindent}%         Indent amount (empty = no indent, \parindent = para indent)
{\bfseries}% Thm head font
{.}%        Punctuation after thm head
{\newline}% Space after thm head: \newline = linebreak
{}%         Thm head spec
\theoremstyle{myLovelyTheorem}
\newtheorem{thm}{Теорема}[section]

\newtheorem*{prf}{Док-во}
\newtheorem*{lem}{Лемма}


\begin{document}
    \begin{lem}
            Пусть $f(x) = (x-x_0)^n$, тогда $f^{(k)}(x_0) = \begin{cases} n! & k = n \\ 0 & k \ne n \end{cases} $
    \end{lem}
    \begin{prf}
            $f^{(n)}(x) = n(n-1)...(n-k+1)(x-x_0)^{n-k}$

    \end{prf}
    \begin{thm}[Формула Тейлора для многочлена]
            Пусть $T$ - многочлен степени $\le n$, тогда $T(x) = \sum\limits_{k = 0}^n  \frac{T^{(k)}(x_0)}{k!}(x-x_0)^k$.
    \end{thm}
    \begin{prf}
            $T(x) = \sum\limits_{k=0}^n c_k(x-x_0)^k$

            $T^{(n)}(x) = \sum\limits_{k=0}^n c_k((x-x_0)^k)^{(n)}  =$ 

            $= c_1((x-x_0)^1)^{(n)} + c_2((x-x_0)^2)^{(2)} + ... + c_n((x-x_0)^n)^{(n)}$


            Подставим $x = x_0$, тогда $T^{(n)}(x_0) = c_n\cdot n! \Rightarrow c_n = \frac{T^{(n)}(x_0)}{n!}$
    \end{prf}
\end{document}
2
  • Welcome to TeX.SE. Please provide a complete document, not fragments
    – user31729
    Feb 7, 2017 at 9:35
  • In your set up a \par in ordinary text adds no space. What do you wish to achieve? Feb 7, 2017 at 9:56

1 Answer 1

1

Your question is not very clear, but since you explicitly set \parindent to zero, while specifying \parindent as the fifth argument of \newtheoremstyle, I’m assuming that you want to indent by the “normal paragraph indent” the heading of your theorems, in spite of having no paragraph indentation for the normal text. The following code does exactly this.

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{amsmath}
\usepackage{amsthm}

\newlength{\myparindent}% it is also possible to avoid using a "\skip" register
\setlength{\myparindent}{\parindent}
\setlength{\parindent}{0pt}

\newtheoremstyle{myLovelyTheorem}% name
    {}% Space above, empty = `usual value'
    {}% Space below
    {}% Body font
    {\myparindent}% Indent amount (empty = no indent, \parindent = para indent)
    {\bfseries}% Thm head font
    {.}%        Punctuation after thm head
    {\newline}% Space after thm head: \newline = linebreak
    {}%         Thm head spec
\theoremstyle{myLovelyTheorem}
\newtheorem{thm}{Theorem}[section]

\newtheorem*{prf}{Proof}
\newtheorem*{lem}{Lemma}



\begin{document}

\section{A section title}

This is normal text, let us continue it at least until the next line to show the
paragraph indentation.

\begin{lem}
    For all~$x$, we have $x+x=2x$.
\end{lem}
\begin{prf}
    Exercise.
\end{prf}
\begin{thm}
    It holds true that $1+1=2$.
\end{thm}
\begin{prf}
    Apply the lemma for $x=1$, and note that, being $1$ the unit of the field 
    of real numbers, we have $2\cdot1=2$.
\end{prf}

\end{document}

This is the output:

Output of the code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .