如何在盒装定理环境中调整我所做的描述与枚举语句的位置?

如何在盒装定理环境中调整我所做的描述与枚举语句的位置?

基本上,我想要一个优雅的命令,使与枚举语句一起进行的描述(交换律、结合律等)与围绕我的定理环境的灰色框的最右侧对齐。我将不胜感激任何可以解决此问题的代码或建议。

这是我从图像下方的最少代码中获得的输出: 在此处输入图片描述

    \documentclass[english,nohyper]{tufte-handout}
    \usepackage{amsthm}
    \usepackage{amsmath}


    \usepackage{enumitem}       % customizable list environments
    \newtheorem{thm}{\protect\theoremname}


    \usepackage{framed} % responsible for creating gray box around environment
    \definecolor{shadecolor}{RGB}{236,236,236}
    \providecommand{\theoremname}{Theorem}

    \begin{document}
    \begin{snugshade} % begins gray box around thm
    \begin{thm}
    let so and so be, then:
    \begin{enumerate}[labelindent=0pt,leftmargin=*,widest= a,label=\textup{\textbf{(\alph*)}}]
    \item $A+B=B+A\quad\text{commutativity}$
    \item $A+\left(B+C\right)=\left(A+B\right)+C\quad\text{associativity}$
    \item $O+A=A+O=A\quad\text{identity}$
    \item $A+\left(-A\right)=O\quad\text{inverse}$
    \end{enumerate}
    \end{thm}
    \end{snugshade} % ends gray box around thm
    \end{document}

答案1

\quad不要使用 ,而要使用\hspace{\fill}

\documentclass[english,nohyper]{tufte-handout}
\usepackage{amsthm}
\usepackage{amsmath}


\usepackage{enumitem}       % customizable list environments
\newtheorem{thm}{\protect\theoremname}


\usepackage{framed} %creates gray box around environment
\definecolor{shadecolor}{RGB}{236,236,236}
\providecommand{\theoremname}{Theorem}

\begin{document}
\begin{snugshade}
\begin{thm}
let so and so be, then:    
\begin{enumerate}[labelindent=0pt,leftmargin=*,widest= a,label=\textup{\textbf{(\alph*)}}]
\item $A+B=B+A \hspace{\fill}\text{commutativity}$
\item $A+\left(B+C\right)=\left(A+B\right)+C \hspace{\fill}\text{associativity}$
\item $O+A=A+O=A \hspace{\fill}\text{identity}$
\item $A+\left(-A\right)=O\hspace{\fill}\text{inverse}$
\end{enumerate}
\end{thm}
\end{snugshade}
\end{document}

在此处输入图片描述

更新根据建议克里斯(cmhughes),您可以使用优雅的mdframed包来放置框架等,并且它是高度可定制的。查看mdframed 手册以及一些通过texdoc mdframed命令提示符运行的示例。下面是一个使用 mdframed 的最小示例:

\documentclass[english,nohyper]{tufte-handout}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{enumitem}       % customizable list environments
\newtheorem{thm}{\protect\theoremname}
\usepackage[framemethod=default]{mdframed}
\usepackage{framed} % responsible for creating gray box around environment
\definecolor{shadecolor}{RGB}{236,236,236}
\providecommand{\theoremname}{Theorem}
\mdfdefinestyle{theoremstyle}{%
linecolor=red,linewidth=.5pt,%
frametitlerule=true,%
frametitlebackgroundcolor=gray!30,
backgroundcolor=gray!10,
innertopmargin=\topskip,
}
\newenvironment{mdthm}
{\begin{mdframed}[style=theoremstyle]\begin{thm}}
{\end{thm}\end{mdframed}}

\begin{document}
\begin{mdthm}
let so and so be, then:
\begin{enumerate}[labelindent=0pt,leftmargin=*,widest=a,label=\textup{\textbf{(\alph*)}}]
\item $A+B=B+A\hspace{\fill}\text{commutativity}$
\item $A+\left(B+C\right)=\left(A+B\right)+C\hspace{\fill}\text{associativity}$
\item $O+A=A+O=A\hspace{\fill}\text{identity}$
\item $A+\left(-A\right)=O\hspace{\fill}\text{inverse}$
\end{enumerate}
\end{mdthm}

\mdtheorem[style=theoremstyle]{thmm}{Theorem}
Another style with some change:
\begin{thmm}[\normalfont let so and so be, then:]
\begin{enumerate}[labelindent=0pt,leftmargin=*,widest= a,label=\textup{\textbf{(\alph*)}}]
\item $A+B=B+A \hspace{\fill}\text{commutativity}$
\item $A+\left(B+C\right)=\left(A+B\right)+C \hspace{\fill}\text{associativity}$
\item $O+A=A+O=A \hspace{\fill}\text{identity}$
\item $A+\left(-A\right)=O\hspace{\fill}\text{inverse}$
\end{enumerate}
\end{thmm}
\end{document}

在此处输入图片描述

相关内容