latex - 对齐编号的段落
问题描述
我正在尝试交叉引用一些编号的段落。我正在使用 \numpar 但第一个总是不对齐。(\项目没有工作)
这是我所做的:
\section{First section}
\subsection*{Subsection1}
\numpar\label{A1} blablabla1
\numpar\label{A2} blablabla2
\numpar\label{A3} blablabla3
\section{Second section}
Statement \ref{A2} = 2 must be true.
这导致:
我需要对齐所有数字而不影响未编号的段落。我对其他命令持开放态度,而不是 \numpar 如果有的话。任何建议表示赞赏。
解决方案
你为什么不使用enumerate
?它是为这种问题而完成的。
\documentclass{article}
\begin{document}
\section{First section}
\subsection*{Subsection1}
\begin{enumerate}
\item \label{A1} blablabla1
\item \label{A2} blablabla2
\item \label{A3} blablabla3
\end{enumerate}
\section{Second section}
Statement \ref{A2} = 2 must be true.
\end{document}
如果需要,您可以使用 enumitem 包自定义外观。
例如,要增加缩进,加载包,然后开始枚举:
\begin{enumerate}[leftmargin=3cm]`
enumitem 包中有许多选项,它当然可以满足您的需求。
编辑:请注意 \item 将缩进它之后的任何内容。如果您不想要这种行为,请在段落之前关闭枚举。然后您可以重新启动枚举,但您必须注意项目编号(见下文)。
\documentclass{article}
\usepackage{enumitem}
\begin{document}
\section{First section}
\subsection*{Subsection1}
\begin{enumerate}
\item \label{A1} blablabla1
This paragraph will be indented
\end{enumerate}
But this one will not.
\begin{enumerate}\setcounter{enumi}{1}
% This insures that item numbering will be coherent
% set it to the value of the last item
% If using the enumitem package, there is a simpler way with 'resume'
% \begin{enumerate}[resume]
\item \label{A2} blablabla2
\item \label{A3} blablabla3
\end{enumerate}
And another non indented par
\section{Second section}
Statement \ref{A2} = 2 must be true.
\end{document}
推荐阅读
- python - python 3:列表的值在进入 for 循环时发生变化
- c# - 如何通过流利的 api 进行 1 对多的关联
- php - 将 Foreach 数组拆分为奇数和偶数
- vue.js - Vue js在作用域插槽中选择带有v-model的元素
- laravel - 当我使用 api 注销并再次发送获取请求以显示用户数据时,它显示“Route [login] not defined”。
- cordova-plugins - 错误:您的系统路径上未安装 Cordova 命令行界面
- electron - 是否可以与其他程序界面交互?
- java - 如何检查一年中的月份是否为一月
- javascript - 我可以更改链接的 div
- qt - 在 QOpenGLWidget 上使用 Qt5 小部件而不过度绘制?