[Tex/LaTex] aside in XeLaTeX can’t break line automatically

line-breakingxetex

I downloaded a resume template and try to modify it. However, when I modify the email address on the left aside. Since my email address is much longer than the previous mail address within the file. So the email address in the generated pdf just stretched to the main content. How to let LaTeX automatically detect line break within the aside panel so I don't need to adjust it by my own? Thank you very much!

Code:

\documentclass[]{friggeri-cv}
\addbibresource{bibliography.bib}

\begin{document}
\header{Songlin}{Yang}
       {social network analyst}


% In the aside, each new line forces a line break
\begin{aside}
  \section{about}
    2925 Dufferin Street
    North York
    Ontario
    ~
    \href{mailto:songlin.yang@mail.utoronto.ca}{songlin.yang@mail.utoronto.ca}
    ~
  \section{languages}
    English
    Chinese
  \section{programming}
    {\color{red} $\varheartsuit$} JavaScript
    (ES5, node.js)
    Python, C, OCaml
    CSS3 \& HTML5
\end{aside}

Result

Best Answer

friggeri-cv.cls downloaded at http://www.latextemplates.com/template/friggeri-resume-cv.

To have a break in your email address, you can simply add a space in it:

\href{mailto:songlin.yang@mail.utoronto.ca}{songlin.yang@ mail.utoronto.ca}

MWE:

\documentclass[]{friggeri-cv}

\addbibresource{bibliography.bib}

\begin{document}
\header{Songlin}{Yang}
       {social network analyst}


% In the aside, each new line forces a line break
\begin{aside}
  \section{about}
    2925 Dufferin Street
    North York
    Ontario
    ~
    \href{mailto:songlin.yang@mail.utoronto.ca}{songlin.yang@ mail.utoronto.ca}
    ~
  \section{languages}
    English
    Chinese
  \section{programming}
    {\color{red} $\varheartsuit$} JavaScript
    (ES5, node.js)
    Python, C, OCaml
    CSS3 \& HTML5
\end{aside}
\end{document} 

Output

enter image description here

Otherwise, you can make more room for the aside environment, patching this environment.

That is, add the following lines in your preamble:

\patchcmd{\aside}
  {\begin{textblock}{3.6}(1.5, 4.33)}
  {\begin{textblock}{5.3}(0, 4.33)}
  {}{}

MWE:

\documentclass[]{friggeri-cv}

\patchcmd{\aside}
  {\begin{textblock}{3.6}(1.5, 4.33)}
  {\begin{textblock}{5.3}(0, 4.33)}
  {}{}

\addbibresource{bibliography.bib}

\begin{document}
\header{Songlin}{Yang}
       {social network analyst}


% In the aside, each new line forces a line break
\begin{aside}
  \section{about}
    2925 Dufferin Street
    North York
    Ontario
    ~
    \href{mailto:songlin.yang@mail.utoronto.ca}{songlin.yang@mail.utoronto.ca}
    ~
  \section{languages}
    English
    Chinese
  \section{programming}
    {\color{red} $\varheartsuit$} JavaScript
    (ES5, node.js)
    Python, C, OCaml
    CSS3 \& HTML5
\end{aside}
\end{document} 

Output:

enter image description here

Related Question