如何使枚举标签左对齐

如何使枚举标签左对齐

我有这个MWE:

\documentclass[12pt,a4paper]{article}

\usepackage{nicematrix}

\begin{document}
\begin{enumerate}
\item 

\begin{center}

$\begin{pNiceMatrix}[first-row,first-col]
 & \{1,2\} & \{1,3\} & \{1,4\} & \{2,3\} & \{2,4\} & \{3,4\} \\
x_1 & 1 & 0 & 1 & 0 & 0 & 0 \\
x_2 & -1 & 0 & 0 & 1 & 1 & 0 \\
x_3 & 0 & 0 & 0 & -1 & 0 & 1 \\
x_4 & 0 & 0 & -1 & 0 & -1 & -1 \\
\end{pNiceMatrix}$

\end{center}

\item Two.
\item Three.

\end{enumerate}
\end{document}

在此处输入图片描述

不幸的是,矩阵前面的 1. 也居中了。我该如何避免这种情况?

答案1

快速而肮脏的黑客攻击:

\documentclass[12pt,a4paper]{article}

\usepackage{nicematrix}

\begin{document}
\begin{enumerate}
\item  \hfill $\begin{pNiceMatrix}[first-row,first-col]
 & \{1,2\} & \{1,3\} & \{1,4\} & \{2,3\} & \{2,4\} & \{3,4\} \\
x_1 & 1 & 0 & 1 & 0 & 0 & 0 \\
x_2 & -1 & 0 & 0 & 1 & 1 & 0 \\
x_3 & 0 & 0 & 0 & -1 & 0 & 1 \\
x_4 & 0 & 0 & -1 & 0 & -1 & -1 \\
\end{pNiceMatrix}$\hfill\mbox{}

\item Two.
\item Three.

\end{enumerate}
\end{document}

在此处输入图片描述

答案2

一个简单的解决方案是将矩阵放在里面minipage

\documentclass[12pt,a4paper]{article}

\usepackage{nicematrix}

\begin{document}
\begin{enumerate}
\item 
\begin{minipage}{\linewidth}
\begin{center}
$\begin{pNiceMatrix}[first-row,first-col]
 & \{1,2\} & \{1,3\} & \{1,4\} & \{2,3\} & \{2,4\} & \{3,4\} \\
x_1 & 1 & 0 & 1 & 0 & 0 & 0 \\
x_2 & -1 & 0 & 0 & 1 & 1 & 0 \\
x_3 & 0 & 0 & 0 & -1 & 0 & 1 \\
x_4 & 0 & 0 & -1 & 0 & -1 & -1 \\
\end{pNiceMatrix}$
\end{center}
\end{minipage}
\item Two.
\item Three.

\end{enumerate}
\end{document}

代码输出

相关内容