我怎样才能得到正确的对齐

我怎样才能得到正确的对齐

我从这里复制了这段代码在定理环境中枚举对齐问题 并添加\usepackage[unicode,bookmarksnumbered]{hyperref}

\documentclass{article}
\usepackage{amsthm}
\usepackage{fouriernc}
\usepackage[utf8]{vietnam}
\usepackage{amsmath}
\theoremstyle{definition}
\newtheorem{thm}{}[section]
\usepackage[unicode,bookmarksnumbered]{hyperref}
\usepackage{enumerate}
\begin{document}
\section{My theorem}
\begin{thm}\begin{minipage}[t]{\linewidth}
\begin{enumerate}[(a)]
\item This is a problem This is a problem This is a problem This is a problem This is a problem This is a problemThis is a problem This is a problem  This is a problem This is a problem This is a problem This is a problem This is a problem This is a problemThis is a problem This is a problem
\item Item 2
\item Item 3
\end{enumerate}
\end{minipage}
\end{thm}
\end{document} 

我有 在此处输入图片描述

数字 1.1 与项目 (a) 不一致。

如果我删除\usepackage[unicode,bookmarksnumbered]{hyperref},我得到正确的对齐 在此处输入图片描述

我怎样才能获得正确的对齐?

答案1

hyperref包将锚点放在列表上方,因此有额外的垂直空间。如果不需要锚点,您可以包装\item列表中的第一个或环境中的整个enumerate或所有环境。以下 MWE 包装在 中:minipageNoHyperenumerateNoHyper

\documentclass{article}
\usepackage{amsthm}
\usepackage{fouriernc}
\usepackage[utf8]{vietnam}
\usepackage{amsmath}
\theoremstyle{definition}
\newtheorem{thm}{}[section]
\usepackage[unicode,bookmarksnumbered]{hyperref}
\usepackage{enumerate}
\begin{document}
    \section{My theorem}
    \begin{thm}
        \begin{minipage}[t]{\linewidth}
           \begin{NoHyper}
            \begin{enumerate}[(a)]
                \item This is a problem This is a problem This is a problem This is a problem This is a problem This is a problemThis is a problem This is a problem  This is a problem This is a problem This is a problem This is a problem This is a problem This is a problemThis is a problem This is a problem
                \item Item 2
                \item Item 3
            \end{enumerate}
          \end{NoHyper} 
        \end{minipage}
    \end{thm}
\end{document}

输出: 在此处输入图片描述

答案2

我认为问题是由于hyperref包重新定义了宏并放置了用于交叉引用的锚点。我更喜欢以下代码:

\documentclass{article}
\usepackage{amsthm}
\usepackage{fouriernc}
\usepackage[utf8]{vietnam}
\usepackage{amsmath}
\theoremstyle{definition}
\newtheorem{thm}{}[section]
\usepackage[unicode,bookmarksnumbered]{hyperref}
\usepackage{lipsum}
\usepackage{enumitem}
\sloppy
\begin{document}
\section{My theorem}
\lipsum[1]
\begin{thm}\begin{minipage}[t]{\linewidth}
\begin{enumerate}[label=(\arabic*),before=\vspace*{-\baselineskip},rightmargin=\leftmargin]
\item This is a problem This is a problem This is a problem This is a problem This is a problem This is a problemThis is a problem This is a problem  This is a problem This is a problem This is a problem This is a problem This is a problem This is a problemThis is a problem This is a problem
\item Item 2
\item Item 3
\end{enumerate}
\end{minipage}
\end{thm}
\lipsum[1]
\end{document} 

在示例中,我使用了enumitem包而不是enumerate

相关内容