1

is it possible to modify the Figure environment in order to distinguish it better from the text in a one column document? I mean, I was thinking in doing

--------- Figure # ----------

        [The Plot]

-----------------------------

with tikz or something similar. Or if someone had a better idea of making an environment like this (maybe putting a gray background to the caption). This is because my captions are not very different from my text and sometimes it doesn't look very good. I haven't found something related. Usually what is changed are the headings, chapters or sections.

1 Answer 1

4

EDITED to remove double appearance of "Figure 1". EDITED again to give the OP a gray box around the caption.

EDITED a 3rd time to place repetitive stuff in macros. Use \startfig to open the figure, and \capfig{} to provide the caption and/or label and close it out.

Final EDIT to add support for labels.

\documentclass{article}
\usepackage{lipsum,graphicx,xcolor}
\usepackage[labelformat=empty]{caption}
\def\startfig{%
  \centering%
  \stepcounter{figure}%
  \hrulefill\ \raisebox{-.2\baselineskip}{Figure \thefigure} \hrulefill\par%
  \addtocounter{figure}{-1}%
}
\def\capfig#1{%
  \caption[#1]{\colorbox{gray!40}{#1}}\par
  \hrulefill%
}
\begin{document}
\listoffigures
\noindent\hrulefill\par
\lipsum[1]
\begin{figure}[ht]
\startfig
\includegraphics{knuth}
\capfig{Our Founder\label{fg:x}}
\end{figure}
In Figure~\ref{fg:x}, we find 
\lipsum[4]
\end{document}

enter image description here

2
  • What about the labels? I get an error Package caption Warning: \label without proper \caption =o I tried to put the label before ending the figure environment
    – PerroNoob
    Commented Aug 9, 2014 at 22:05
  • 1
    @DavidWinchester Fixed to handle labels. Commented Aug 11, 2014 at 10:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .