Graphics, Figures & TablesSeparating Figures from Text with dotted Line

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
sultan1919
Posts: 4
Joined: Fri Apr 29, 2011 7:23 pm

Separating Figures from Text with dotted Line

Post by sultan1919 »

I was wondering if anyone knows of a good way to separate Figures from the body of the document with a dotted line? I'm thinking a dotted line below the figure for those appearing at the top; one above for those appearing at the bottom; and one both above and below for those appearing inside the text on a given page.

I'm using fancyhdr as well so I'd prefer not to use a solid line to separate Figures as it would be too similar to the solid line at the top of each page already.

Any help would be much appreciated - thanks!

-sultan1919

P.S. - I'm sorry if this has been posted before, I couldn't find it in my search.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Separating Figures from Text with dotted Line

Post by localghost »

LaTeX provides the two macros \topfigrule and \botfigrule for this purpose. Don't be irritated, the two commands apply in general to all floats and not only figures.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage{blindtext}

\def\topfigrule{\vskip1ex\noindent\dotfill}
\def\botfigrule{\noindent\dotfill\vskip1ex}

\begin{document}
  \blindtext[4]

  \begin{figure}[!ht]
    \centering
    \rule{\linewidth}{0.75\linewidth}
    \caption{Dummy figure}\label{fig:dummy}
  \end{figure}

  \blindtext[3]
\end{document}
The only restriction to their content is that it mustn't occupy vertical space (or this must be compensable).

For floats appearing in the text you my need to do that manually. Perhaps packages like float or floatrow can help in restyling floats.


Thorsten
Post Reply