如何以视觉上吸引人的方式对解决方案的每个步骤进行编号?

如何以视觉上吸引人的方式对解决方案的每个步骤进行编号?

我正在寻求有关格式化解决方案的帮助。具体来说,我正在寻找一种方法来对解决方案的每个步骤进行编号,而不使用“步骤 1:”、“步骤 2:”等格式。我希望找到一种更具视觉吸引力的方式来对每个步骤进行编号。

此外,如果您能帮助我在 Overleaf 上整齐地格式化解决方案,我将不胜感激。如果有人有能力帮助我解决这些问题,请告诉我。

\documentclass{article}

\usepackage{amsmath}

\begin{document}    
\section{Task}
    1. Calculate the inverse of the matrix
    
    \[
    B=\left[\begin{array}{lll}
    0 & 2 & 3 \\
    2 & 4 & 0 \\
    3 & 5 & 1
    \end{array}\right]
    \]
    \subsection{Solution}
    Gauss-Jordan elimination can be used to compute the inverse of the matrix $B$ . We start by augmenting the matrix B with an identity matrix to the right of the matrix $B$, so that we get it in the form $\left[B | I\right]$:
    \[
    \left[\begin{array}{lll|lll}
    0 & 2 & 3 & 1 & 0 & 0 \\
    2 & 4 & 0 & 0 & 1 & 0 \\
    3 & 5 & 1 & 0 & 0 & 1
    \end{array}\right]
    \]
    Step 1: Swap rows 1 and 2
    \[
    \left[\begin{array}{lll|lll}
    2 & 4 & 0 & 0 & 1 & 0 \\
    0 & 2 & 3 & 1 & 0 & 0 \\
    3 & 5 & 1 & 0 & 0 & 1
    \end{array}\right]
    \]
    Step 2: Divide row 1 by 2
    \[
    \left[\begin{array}{lll|lll}
    1 & 2 & 0 & 0 & \frac{1}{2} & 0 \\
    0 & 2 & 3 & 1 & 0 & 0 \\
    3 & 5 & 1 & 0 & 0 & 1
    \end{array}\right]
    \]
    Step 3: Divide row 2 by 2
    \[
    \left[\begin{array}{lll|lll}
    1 & 2 & 0 & 0 & \frac{1}{2} & 0 \\
    0 & 1 & \frac{3}{2} & \frac{1}{2} & 0 & 0 \\
    3 & 5 & 1 & 0 & 0 & 1
    \end{array}\right]
    \]
    Step 4: Multiply row 1 by 3 and subtract 3*row 1 from row 3
    \[
    \left[\begin{array}{lll|lll}
    1 & 2 & 0 & 0 & \frac{1}{2} & 0 \\
    0 & 1 & \frac{3}{2} & \frac{1}{2} & 0 & 0 \\
    0 & -1 & 1 & 0 & -\frac{3}{2} & 1
    \end{array}\right]
    \]
    Step 5: Add row 3 with row 2
    \[
    \left[\begin{array}{lll|lll}
    1 & 2 & 0 & 0 & \frac{1}{2} & 0 \\
    0 & 1 & \frac{3}{2} & \frac{1}{2} & 0 & 0 \\
    0 & 0 & \frac{5}{2} & \frac{1}{2} & -\frac{3}{2} & 1
    \end{array}\right]
    \]
    Step 6: Add $-2\cdot$ row 2 to row 1
    \[
    \left[\begin{array}{lll|lll}
    1 & 0 & -3 & -1 & \frac{1}{2} & 0 \\
    0 & 1 & \frac{3}{2} & \frac{1}{2} & 0 & 0 \\
    0 & 0 & \frac{5}{2} & \frac{1}{2} & -\frac{3}{2} & 1
    \end{array}\right]
    \]
    Step 7: $R_3' = 5/2 \cdot R_3$
    
    \[
    \left[\begin{array}{lll|lll}
    1 & 0 & -3 & -1 & \frac{1}{2} & 0 \\
    0 & 1 & \frac{3}{2} & \frac{1}{2} & 0 & 0 \\
    0 & 0 & 1 & \frac{1}{5} & -\frac{3}{5} & \frac{2}{5}
    \end{array}\right]
    \]
    
    Step 8: $R_1' = 3R_3+R_1$ and $R_2' = -1.5\cdot R_3 + R_2$
    
    \[
    \left[\begin{array}{lll|lll}
    1 & 0 & 0 & -\frac{2}{5} & -\frac{13}{10} & \frac{6}{5} \\
    0 & 1 & 0 & \frac{1}{5} & \frac{9}{10} & -\frac{3}{5} \\
    0 & 0 & 1 & \frac{1}{5} & -\frac{3}{5} & \frac{2}{5}
    \end{array}\right]
    \]
    
    We now have the matrix in reduced stair step form, which means we have found its inverse. Thus is
    
    \[
    \left[\begin{array}{lll|lll}
    1 & 0 & 0 & -\frac{2}{5} & -\frac{13}{10} & \frac{6}{5} \\
    0 & 1 & 0 & \frac{1}{5} & \frac{9}{10} & -\frac{3}{5} \\
    0 & 0 & 1 & \frac{1}{5} & -\frac{3}{5} & \frac{2}{5}
    \end{array}\right]
    \]
