Updated version
After the edit with the question, I propose a different approach here not using a list to place the labels but reducing the width for the tcolorbox
and using an optional argument (it could easily be turned into mandatory) and the overlay
key to place the label at a fixed vertical position; since the label is placed inside a node of fixed width and with align=right
, they admit line breaking and raggedleft texts (feel free to change the lengths according to your needs):
\documentclass{article}
\usepackage[left=60pt,top=60pt,right=60pt,bottom=60pt]{geometry}
\usepackage{xcolor}
\usepackage{kantlipsum}
\usepackage{enumitem}
\usepackage[many]{tcolorbox}
\setitemize{nolistsep,labelsep=1ex,leftmargin=*}
%% colors---
\definecolor{lightgray}{gray}{0.8}
%%items--
\newlist{items}{description}{1}
\setlist[items]{align=right,font=\normalfont, leftmargin=1.8in,style=nextline,labelsep=1em,}
%% leftrulebox---
\tcbuselibrary{skins,breakable}
\newtcolorbox{leftrulebox}[1][]{
colback=white,
left=0.5ex,
top=0pt,
arc=0pt,
outer arc=0pt,
enlarge left by=1.8in,
enlarge right by=-\dimexpr1.8in+\parindent\relax,
right=\dimexpr1.8in+\parindent\relax,
leftrule=1pt,
rightrule=0pt,
toprule=0pt,
bottomrule=0pt,
breakable,
nobeforeafter,
enhanced jigsaw,
overlay={
\node[anchor=north east,inner ysep=0pt,align=right,text width=1.5in]
at ([yshift=-0.55ex]frame.north west) {\hfill#1};
},
before=\vskip2\itemsep\noindent
}
\begin{document}
\section*{Objective}
\begin{leftrulebox}[Objective]
\kant[1]
\end{leftrulebox}
\section*{Positions}
\begin{leftrulebox}[1/2010 -- 2/2012]
\textbf{Lead Programmer}, Social Networks Inc \par
Some text \par some text
\begin{itemize}
\item Reengineered multiple systems that fueled improvements to productivity, eficiency, uptime and accuracy for global business operations. Developed code, system design and test/QA plans for all solutions and often coordinated the national or international rollout.
\item Led, architected and participated in the design, testing and deployment of client/server, multi-tier applications, ActiveX and related components.
\item Developed new procedures for requirements gathering, needs analysis, testing, scripting and documentation to strengthen quality and functionality of business-critical applications.
\end{itemize}
\end{leftrulebox}
\begin{leftrulebox}[1/2009 -- 2/2010]
\textbf{Programmer I}, The Coolest Search Engine
\begin{itemize}
\item Led solutions engineering that involved process automation, macro conversion and functionality enhancement. Replaced time-consuming, error prone manual processes with elegant, automated solutions.
\item Developed and implemented cross-platform, Java-based POS system. Completed project under budget and three weeks ahead of deadline.
\item Coded new solutions that increased availability and scalability by 45\% and 75\%, respectively.
\end{itemize}
\end{leftrulebox}
\section*{Skills}
\begin{leftrulebox}[\textbf{Systems}]
\kant[1-2]
\end{leftrulebox}
\begin{leftrulebox}[\textbf{Others}]
some short text here
\end{leftrulebox}
\begin{leftrulebox}[\textbf{Databases}]
some short text here
\end{leftrulebox}
\end{document}
Some images showing the label alignment:
First version
After \item[some text]
TeX is in vertical mode and this produces the undesired effect. Add \leavevmode
.
\documentclass{article}
\usepackage[left=60pt,top=60pt,right=60pt,bottom=60pt]{geometry}
\usepackage{kantlipsum}
\usepackage{xcolor}
\usepackage{enumitem}
\setitemize{nolistsep,labelsep=1ex,leftmargin=*}
%% colors---
\definecolor{lightgray}{gray}{0.8}
%%items--
\newlist{items}{description}{1}
\setlist[items]{align=right,font=\normalfont, leftmargin=1.8in,style=nextline,labelsep=1em,}
%% leftrulebox---
\usepackage[many]{tcolorbox}
\tcbuselibrary{skins,breakable}
\newtcolorbox{leftrulebox}{
colback=white,
left=0.5ex,
top=0pt,
arc=0pt,
outer arc=0pt,
leftrule=1pt,
rightrule=0pt,
toprule=0pt,
bottomrule=0pt,
breakable,
enhanced jigsaw,
before=\vskip-13.5pt
}
%
%
\begin{document}
\begin{items}
\item[Some text]%
\leavevmode
\begin{leftrulebox}
\par
\textbf{Lead Programmer}, Social Networks Inc \par
Some text \par some text
\begin{itemize}
\item Reengineered multiple systems that fueled improvements to productivity, eficiency, uptime and accuracy for global business operations. Developed code, system design and test/QA plans for all solutions and often coordinated the national or international rollout.
\item Led, architected and participated in the design, testing and deployment of client/server, multi-tier applications, ActiveX and related components.
\item Developed new procedures for requirements gathering, needs analysis, testing, scripting and documentation to strengthen quality and functionality of business-critical applications.
\end{itemize}
\kant[1-5]
\end{leftrulebox}
\end{items}
\end{document}
Using just \leavevmode
the box will be slightly down, due to the regular spacing before a tcolorbox
; you can correct this by using a convenient \vskip
for before
either globally (as in my example) or locally, by adding an optional argument to pass options to the tcolorbox
:
\documentclass{article}
\usepackage[left=60pt,top=60pt,right=60pt,bottom=60pt]{geometry}
\usepackage{kantlipsum}
\usepackage{xcolor}
\usepackage{enumitem}
\setitemize{nolistsep,labelsep=1ex,leftmargin=*}
%% colors---
\definecolor{lightgray}{gray}{0.8}
%%items--
\newlist{items}{description}{1}
\setlist[items]{align=right,font=\normalfont, leftmargin=1.8in,style=nextline,labelsep=1em,}
%% leftrulebox---
\usepackage[many]{tcolorbox}
\tcbuselibrary{skins,breakable}
\newtcolorbox{leftrulebox}[1][]{
colback=white,
left=0.5ex,
top=0pt,
arc=0pt,
outer arc=0pt,
leftrule=1pt,
rightrule=0pt,
toprule=0pt,
bottomrule=0pt,
breakable,
enhanced jigsaw,
#1
}
%
%
\begin{document}
\begin{items}
\item[Some text]
\leavevmode
\begin{leftrulebox}[before=\vskip-13.5pt]
\par
\textbf{Lead Programmer}, Social Networks Inc \par
Some text \par some text
\begin{itemize}
\item Reengineered multiple systems that fueled improvements to productivity, eficiency, uptime and accuracy for global business operations. Developed code, system design and test/QA plans for all solutions and often coordinated the national or international rollout.
\item Led, architected and participated in the design, testing and deployment of client/server, multi-tier applications, ActiveX and related components.
\item Developed new procedures for requirements gathering, needs analysis, testing, scripting and documentation to strengthen quality and functionality of business-critical applications.
\end{itemize}
\kant[1-5]
\end{leftrulebox}
\end{items}
\end{document}
Warning: I am no titlesec
expert, but as far as I understood the 3rd. mandatory argument of a \titleformat
is used for the vertical separation of the title. So use a negative value to shift up the title.
I introduced the \chaptertopspacing
length variable and set it to the value of 130pt
, this value is somewhat 'arbitrary' and should be changed to one's own needs.
\documentclass{book}
\usepackage[explicit]{titlesec}
\usepackage[many]{tcolorbox}
\usepackage{fancyhdr}
\usepackage{lmodern}
\usepackage{lipsum}
\definecolor{titlebgdark}{RGB}{0,163,243}
\definecolor{titlebglight}{RGB}{191,233,251}
\newlength{\chaptertopspacing}
\setlength{\chaptertopspacing}{130pt}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}
{}
{-\chaptertopspacing}
{%
\begin{tcolorbox}[
enhanced,
colback=titlebgdark,
boxrule=0.25cm,
colframe=titlebglight,
arc=0pt,
outer arc=0pt,
leftrule=0pt,
rightrule=0pt,
fontupper=\color{white}\sffamily\bfseries\huge,
enlarge left by=-1in-\hoffset-\oddsidemargin,
enlarge right by=-\paperwidth+1in+\hoffset+\oddsidemargin+\textwidth,
width=\paperwidth,
left=1in+\hoffset+\oddsidemargin,
right=\paperwidth-1in-\hoffset-\oddsidemargin-\textwidth,
top=0.6cm,
bottom=0.6cm,
overlay={
\node[
fill=titlebgdark,
draw=titlebglight,
line width=0.15cm,
inner sep=0pt,
text width=1.7cm,
minimum height=1.7cm,
align=center,
font=\color{white}\sffamily\bfseries\fontsize{30}{36}\selectfont
]
(chapname)
at ([xshift=-4cm]frame.north east)
{\thechapter};
\node[font=\small,anchor=south,inner sep=2pt] at (chapname.north)
{\MakeUppercase\chaptertitlename};
}
]
#1
\end{tcolorbox}%
}
\titleformat{name=\chapter,numberless}[display]
{\normalfont\huge\bfseries}
{}
{-\chaptertopspacing}
{%
\begin{tcolorbox}[
enhanced,
colback=titlebgdark,
boxrule=0.25cm,
colframe=titlebglight,
arc=0pt,
outer arc=0pt,
remember as=title,
leftrule=0pt,
rightrule=0pt,
fontupper=\color{white}\sffamily\bfseries\huge,
enlarge left by=-1in-\hoffset-\oddsidemargin,
enlarge right by=-\paperwidth+1in+\hoffset+\oddsidemargin+\textwidth,
width=\paperwidth,
left=1in+\hoffset+\oddsidemargin,
right=\paperwidth-1in-\hoffset-\oddsidemargin-\textwidth,
top=0.6cm,
bottom=0.6cm,
]
#1
\end{tcolorbox}%
}
\titlespacing*{\chapter}
{0pt}{0pt}{40pt}
\makeatother
\begin{document}
\chapter*{A test unnumbered chapter}
\lipsum[4]
\chapter{A test chapter with a long title that will span more than one line}
\lipsum[4]
\end{document}
Here's the version with a special \newtcolorbox
setting:
\documentclass{book}
\usepackage[explicit]{titlesec}
\usepackage[many]{tcolorbox}
\usepackage{fancyhdr}
\usepackage{lmodern}
\usepackage{blindtext}
\definecolor{titlebgdark}{RGB}{0,163,243}
\definecolor{titlebglight}{RGB}{191,233,251}
\newlength{\chaptertopspacing}
\setlength{\chaptertopspacing}{130pt}
% Common settings for unstarred and starred chapters
\newtcolorbox{chaptertitlebox}[1][]{%
enhanced,
colback=titlebgdark,
boxrule=0.25cm,
colframe=titlebglight,
arc=0pt,
outer arc=0pt,
remember as=title,
leftrule=0pt,
rightrule=0pt,
fontupper=\color{white}\sffamily\bfseries\huge,
enlarge left by=-1in-\hoffset-\oddsidemargin,
enlarge right by=-\paperwidth+1in+\hoffset+\oddsidemargin+\textwidth,
width=\paperwidth,
left=1in+\hoffset+\oddsidemargin,
right=\paperwidth-1in-\hoffset-\oddsidemargin-\textwidth,
top=0.6cm,
bottom=0.6cm,
#1
}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}
{}
{-\chaptertopspacing}
{%
\begin{chaptertitlebox}[%
overlay={
\node[
fill=titlebgdark,
draw=titlebglight,
line width=0.15cm,
inner sep=0pt,
text width=1.7cm,
minimum height=1.7cm,
align=center,
font=\color{white}\sffamily\bfseries\fontsize{30}{36}\selectfont
]
(chapname)
at ([xshift=-4cm]frame.north east)
{\thechapter};
\node[font=\small,anchor=south,inner sep=2pt] at (chapname.north)
{\MakeUppercase\chaptertitlename};
}
]
#1
\end{chaptertitlebox}%
}
\titleformat{name=\chapter,numberless}[display]
{\normalfont\huge\bfseries}
{}
{-\chaptertopspacing}
{%
\begin{chaptertitlebox}
#1
\end{chaptertitlebox}%
}
\titlespacing*{\chapter}
{0pt}{0pt}{40pt}
\makeatother
\begin{document}
\chapter*{A test unnumbered chapter}
\blindtext[10]
\chapter{A test chapter with a long title that will span more than one line}
\blindtext[10]
\end{document}
Best Answer
One way is to use the
adjustbox
package and apply:which yields:
Notes:
If you don't want the two boxes separate horizontally, remove the
\hfill
.Since the depth of the titles in the two boxes varied, I added a
\vphantom{p}
to the second box's title.References:
Code: