减少 \ref 后的空格

减少 \ref 后的空格

我有以下乳胶文件:

\documentclass[AMA,STIX1COL]{WileyNJD-v2}
\usepackage{moreverb}
\usepackage{algpseudocode}
\usepackage{algorithm}
\usepackage{tabu}
\usepackage{tabularx}
\usepackage{rotating}
\usepackage{amsmath}
\newcommand\BibTeX{{\rmfamily B\kern-.05em \textsc{i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\begin{document}
\section{Example}
Some text here {\ref{fig:example_graph}}, followed by text here, Table {\ref{tab:lfr_nets}}, and some text here
\begin{figure}[hbt!]
    \centering
    \includegraphics[width=0.5\textwidth]{images/Unknown.png}
    \caption{\hl{Example Graph}}
    \label{fig:example_graph}
\end{figure}
\begin{table}[hbt!]
    \centering
\begin{tabu} to 0.8\textwidth {X[l] X[l] X[l] X[l]}
    \hline
    \textbf {A} & \textbf{B} & \textbf{C} &  \textbf{D} \\
    \hline
    LFR1 & 20 & 34 & 1.7\\
    \hline
\end{tabu}
\caption{Properties of generated LFR Networks}
    \label{tab:lfr_nets}
\end{table}
\end{document}

渲染结果如下,在 1 和逗号之间有额外的空格 在此处输入图片描述

原始日志


附录:这是一个希望几乎完全最小化的示例。它在交叉引用类型figure和的对象后生成不需要的额外空间,但不会在类型和table的对象后生成。该类的版本是。问题行为并非独有的:它也会出现在和中。sectionequationWileyNJD-v22017/06/23 v0.2\ref\autoref\cref

在此处输入图片描述

\documentclass[colorlinks]{WileyNJD-v2}
\listfiles % print a list of all files that get loaded to the log file
\usepackage[nameinlink,noabbrev]{cleveref} % for '\Cref' command

\begin{document}
% increment a few counters via \refstepcounter and provide \label instructions
\refstepcounter{section}\label{sec:ex}
\refstepcounter{figure}\label{fig:example_graph}
\refstepcounter{table}\label{tab:lfr_nets}
\refstepcounter{equation}\label{eq:triv}

Figure \ref{fig:example_graph}. \autoref{fig:example_graph}. \Cref{fig:example_graph}. 

Table \ref{tab:lfr_nets}. \autoref{tab:lfr_nets}. \Cref{tab:lfr_nets}.
 
Section \ref{sec:ex}. \autoref{sec:ex}. \Cref{sec:ex}.

Equation \eqref{eq:triv}. \autoref{eq:triv}. \Cref{eq:triv}
\end{document}

文件列表如下(该文档使用MacTeX2020编译,已应用所有更新):

WileyNJD-v2.cls    2017/06/23 v0.2 Standard LaTeX document class for Journal
 article.cls    2019/12/20 v1.4l Standard LaTeX document class
   fleqn.clo    2016/12/29 v1.2b Standard LaTeX option (flush left equations)
  size10.clo    2019/12/20 v1.4l Standard LaTeX file (size option)
graphicx.sty    2019/11/30 v1.2a Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
graphics.sty    2019/11/30 v1.4a Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
  pdftex.def    2018/01/08 v1.0l Graphics/color driver for pdftex
multicol.sty    2019/12/09 v1.8y multicolumn formatting (FMi)
multirow.sty    2019/05/31 v2.5 Span multiple rows of a table
   cuted.sty    2012/10/04 v1.5 Mixing onecolumn and twocolumn modes
   ifpdf.sty    2019/10/25 v3.4 ifpdf legacy package. Use iftex instead.
   iftex.sty    2020/03/06 v1.0d TeX engine tests
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
changepage.sty    2009/10/20 v1.0c check page and change page layout
    calc.sty    2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
  xcolor.sty    2016/05/11 v2.12 LaTeX color extensions (UK)
   color.cfg    2016/01/02 v1.6 sample color configuration
   float.sty    2001/11/08 v1.3d Float enhancements (AL)
floatpag.sty    1999/04/29 FLOAT PAGESTYLE
dblfloatfix.sty    2012/12/31 v1.0a (JAW)
fixltx2e.sty    2016/12/29 v2.1a fixes to LaTeX (obsolete)
rotating.sty    2016/08/11 v2.16d rotated objects in LaTeX
  ifthen.sty    2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
longtable.sty    2020/01/07 v4.13 Multi-page Table package (DPC)
    ulem.sty    2019/11/18
enumerate.sty    2015/07/23 v3.00 enumerate extensions (DPC)
    soul.sty    2003/11/17 v2.4 letterspacing/underlining (mf)
 caption.sty    2020/01/03 v3.4h Customizing captions (AR)
caption3.sty    2020/01/03 v1.8h caption3 kernel (AR)
ltcaption.sty    2020/05/30 v1.4b longtable captions (AR)
hyperref.sty    2020-05-15 v7.00e Hypertext links for LaTeX
 ltxcmds.sty    2019/12/15 v1.24 LaTeX kernel commands for general use (HO)
pdftexcmds.sty    2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO)
infwarerr.sty    2019/12/03 v1.5 Providing info/warning/error messages (HO)
kvsetkeys.sty    2019/12/15 v1.18 Key value parser (HO)
kvdefinekeys.sty    2019-12-19 v1.6 Define keys (HO)
pdfescape.sty    2019/12/09 v1.15 Implements pdfTeX's escape features (HO)
 hycolor.sty    2020-01-27 v1.10 Color options for hyperref/bookmark (HO)
letltxmacro.sty    2019/12/03 v1.6 Let assignment for LaTeX macros (HO)
 auxhook.sty    2019-12-17 v1.6 Hooks for auxiliary files (HO)
kvoptions.sty    2019/11/29 v3.13 Key value format for package options (HO)
  pd1enc.def    2020-05-15 v7.00e Hyperref: PDFDocEncoding definition (HO)
 intcalc.sty    2019/12/15 v1.3 Expandable calculations with integers (HO)
etexcmds.sty    2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO)
  bitset.sty    2019/12/09 v1.3 Handle bit-vector datatype (HO)
bigintcalc.sty    2019/12/15 v1.5 Expandable calculations on big integers (HO)
atbegshi.sty    2019/12/05 v1.19 At begin shipout hook (HO)
 hpdftex.def    2020-05-15 v7.00e Hyperref driver for pdfTeX
atveryend.sty    2019-12-11 v1.11 Hooks at the very end of document (HO)
rerunfilecheck.sty    2019/12/05 v1.9 Rerun checks for auxiliary files (HO)
uniquecounter.sty    2019/12/15 v1.4 Provide unlimited unique counter (HO)
bookmark.sty    2019/12/03 v1.28 PDF bookmarks (HO)
bkm-pdftex.def    2019/12/03 v1.28 bookmark driver for pdfTeX (HO)
  twoopt.sty    2016/05/16 v1.6 Definitions with two optional arguments (HO)
footmisc.sty    2011/06/06 v5.5b a miscellany of footnote facilities
tabularx.sty    2020/01/15 v2.11c `tabularx' package (DPC)
   array.sty    2019/08/31 v2.4l Tabular extension package (FMi)
varwidth.sty    2009/03/30 ver 0.92;  Variable-width minipages
 dcolumn.sty    2014/10/28 v1.06 decimal alignment package (DPC)
showframe.sty    2011/02/24 v0.1i showframe (new impl., RN)
 eso-pic.sty    2018/04/12 v2.0h eso-pic (RN)
booktabs.sty    2020/01/12 v1.61803398 Publication quality tables
 amsmath.sty    2020/01/20 v2.17e AMS math features
 amstext.sty    2000/06/29 v2.01 AMS text
  amsgen.sty    1999/11/30 v2.0 generic functions
  amsbsy.sty    1999/11/29 v1.2d Bold Symbols
  amsopn.sty    2016/03/08 v2.02 operator names
  amsthm.sty    2020/05/29 v2.20.6
algorithm.sty    2009/08/24 v0.1 Document Style `algorithm' - floating environment
algorithmicx.sty    2005/04/27 v1.2 Algorithmicx
algpseudocode.sty    
listings.sty    2020/03/24 1.8d (Carsten Heinz)
 lstmisc.sty    2020/03/24 1.8d (Carsten Heinz)
listings.cfg    2020/03/24 1.8d listings configuration
   alltt.sty    1997/06/16 v2.0g defines alltt environment
 wrapfig.sty    2003/01/31  v 3.6
cleveref.sty    2018/03/27 v0.21.4 Intelligent cross-referencing
l3backend-pdfmode.def    2020-06-23 L3 backend support: PDF mode
supp-pdf.mkii
epstopdf-base.sty    2020-01-24 v2.11 Base part for package epstopdf
  grfext.sty    2019/12/03 v1.3 Manage graphics extensions (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
 nameref.sty    2019/09/16 v2.46 Cross-referencing by name of section
refcount.sty    2019/12/15 v3.6 Data extraction from label references (HO)
gettitlestring.sty    2019/12/15 v1.6 Cleanup title references (HO)

答案1

我遇到了同样的问题,并通过以下方式解决了:

  1. 打开名为WileyNJD-v2.cls
  2. 找到以下两个字符串:

\renewcommand{\thefigure}{\arabic{图}\enspace }
\renewcommand{\thetable}{\arabic{表}\enspace }

  1. 请删除\空格

  2. 享受!

相关内容