\end{document}

答案1

  • 不是一个真正的答案......
  • 看来您可以尝试使用examdocumentclass,它可能更适合您的目的
  • 但文档的设计由您决定
  • 以下是可能的文档设计示例,其中介绍了enumitem您的步骤的包:
\documentclass{article}
\usepackage{amsmath}
    \renewcommand\arraystretch{1.2}
\usepackage{enumitem}

\begin{document}
\section{Task}
Calculate the inverse of the matrix
    \[
B = \begin{bmatrix}
0 & 2 & 3 \\
2 & 4 & 0 \\
3 & 5 & 1
\end{bmatrix}
    \]
\subsection*{Solution}
Gauss-Jordan elimination can be used to compute the inverse of the matrix $B$. We start by augmenting the matrix B with an identity matrix to the right of the matrix $B$, so that we get it in the form $\left[B | I\right]$:
    \[
\left[\begin{array}{lll|lll}
0 & 2 & 3 & 1 & 0 & 0 \\
2 & 4 & 0 & 0 & 1 & 0 \\
3 & 5 & 1 & 0 & 0 & 1
\end{array}\right]
    \]
To the solution then yield the following steps:
    \begin{enumerate}[leftmargin=*]
\item   Swap rows 1 and 2
    \[
    \left[\begin{array}{ccc|ccc}
    2 & 4 & 0 & 0 & 1 & 0 \\
    0 & 2 & 3 & 1 & 0 & 0 \\
    3 & 5 & 1 & 0 & 0 & 1
    \end{array}\right]
    \]
\item   Divide row 1 by 2
    \[
    \left[\begin{array}{ccc|rrr}
    1 & 2 & 0 & 0 & \frac{1}{2} & 0 \\
    0 & 2 & 3 & 1 & 0 & 0 \\
    3 & 5 & 1 & 0 & 0 & 1
    \end{array}\right]
    \]
\item   Divide row 2 by 2
    \[
    \left[\begin{array}{ccc|ccc}
    1 & 2 & 0 & 0 & \frac{1}{2} & 0 \\
    0 & 1 & \frac{3}{2} & \frac{1}{2} & 0 & 0 \\
    3 & 5 & 1 & 0 & 0 & 1
    \end{array}\right]
    \]
\item   Multiply row 1 by 3 and subtract 3*row 1 from row 3
    \[
    \left[\begin{array}{rrr|rrr}
    1 & 2 & 0 & 0 & \frac{1}{2} & 0 \\
    0 & 1 & \frac{3}{2} & \frac{1}{2} & 0 & 0 \\
    0 & -1 & 1 & 0 & -\frac{3}{2} & 1
    \end{array}\right]
    \]
