overpic
我在课程中使用包memoir
来包含图形并在其上叠加文本。有没有一种简单的方法可以告诉 overpic 使用与文本主字体不同的字体?(不过,我仍然希望图形标题使用主字体。)
以下是 MWE:
\documentclass[11pt,a4paper]{memoir}
\usepackage{fouriernc} % use the Arev font
\usepackage{overpic} % use the overpic package
% caption images outside the figure environment
\newfixedcaption{\figcaption}{figure} \captionnamefont{\normalfont} \captiontitlefont{\normalfont}
\begin{document}
This is the font of my main text.
\begin{center}
\begin{overpic}[width=0.5\textwidth]{./myfig.pdf}
\put(10, 10){This should be a different font}
\end{overpic}
\figcaption{This should be the same font as my main text.}
\end{center}
\end{document}
答案1
您可以通过在文档前言中插入以下内容来自动重新定义\put
插入(或任何字体选择):\sffamily
\let\oldput\put
\def\put(#1,#2)#3{%
\oldput(#1,#2){\sffamily #3}%
}
这是一个简单的例子:
\documentclass[11pt,a4paper]{memoir}
\let\oldput\put
\def\put(#1,#2)#3{%
\oldput(#1,#2){\sffamily #3}%
}
\usepackage{fouriernc} % use the Arev font
\usepackage{overpic} % use the overpic package
% caption images outside the figure environment
\newfixedcaption{\figcaption}{figure} \captionnamefont{\normalfont} \captiontitlefont{\normalfont}
\begin{document}
This is the font of my main text.
\begin{center}
\begin{overpic}[width=0.5\textwidth]{tiger.pdf}
\put(10, 10){This should be a different font}
\end{overpic}
\figcaption{This should be the same font as my main text.}
\end{center}
\end{document}