┓形图形及标题

┓形图形及标题

我有一个具有┓形的(浮动)图形,即左下角有一个巨大的空白方块。

在此处输入图片描述

我想在这个空白处填写图片的标题。有什么办法吗?

我的课程加载captionfloatrow打包,所以我需要一些可以与之配合的东西floatrow

答案1

那么使用 TikZ 并在图像上写上标题怎么样?

\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}

\begin{document}
\begin{figure}
    \begin{tikzpicture}
     \node [draw=black, anchor=south west] at (0,0) {\includegraphics[width=\textwidth]{fig1}};

     \node [draw=black, anchor=south west, text width=.3\textwidth] at (0,0) {\caption{A picture of a X.}};
    \end{tikzpicture} 
\end{figure}
\end{document}

A\RawFloats\begin{figure} 解决 floatrow 的问题

答案2

这是一个非常基本的、可行的实现,将标题插入到所需的位置:

在此处输入图片描述

\documentclass{article}
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\newsavebox{\graphicsbox}
\begin{document}
\begin{figure}[ht]
  \centering
  \savebox{\graphicsbox}{\includegraphics[width=.7\linewidth]{myfigure}}% Store image
  \leavevmode\rlap{\usebox{\graphicsbox}}% Set image with complete overlap
  \begin{minipage}[b]{.5\wd\graphicsbox}% Insert caption
    \caption{This is my caption. It has a large amount of information, and should
      flow over several lines.}
  \end{minipage}\hspace*{.5\wd\graphicsbox}% Add space to represent figure width
\end{figure}
\end{document}

将图像放置在一个框中\graphicsbox,以便计算其宽度。此宽度用于测量minipage和后续间距。bottom [b]-placement 可确保标题在扩展时垂直堆叠。minipage当然,和周围间距的对齐方式可以更改。例如,要\columnsep在标题和图像之间添加间隙,请使用

\begin{minipage}[b]{\dimexpr.5\wd\graphicsbox-\columnsep}% Insert caption
  % <caption>
\end{minipage}\hspace*{\dimexpr.5\wd\graphicsbox+\columnsep}% Add space to represent figure width

答案3

boxhandler我对 的宏做了两行更改\ReciteFigure,并设置了一些包参数。

\documentclass{article}
\usepackage{floatrow}
\usepackage{caption}
\usepackage{boxhandler}

\makeatletter
\renewcommand\ReciteFigure[6][ht]{%
  \begin{figure}[#1]%
    \begin{\LRFigurePlacement}%
      \let\@makecaption\new@makecaption%
      \setlength\abovecaptionskip{\arabic{abovecaptionskipterm}\p@}%
      \setlength\belowcaptionskip{\arabic{belowcaptionskipterm}\p@}%
        \set@DataBoxWidth{#3}%
        \setlength\CaptionBoxWidth{#4}%
        \set@BoxOffsets%
        \if T#6%
          \rule{\@DataBoxOffset}{0in}%
          \makebox[\@DataBoxWidth][l]{#5}%
          \rule{\@DataBoxOffset}{0in}\\%
        \fi
        \rule{\@DataBoxOffset}{0in}%
        \usebox{#3}%
        \rule{\@DataBoxOffset}{0in}%
        \par%
        \rule{\@CaptionBoxOffset}{0em}%
        \parbox{.5\CaptionBoxWidth}{\bx@caption{#2}}% .5 WAS ADDED
        \hspace{.5\CaptionBoxWidth}%                  THIS LINE WAS ADDED
        \rule{\@CaptionBoxOffset}{0em}%
        \if T#6%
          \rule{\@DataBoxOffset}{0in}\\%
          \makebox[\@DataBoxWidth][r]{#5}%
          \rule{\@DataBoxOffset}{0in}%
        \fi
      \let\@makecaption\old@makecaption%
      \setlength\abovecaptionskip\oldabovecaptionskip%
      \setlength\belowcaptionskip\oldbelowcaptionskip%
    \end{\LRFigurePlacement}%
  \end{figure}%
}
\makeatother

\begin{document}
\setcounter{abovecaptionskipterm}{-80}
\captionStyle{n}{c}
\def\CaptionJustification{\raggedright}
\bxfigure{My caption goes here and may exceed one line}
{\fbox{\rule{2in}{0in}\rule{0in}{2in}}}

\end{document}

在此处输入图片描述

相关内容