Skip to main content
2 of 3
edited tags
David Carlisle
  • 828.7k
  • 74
  • 1.7k
  • 2.6k

Question about paragraph with arguments for left aligned, centered and right aligned text

Consider the following minimal but working example.

\documentclass[landscape]{article} \usepackage[a3paper, textwidth=7.5cm, margin=1cm,landscape]{geometry} \usepackage{titlesec} \usepackage{xcolor} \newcommand{\mytitle}[1]{\colorbox{gray!40}{\makebox[\dimexpr\columnwidth- 2\fboxsep\relax]{\filcenter #1\strut}}} \titleformat{\paragraph} {\normalfont\normalsize\bfseries}{\theparagraph}{1em}{\mytitle} \titlespacing*{\paragraph} {0pt}{3.25ex plus 1ex minus .2ex}{1em} \begin{document} \thispagestyle{empty} \paragraph{Cheat Sheet Number Theory (1/2) - X.005 --/12-'15} \end{document} 

I have a question about the custom \paragraph command. I would like to change this to the following format.

\paragraph{Left aligned text}{Centered heading}{Right aligned text} 

When the first and third arguments are empty like so

\paragraph{}{Centered heading}{} 

the command should work as it does now.

Also

\paragraph{Left Aligned}{Centered heading}{} 

and

\paragraph{}{Centered heading}{Right aligned} 

should work as intuitively expected.

Is this possible by modifying the preamble as listed above? If so, then please advise on how I should implement this.

nilo de roock
  • 891
  • 1
  • 10
  • 17