以特定方式在子方程式内对齐方框方程式并使其圆角化

以特定方式在子方程式内对齐方框方程式并使其圆角化

我有以下代码,它使用来自在线来源的代码

\documentclass[]{article}

\usepackage{mathtools}
\usepackage{fancyhdr}
\usepackage{amssymb}
\usepackage{extramarks}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage[plain]{algorithm}
\usepackage{algpseudocode}
\usepackage{xcolor}
\usepackage{bbm}
\usepackage{bigints}
\usepackage{amsfonts}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{cancel}
\usepackage{cite}
\usepackage{framed}
\usepackage{empheq}


\newsavebox{\mysaveboxM} % M for math
\newsavebox{\mysaveboxT} % T for text

\newcommand*\Garybox[2][Example]{%
    \sbox{\mysaveboxM}{#2}%
    \sbox{\mysaveboxT}{\fcolorbox{black}{white}{#1}}%
    \sbox{\mysaveboxM}{%
        \parbox[b][\ht\mysaveboxM+.5\ht\mysaveboxT+.5\dp\mysaveboxT][b]{\wd\mysaveboxM}{#2}%
    }%
    \sbox{\mysaveboxM}{%
        \fcolorbox{black}{white}{%
            \makebox[\linewidth-10em]{\usebox{\mysaveboxM}}%
        }%
    }%
    \usebox{\mysaveboxM}%
    \makebox[0pt][r]{%
        \makebox[\wd\mysaveboxM][c]{%
            \raisebox{\ht\mysaveboxM-0.5\ht\mysaveboxT+0.5\dp\mysaveboxT-0.5\fboxrule}{\usebox{\mysaveboxT}}%
        }%
    }%
}

\begin{document}
    \begin{subequations}
            \begin{empheq}[box=\Garybox]{align}
        \sum \mathbf{F} &= \mathbf{0} \label{a} \\
        \sum F_{x} \,\mathbf{i} + \sum F_{y} \,\mathbf{j} + \sum F_{z} \,\mathbf{k} &= 
        \mathbf{0} \label{b} \\
        \sum F_{x} &= 0 \label{c} \\
        \sum F_{y} &= 0 \label{d} \\
        \sum F_{z} &= 0 \label{e}
        \end{empheq}
    \end{subequations}
\end{document}

我得到以下 在此处输入图片描述

我需要将所有角都弄圆,而且方程式似乎没有居中,我希望每个方程式都居中。我一直在尝试修改代码,但出现编译错误或根本没有更改。我将不胜感激任何帮助,我感谢所有帮助者。

答案1

使用 tcolorbox p.15 文档

\documentclass{article}
\usepackage{amsmath, amssymb}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\newtcolorbox{mybox}[2][]{%<--- see the dox tcolorbox p.15
  colback=red!5!white,
  colframe=red!75!black,
  fonttitle=\bfseries,
  colbacktitle=red!85!black,
  enhanced,
  attach boxed title to top center={yshift=-2mm},
  title={#2},#1}
\begin{document}
\begin{mybox}[colback=yellow]{Example}%<--- see the dox tcolorbox p.15
  \begin{subequations}
    \begin{gather}
      \sum \mathbf{F} = \mathbf{0} \label{a} \\
      \sum F_{x} \,\mathbf{i} + \sum F_{y} \,\mathbf{j} + \sum F_{z} \,\mathbf{k} = \mathbf{0} \label{b} \\
      \sum F_{x} = 0 \label{c} \\
      \sum F_{y} = 0 \label{d} \\
      \sum F_{z} = 0 \label{e}
    \end{gather}
  \end{subequations}
\end{mybox}
\end{document}

在此处输入图片描述

相关内容