Hot answers tagged

33

The style "plain" should be equivalent to \newtheoremstyle{plain} {\topsep} % ABOVESPACE {\topsep} % BELOWSPACE {\itshape} % BODYFONT {0pt} % INDENT (empty value is the same as 0pt) {\bfseries} % HEADFONT {.} % HEADPUNCT {5pt plus 1pt minus 1pt} % HEADSPACE {} % CUSTOM-HEAD-SPEC The style "definition" is the same ...


32

You can put this in the preamble, without the need to define new theorem styles; in fact this redefines the plain and definition theorem styles in order that the theorem title has the same font attributes as the theorem heading: \usepackage{amsthm} \makeatletter \def\th@plain{% \thm@notefont{}% same as heading font \itshape % body font } \def\th@...


32

You need to redefine \proofname: \documentclass{amsbook} \usepackage{amsthm} \renewcommand*{\proofname}{Solution} \begin{document} \begin{proof} This is a solution. \end{proof} \end{document}


23

You can use the thmtools package as a front-end to amsthm; adding the end marks is then an easy matter: \documentclass{book} \usepackage{amssymb} \usepackage{amsthm} \usepackage{thmtools} \declaretheorem[style=definition,qed=$\blacksquare$,numberwithin=chapter]{definition} \declaretheorem[style=definition,qed=$\blacktriangle$,sibling=definition]{example} \...


20

