1

Option 1 or Option 1

I would like to create a pattern for each section to display a line in the line of the question number, and below the right aligned, score of the question.

How can I create this ornament in \section??

  • 2
    Welcome to TeX.SE! Can you please show us a short, compilable code you have so far? – Mensch Nov 21 '17 at 23:35
  • You can use adforn or dingbat packages (among others), which contain some fancy symbols for ornaments. You can find the entire catalogue of these and other symbols in The Comprehensive LaTeX Symbol List – Cragfelt Nov 22 '17 at 1:50
3

Something like this?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{siunitx}
\usepackage[svgnames]{xcolor}
\usepackage{lipsum}% just to generate text for the example
\usepackage[explicit]{titlesec}
\titleformat{\section}[display]{\normalsize\bfseries\sffamily}%
{ \raisebox{-1.25ex}{\parbox{2cm}{Question~\num[minimum-integer-digits = 2, detect-all]{\thesection}}}\color{Gainsboro}\titlerule[2pt]}{0em}{{ \vspace*{-2.1ex}
\hspace*{2cm}\color{Gainsboro}\titlerule[2pt]}\llap{\raisebox{-2ex}{#1}}}

\begin{document}

\section{2 points}

\lipsum[2]

\end{document} 

enter image description here

  • error in xcolor Gainsboro! ERROR: Option clash for package xcolor. \usepackage – Marcio Lord Nov 22 '17 at 3:58
  • I fixed this error: \definecolor{Gainsboro}{rgb}{0.86, 0.86, 0.86} – Marcio Lord Nov 22 '17 at 4:06
  • @MarcioLord - The errors you say you're getting indicate that you didn't really take on board all of Bernard's code. (Aside: Bernard's code compiles just fine.) It's not helpful or informative to leave comments about errors which aren't actually caused by the code that was provided in an answer. – Mico Nov 22 '17 at 6:33
  • @MarcioLord: It most probably means another package already loads xcolor without option. In this case, simply declare svgnames as an option of your \documentclass. – Bernard Nov 22 '17 at 9:44

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.