运行以下 MWE 时:
\documentclass{memoir}
\usepackage{graphicx}
\newsubfloat{figure}
\usepackage[draft]{showkeys}
%\usepackage{bookmark}
\begin{document}
\begin{figure}[htb]
\centering
\subbottom[A\label{fig:examplea}]{\includegraphics[width=0.49\columnwidth]{example-image-a}}
\subbottom[B\label{fig:exampleb}]{\includegraphics[width=0.49\columnwidth]{example-image-b}}
\caption{Example A and B}
\label{fig:examples}
\end{figure}
\end{document}
但是如果我取消注释书签包(如下所示):
\documentclass{memoir}
\usepackage{graphicx}
\newsubfloat{figure}
\usepackage[draft]{showkeys}
\usepackage{bookmark}
\begin{document}
\begin{figure}[htb]
\centering
\subbottom[A\label{fig:examplea}]{\includegraphics[width=0.49\columnwidth]{example-image-a}}
\subbottom[B\label{fig:exampleb}]{\includegraphics[width=0.49\columnwidth]{example-image-b}}
\caption{Example A and B}
\label{fig:examples}
\end{figure}
\end{document}
有没有办法在显示书签图片的同时还在底部图片上显示按键?
如果要从 TeXlive 2016 更新到 2017,我会在几天内完成,但现在还做不到
答案1
在我找到制作简短补丁的方法之前,这里有一些似乎可行的方法
\makeatletter
\AtBeginDocument{
\@ifpackageloaded{hyperref}{%
\@ifpackageloaded{showkeys}{%
\renewcommand*{\sf@@memsub@label}[1]{%
\@bsphack
\SK@\SK@@label{#1}% <-- added
\protected@write\@auxout{}{%
\string\newlabel{#1}%
{{\@nameuse{p@sub\@captype}\@nameuse{@@thesub\@captype}}%
{\thepage}%
{\mem@currentlabelname\relax}%
{\@currentHref}{}}}%
\protected@write\@auxout{}{%
\string\newlabel{sub@#1}%
{{\@nameuse{@@thesub\@captype}}%
{\thepage}%
{\mem@currentlabelname\relax}%
{\@currentHref}{}}}%
\@esphack}
}{}
}{}
}
\makeatother
使用较短的补丁进行更新
% experimental, may change
\usepackage{regexpatch}
\makeatletter
\AtBeginDocument{
\makeatletter
\regexpatchcmd{\sf@@memsub@label}{\c{@bsphack}}{%
\c{@bsphack}\c{SK@}\c{SK@@label}\cB\{\cP\#1\cE\}
}{ \typeout{success} }{ \typeout{failure} }
\makeatother
}
\makeatother