运行此示例:
\documentclass[
10pt,
a5paper
]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\definecolor{ultramarine}{RGB}{0,32,96}
\RequirePackage{xpatch}
\RequirePackage{amssymb}
\RequirePackage{hyperref}
\newcommand{\goToSummaryText}{%
\small\mdseries
\hyperlink{summary}{\textcolor{ultramarine}{$\leftleftarrows$}}
{$|$}
\Acrobatmenu{GoBack}{\textcolor{ultramarine}{$\leftarrow$}}
}
\makeatletter
\newif\ifismemoirloaded\ismemoirloadedfalse
\newif\ifisabntexloaded\isabntexloadedfalse
\@ifclassloaded{memoir}{%
\ismemoirloadedtrue%
}{}
\@ifclassloaded{abntex2}{%
\isabntexloadedtrue%
}{}
\newcommand{\addGoToSummary}
{%
\@ifundefined{printpartnum}{\message{printpartnum patch for addGoToSummary could NOT
be applied because there is no printpartnum command available!^^J}}{%
\let\oldAddGoToprintpartnum\printpartnum
\xapptocmd{\printpartnum}{~\protect\goToSummaryText}{}{}
}
}
\makeatother
\let\oldAddGoTotableofcontents\tableofcontents
% Insert internal document link
\renewcommand{\tableofcontents}{%
\hypertarget{summary}%
\oldAddGoTotableofcontents%
}
\begin{document}
\addGoToSummary
\part{My}
\end{document}
我们得到这个PDF:
如果我将其改为\printpartnum
,则和\printparttitle
之间的垂直间距就会减小:\printpartname
\printparttitle
我怎样才能修补并保持和\printpartname
之间的原始间距?\printpartname
\printparttitle
查看该\part
命令的回忆录类代码,我不明白为什么间距会中断:
{\centering
\interlinepenalty \@M
\parskip\z@
\normalfont
\ifnum \c@secnumdepth >-2\relax
\printpartname \partnamenum \printpartnum
\midpartskip
\fi
\printparttitle{#2}\par}%
\@endpart}
相关问题:
- 为什么 abntex2 类在章节标题后插入新行?
- 如何在每个部分自动添加[转至摘要] | [返回]?
- 如何修复转到摘要以便 \section[Some]{Some more} 不会抛出所有这些错误?
- 回忆录类中的“\Sectionformat”与“\Chapterformat”等效的是什么?
更新
我设法用这个技巧修复了它,但仍然无法正常工作。
如果这是一个实际的解决方案,我更喜欢通用的解决方案,因为如果有人将更改为\midpartskip
其他内容50pt
,则它们的值将被30pt
此处的设置覆盖:
\newif\ifismemoirloaded\ismemoirloadedfalse
\@ifclassloaded{memoir}{%
\ismemoirloadedtrue%
}{}
\newcommand{\addGoToSummary}
{%
\@ifundefined{printparttitle}{\message{printparttitle patch for addGoToSummary could NOT
be applied because there is no printparttitle command available!^^J}}{%
\let\oldAddGoToprintparttitle\printparttitle
\let\oldAddGoToprintpartnum\printpartnum
\xapptocmd{\printpartnum}{%
\let\oldAddGoTomidpartskip\midpartskip%
\renewcommand{\midpartskip}{\par\vskip 30pt}%
}{}{}
\xapptocmd{\printparttitle}{%
\let\midpartskip\oldAddGoTomidpartskip%
~\protect\goToSummaryText%
}{}{}
}
}
\newcommand{\removeGoToSummary}
{%
\@ifundefined{printparttitle}{\message{printparttitle patch for removeGoToSummary could NOT
be applied because there is no printparttitle command available!^^J}}{%
\let\printparttitle\oldAddGoToprintparttitle
\let\printpartnum\oldAddGoToprintpartnum
}
}
这另一个东西也有类似的效果,但距离没有达到 100% 相等。距离比 稍大30pt
。我添加了\protect
并\midpartskip
在\midpartskip
另一个命令上设置了 。
\let\oldAddGoToprintparttitle\printparttitle
\let\oldAddGoToprintpartnum\printpartnum
\xapptocmd{\printpartnum}{%
\let\oldAddGoTomidpartskip\protect\midpartskip%
}{}{}
\xapptocmd{\printparttitle}{%
\let\midpartskip\oldAddGoTomidpartskip%
~\protect\goToSummaryText%
}{}{}
更正,这根本不起作用。当我尝试设置时:
\begin{document}
\addGoToSummary
\setlength\midchapskip{50pt}
\part{My}
\end{document}
我完全被忽略了,距离仍然在32pt
。
答案1
您缺少一个群组:
\newcommand{\goToSummaryText}{{% group here
\small\mdseries
\hyperlink{summary}{\textcolor{ultramarine}{$\leftleftarrows$}}
{$|$}
\Acrobatmenu{GoBack}{\textcolor{ultramarine}{$\leftarrow$}}%
}}
原始定义\small
影响了基线跳过,因此您得到了\lineskip
间距。