\item   Add row 3 with row 2
    \[
    \left[\begin{array}{rrr|rrr}
    1 & 2 & 0 & 0 & \frac{1}{2} & 0 \\
    0 & 1 & \frac{3}{2} & \frac{1}{2} & 0 & 0 \\
    0 & 0 & \frac{5}{2} & \frac{1}{2} & -\frac{3}{2} & 1
    \end{array}\right]
    \]
\item   Add $-2\cdot$ row 2 to row 1
    \[
    \left[\begin{array}{rrr|rrr}
    1 & 0 & -3 & -1 & \frac{1}{2} & 0 \\
    0 & 1 & \frac{3}{2} & \frac{1}{2} & 0 & 0 \\
    0 & 0 & \frac{5}{2} & \frac{1}{2} & -\frac{3}{2} & 1
    \end{array}\right]
    \]
\item   $R_3' = 5/2 \cdot R_3$
    \[
    \left[\begin{array}{rrr|rrr}
    1 & 0 & -3 & -1 & \frac{1}{2} & 0 \\
    0 & 1 & \frac{3}{2} & \frac{1}{2} & 0 & 0 \\
    0 & 0 & 1 & \frac{1}{5} & -\frac{3}{5} & \frac{2}{5}
    \end{array}\right]
    \]
\item   $R_1' = 3R_3+R_1$ and $R_2' = -1.5\cdot R_3 + R_2$
    \[
    \left[\begin{array}{lll|rrr}
    1 & 0 & 0 & -\frac{2}{5} & -\frac{13}{10} & \frac{6}{5} \\
    0 & 1 & 0 & \frac{1}{5} & \frac{9}{10} & -\frac{3}{5} \\
    0 & 0 & 1 & \frac{1}{5} & -\frac{3}{5} & \frac{2}{5}
    \end{array}\right]
    \]
We now have the matrix in reduced stair step form, which means we have found its inverse. Thus is
    \[
    \left[\begin{array}{lll|rrr}
    1 & 0 & 0 & -\frac{2}{5} & -\frac{13}{10} & \frac{6}{5} \\
    0 & 1 & 0 & \frac{1}{5} & \frac{9}{10} & -\frac{3}{5} \\
    0 & 0 & 1 & \frac{1}{5} & -\frac{3}{5} & \frac{2}{5}
    \end{array}\right]
    \]
    \end{enumerate}
\end{document}

在此处输入图片描述

答案2

您可以加载该enumitem包并使用其机制创建一个枚举列表,其项目以单词“Step”开头。

在此处输入图片描述

\documentclass{article}
\usepackage{amsmath} % for 'bmatrix' environment
\usepackage{enumitem}
\newlist{stepenum}{enumerate}{1}
\setlist[stepenum]{label={Step \arabic*.},wide=0pt}

\begin{document}    

\section{Task}

1. Calculate the inverse of the matrix
    \[
    B=\begin{bmatrix}
    0 & 2 & 3 \\
    2 & 4 & 0 \\
    3 & 5 & 1
    \end{bmatrix}
    \]
    
\subsection{Solution}
Gauss-Jordan elimination can be used to compute the inverse of the matrix $B$. We start by augmenting the matrix $B$ with an identity matrix to the right of the matrix $B$, so that we get it in the form $[B \mid I]$:
    \[
    \left[\begin{array}{@{}rrr|rrr@{}}
    0 & 2 & 3 & 1 & 0 & 0 \\
    2 & 4 & 0 & 0 & 1 & 0 \\
    3 & 5 & 1 & 0 & 0 & 1
    \end{array}\right]
    \]
   
\begin{stepenum}
\item Swap rows 1 and 2
    \[
    \left[\begin{array}{@{}rrr|rrr@{}}
    2 & 4 & 0 & 0 & 1 & 0 \\
    0 & 2 & 3 & 1 & 0 & 0 \\
    3 & 5 & 1 & 0 & 0 & 1
    \end{array}\right]
    \]
    
