0

I have some code that currently creates a section title like this:

enter image description here

The relevant line in the code which does this is:

\titleformat{\section}[hang]{\fontsize{30}{38}\selectfont\bfseries}{\color{c1}}{20pt}{\begin{tabular}[t]{@{\color{c1}\vrule width 3pt}>{\hsp}l}#1\end{tabular}}

I'd like to right-align this, so that it looks like this:

enter image description here

How can I achieve this? I tried playing around with the code in the line above but to no avail.


MWE:

% these define the type of document and the look of the page
\documentclass[]{article}
\usepackage{lmodern}
\usepackage[toc,page]{appendix}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
\usepackage[margin=0.8in, top = 1.3in, headheight = 0.6in]{geometry}
%\usepackage[bottom, flushmargin]{footmisc}
\setlength{\footnotesep}{\baselineskip} % space between footnotes 
\setlength{\parindent}{0pt} % space at start of paragraph
\setlength{\parskip}{0.14in} % space between paragraphs
\usepackage[nodisplayskipstretch]{setspace}
\setstretch{1.1}

% colors
\usepackage{tcolorbox}
\usepackage{color} % colors
\usepackage{xcolor, colortbl} % more control over colors
\definecolor{c1}{HTML}{122084}

% heading formats
\usepackage[explicit]{titlesec}
\newcommand{\hsp}{\hspace{20pt}}
\titlespacing\section{0cm}{0in}{0in}
\titlespacing\subsection{0pt}{0.21in}{0.01in}
\titlespacing\subsubsection{0pt}{0.21in}{0in}


% table-related
\usepackage{array}
\usepackage{booktabs}
\usepackage{multicol, makecell}
\usepackage{multirow, hhline}
\usepackage{siunitx}
\newcommand\bstrut{\rule{0pt}{2.5ex}} % space before row
\newcommand\astrut{\rule[-1.25ex]{0pt}{0pt}} % space after row
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}


\begin{document}

\thispagestyle{plain}

\titleformat{\section}[hang]{\fontsize{30}{38}\selectfont\bfseries}{\color{c1}}{20pt}{\begin{tabular}[t]{@{\color{c1}\vrule width 3pt}>{\hsp}l}#1\end{tabular}}

\section*{An Internationally \\ Renowned Title}

\end{document}

1 Answer 1

1

enter image description here

\documentclass[]{article}
\usepackage{lmodern}
\usepackage[toc,page]{appendix}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
\usepackage[margin=0.8in, top = 1.3in, headheight = 0.6in]{geometry}
%\usepackage[bottom, flushmargin]{footmisc}
\setlength{\footnotesep}{\baselineskip} % space between footnotes 
\setlength{\parindent}{0pt} % space at start of paragraph
\setlength{\parskip}{0.14in} % space between paragraphs
\usepackage[nodisplayskipstretch]{setspace}
\setstretch{1.1}

% colors
\usepackage{tcolorbox}
\usepackage{color} % colors
\usepackage{xcolor, colortbl} % more control over colors
\definecolor{c1}{HTML}{122084}

% heading formats
\usepackage[explicit]{titlesec}
\newcommand{\hsp}{\hspace{-10cm}}
\titlespacing\section{18cm}{0in}{0in}
\titlespacing\subsection{0pt}{0.21in}{0.01in}
\titlespacing\subsubsection{0pt}{0.21in}{0in}


% table-related
\usepackage{array}
\usepackage{booktabs}
\usepackage{multicol, makecell}
\usepackage{multirow, hhline}
\usepackage{siunitx}
\newcommand\bstrut{\rule{0pt}{2.5ex}} % space before row
\newcommand\astrut{\rule[-1.25ex]{0pt}{0pt}} % space after row
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}


\begin{document}

\thispagestyle{plain}

\titleformat{\section}[hang]{\fontsize{30}{38}\selectfont\bfseries}{\color{c1}}{20pt}{\begin{tabular}[t]{@{\color{c1}\vrule width 3pt}>{\hsp}r}#1\end{tabular}}

\section*{An Internationally \\ Renowned Title}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .