5

Where can I find the decorative separator pictured here?

enter image description here

I want to add it to the (nearly complete) chapter title below. Note: the program I use (Latexian) has the most common packages installed, but doesn't let you load new ones (as far as I know). For example, I can't use pgfornaments.

\documentclass{report}

\makeatletter
\def\@makechapterhead#1{%
    \vspace*{-5em}% Space above number
    {\parindent \z@  \normalfont
    \interlinepenalty\@M
    \LARGE\centering \textbf{\itshape\thechapter}%
    \par\vspace{0.5em}% Space between number and title
    {\LARGE\itshape#1}%
    \par\vspace{4em}% Space between title and text
}}
\makeatother

\begin{document}

\chapter{Chapter title}

\end{document}
  • What exactly is your question? Are you searching the line element? – Johannes_B May 1 '15 at 16:23
  • Yes, the line element. – Randy Randerson May 1 '15 at 16:28
  • Maybe the following is of interest: Totally sweet horizontal rules in LaTeX – Johannes_B May 1 '15 at 16:41
  • Thanks for the suggestion, but I couldn't find what I'm looking for. – Randy Randerson May 1 '15 at 16:55
  • 1
    @cfr: The post is only requesting a reproduction of the "rule", so I would say yes. – Werner May 2 '15 at 0:29
10

Your choice of editor does not affect the packages you can install. You can update your TeX distribution, install additional packages, classes and fonts, and create your own independent of your editor. Your editor does not, that is, stop you using pgfornaments and I'm assuming nothing else does, so if you like its decorations, you should certainly install and use it.

decorule offers a decorative, swelled rule which does not depend on the installation of additional ornaments or fonts. Instead, it creates the rule from a character included in all TeX distributions. However, the results are predictably somewhat less satisfying than a proper typographic decoration might be.

decorative rule

\documentclass{report}

\makeatletter
\def\@makechapterhead#1{%
    \vspace*{-5em}% Space above number
    {\parindent \z@  \normalfont
    \interlinepenalty\@M
    \LARGE\centering \textbf{\itshape\thechapter}%
    \decorule
    \par\vspace{0.5em}% Space between number and title
    {\LARGE\itshape#1}%
    \par\vspace{4em}% Space between title and text
}}
\makeatother
\usepackage{decorule}

\begin{document}

\chapter{Chapter title}

\end{document}

Or you could try swrule. Again, no special stuff needs to be installed. However, I've never managed to produce satisfactory results:

swelled rule

\documentclass{report}

\makeatletter
\def\@makechapterhead#1{%
    \vspace*{-5em}% Space above number
    {\parindent \z@  \normalfont
    \interlinepenalty\@M
    \LARGE\centering \textbf{\itshape\thechapter}%
    \par\vspace{0.25em}% Space between number and title
    \mbox{}\swrulex{.3\textwidth}{.25pt}{3.5pt}
    \par\vspace{0.25em}% Space between number and title
    {\LARGE\itshape#1}%
    \par\vspace{4em}% Space between title and text
}}
\makeatother
\usepackage{swrule}
\begin{document}

\chapter{Chapter title}

\end{document}

If you don't mind the overhead, you could always draw one:

drawn rule

\documentclass{report}
\usepackage{tikz}
\newsavebox{\myrule}
\sbox{\myrule}{\tikz {\path [fill, draw] (0,0) [out=0, in=180] to +(.125\textwidth,1pt) [out=0, in=180] to +(.125\textwidth,-1pt) [out=180, in=0] to +(-.125\textwidth,-1pt) [out=180, in=0] to cycle;}}
\makeatletter
\def\@makechapterhead#1{%
    \vspace*{-5em}% Space above number
    {\parindent \z@  \normalfont
    \interlinepenalty\@M
    \LARGE\centering \textbf{\itshape\thechapter}%
    \par\vspace{0.25em}% Space between number and title
    \usebox{\myrule}%
    \par\vspace{0.25em}% Space between number and title
    {\LARGE\itshape#1}%
    \par\vspace{4em}% Space between title and text
}}
\makeatother
\begin{document}

\chapter{Chapter title}

\end{document}

The advantage of creating \myrule as a box is that the TikZ picture only has to be rendered once for the document, regardless of how many times it is used. If, however, you want to be able to alter the length of the rule within the document, a command will work better:

\documentclass{report}
\usepackage{tikz}
\newcommand*\myrule[1][.25\textwidth]{%
  \tikz {\path [fill, draw] (0,0) [out=0, in=180] to +(.5*#1,1pt) [out=0, in=180] to +(.5*#1,-1pt) [out=180, in=0] to +(-.5*#1,-1pt) [out=180, in=0] to cycle;}}
\makeatletter
\def\@makechapterhead#1{%
    \vspace*{-5em}% Space above number
    {\parindent \z@  \normalfont
    \interlinepenalty\@M
    \LARGE\centering \textbf{\itshape\thechapter}%
    \par\vspace{0.25em}% Space between number and title
    \myrule%
    \par\vspace{0.25em}% Space between number and title
    {\LARGE\itshape#1}%
    \par\vspace{4em}% Space between title and text
}}
\makeatother
\begin{document}

\chapter{Chapter title}

\end{document}

Here, \myrule is .25\textwidth by default but \myrule[some length] will override that default. For example, \myrule[.1\textwidth] would produce

shorter rule

This can then be adapted to permit changing the length as appropriate in the document:

\documentclass{report}
\usepackage{tikz}
\newcommand*\myrule[1][.25\textwidth]{%
  \tikz {\path [fill, draw] (0,0) [out=0, in=180] to +(.5*#1,1pt) [out=0, in=180] to +(.5*#1,-1pt) [out=180, in=0] to +(-.5*#1,-1pt) [out=180, in=0] to cycle;}}
\newlength\myrulelength
\setlength{\myrulelength}{.1\textwidth}
\makeatletter
\def\@makechapterhead#1{%
    \vspace*{-5em}% Space above number
    {\parindent \z@  \normalfont
    \interlinepenalty\@M
    \LARGE\centering \textbf{\itshape\thechapter}%
    \par\vspace{0.25em}% Space between number and title
    \myrule[\myrulelength]%
    \par\vspace{0.25em}% Space between number and title
    {\LARGE\itshape#1}%
    \par\vspace{4em}% Space between title and text
}}
\makeatother
\begin{document}
\let\clearpage\relax% only for testing!

\chapter{Chapter title}

\setlength\myrulelength{.2\textwidth}
\chapter{Another chapter title}

\end{document}

variable length rule

To have the length automatically adapt depending on the length of the chapter title, you might try this:

\documentclass{report}
\usepackage{tikz}
\newcommand*\myrule[1][.25\textwidth]{%
  \tikz {\path [fill, draw] (0,0) [out=0, in=180] to +(.5*#1,1pt) [out=0, in=180] to +(.5*#1,-1pt) [out=180, in=0] to +(-.5*#1,-1pt) [out=180, in=0] to cycle;}}
\newlength\myrulelength
\setlength{\myrulelength}{.1\textwidth}
\makeatletter
\def\@makechapterhead#1{%
    \vspace*{-5em}% Space above number
    {\parindent \z@  \normalfont
    \interlinepenalty\@M
    \LARGE\centering \textbf{\itshape\thechapter}%
    \settowidth{\myrulelength}{\LARGE\itshape#1}%
    \par\vspace{0.25em}% Space between number and title
    \myrule[.8\myrulelength]%
    \par\vspace{0.25em}% Space between number and title
    {\LARGE\itshape#1}%
    \par\vspace{4em}% Space between title and text
}}
\makeatother
\begin{document}
\let\clearpage\relax% only for testing!

\chapter{Chapter title}

\chapter{Another chapter title}

\end{document}

auto-variable rule

  • You have lot of patience. +1. – user11232 May 2 '15 at 2:42
  • When I tried to use the second to last one, it wouldn't compile. Specifically, next to \chapter{Chapter title}, it gives the following errors: (1) "paragraph ended before tikz @ collect @ coordinate @ onpath was complete" and (2) "extra } or forgotten \endgroup". If you need more information I can provide it, but hopefully this will tell you what's going on. – Randy Randerson May 3 '15 at 7:39
  • @RandyRanderson Can you compile the example as included in my post i.e. that exact code? If so, then I'd need an example which produces the error. If not, then try putting \listfiles before \documentclass so we can compare the versions of files we're using. I just double-checked and the example compiles fine for me, so I can't tell what's wrong without more information as I can't reproduce the problem. – cfr May 3 '15 at 13:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.