\item Divide row 1 by 2
    \[
    \left[\begin{array}{@{}rrr|rrr@{}}
    1 & 2 & 0 & 0 & \frac{1}{2} & 0 \\
    0 & 2 & 3 & 1 & 0 & 0 \\
    3 & 5 & 1 & 0 & 0 & 1
    \end{array}\right]
    \]
    
\item Divide row 2 by 2
    \[
    \left[\begin{array}{@{}rrr|rrr@{}}
    1 & 2 & 0 & 0 & \frac{1}{2} & 0 \\
    0 & 1 & \frac{3}{2} & \frac{1}{2} & 0 & 0 \\
    3 & 5 & 1 & 0 & 0 & 1
    \end{array}\right]
    \]
    
\item Multiply row 1 by 3 and subtract 3*row 1 from row 3
    \[
    \left[\begin{array}{@{}rrr|rrr@{}}
    1 & 2 & 0 & 0 & \frac{1}{2} & 0 \\
    0 & 1 & \frac{3}{2} & \frac{1}{2} & 0 & 0 \\
    0 & -1 & 1 & 0 & -\frac{3}{2} & 1
    \end{array}\right]
    \]
    
\item Add row 3 with row 2
    \[
    \left[\begin{array}{@{}rrr|rrr@{}}
    1 & 2 & 0 & 0 & \frac{1}{2} & 0 \\
    0 & 1 & \frac{3}{2} & \frac{1}{2} & 0 & 0 \\[\jot]
    0 & 0 & \frac{5}{2} & \frac{1}{2} & -\frac{3}{2} & 1
    \end{array}\right]
    \]
    
\item Add $-2\cdot$ row 2 to row 1
    \[
    \left[\begin{array}{@{}rrr|rrr@{}}
    1 & 0 & -3 & -1 & \frac{1}{2} & 0 \\
    0 & 1 & \frac{3}{2} & \frac{1}{2} & 0 & 0 \\[\jot]
    0 & 0 & \frac{5}{2} & \frac{1}{2} & -\frac{3}{2} & 1
    \end{array}\right]
    \]
    
\item $R_3' = 5/2 \cdot R_3$ 
    \[
    \left[\begin{array}{@{}rrr|rrr@{}}
    1 & 0 & -3 & -1 & \frac{1}{2} & 0 \\
    0 & 1 & \frac{3}{2} & \frac{1}{2} & 0 & 0 \\[\jot]
    0 & 0 & 1 & \frac{1}{5} & -\frac{3}{5} & \frac{2}{5}
    \end{array}\right]
    \]
    
\item $R_1' = 3R_3+R_1$ and $R_2' = -1.5\cdot R_3 + R_2$
    \[
    \left[\begin{array}{@{}rrr|rrr@{}}
    1 & 0 & 0 & -\frac{2}{5} & -\frac{13}{10} & \frac{6}{5} \\[\jot]
    0 & 1 & 0 & \frac{1}{5} & \frac{9}{10} & -\frac{3}{5} \\[\jot]
    0 & 0 & 1 & \frac{1}{5} & -\frac{3}{5} & \frac{2}{5}
    \end{array}\right]
    \]
\end{stepenum}

We now have the matrix in reduced stair step form, which means we have found its inverse. Thus is
    \[
    \left[\begin{array}{@{}rrr|rrr@{}}
    1 & 0 & 0 & -\frac{2}{5} & -\frac{13}{10} & \frac{6}{5} \\[\jot]
    0 & 1 & 0 & \frac{1}{5} & \frac{9}{10} & -\frac{3}{5} \\[\jot]
    0 & 0 & 1 & \frac{1}{5} & -\frac{3}{5} & \frac{2}{5}
    \end{array}\right]
    \]

\end{document}

相关内容