\ref 根据段落中的位置在标签名称中添加空格

\ref 根据段落中的位置在标签名称中添加空格

好的,根据这里建议的解决方法,这是一个非常奇怪的问题: LaTeX 中描述列表项的参考名称

我试图在本文中通过名称对描述进行超链接/引用,但由于某种原因,格式有时会在描述名称后添加一些空格,从而形成难看的长红色框。

以下是一些以这种方式编译的代码。我保留了所有软件包,看看是否有人能猜出其中的复杂性:

\documentclass[12pt]{article}
\usepackage{lingmacros, 
amssymb, 
setspace, 
units, 
tabto, 
array, 
nameref, 
enumitem, 
footnote, 
cite, 
changes, 
epigraph}

\usepackage[square,sort,comma]{natbib}
\usepackage[margin=1in]{geometry}
\usepackage[utf8]{inputenc}

\usepackage{hyperref}

%----------- Command to make description Labels

\makeatletter
\let\orgdescriptionlabel\descriptionlabel
\renewcommand*{\descriptionlabel}[1]{%
  \let\orglabel\label
  \let\label\@gobble
  \phantomsection
  \edef\@currentlabel{#1}%
  %\edef\@currentlabelname{#1}%
  \let\label\orglabel
  \orgdescriptionlabel{#1}%
}
\makeatother

%---------- This is a new draft toggle to turn of sections with \ifdraft
\newif\ifdraft

%opening
\title{Group Skepticism}

\author{}

\begin{document}

\maketitle

\begin{description}
    \item [NSC\label{NSC}] No true theory of testimonial evidence is inconsistent with the extent of testimonial evidence clear critical common sense says that we have.
\end{description}

The second assumption is a transmission principle. Jennifer Lackey clarifies the discussion about these principles by giving the following proposal.

\begin{description}
    \item[TEP-N\label{TEP-N}] For every speaker, S, and hearer, A, A knows (believes with justification/warrant/ has evidence\footnote{The `has evidence that' condition is not found in Lackey, but having evidence will feature prominently in the discussion below, so I have included it here.}) that p on the basis of S’s testimony that p only if S knows (believes with justification/warrant/ has evidence) that p. 
\end{description}

Though Lackey argues against this transmission principle, \ref{TEP-N} and principles like it have not completely fallen out of fashion. Such transmission principles could provide the needed link from individual epistemology to group epistemology. If we assume that learning something entails being justified in believing it and that 2 is a common sense instance of learning, we can infer from \ref{TEP-N} and \ref{NSC} that Wikipedia believes with justificaiton that Abraham Lincoln died on April 15, 1865. Hence, groups have epistemic states.


\end{document}

这不是最糟糕的例子,但它表明有时间距是正确的,有时间距是错误的,尤其是在段落的第一行。如果你觉得这个编译没问题,以下是我论文中最糟糕的情况:

在此处输入图片描述

有任何想法吗?

答案1

您不应该重新定义 \descriptionlabel。它用于格式化标签,并且参数可以包含字体、惩罚和其他不适合标签的内容。最好使用 enumitem 的格式键:

\documentclass[12pt]{article}
\usepackage{lingmacros, amssymb, setspace, units, tabto, array, hyperref, nameref, enumitem, footnote, cite, changes, epigraph}

\usepackage[square,sort,comma]{natbib}
\usepackage[margin=1in]{geometry}
\usepackage[utf8]{inputenc}

\makeatletter
\newcommand\storedescriptionlabel[1]{%
  \let\orglabel\label
  \let\label\@gobble
  \phantomsection
  \edef\@currentlabel{#1}%
  \let\label\orglabel
  #1}
\makeatother

%---------- This is a new draft toggle to turn of sections with \ifdraft
\newif\ifdraft

%opening
\title{Group Skepticism}

\author{}

\begin{document}

\maketitle

\begin{description}[format={\storedescriptionlabel}]
    \item [NSC\label{NSC}] No true theory of testimonial evidence is inconsistent with the extent of testimonial evidence clear critical common sense says that we have.
\end{description}

The second assumption is a transmission principle. Jennifer Lackey clarifies the discussion about these principles by giving the following proposal.

\begin{description}[format={\storedescriptionlabel}]
    \item[TEP-N\label{TEP-N}] For every speaker, S, and hearer, A, A knows (believes with justification/warrant/ has evidence\footnote{The `has evidence that' condition is not found in Lackey, but having evidence will feature prominently in the discussion below, so I have included it here.}) that p on the basis of S’s testimony that p only if S knows (believes with justification/warrant/ has evidence) that p.
\end{description}

Though Lackey argues against this transmission principle, \ref{TEP-N} and principles like it have not completely fallen out of fashion. Such transmission principles could provide the needed link from individual epistemology to group epistemology. If we assume that learning something entails being justified in believing it and that 2 is a common sense instance of learning, we can infer from \ref{TEP-N} and \ref{NSC} that Wikipedia believes with justificaiton that Abraham Lincoln died on April 15, 1865. Hence, groups have epistemic states.


\end{document}

答案2

需要额外空间的原因是\descriptionlabel

该命令 有效\enit@description@i调用\descriptionlabel和应用 \enit@align{\enit@format{##1}}。这将导致额外的空间,因为NSC\label{NSC}将为添加此空间\label{NSC}

我采用了另一种策略:的参数\item [Foo]会自动生成一个text-label同名的,即\label{Foo}

只要那些描述标签是唯一的,就不会有问题!

\documentclass[12pt]{article}
\usepackage{lingmacros, amssymb, setspace, units, tabto, array, footnote, cite, changes, epigraph}
\usepackage[square,sort,comma]{natbib}
\usepackage[margin=1in]{geometry}


\usepackage[utf8]{inputenc}
\usepackage{xpatch}

\newcounter{desccounter}
\newcounter{descitemcounter}[desccounter]

\usepackage{enumitem}


\AtBeginEnvironment{description}{%
  \refstepcounter{desccounter}%
}


\makeatletter

\newcommand{\generateautolabel}[1]{%
  \refstepcounter{descitemcounter}%
  \edef\@currentlabel{#1}%
  \label{#1}%
}



\def\enit@description@i#1#2#3#4{%
  \ifnum#1>#3\relax
    \enit@toodeep
  \else
    \enit@list{}%
      {\let\enit@type\tw@
       \advance#1\@ne
       \labelwidth\z@
       \enit@align@left
       \let\makelabel\descriptionlabel
       \enit@style@standard
       \enit@preset{#2}{#1}{#4}%
       \enit@calcleft
       \let\enit@svlabel\makelabel
       \def\makelabel##1{%
         \labelsep\z@
         \ifenit@boxdesc
         \generateautolabel{##1}%
         \enit@svlabel{\enit@align{\enit@format{##1}}}%
         \else
         \nobreak
         \generateautolabel{##1}%
         \enit@svlabel{\enit@format{##1}}%
         \aftergroup\enit@postlabel
         \fi}%
       \enit@before}%
     \fi}


\makeatother



\usepackage{hyperref}


%----------- Command to make description Labels


%---------- This is a new draft toggle to turn of sections with \ifdraft
\newif\ifdraft

%opening
\title{Group Skepticism}

\author{}

\begin{document}

\maketitle

\section{Foo} \label{foosection}

\begin{description}
    \item [NSC] No true theory of testimonial evidence is inconsistent with the extent of testimonial evidence clear critical common sense says that we have.
\end{description}

The second assumption is a transmission principle. Jennifer Lackey clarifies the discussion about these principles by giving the following proposal.

\clearpage

\begin{description}
    \item[TEP-N] For every speaker, S, and hearer, A, A knows (believes with justification/warrant/ has evidence\footnote{The `has evidence that' condition is not found in Lackey, but having evidence will feature prominently in the discussion below, so I have included it here.}) that p on the basis of S’s testimony that p only if S knows (believes with justification/warrant/ has evidence) that p. 
\end{description}

\clearpage

Though Lackey argues against this transmission principle, \ref{TEP-N} and principles like it have not completely fallen out of fashion. Such transmission principles could provide the needed link from individual epistemology to group epistemology. If we assume that learning something entails being justified in believing it and that 2 is a common sense instance of learning, we can infer from \ref{TEP-N} and \ref{NSC} that Wikipedia believes with justificaiton that Abraham Lincoln died on April 15, 1865. Hence, groups have epistemic states.


\end{document}

相关内容