0

This answer: https://tex.stackexchange.com/a/170767/69378 is (to me) an incredibly useful and versatile tcolorbox. This answer has satisfied my page design for almost a year now, but I am curious to know what would be required to make the text in the left hand column wrap and or hyphenate? When I have two moderately long words or am leaving a short note in this column it would be better if it could wrap and or hyphenate.

To no avail, I have tried out (and will try and update this list as I continue)

  • \hfill#1
  • \parbox{} wraps in various places in the tcolorbox (I may have incorrectly inferred that this would help from https://tex.stackexchange.com/a/296123/69378 by a comment about colorboxes by @ChristianHupfer)
  • \sloppy
  • \raggedleft#1

The MWE below is taken from the linked answer above, and quickly tweaked to show how (in my opinion) the tcolorbox is not very aggressive in wrapping or hyphenation.

\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.8cm,
    enlarge right by=-\dimexpr1.8cm+\parindent\relax,
    right=\dimexpr1.8cm+\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 and a nice long string here}]
\kant[1-3]
\end{leftrulebox}

\begin{leftrulebox}[\textbf{Others, oh so many others}]
some short text here\\
some short text here\\
some short text here \\
some short text here \\
\end{leftrulebox}

\begin{leftrulebox}[\textbf{(Databases of all different sorts)}]
some short text here\\
some short text here\\
some short text here \\
some short text here \\
\end{leftrulebox}

\end{document}
EngBIRD
  • 3,985
  • apart from the warnings about the misuse of \\ at the end of a paragraph, I don't see any particularly bad problems with hyphenation/line wrapping in your example? there are no over-full boxes where a word did not hyphenate, which is what I expected to see?? – David Carlisle Apr 05 '16 at 16:16
  • @DavidCarlisle Sorry about the \ at the end of the paragraph, copy paste error. An inked screenshot may have been helpful, but it didn't occur to me. To try and be more specific, I only gave the left column 1.8cm and in particular the date strings 1/2010 - 2/2012 surprises me that they didn't generate an overfull box and wrap... I am pretty sure this text is greater than 1.8 cm. – EngBIRD Apr 05 '16 at 16:29

1 Answers1

2

Hard to guess what layout you are looking for, but this reduces the width to 1in to make line wrapping more likely and uses ragged2e to allow ragged right and hyphenation. I also deleted the two \\ that were generating underfull hbox warnings.

enter image description here

\documentclass{article}
\usepackage[left=60pt,top=60pt,right=60pt,bottom=60pt]{geometry}
\usepackage{xcolor}
\usepackage{kantlipsum}
\usepackage{enumitem}
\usepackage[many]{tcolorbox}

\usepackage[newcommands]{ragged2e}
\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.8cm,
    enlarge right by=-\dimexpr1.8cm+\parindent\relax,
    right=\dimexpr1.8cm+\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=1in] 
        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 and a nice long string here}]
\kant[1-3]
\end{leftrulebox}

\begin{leftrulebox}[\textbf{Others, oh so many others}]
some short text here\\
some short text here\\
some short text here \\
some short text here 
\end{leftrulebox}

\begin{leftrulebox}[\textbf{(Databases of all different sorts)}]
some short text here\\
some short text here\\
some short text here \\
some short text here 
\end{leftrulebox}

\end{document}
David Carlisle
  • 757,742