在新定义的 \end 环境的末尾,正方形没有向右对齐

在新定义的 \end 环境的末尾,正方形没有向右对齐

我写了下面的代码,

\documentclass[10pt, twocolumn, twoside, journal]{IEEEtran}

\usepackage{amsmath, amsfonts, amssymb, color, enumerate, amsthm, graphicx}
\usepackage{tikz, subcaption, cite}
\usepackage{color, xcolor, soul, bm}
\usepackage{marginnote}
\usepackage[normalem]{ulem}
\newtheorem{problem}{Problem}
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}{Corollary}
\newtheorem{assumption}{Assumption}
\newtheorem{proposition}{Proposition}
\newtheorem{lemma}{Lemma}
\newtheorem{remark}{Remark}
\newtheorem{definition}{Definition}
\newtheorem{example}{Example}
\usepackage{epsfig} 
\usepackage{psfrag}
\DeclareMathOperator{\diag}{diag}
\usepackage{tcolorbox}
\newcommand{\JW}[1]{{\color{red}#1}}

\usepackage{algorithm}
\usepackage{algpseudocode}
\allowdisplaybreaks


\def\endtheorem{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
\def\endlemma{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
\def\endproposition{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
\def\endexample{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
\def\endremark{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}
\def\enddefinition{\hspace*{\fill}~\IEEEQEDopen\par\endtrivlist\unskip}

\begin{document}
\title{My title}

\author{Mohammad}

\newcommand{\ty}{\color{yellow}}
\newcommand{\tb}{\color{blue}}
\newcommand{\tr}{\color{red}}
\newcommand{\tg}{\color{green}}


\maketitle

\thispagestyle{empty}
%\pagestyle{empty}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{abstract}
My abstract
\end{abstract}

\begin{IEEEkeywords}
    key words
\end{IEEEkeywords}

\begin{lemma}
This is my lemma and when the text happens to end near the right margin the symbol will be flushed left, not right.
\end{lemma}


\end{document} 

我确实看到这里已经回答了同样的问题:如何使所有类似定理的环境都有一个结束符号?

但我想知道我的 \def 命令有什么问题,以及我是否可以修复它们。如果不行,请告诉我其他解决方法。

相关内容