1

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 threeenter image description here. 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}
\definecolor{shadecolor}{RGB}{0,0,0}
\usepackage{float}
\usepackage{fancyhdr}
\usepackage{enumitem}
\pagestyle{fancy} 
\usepackage{pdfpages}
\usepackage{multicol}
%\usepackage[head=128pt]{geometry}
\title{\textsc{Extra Curricular Achievements}}
\author{Erik Jonasson}
\usepackage{geometry}
\setlength{\footskip}{0.1pt}
\setlength{\headheight}{80pt}
\setlength{\topmargin}{0pt}
\setlength\parindent{0pt}
\usepackage{titlesec} 
\begin{document}

\newcommand\FUM{5} 


\begin{snugshade*}
    \noindent\textsc{\section*{\begin{tabular}{c|c}
    \color{white}{F18-{\FUM}.1} 
    & \color{white}{Formalia} 
\end{tabular}}}
\end{snugshade*}
\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
  • 1
    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
  • 2
    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
1

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}
\definecolor{shadecolor}{RGB}{0,0,0}
\usepackage{titlesec} 
\begin{document}

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

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

\section*{\begin{snugshade}\begin{tabular}{c|c}
    \color{white}{F18-5.1} 
    & \color{white}{Formalia} 
\end{tabular}\end{snugshade}\vspace{-1cm}}
abc

\section*{\begin{snugshade}\color{white}F18-5.1\quad Formalia\end{snugshade}}

\end{document}

Result:

enter image description here

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.

| improve this answer | |

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.