tags:

views:

8235

answers:

8

I have been trying to find a way to easily drop a nice horizontal rule into a LaTeX document. \hline just makes a line across the page. It would seem that some package must provide something that is maybe half a page wide, with little bedknobs on the ends or something to act as a nice section marker for paragraphs.

Any ideas? Or am I boned, and need to come up with my own macro to create such a beast?

+8  A: 

In general:

\rule{width}{height}

macro:

\newcommand{\sectionline}{%
  \nointerlineskip \vspace{\baselineskip}%
  \hspace{\fill}\rule{0.5\linewidth}{.7pt}\hspace{\fill}%
  \par\nointerlineskip \vspace{\baselineskip}
}
Łukasz Lew
+1  A: 

Everything I've ever read defines a custom command for fancy graphical paragraph separators. Nothing in latex adds bedknobs or any fancy decorations, and I can't find any packages which add such functionality.

The example I've seen is typically:

\newcommand{\parasep}{\begin{center}*\hspace{6em}*\hspace{6em}*\end{center}}

Obviously from here you could replace the asterisks with something more visually appealing.

jasedit
+1  A: 

You might try perusing some font collections. Here are some free examples; if you're willing to pay a little money or do some work on your own, you can get some really nice ones.


Noah
Fonts are the way to go, but the typoasis fonts are just raw foundries, and so don't integrate very well with tex. See my comment below.
Charles Stewart
A: 

Just use an image for that. Or just for the end points. And a \newcommand, of course. In LaTeX you're always supposed to come up with your own macro, or borrow one.

Stephan Eggermont
+5  A: 

If anyone still cares, I used this image and then this code:

http://billygotmail.googlepages.com/hrule.PNG

In header:

\newcommand{\parasep}{
\begin{center} 
   \includegraphics[scale=.5]{hrule.png} 
\end{center}}

In body where you want the image:

\parasep

Oh and remember to:

\usepackage{graphicx}
billynomates
Cf. my comment on dreamlax's post, below.
Charles Stewart
i get this error:! Missing \endcsname inserted.<to be read again> \unhbox ? I have no idea why?
Andreas
In which implementation you can provide the filename with the extension on?
progo
+2  A: 

In TeX, there is a primitive command \leaders which is able to take an hbox and replicate it as many times as necessary to fill a specific amount of glue (which can be the entire with of the page if necessary). Each box that it lays down will stick to a vertical grid, so that boxes laid directly below will be in-line with the ones above (so they don't appear out of sync). This technique is commonly used for tables of contents.

You can supply your own custom graphic and box to have a repeating pattern used as a line.

\usepackage{graphicx}

\newcommand{\nicehline}{%
    \par\noindent
    \leaders\hbox to 1in{\includegraphics{somethingnice.png}}\hfill
    \par
}

Lorem ipsum dolor sit amet.

\nicehline

Lorem ipsum dolor sit amet.

Of course, you'll need to supply your own somethingnice.png, or alternatively use a dingbat. Perhaps it may be better to save the graphic into its own box register if it will mean the graphics are only included once and referenced thereafter (as opposed to included each time it is to be displayed).

dreamlax
Charles Stewart
+1  A: 

Memoir document class has facilities to draw these "totally sweet" anonymous breaks. See P.108-9 of the manual for details.

Seamus
+2  A: 

Just to reiterate: you can get better results with fonts than embedded images, and better results with TeX-native font representations (e.g., MetaFont), than with TrueType fonts.

Noah, above, linked to typoasis, which has some mouthwateringly beautiful fonts, but they are alien to TeX, so you might not get ideal results with them.

Zapfino, Hermann Zapf's calligraphic font, is worth a look: Zapf worked with Knuth on this, and some other, fonts, so it is all done The Right Way.

If you do make use of TeX-alien fonts, it is best to import tham as MetaType1 fonts using, say, the pf2mt1 utility; cf. the CTAN metatype1 package's README for some info.

Charles Stewart