I'm looking to define a section-like command for a CV document that takes
three arguments: role, company, and time - like shown below. Because I lack
the TeX experience I used the titlesec
package but it feels a little
forced as section titles don't have three parameters.
My own attempt in TeX, show below as \exp
, works kind of but breaks down
in situations where it needs to be clever about page breaks and other
corner cases. I was not able to reverse engineer the code that titlesec
uses and would be grateful for a direct implementation of such a title
command. It doesn't need to create a TOC entry.
\documentclass{article}
\usepackage[explicit]{titlesec}
\titlespacing*{\subsection}{0pt}{*2}{0pt}
\titleformat{\subsection}
{\normalfont\sffamily}
{}{0pt}{#1}
\def\experience#1#2#3{\subsection{\textbf{#3} -- #1\hfill #2}}
\begin{document}
\experience{Startup Inc.}{June 2013 -- June 2015}{Developer}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
amet.
\def\exp#1#2#3{
\ifhmode\par\fi
\removelastskip
\vskip2ex plus 0.5ex minus 0.3 ex\goodbreak
\hbox to \hsize{\sffamily\textbf{#3} -- #1\hfill #2}
\nobreak}
\exp{Startup Inc.}{June 2013 -- June 2015}{Developer}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
amet.
\end{document}
\experience
command?\exp
is already defined inamsmath
package. It is not good idea to use the same name for different purposes, regardless that you probably not use in your CV :-)titlesec
was made for or supports and I'm curious how this would be implemented in either TeX or LaTeX. @Zarko: I just picked something as I didn't want to override\experience
such that we can keep them apart in the discussion.\experience
as wrapper for a\subsection
or should\subsection
be changed as well?latex.ltx
, especially for\@startsection
and@sect
, but the easiest way is to grab\subsection
in a\let
statement and make a wrapper around it, using\subsection*
always