我正在向演示文稿中插入一些beamer
我自己没有创建的图片。因此,我想仅使用命令添加一些源信息,例如
\PassOptionsToPackage{demo}{graphicx}
\documentclass[12pt]{beamer}
\newcommand{\credit}[1]{what to put here?}
\begin{document}
\begin{frame}{demo}
\includegraphics[width=\linewidth]{demo}
\credit{Credit where credit is due.} % How best to implement this?
\end{frame}
\end{document}
它应该看起来是这样的,但理想情况下字体看起来不会那么笨重。
答案1
\PassOptionsToPackage{demo}{graphicx}
\documentclass[12pt]{beamer}
\newcommand{\credit}[1]{\par\hfill \footnotesize Credit:~\itshape#1}
\begin{document}
\begin{frame}{demo}
\includegraphics[width=\linewidth]{demo}
\credit{where credit is due.} % How best to implement this?
\end{frame}
\end{document}
答案2
\PassOptionsToPackage{demo}{graphicx}
\documentclass[12pt]{beamer}
\usepackage{tikz}
\usetikzlibrary{calc}
\tikzset{credit/.style={
append after command={
let \p1=($(\tikzlastnode.north east)-(\tikzlastnode.north west)$) in
node[anchor=north east,align=right,text width=\x1,font=\footnotesize,
node contents={Source:~\textit{#1}}, at = (\tikzlastnode.south east)]
}
}
}
\def\myimage#1#2#3{\tikz\node[inner sep=0,credit={#3}]{\includegraphics[#1]{#2}};}
\begin{document}
\begin{frame}{demo}
\myimage{height=2cm}{demo}{where credit is due.}
\myimage{height=1cm,width=4cm}{demo}{Some longer test for testing and more words lack of imagination}
\myimage{height=2cm,width=\textwidth}{demo}{You get the idea}
\end{frame}
\end{document}