# How can images be separated from text by a horizontal line?

I would like to arrange my text according to the style used by chemical journals such as JACS.

In there, images are separated from text by a dark blue, thick line from the text (horizontal line with textwidth). However images do not have this blue at the top if on beginning of page or at the bottom if on end of page.

Does anyone have an idea how I can do latex make this an automatic task?

For those with journal access, a example would be: http://pubs.acs.org/doi/ipdf/10.1021/ja507832e

My preamble so far:

\documentclass[11pt, oneside, english, ngerman]{scrreprt}
\usepackage{geometry}
\geometry{a4paper}

\usepackage{graphicx}
\usepackage{siunitx}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{amsmath}
\usepackage[section]{placeins}
\usepackage[runs=2]{auto-pst-pdf}
\usepackage{chemmacros}
\usepackage[onehalfspacing]{setspace}
%
\usepackage{ragged2e}
\usepackage{array}
\usepackage{caption}
\usepackage{mhchem}
\usepackage{textcomp}
\renewcommand{\thefootnote}{\alph{footnote}}

\usepackage[sorting=none,
natbib=true, backend=bibtex, style=chem-acs]{biblatex}
\usepackage{textgreek}
\usepackage{pxfonts}
\usepackage{chemnum}
\usepackage[journal=angew, tracking=bpchem]{chemstyle}


• What about those without the journal access? Please add a picture. – user11232 Nov 16 '14 at 1:28
• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to help when we see compilable code, starting with \documentclass{...} and ending with \end{document}. This should include some sample images and text. These can be 'dummy' content e.g. you can use images from the mwe package and text from kantlipsum. – cfr Nov 16 '14 at 2:28
• @HarishKumar See here. This one is open access at the moment, at any rate. The OP could easily have provided a link to one of these rather than to something which asks for dollars to view ;(. – cfr Nov 16 '14 at 2:32
• The journal only appears to use the lines when a figure or table spans the two columns. When images are in a single column (set in place?), no lines are required. Is that right? – cfr Nov 16 '14 at 2:37
• Uhm no, lines are always required, even in single line images. Thanks for adding the open source example. I am pretty sure I am not allowed to post screenshots of copyrighted material from journals. – user66292 Nov 20 '14 at 18:23

Separator rule commands are built in to the latex format, but defined to do nothing by default, so if you define them to make a coloured rule, you get:

\documentclass{scrreprt}

\usepackage{color}

\newcommand\topfigrule{{%
\color{blue}\vspace{2pt}\hrule height 2pt\relax\vspace{-4pt}}}

\newcommand\botfigrule{{%
\color{blue}\vspace{-4pt}\hrule height 2pt\relax\vspace{2pt}}}

\begin{document}

\def\f{\begin{figure}\caption{zzz}
\rule{2cm}{1cm}
\end{figure}}
\def\t{text... text... }

\t\t\t\t\f\f\t\t\t\f

\t\t\t\t\t\t\t\t\t\t\t
\t\t\t\t\t\t\t\t\t\t\t

\end{document}


\usepackage[journal=angew, tracking=bpchem]{chemstyle}


the rules go as that package adds h to the default options and on this document all figures are placed in the h position which is not ruled off from the text.

\makeatletter
\def\fps@figure{tbp}
\makeatother


after the package or equivalently use [tbp] on each figure.

Or you could rule h floats. Unlike top and bottom floats which are added as a unit, separated by a rule, h-ere floats are added to the page as they are met and latex does not record if they come together or are separated by text, so you can not rule groups of figures that are placed mid page. You could however instead of having top and bottom fig rules use a ruled float style and rule every one, using float package to style the figures or simply placing a blue rule at the start and end of each figure.

• You learn something new every day... – cgnieder Nov 16 '14 at 11:23
• Thanks that's exactly what I was looking for. One little problem remains though. The \hrule does not seem to be compatible with the chemstyle package. The console does not produce any error, but no horizontal lines are displayed when the chemstyle package is loaded (with the above MWE) Does anyone have an idea how to get around this? – user66292 Nov 20 '14 at 18:24
• @user66292 got a bit long for a comment, I added some notes to the answer – David Carlisle Nov 20 '14 at 20:02
• I have given this approach a try and it seems that omitting the -h option is not the ideal way, often making images appear in unwanted positions. The other option, ruling every image, is what I was trying to avoid, because it makes the document look very inconsistent having bottom or top lines on some but not all pages (depending on wether the page begins with an image or text). Is there absolutely no way to set up an additional command, ruling h-floats? Also I did not know that chemstyle sets up -h as a default for floats, is placing schemes this way a chemistry thing? – user66292 Nov 26 '14 at 22:21
• @user66292 there is always a way (in that any part of latex can be redefined in the document) but doing it in general would be a fairly major rewrite of latex's page layout routines. If you can assume that no h floats come next to each other it's easy, just add the lines, but once an h float is added there i basically no record of it and so if latex adds another h float on the page it would be ruled even if adjacent, similarly if an h float happens to be at the top of a page that has top floats it is hard to adjust the rules. – David Carlisle Nov 26 '14 at 22:26