Page LayoutAdd different "QED" like symbols.

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
lucia_
Posts: 7
Joined: Mon Sep 14, 2020 4:04 pm

Add different "QED" like symbols.

Post by lucia_ »

Hi,

I am writing an essay which has different math environments e.g. theorems, lemmas, proofs, etc.

At the end of the proofs, I have the default white square.
I wanted to add symbols at the end of definitions, examples, and remarks as well. I found this solution online, which I've added to my preamble:

Code: Select all

\theoremstyle{definition}
\newtheorem{definitionx}{Definition}[chapter]
\newtheorem{examplex}[definitionx]{Example}
\newtheorem{remarkx}[definitionx]{Remark}

\newenvironment{example}
  {\pushQED{\qed}\renewcommand{\qedsymbol}{$\lrcorner_E$}\examplex}
  {\popQED\endexamplex}
  
 \newenvironment{remark}
  {\pushQED{\qed}\renewcommand{\qedsymbol}{$\lrcorner_R$}\remarkx}
  {\popQED\endremarkx}
  
  \newenvironment{definition}
  {\pushQED{\qed}\renewcommand{\qedsymbol}{$\lrcorner_D$}\definitionx}
  {\popQED\enddefinitionx}
The only problem is that I've noticed that when I have a proof environment inside of a remark environment, the white square at the end of the proof is changing to the remark symbol: $\lrcorner_R$

Anyone know how I can fix this?
Last edited by Stefan Kottwitz on Mon Apr 12, 2021 7:34 pm, edited 2 times in total.
Reason: code marked

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

Add different "QED" like symbols.

Post by Stefan Kottwitz »

Hi Lucia,

which theorem package are you using? There are several (amsthm, ntheorem, and more).

Stefan
LaTeX.org admin
lucia_
Posts: 7
Joined: Mon Sep 14, 2020 4:04 pm

Add different "QED" like symbols.

Post by lucia_ »

Hi Stefan,

I am using amsthm.

Lucia
User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

Add different "QED" like symbols.

Post by Stefan Kottwitz »

Here is an example for our members that shows what happens. That's for the forum helpers to easily test by a click on "Run LaTeX here".

Code: Select all

\documentclass{report}
\usepackage{amsthm}
\usepackage{amssymb}
\theoremstyle{definition}
\newtheorem{definitionx}{Definition}[chapter]
\newtheorem{examplex}[definitionx]{Example}
\newtheorem{remarkx}[definitionx]{Remark}

\newenvironment{example}
  {\pushQED{\qed}\renewcommand{\qedsymbol}{$\lrcorner_E$}\examplex}
  {\popQED\endexamplex}
  
 \newenvironment{remark}
  {\pushQED{\qed}\renewcommand{\qedsymbol}{$\lrcorner_R$}\remarkx}
  {\popQED\endremarkx}
  
  \newenvironment{definition}
  {\pushQED{\qed}\renewcommand{\qedsymbol}{$\lrcorner_D$}\definitionx}
  {\popQED\enddefinitionx}
\begin{document}
\begin{remark}
This is a remark.
\begin{proof}
This is a proof.
\end{proof}
\end{remark}
\end{document}
Stefan
LaTeX.org admin
rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

Add different "QED" like symbols.

Post by rais »

This should bring the square back for a proof even inside another definition-like environment, where a different qed symbol is used:

Code: Select all

\documentclass{report}
\usepackage{amsthm}
\usepackage{amssymb}
\theoremstyle{definition}
\newtheorem{definitionx}{Definition}[chapter]
\newtheorem{examplex}[definitionx]{Example}
\newtheorem{remarkx}[definitionx]{Remark}

\newenvironment{example}
  {\pushQED{\qed}\renewcommand{\qedsymbol}{$\lrcorner_E$}\examplex}
  {\popQED\endexamplex}
  
 \newenvironment{remark}
  {\pushQED{\qed}\renewcommand{\qedsymbol}{$\lrcorner_R$}\remarkx}
  {\popQED\endremarkx}
  
  \newenvironment{definition}
  {\pushQED{\qed}\renewcommand{\qedsymbol}{$\lrcorner_D$}\definitionx}
  {\popQED\enddefinitionx}

\makeatletter
\renewenvironment{proof}[1][\proofname]{\par
  \pushQED{\qed}%
  \renewcommand\qedsymbol{\openbox}%<--
  \normalfont \topsep6\p@\@plus6\p@\relax
  \trivlist
  \item[\hskip\labelsep
        \itshape
    #1\@addpunct{.}]\ignorespaces
}{%
  \popQED\endtrivlist\@endpefalse
}
\makeatother
\begin{document}
\begin{remark}
This is a remark.
\begin{proof}
This is a proof.
\end{proof}
\end{remark}
\end{document}
KR
Rainer
lucia_
Posts: 7
Joined: Mon Sep 14, 2020 4:04 pm

Add different "QED" like symbols.

Post by lucia_ »

Amazing! Thank you :)
Post Reply