Im trying to limit the area that is turned black with my code to just the one line i have text in insted of the now three. But latex is hard i guess.

\documentclass[a4paper, 11pt]{article}
\usepackage{comment} % enables the use of multi-line comments (\ifx \fi)
\usepackage{fullpage} % changes the margin
\usepackage[swedish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{xcolor}
\usepackage{framed}
\usepackage{float}
\usepackage{fancyhdr}
\usepackage{enumitem}
\pagestyle{fancy}
\usepackage{pdfpages}
\usepackage{multicol}
\title{\textsc{Extra Curricular Achievements}}
\author{Erik Jonasson}
\usepackage{geometry}
\setlength{\footskip}{0.1pt}
\setlength{\topmargin}{0pt}
\setlength\parindent{0pt}
\usepackage{titlesec}
\begin{document}

\newcommand\FUM{5}

\noindent\textsc{\section*{\begin{tabular}{c|c}
\color{white}{F18-{\FUM}.1}
& \color{white}{Formalia}
\end{tabular}}}
\end{document}

• Welcome to TeX-SE! Does this help? And a general remark: please do not assume that everyone knows what snugshade is. Therefore always provide use with a minimal working example that starts with \documentclass and ends with \end{document}, and can be compiled and illustrates the issue. You will see that when doing this you will get much more valuable feedback. – user121799 Jun 6 '19 at 2:06
• Your code is still not compilable as at lest the following code is missing in the preamble: \usepackage{xcolor} \usepackage{framed} \definecolor{shadecolor}{rgb}{0,0,0}. Additionally, \FUM is undefined. – leandriis Jun 6 '19 at 9:13
• The MWE does not compile – Cuniye Datacu Jun 6 '19 at 9:29
• Are you trying to get a background color for your headings? If so, this is quite easy with a KOMA-script document class, see here: tex.stackexchange.com/a/269013/4736 . – Keks Dose Jun 6 '19 at 16:23
• yeah nice thanks! – Peter Molander Jun 6 '19 at 19:08

In case you don't want to use KOMA classes, you can try some variants with snugshade. First the original, then without the noindent and smallcaps (which did not work anyway), then with the snugshade within the section, and finally with the snugshade in the section and without the tabular.

\documentclass[a4paper, 11pt]{article}

\usepackage[table]{xcolor}
\usepackage{tabularx}
\usepackage{framed}
\usepackage{titlesec}
\begin{document}

\noindent\textsc{\section*{\begin{tabular}{c|c}
\color{white}{F18-5.1}
& \color{white}{Formalia}
\end{tabular}}}

\section*{\begin{tabular}{c|c}
\color{white}{F18-5.1}
& \color{white}{Formalia}
\end{tabular}}


Note the \vspace{-1cm} in the third variant, for some reason this option takes a lot of vertical space which needs to be corrected a bit.