图形过宽,标题宽度相同,均超出右边缘,且左对齐

图形过宽,标题宽度相同,均超出右边缘,且左对齐

这个问题类似于那个问题但是,我想将图形标题与过宽的图形左对齐,以便它溢出右边距。

平均能量损失

\documentclass{scrartcl} % KOMA-Script article
\usepackage{lipsum}
\usepackage[english]{babel}
\usepackage{epsfig}
\usepackage{graphicx}\graphicspath{Figures}
\usepackage{float}
\usepackage[format=plain,justification=raggedright,font={small}]{caption}
\captionsetup[figure]{width=1.2\textwidth}

\begin{document} 

\lipsum[120]
\begin{figure}[thbp]
  \includegraphics[draft,width=1.2\textwidth]{Figures/foo.pdf}%
  \caption{Caption that has the same width as the figure, but should be aligned to the left as everything else, but should spill out of the right margin}
  \label{fig:key}
\end{figure}

\lipsum[120]

\end{document}

我想要的是这个:

结果

答案1

width=包的设置将caption始终使其标题相对于 居中\textwidth,因此width=1.2\textwidth实际上会给您左右边距-0.1\textwidth

为了操纵其边距,最好使用margin=,因为它为左右边距提供了离散值。例如:

\documentclass{scrartcl} % KOMA-Script article
\usepackage{lipsum}
\usepackage[english]{babel}
\usepackage{graphicx}\graphicspath{Figures}
\usepackage[format=plain,justification=raggedright,font={small}]{caption}

% uncomment this if the setting should affect all figures
%\captionsetup[figure]{margin={0pt,-0.2\textwidth}}

\begin{document} 

\lipsum[120]
\begin{figure}[thbp]
  \includegraphics[draft,width=1.2\textwidth]{Figures/foo.pdf}%
  \captionsetup{margin={0pt,-0.2\textwidth}}% only for this figure
  \caption{Caption that has the same width as the figure, but should be aligned to the left as everything else, but should spill out of the right margin}
  \label{fig:key}
\end{figure}

\lipsum[120]

\end{document}

另外,可以将整个图形内容放入具有所需宽度的小页面中,这样内容和标题都将调整到新的宽度:

\documentclass{scrartcl} % KOMA-Script article
\usepackage{lipsum}
\usepackage[english]{babel}
\usepackage{graphicx}\graphicspath{Figures}
\usepackage[format=plain,justification=raggedright,font={small}]{caption}

\begin{document} 

\lipsum[120]
\begin{figure}[thbp]
\begin{minipage}{1.2\textwidth}
  \includegraphics[draft,width=\textwidth]{Figures/foo.pdf}%
  \caption{Caption that has the same width as the figure, but should be aligned to the left as everything else, but should spill out of the right margin}
  \label{fig:key}
\end{minipage}
\end{figure}

\lipsum[120]

\end{document}

两者应给出相同的结果:

在此处输入图片描述

答案2

boxhandler 包为自定义图形标题提供了很大的灵活性,它允许您独立于图像宽度指定标题宽度、居中、左对齐或右对齐标题、相对于图 x 缩进标题。标签等。

但是,我不知道如何像上一个答案所说的那样暂时将边距扩展到 \textwidth 以外的右侧。也许您可以将文本放在宽度较小的小页面上,同时将文档的 \textwidth 保留为图形所需的宽度。

以下是一个例子:

\documentclass{article}
\usepackage{boxhandler}
\parindent 0in
\begin{document}

\begin{minipage}{3in}
Text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
\end{minipage}

\bxfigure[ht]{The caption by default will be indented with respect to
the figure label, as is shown here}{\fbox{\rule{0ex}{6ex}%
\makebox[\textwidth]{Image}}}

\begin{minipage}{3in}
Text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
\end{minipage}

\end{document}

例子

相关内容