\qedhere의 적용 가능성을 정리 클래스 요소로 확장

\qedhere의 적용 가능성을 정리 클래스 요소로 확장

목표:$\qedsymbol$이 증명의 끝을 표시하는 것처럼 일종의 기호를 사용하여 예제와 연습의 끝을 표시할 수 있기를 원합니다. 특히, 내가 선택한 기호에 대해 \qedhere와 같은 역할을 하는 명령이 필요합니다.

배경:이는 실제로 다음 목록에 나열된 잠재적인 수정 사항 중 하나입니다.amsthm 패키지 문서: "\qedhere의 적용 가능성을 정리 클래스 요소와 증명으로 확장합니다." 그들은 이것이 장점이 있지만 더 많은 작업이 필요하고 본질적으로 미루어지고 있다고 말합니다.

내 시도:

자체 종료 기호를 사용하여 운동 환경을 구현하려고 시도한 방식은 다음과 같습니다.

\documentclass{memoir}

\usepackage{amsthm}
\usepackage[varg,bigdelims]{newpxmath}
\usepackage{ifthen}

\newcounter{madesymbol}

\newtheorem{exc}{Exercise}
\newcounter{exc-counter}
\newenvironment{exercise}[1][]
{
    \begin{exc}[#1]~
    \def\mysymbol{$\lozenge$}
    \setcounter{madesymbol}{0}
    \def\tagsymbol{\stepcounter{madesymbol}\tag*{\mysymbol}}
}
{
    \ifthenelse{\equal{\value{madesymbol}}{0}}{\hspace*{\fill}\mysymbol}{}
    \end{exc}
    \stepcounter{exc-counter}
}

\begin{document}

\begin{exercise}
A function $f$...
\end{exercise}

\end{document}

이것은 부피가 큰 느낌이 들며 더 나은 솔루션을 찾고 있습니다.

n정리의 문제점: 내가 본 제안 중 하나는 ntheorem 패키지입니다. 나는 ntheorem을 시도했지만 "모든 것"을 변경하는 것 같습니다. 예를 들어 amsthm처럼 전혀 작동하지 않습니다([amsthm] 옵션이 로드된 경우에도). 누군가 이 패키지를 사용하라고 제안하면 가능한 한 amsthm과 비슷하게 작동하도록 명시적인 코드를 제공하십시오.

답변1

이 시도:

\documentclass{article}
\usepackage{amsthm}
\begin{document}

\newtheorem{ex-inner}{Exercise}
\newenvironment{ex}{%
  %\def\qedsymbol{$\lozenge$}% Set the QED symbol. 
  \pushQED{\qed}%
  \begin{ex-inner}%
}{%
  \popQED
  \end{ex-inner}%
}


\begin{ex}
Here is an exercise.
\end{ex}

\begin{ex}
Hi!
\[x=y\qedhere\]
\end{ex}

\begin{proof}
Hi!
\[x=y\qedhere\]
\end{proof}
\end{document} 

답변2

다음은 이를 어떻게 수행할 수 있는지에 대한 데모입니다 ntheorem. 한 가지 독특한 특징은 여러 줄 표시로 끝나는 경우에도 배치가 자동으로 수행된다는 것입니다(두 개의 컴파일이 필요할 수 있으며 환경 끝에 빈 줄이 없어야 합니다. QED 기호는 사용자 정의하기가 매우 쉽습니다.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage[svgnames, table]{xcolor}
\usepackage{mathtools, nccmath}

\usepackage[thmmarks, thref, amsmath]{ntheorem}
\theoremheaderfont{\itshape\bfseries}% default is \upshape\bfseries
\theoremseparator{. \textemdash}
\newtheorem{thm}{Theorem}[section]
\newtheorem{prop}{Proposition}[section]

\theoremseparator{.}
\theoremheaderfont{\upshape\bfseries}%
\theorembodyfont{\upshape\mdseries}% default is \itshape
\newtheorem{dfn}{Definition}[section]
\theoremsymbol{\raisebox{-0.1\height}{\color{IndianRed}$ \boldsymbol\diamondsuit $}}
\newtheorem{ex}{Exercise}

\theoremstyle{nonumberplain}
\theoremheaderfont{\scshape}
\theoremseparator{:}
\theoremsymbol{\ensuremath{\color{Gainsboro}\blacksquare}}

\newtheorem{proof}{Proof}
\begin{document}
\setcounter{section}{2}

\begin{thm}
Clangle-Wangles’ habits of life are domestic and superfluous, and their general demeanour pensive and pellucid.
\end{thm}

\begin{dfn}
  A \textbf{Snark} is a Boojum.
\end{dfn}

\begin{ex}
Here is an exercise.
\end{ex}

\begin{ex}
Hi!
\[ x=y \]
\end{ex}

\begin{proof}
There are two cases: \useshortskip
\begin{align*}
x & =y \\ u & =v
\end{align*}
\end{proof}

\end{document} 

여기에 이미지 설명을 입력하세요

관련 정보