I actually found out the answer to my question by going the ECM route. What was causing the problem was that I was using the parskip package with the option parfill, so that paragraphs, instead of starting with a blank indent, would start with no indent but separated by a blank line. ECM: \documentclass{article} \usepackage{amsthm} \newtheorem{theorem}{...


20

Yes, there's an easy way. You can define your solution environment with "Solution" as the optional argument for proof: \documentclass{article} \usepackage{amsthm} \newenvironment{solution} {\begin{proof}[Solution]} {\end{proof}} \begin{document} \begin{proof} test. \end{proof} \begin{solution} test. \end{solution} \end{document}


18

a manual way to drop to a new line immediately after the proof heading is to insert $ $\newline but it's possible to build on the existing proof definition and thereby retain the ability to use the \qedhere facility to move the "tombstone" up to the actual last line of the proof. \documentclass{article} \usepackage{amsmath,amsthm} \newenvironment{myproof}...


17

with amsthm, you can provide an optional proof heading ending with \nopunct; this setting is checked by \@addpunct before adding the period. so you could input \begin{proof}[Proof:\nopunct] ... \end{proof} and the last thing in the heading would be the colon. or you could just omit all punctuation -- but you do have to use the option to provide the text. ...


17

You need to update the way the theorem header is set, since it includes ( ) by default (taken from amsclass.dtx): \def\thmhead@plain#1#2#3{% \thmname{#1}\thmnumber{\@ifnotempty{#1}{ }\@upn{#2}}% \thmnote{ {\the\thm@notefont(#3)}}} \let\thmhead\thmhead@plain Note the use of (#3) above. So, we copy-and-paste the above definition with the adjustment: \...


16

Put the following code in the preamble: \makeatletter \def\thm@space@setup{% \thm@preskip=\parskip \thm@postskip=0pt } \makeatother The problem is that amsthm sets \thm@preskip to \topsep, which is zeroed by parskip.


16

it's probable that your proof ends with a list or a display environment. since you're using amsthm, you can put \qedhere just before the end of that environment and the "tombstone" will be moved up onto the last line of the list or display. edit: with the addition of a (non)working example, it became obvious that the problem was caused by a blank line ...


16

If you remove the blank line between This is the concluding line of the proof. and the \end{proof}, the problem disappears.


16

You can use mdframed: \documentclass{article} \usepackage{amsthm} \usepackage[framemethod=tikz]{mdframed} \usepackage{lipsum} \theoremstyle{plain} \newmdtheoremenv[ linecolor=cyan, roundcorner=5pt, linewidth=1pt ]{theo}{Theorem} \theoremstyle{definition} \newmdtheoremenv[ hidealllines=true, leftline=true, innerleftmargin=10pt, ...


15

You can put this code to the very end of your preamble: \usepackage{environ} \NewEnviron{killcontents}{} \let\proof\killcontents \let\endproof\endkillcontents It defines the environment killcontents that kills its contents, and then "maps" proof environment to killcontents.


15

This problem isn't so easy to solve. the problem consist in this: hyperref only defines a name if you use \newtheorem{theorem}{<theorem name>} for using with \autoref. This name is Theorem in English (obviously changes if we use babel), it is stored in the macro \theoremautorefname and can be changed using \renewcommand{\theoremautorefname}{<new ...


14

Here's a complete MWE with description using the amsthm package, see section 4.3 of the documentation for more details \documentclass{article} \usepackage{lipsum} \usepackage{amsthm} \newtheoremstyle{mystyle}% % Name {}% % Space above {}% % Space below {\itshape}% ...


14

Loading thmtools and nameref will give you this feature. You will have to use \nameref instead of \cref, but I think most of the time it is you who is the best to decide whether it is the theorem's name or number you want to reference. EDIT Code added with commands \myref and \Myref for single references to automatically add the name in brackets when ...


14

By design latex tries to give commands a consistent syntax, the environment syntax in particular here makes it clear what is intended to be in math, and what is not. However the error message comes from the tex engine itself if \par is seen in math mode. To prevent this latex would have to prevent blank lines generating a \par token (which is tricky to do ...


13

This is a known issue that is associated with hyperref and is discussed/answered in the UK TeX FAQ. In answer to your "bonus question": This stems from the fact that you're using the same counter to reference two different things by virtue of \newtheorem{thm}{Theorem} \newtheorem{lem}[thm]{Lemma} This tells LaTeX that you want a new environment called lem,...


13

This can be solved by using the final argument of \newtheoremstyle. It has an unusual format that is the content of a three argument command for printing the title heading. To get the name, number and optional title you make it be \thmname{#1}\thmnumber{ #2}\thmnote{ (#3)} which is essentially the standard definition \def\thmhead@plain#1#2#3{% \...


13

You can change just the end environment via: \let\Oldendex\endex% \def\endex{\qed\Oldendex}% Here is a before and after: Code: \documentclass{book} \usepackage{amssymb, amsmath, amsthm} \newtheorem{ex}{Example}[chapter] \let\Oldendex\endex% \def\endex{\qed\Oldendex}% \begin{document} \begin{ex} This is my example \end{ex} \end{document}


13

amsthm and mathtools are unrelated. mathtools updates and extends amsmath. you still need amsthm if you want the proof environment.


12

A way to do this is to use the thmtools package: \documentclass{article} \usepackage{amsthm} \usepackage{thmtools} \declaretheorem{theorem} \declaretheoremstyle[% spaceabove=-6pt,% spacebelow=6pt,% headfont=\normalfont\itshape,% postheadspace=1em,% qed=\qedsymbol,% headpunct={} ]{mystyle} \declaretheorem[name={Proof},style=mystyle,...


12

A better and simpler solution is to redefine \proofname: \usepackage{amsthm} \let\oldproofname=\proofname \renewcommand{\proofname}{\rm\bf{\oldproofname}} This is better than redefining the proof environment because the environment goes to considerable lengths to position the \qed mark correctly, and to respect the indentation style used in theorems (which ...


12

The following code uses the .aux file for that. It provides a macro \total@problems that sets \totalproblems to its parameter. And calls this macro at the end of document to store the value of counter problem. You need to run twice, and there is 0 stored at the first run. \documentclass{article} \usepackage{amsthm} \newtheorem{problem}{Problem} % STARTS ...


12

This is a more proper way to do it: \documentclass[a4paper,12pt]{article} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{amssymb,amsmath,amsthm} \newtheorem{theorem}{Theorem} \usepackage{mathtools} % Bonus \DeclarePairedDelimiter\norm\lVert\rVert \begin{document} \section{Mathematical Methods} \begin{theorem}[Placheral's Theorem] ...


12

UPDATE This is fixed in hyperref release 6.83q 2016-06-24 The change to hyperref was to fix this issue https://github.com/ho-tex/hyperref/issues/11 which I have just re-opened, pointing here. I will update hyperref to address this (somehow:-) but meanwhile, this works: \documentclass{article} \usepackage{amsthm} \usepackage{hyperref} \usepackage{...


12

The error message tells exactly why it is problematic: Paragraph ended before \align was complete. In standard (La)TeX, an empty line signifies a paragraph break. Since it does not make sense to start a new paragraph inside a single math display, the display math environments were not implemented with paragraph breaks in mind (a simplification, but we ...


Only top voted, non community-wiki answers of a minimum length are eligible