0

I am using the article class and need to underline or put a box around the section. It's a resume heading so it needs to be neat. enter image description here

\documentclass{article}
\usepackage[a4paper,bottom = 0.6in,left = 0.56in,right = 0.56in,top = 0.6in]{geometry}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{array}
\usepackage{enumitem}
\usepackage{wrapfig}
\usepackage{microtype}
\usepackage{titlesec}
\usepackage{textcomp}
\usepackage[colorlinks=false]{hyperref}
\usepackage[table]{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{verbatim}
\newcommand{\xfilll}[2][1ex]{
\dimen0=#2\advance\dimen0 by #1
\leaders\hrule height \dimen0 depth -#1\hfill}
\titleformat{\section}{\large\scshape\raggedright}{}{0em}{}
\renewcommand\labelitemi{\raisebox{0.4ex}{\tiny$\bullet$}}
\renewcommand{\labelitemii}{$\cdot$}
\pagenumbering{gobble}
\begin{document}
    \section*{\colorbox{lightgray!50}{\hspace{57.5mm}\Large Professional Experience\hspace{57.5mm}}}
\end{document}

I tried shifting /hline in the upward direction but couldn't do it either.

  • Welcome to TeX SX! Is it for a single section? – Bernard Jul 24 '19 at 15:18
  • It is for all the sections. I have found a solution not very elegant though. \section*{\framebox(516,16){\colorbox{lightgray!50}{\hspace{57.5mm}\Large Professional Experience\hspace{57.5mm}}}} – Anurag Gupta Jul 24 '19 at 16:35
  • This is not a code for a section \ it will the vertical spacing around sections. – Bernard Jul 24 '19 at 16:41
  • Do the headings have to be centred? – Bernard Jul 24 '19 at 16:45
  • Yes, and It work – Anurag Gupta Jul 24 '19 at 19:09
0

I propose this:

\documentclass{article}
\usepackage[a4paper, bottom=0.6in, left=0.56in, right=0.56in, top=0.6in]{geometry}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{array}
\usepackage{enumitem}
\usepackage{wrapfig}
\usepackage{microtype}
\usepackage{titlesec}
\usepackage{textcomp}
\usepackage[colorlinks=false]{hyperref}
\usepackage[table, svgnames]{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{verbatim}
\newcommand{\xfilll}[2][1ex]{
\dimen0=#2\advance\dimen0 by #1
\leaders\hrule height \dimen0 depth -#1\hfill}
\colorlet{headingcolor}{Gainsboro!50!Lavender!30}
\newcommand{\headingbox}[1]{%
\setlength{\fboxsep}{1ex}\SetTracking[ no ligatures=f]{encoding=*, shape=sc}{70} \colorbox{headingcolor}{\parbox{\linewidth}{\centering#1}}}

\titleformat{\section}{\Large\scshape\filcenter}{}{0em}{\headingbox}
\renewcommand\labelitemi{\raisebox{0.4ex}{\tiny$\bullet$}}
\renewcommand{\labelitemii}{$\cdot$}
\pagenumbering{gobble}

\begin{document}

Some text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.

\section*{Professional Experience}

Some other text. Some other text. Some other text. Some other text…

\end{document} 

enter image description here

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.