I am currently using the following code to produce a document with a specific style of section title.

     \documentclass[11pt, a4paper]{report}
     \usepackage{lipsum}% just to generate text for the example

     {\begin{varwidth}{.7\linewidth}\raggedright##1\end{varwidth}~ \{xrfill[0.3ex]{1.5pt}}


     \section{Section 1.1}


I would appreciate it if someone could provide a the code to produce the following output enter image description here where the numbers on the far right are page numbers for the relevant subsections. The bottom image shows what I would like to happen if a title for a particular section is too large to fit on one line. The style in section format and style is similar to the one I am looking for, however I cannot see a way of getting rid of the dots when using minitoc. I would appreciate a quick response, as I would like to use the layout in an upcoming project.

  • 1
    While you may need to work on the format, I believe the minitoc package does this sort of function. See tex.stackexchange.com/questions/3001/… – Steven B. Segletes Jan 13 '17 at 19:02
  • 1
    This doesn't seem to be exactly the right style I'm looking for. This seems to deal with sections, rather than subsections, and as you say, the format is different. I'd rather someone provided a code that gives a look closer to that I requested. – wrb98 Jan 14 '17 at 1:11

This should fit to your intended output, as I can see from section format and style:

\documentclass[11pt, a4paper]{report}




     \if@noskipsec \leavevmode \fi


\noindent{\vline  \@height 0.5ex \@width\linewidth}%   )%%% 
    %                                                  )%%% Code to replace to obtain a double horizontal (==) line 
\hspace{-1\linewidth}%                                 )%%%
\colorbox{white}{\normalfont\bfseries\large Section \thesection} 


\vskip 3ex




\section{Differentiation and integration}

\subsection{Introduction and motivation}

\subsection{Basic definitions}

\subsection{Worked exercises}

\subsection{Homework exercises}



(A) setting a background colour of the "Contents" gives an error in compiling (for that reason the entry is commented, see above);

(B) the horizontal line is a little below the one of your intended output.

Given that you asked for a quick reply, I managed to prepare this working solution, and then hopefully yourself or someone else will fix these two little issues.

Edit: To add a double horizontal (==) line instead of the thick solid line after the "Section 1.1", as requested, replace the relative lines with the following code:

| improve this answer | |
  • That would work very nicely. I was wondering if it is possible to improve aesthetics by adding a double horizontal (==) line instead of the thick solid line after the "Section 1.1"? – wrb98 Jan 15 '17 at 11:42
  • I updated the answer adding your request – ALE Jan 15 '17 at 13:26
  • Do you know how I would go about altering the vertical space between the "Contents" title and the first subsection title? – wrb98 Jan 15 '17 at 17:31
  • add this line to the preamble \mtcsetfeature{minitoc}{open}{\vspace{1cm}}, where 1cm is the space that you want. – ALE Jan 15 '17 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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