我想添加我的地址的源地址,如下所示:
但地址必须从图的开头开始,就像这样:
我该怎么做?谢谢
答案1
从上一个问题中获取代码,我添加了一个命令,用于说明要与图像一起排版的源tabular
:
\documentclass{article}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{url}
\captionsetup{
format=hang,
justification=raggedright,
singlelinecheck=false,
figureposition=top,
}
\newcommand{\includegraphicswithsource}[3][]{%
\begin{tabular}{@{}l@{}}
\includegraphics[#1]{#2}\\
Source: \url{#3}
\end{tabular}%
}
\begin{document}
\begin{figure}
\centering
\captionbox{some text goes here. This text is just
some dummy replacement for the figure caption}{%
\includegraphicswithsource[width=6cm]{example-image-a}{www.dummy.com}%
}
\end{figure}
\end{document}
答案2
一个选项是将图像及其源文本放在varwidth
(需要varwidth
包)环境:
\documentclass[twocolumn]{scrartcl}
\usepackage{graphicx}
\usepackage{varwidth}
\usepackage{url}
\newcommand\Source[1]{\par\textbf{Source:} \url{#1}\par}
\begin{document}
\begin{figure}
\centering
\caption{some text goes here. This text is just some dummy replacement for the figure caption}
\begin{varwidth}{\linewidth}
\includegraphics[width=6cm]{example-image-a}
\Source{www.dummy.com}
\end{varwidth}
\end{figure}
\end{document}
如果你知道图形的宽度,一个简单的小页面就可以完成这项工作:
\documentclass[twocolumn]{scrartcl}
\usepackage{graphicx}
\usepackage{url}
\newcommand\Source[1]{\par\textbf{Source:} \url{#1}\par}
\begin{document}
\begin{figure}
\centering
\caption{some text goes here. This text is just some dummy replacement for the figure caption}
\begin{minipage}{6cm}% the width here is equal to the image width
\includegraphics[width=6cm]{example-image-a}
\Source{www.dummy.com}
\end{minipage}
\end{figure}
\end{document}
答案3
这是使用 的可能性\stackunder
。我展示了两个图,第二个图带有boxhandler
包装,为 OP 提供了与所呈现内容类似的标题格式,尽管它位于图像下方而不是上方。
\documentclass{article}
\usepackage{stackengine,lipsum,boxhandler}
\usepackage[demo]{graphicx}
\begin{document}
\lipsum[4]
\begin{figure}[ht]
\centering
\caption{Lorem imsum dolor sit amet, consectetuer adipiscing elit.
Aenean commodo ligula eget dolor. Aenean massa.}
\def\stackalignment{l}
\stackunder{\includegraphics[width=3in]{demo}}{\textbf{Source:} www.dummy.com}
\end{figure}
\bxfigure[ht]
{Lorem imsum dolor sit amet, consectetuer adipiscing elit.
Aenean commodo ligula eget dolor. Aenean massa.}
{\def\stackalignment{l}
\stackunder{\includegraphics[width=3in]{demo}}{\textbf{Source:} www.dummy.com}}
\end{document}
答案4
这个怎么样?我使用了measuredfigure
环境,从threeparttable
,来获得图形宽度的标题,以及copyrightbox
,这样做是为了将这样的信息添加到表格/图形中:
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption, threeparttable}
\usepackage{copyrightbox, url}
\urlstyle{sf}
\captionsetup{format=hang}
\begin{document}
\begin{measuredfigure}
\centering
\caption{some text goes here. This text is just some dummy replacement for the figure caption}
\copyrightbox[b]{
\includegraphics[width=6cm]{sourceimg}}
{Source: \url{www.dummy.com}}
\end{measuredfigure}
\end{document}