3

I want to put an qedsymbol at the end of a non-proof environment such as

\begin{theorem}
This is a funny equation
\[
\begin{array}{rcl}
x+y&=&z,\\
a+b&=&c.
\end{array}
\]
\end{theorem}

and I want to put the symbol at the right side of the line of

a+b=c

but not the right side of the whole list of equations.

And also in a proof environment I want to make qedsymbol at the right side of the line of a+b=c but not the right side of the whole list of equations.

\begin{proof}
So we have
\[
\begin{array}{rcl}
x_1+y^2&=&z^3,\\
a^2+b_2&=&c^6.
\end{array}
\]
\end{proof}

QUESTION: Who has a good way to do these two things together?

All the codes of mine are as follows.

\documentclass[11pt,b5paper]{ctexbook}
\usepackage{amsmath,amsthm,amssymb,amsfonts,mathrsfs}
%%%change qedsymbol%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\qedsymbol}{\ensuremath\boxtimes}
%%%set theorems%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\theoremstyle{theorem}
\newtheorem{theorem}{定理}[section]
\newtheorem{lemma}[theorem]{引理}
\newtheorem{corollary}[theorem]{推论}
\newtheorem{proposition}[theorem]{命题}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{定义}
\newtheorem{remark}[theorem]{评注}
\newtheorem{example}[theorem]{示例}
\newtheorem{exercise}[theorem]{习题}
\newtheorem{thesis}[theorem]{论题}
\newtheorem{conjecture}[theorem]{猜想}
\newtheorem{convention}[theorem]{约定}
\newtheorem{problem}[theorem]{问题}
\newtheorem{axiom}[theorem]{公理}    
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\begin{theorem}
This is a funny equation
\[
\begin{array}{rcl}
x+y&=&z,\\
a+b&=&c.\qedhere
\end{array}
\]
\end{theorem}

\begin{proof}
So we have
\[
\begin{array}{rcl}
x_1+y^2&=&z^3,\\
a^2+b_2&=&c^6.\qedhere
\end{array}
\]
\end{proof}


\begin{proof}
So we have
\begin{align*}
x+y&=z,\\
a+b&=c.\qedhere
\end{align*}
\end{proof}

\end{document}

The compiled PDF sample is also as follows.

enter image description here

NOTE: the new command \myqed I defined can only work in the equation environment (with only 1 line of equations), but can't work in the align* environment. So I still haven't solve the problem.

6
  • 2
    Try looking at \qedhere, in this post or this post for example.
    – Sandy G
    Dec 7, 2017 at 4:58
  • 2
    Also, when you post a question, please provide a "Minimal Working Example" (MWE) that starts with \documentclass, includes all relevant \usepackage commands, ends with \end{document} and compiles without errors, even if it does not produce your desired output.
    – Sandy G
    Dec 7, 2017 at 5:02
  • A working sample has been provided. \qedhere doesn't work
    – M. Logic
    Dec 7, 2017 at 6:09
  • 1
    Replace the array witl align as in the example sin the linked posts. The way you are using array is giving you incorrect spacing. Dec 7, 2017 at 6:12
  • It doesn't work either! @Peter Grill
    – M. Logic
    Dec 7, 2017 at 7:36

2 Answers 2

1

I fixed your code:

\documentclass[11pt,b5paper]{ctexbook}
\usepackage{amsmath,amsthm,amssymb,amsfonts,mathrsfs}
%%%change qedsymbol%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\qedsymbol}{\ensuremath\boxtimes}
%%%set theorems%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\theoremstyle{theorem}
\newtheorem{theorem}{定理}[section]
\newtheorem{lemma}[theorem]{引理}
\newtheorem{corollary}[theorem]{推论}
\newtheorem{proposition}[theorem]{命题}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{定义}
\newtheorem{remark}[theorem]{评注}
\newtheorem{example}[theorem]{示例}
\newtheorem{exercise}[theorem]{习题}
\newtheorem{thesis}[theorem]{论题}
\newtheorem{conjecture}[theorem]{猜想}
\newtheorem{convention}[theorem]{约定}
\newtheorem{problem}[theorem]{问题}
\newtheorem{axiom}[theorem]{公理}    
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\begin{theorem}
This is a funny equation
\begin{align*}
x+y&=z,\\
a+b&=c.\qedhere
\end{align*}
\end{theorem}

\begin{proof}
So we have
\begin{align*}
x_1+y^2&=z^3,\\
a^2+b_2&=c^6.\qedhere
\end{align*}
\end{proof}


\begin{proof}
So we have
\begin{align*}
x+y&=z,\\
a+b&=c.\qedhere
\end{align*}
\end{proof}

\end{document}

enter image description here

If array environment is the last object in the theorem or proof environment, then you should do this:

\begin{theorem}
This is a funny equation
\[
\begin{array}[b]{...}
....
\end{array}\qedhere
\]
\end{theorem}
2
  • @Kuttens -- Try this: \[a+b+c=e.\qedhere\]
    – user91669
    Dec 8, 2017 at 13:16
  • I don't know how to apply to definitions.
    – M. Logic
    Dec 8, 2017 at 13:34
3
\documentclass{article}
\usepackage{amsmath,amsthm}
\newtheorem{thm}{Theorem}
\newenvironment{theorem}[1][]{\begin{thm}[#1]\pushQED{\qed}}{\popQED\end{thm}}
\begin{document}
\begin{theorem}
This is a funny equation
\begin{align*}
x+y&=z,\\
a+b&=c.\qedhere
\end{align*}
\end{theorem}

\begin{proof}
So we have
\begin{align*}
x+y&=z,\\
a+b&=c.\qedhere
\end{align*}
\end{proof}
\end{document}

enter image description here

12
  • But I use \usepackage{amsthm,amsmath,amssymb,amsfonts,mathrsfs} and so your method doesn't work. I don't know why.
    – M. Logic
    Dec 7, 2017 at 8:29
  • @Kuttens amsthdoc page 2: "If the amsthm package is used with a non-AMS document class and with the amsmath package, amsthm must be loaded after amsmath, not before."
    – user91669
    Dec 7, 2017 at 9:41
  • In fact, I define a new theorem environment and a new proof environment in my actual file, and so these codes don't work
    – M. Logic
    Dec 7, 2017 at 9:54
  • Then you're doing something wrong. Some tips: Don't use array environment in this case. amsthm must be loaded after amsmath, not before.
    – user91669
    Dec 7, 2017 at 10:31
  • @Kuttens -- if you're defining new theorem and proof environments, then there's little point in using amsthm at all. maybe there's a different package for theorems that would suit you better. Dec 7, 2017 at 14:33

You must log in to answer this question.

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