I'm new to latex, and I've done a lot of searching but can't seem to find a fix for this:
I want a pretty straightforward proof environment, proof followed by a hanging indent.
Like this:
\documentclass{article}
\parindent=0pt
\parskip=\medskipamount
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{amsmath}
\begin{document}
\paragraph{Proof:}
\hangindent=4em
hello there!\\
testing testing\\
\begin{flalign*}
A &= B \\
C &= D \end{flalign*}
bla bla bla!\\
\end{document}
Which seems to work nicely.
But when I try to make a \newenvironment out of it, it doesn't seem to work:
\documentclass{article}
\parindent=0pt
\parskip=\medskipamount
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{amsmath}
\newenvironment{pf}
{\paragraph{Proof:} \hangindent=4em}{}
\begin{document}
\begin{pf}
hello there!\\
testing testing\\
\begin{flalign*}
A &= B \\
C &= D \end{flalign*}
bla bla bla!\\
\end{pf}
\end{document}
The indent is no longer preserved (the last line is off), and I can't figure out why...
In another more convoluted attempt, I've tried \tabu inside of a \tabu:
\documentclass[12pt,parskip=full]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{amsmath, tabu}
\usepackage{graphicx}
\usepackage{tabularx}
\newenvironment{pfa}
{
\begin{tabu}{l|p{16cm}}
\textit{Proof:} &
\begin{tabu}{p16cm}
}
{ \qed
\end{tabu}
\end{tabu}
}
\begin{document}
\hrulefill
\begin{tabu}{l|p{16cm}}
Proof: & \begin{tabu}{p{16cm}}
hello there!\\
testing testing\\
{\begin{align}
A &= B \\
C &= D \end{align}}
\qed
\end{tabu}
\end{tabu}
\hrulefill
\begin{pfa}
hello there!\\
{\begin{align}
A &= B \\
C &= D \end{align}}
\end{pfa}
\end{document}
Once more, the manually written version works, but the \newevironment fails and throws errors which I can't seem to fix.
\hangindent
. If you want an entire block of code offset from the margin(s), then you can useadjustwidth
fromchangepage
. For more on this, see Indenting a whole paragraph.\par
at the end of the environment, like this:\newenvironment*{pf}{\paragraph*{Proof:}\setlength\hangindent{4em}}{\par}
(note that I use\paragraph*
, not\paragraph
). But, as @Werner has already remarked, this is not the right approach. May I also suggest adescription
environment, customized to your needs with the help of theenumitem
package?tabu
at all costs? Believe me, you do not want to use this package.