0

MWE

\documentclass[a4paper, 12pt]{exam}
\usepackage{amsthm}
\usepackage{thmtools}
\begin{document}
\newtheorem{definition}{Definition}
\newtheorem{example}{Example}
%\newtheorem{proof}{Proof}
\newtheorem{remark}{Remark}
\newtheorem{theorem}{Theorem}
\newtheorem{note}{Note}
\newtheorem{recall}{Recall}



\title{functions}
\author{Credible organization}
\maketitle


\begin{definition}
     arc Length Let curve C be determined by vector function f(t) The arc length s for t= a to t isntent...
\end{definition}

\end{document}

Requirement

I have this example to show the multiple versions of \newtheorem I have created. The output looks like this.

original

I'd like the same text to be indented like this:

enter image description here


I have tried manually specifying the space of the indent but, the space varies for all of my instances of \newtheorem. I also tried this method but it was cumbersome; not because I had to do that for 6 times, it just made managing and updating the source file hard.

How do I declare a new theorem style to be indented in the above pattern that works for other version of the theorems too?

4
  • Indentation? Aren't you referring to a new paragraph? So why aren't your second paragraph in the example started by a blank line as usual? Under normal settings, new paragraphs are indented.
    – daleif
    Commented Jul 23 at 7:09
  • 1
    @daleif. It is to be taken as a single sentence. Sorry for the inconvenience. I'll edit that out. If you are still confused I will add actual images :D Commented Jul 23 at 7:46
  • That definately was not clear.
    – daleif
    Commented Jul 23 at 7:58
  • @DavidCarlisle Really sorry for the whole confusion. I fixed it. Commented Jul 23 at 9:43

1 Answer 1

1

If your theorems are all of this style and don't contain lists (the margin is wrong for lists), this should work.

\documentclass[a4paper,12pt]{exam}
\usepackage{amsthm,kantlipsum}

\newtheorem{definition}{Definition}
\newtheorem{theorem}{Theorem}

\title{functions}
\author{Credible organization}

\makeatletter
\ExplSyntaxOn
\cs_new_protected:Nn \friendly_indentthm_aux:n
  {
    \AddToHook{env/#1/begin}
      {
        \hbox_set:Nn \l_tmpa_box
          {
            \textbf{ \text_titlecase_first:n { #1 } ~
              \int_eval:n { \value{#1} + 1 }. }
          }
        \dim_set:Nn \hangindent { \box_wd:N \l_tmpa_box + \thm@headsep }
        \dim_set_eq:NN \l_tmpa_dim \parindent
        \dim_set:Nn \parindent { \hangindent + \l_tmpa_dim }
      }
  }
\NewDocumentCommand \IndentThms { m }
  {
    \clist_map_inline:nn { #1 } { \friendly_indentthm_aux:n { ##1 } }
  }
\ExplSyntaxOff
\makeatother

\IndentThms{definition,theorem}
\begin{document}

\maketitle

\begin{definition}
\kant[1-2]
\end{definition}

\kant[3]

\begin{theorem}
\kant[4]
\end{theorem}

\end{document}

You must log in to answer this question.

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