# How do i add a blue box around the section number?

I vant to make the section design like shown on the picture below. So far i have managed to get the section numbering in the margin, but I have no idea how to make the box (or change the fonts in sections, chapters and subtitles, but that is not the main thing im asking for now, but if you by any chance know yeah, id love to know :D ).

Im making the document with document class "scrreprt", and the code i used for getting the section numbering in the margin was:

\documentclass[11pt, twoside=semi, titlepage]{scrreprt}

\usepackage[top=2.5cm, bottom=2.5cm, left=6cm, right=2cm, heightrounded, marginparwidth=3.5cm,
marginparsep=0.5cm]{geometry}

\renewcommand*{\othersectionlevelsformat}[1]{%
\makebox[0pt][r]{%
\csname the#1\endcsname\enskip}%
}

\usepackage{blindtext}
\begin{document}
\blinddocument
\end{document}


Do anyone know if this is possible, and how to do it? :)

• Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Sverre Oct 27 '14 at 21:13
• sorry, im kinda new to this, didn't think about it, addet it now! (Y) – landigio Oct 27 '14 at 21:20
• #denfølelsen når læreboka bruker \raggedright... – Holene Oct 27 '14 at 21:24

This is the basics, adjust to suit.

\documentclass[11pt, twoside=semi, titlepage]{scrreprt}

\usepackage[top=2.5cm, bottom=2.5cm, left=6cm, right=2cm, heightrounded, marginparwidth=3.5cm,
marginparsep=0.5cm]{geometry}

\usepackage{xcolor}

\renewcommand*{\othersectionlevelsformat}[1]{%
\makebox[0pt][r]{%
\fcolorbox{blue}{blue}{\color{white}\csname the#1\endcsname}%
\enskip
}
}

\begin{document}

\setcounter{chapter}{1} % just to emulate a chapter has started

\section{VEKTORER I ROMMET}

\end{document}