0

I would like to include an image on the top right of the document (above the horizontal line). Also, I would like to format the section headings (which appear on the left margin of the document) to red color.

\documentclass[10pt]{article}

\usepackage{calc}
\usepackage{comment}
\usepackage{soul}

\makeatletter
\newlength{\bibhang}
\setlength{\bibhang}{1em} %1em}
\newlength{\bibsep}
 {\@listi \global\bibsep\itemsep \global\advance\bibsep by\parsep}
\newenvironment{bibsection}%
        {\begin{enumerate}{}{%
       \setlength{\leftmargin}{\bibhang}%
       \setlength{\itemindent}{-\leftmargin}%
       \setlength{\itemsep}{\bibsep}%
       \setlength{\parsep}{\z@}%
        \setlength{\partopsep}{0pt}%
        \setlength{\topsep}{0pt}}}
        {\end{enumerate}\vspace{-.6\baselineskip}}
\makeatother

\reversemarginpar

\usepackage{titlesec}

\usepackage[paper=letterpaper,
            %includefoot, % Uncomment to put page number above margin
            marginparwidth=1.2in,     % Length of section titles
            marginparsep=.05in,       % Space between titles and text
            margin=1in,               % 1 inch margins
            includemp]{geometry}

\setlength{\parindent}{0in}

\usepackage[shortlabels]{enumitem}

\usepackage{fancyhdr,lastpage}
\pagestyle{fancy}
\fancyhf{}\renewcommand{\headrulewidth}{0pt}
\fancyfootoffset{\marginparsep+\marginparwidth}
\newlength{\footpageshift}
\setlength{\footpageshift}
          {0.5\textwidth+0.5\marginparsep+0.5\marginparwidth-2in}
\lfoot{\hspace{\footpageshift}%
       \parbox{4in}{\, \hfill %
                    \arabic{page} of \protect\pageref*{LastPage} % +LP
                    \hfill \,}}

\usepackage{color,hyperref}
\definecolor{darkblue}{rgb}{0.0,0.0,0.3}
\hypersetup{colorlinks,breaklinks,
            linkcolor=darkblue,urlcolor=darkblue,
            anchorcolor=darkblue,citecolor=darkblue}



 \newcommand{\makeheading}[2][]%
        {\hspace*{-\marginparsep minus \marginparwidth}%
         \begin{minipage}[t]{\textwidth+\marginparwidth+\marginparsep}%
             {\large \bfseries #2 \hfill #1}\\[-0.15\baselineskip]%
                 \rule{\columnwidth}{1pt}%
         \end{minipage}}

\renewcommand{\section}[1]{\pagebreak[3]%
    \hyphenpenalty=10000%
    \vspace{1.3\baselineskip}%
    \phantomsection\addcontentsline{toc}{section}{#1}%
    \noindent\llap{\scshape\smash{\parbox[t]{\marginparwidth}{\raggedright #1}}}%
    \vspace{-\baselineskip}\par}

\newenvironment{outerlist}[1][\enskip\textbullet]%
        {\begin{itemize}[#1,leftmargin=*]}{\end{itemize}%
         \vspace{-.6\baselineskip}}

\newenvironment{lonelist}[1][\enskip\textbullet]%
        {\begin{list}{#1}{%
        \setlength{\partopsep}{0pt}%
        \setlength{\topsep}{0pt}}}
        {\end{list}\vspace{-.6\baselineskip}}

\newenvironment{innerlist}[1][\enskip\textbullet]%
        {\begin{itemize}[#1,leftmargin=*,parsep=0pt,itemsep=0pt,topsep=0pt,partopsep=0pt]}
        {\end{itemize}}

\newenvironment{loneinnerlist}[1][\enskip\textbullet]%
        {\begin{itemize}[#1,leftmargin=*,parsep=0pt,itemsep=0pt,topsep=0pt,partopsep=0pt]}
        {\end{itemize}\vspace{-.6\baselineskip}}

\newcommand{\blankline}{\quad\pagebreak[3]}
\newcommand{\halfblankline}{\quad\vspace{-0.5\baselineskip}\pagebreak[3]}

\newcommand\doilink[1]{\href{http://dx.doi.org/#1}{#1}}
\newcommand\doi[1]{doi:\doilink{#1}}

\providecommand*\url[1]{\href{#1}{#1}}
\renewcommand*\url[1]{\href{#1}{\texttt{#1}}}

\providecommand*\email[1]{\href{mailto:#1}{#1}}

\providecommand\BibTeX{{B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
    \TeX}}
\providecommand\Matlab{\textsc{Matlab}}

\begin{document}
 \makeheading{Abhimanyu Arora}

\section{Contact Information}

\newlength{\rcollength}\setlength{\rcollength}{2in}
\begin{tabular}[t]{@{}p{\textwidth-\rcollength}p{\rcollength}}
Off no. 123  & 123 456 789  \\
Belgium     & \email{abhi@yahoo.com}\\
\end{tabular}


\section{Research Interests}

Development Economics, Microeconomics

\section{Education}

\textbf{University of Belgium},
\begin{outerlist}

\item[] Ph.D. Student, {Economics}
        \begin{innerlist}
        \item Thesis Topic: \emph{Essays in Development Economics}
        \end{innerlist}
\end{outerlist}

\end{document}

I tried the command

\makeheading[\includegraphics[height=1.5in]{my_picutre}]{Your Name}

where I just have \makeheading, but it didn't work out. The error message says it couldn't find out the end of the line...

  • 1
    Please make a complete minimal working example. – Marco Daniel May 31 '14 at 14:05
  • 1
    This looks like an awful hack of some other class or .sty file. I am unsure how to use it and at first glance it does not seem fit to deliver commands for a CV. May I suggest to use moderncv instead? – user31729 May 31 '14 at 14:08
  • @ChristianHupfer: Thanks for your suggestion, but since Werner has advised to use article for its flexibility, let us try this, if you don't mind – Abhimanyu Arora May 31 '14 at 14:16
  • @AbhimanyuArora: Well, I agree with Werner about that letter issue of yours, but there are definitely differences between a CV and a letter. I would not write a book with article (or its corresponding relatives as scrartcl etc.) and I would refrain from writing a letter with book ;-) – user31729 May 31 '14 at 14:18
3

Without discussing the template you can achieve your goals with:

  1. Adding a photo: \makeheading[{\includegraphics[width=1.5cm]{photo}}]{Abhimanyu Arora}
  2. Change the style of section:

    \renewcommand{\section}[1]{\pagebreak[3]%
        \hyphenpenalty=10000%
        \vspace{1.3\baselineskip}%
        \phantomsection\addcontentsline{toc}{section}{#1}%
        \noindent\llap{\scshape\smash{\parbox[t]{\marginparwidth}{\raggedright\textcolor{red}{#1}}}}%
        \vspace{-\baselineskip}\par}
    

Here the complete MWE with the result:

\documentclass[10pt]{article}
\usepackage{graphicx}
\usepackage{calc}
\usepackage{comment}
\usepackage{soul}

\makeatletter
\newlength{\bibhang}
\setlength{\bibhang}{1em} %1em}
\newlength{\bibsep}
 {\@listi \global\bibsep\itemsep \global\advance\bibsep by\parsep}
\newenvironment{bibsection}%
        {\begin{enumerate}{}{%
       \setlength{\leftmargin}{\bibhang}%
       \setlength{\itemindent}{-\leftmargin}%
       \setlength{\itemsep}{\bibsep}%
       \setlength{\parsep}{\z@}%
        \setlength{\partopsep}{0pt}%
        \setlength{\topsep}{0pt}}}
        {\end{enumerate}\vspace{-.6\baselineskip}}
\makeatother

\reversemarginpar

\usepackage{titlesec}

\usepackage[paper=letterpaper,
            %includefoot, % Uncomment to put page number above margin
            marginparwidth=1.2in,     % Length of section titles
            marginparsep=.05in,       % Space between titles and text
            margin=1in,               % 1 inch margins
            includemp]{geometry}

\setlength{\parindent}{0in}

\usepackage[shortlabels]{enumitem}

\usepackage{fancyhdr,lastpage}
\pagestyle{fancy}
\fancyhf{}\renewcommand{\headrulewidth}{0pt}
\fancyfootoffset{\marginparsep+\marginparwidth}
\newlength{\footpageshift}
\setlength{\footpageshift}
          {0.5\textwidth+0.5\marginparsep+0.5\marginparwidth-2in}
\lfoot{\hspace{\footpageshift}%
       \parbox{4in}{\, \hfill %
                    \arabic{page} of \protect\pageref*{LastPage} % +LP
                    \hfill \,}}

\usepackage{color,hyperref}
\definecolor{darkblue}{rgb}{0.0,0.0,0.3}
\hypersetup{colorlinks,breaklinks,
            linkcolor=darkblue,urlcolor=darkblue,
            anchorcolor=darkblue,citecolor=darkblue}



 \newcommand{\makeheading}[2][]%
        {\hspace*{-\marginparsep minus \marginparwidth}%
         \begin{minipage}[t]{\textwidth+\marginparwidth+\marginparsep}%
             {\large \bfseries #2 \hfill #1}\\[-0.15\baselineskip]%
                 \rule{\columnwidth}{1pt}%
         \end{minipage}}

\renewcommand{\section}[1]{\pagebreak[3]%
    \hyphenpenalty=10000%
    \vspace{1.3\baselineskip}%
    \phantomsection\addcontentsline{toc}{section}{#1}%
    \noindent\llap{\scshape\smash{\parbox[t]{\marginparwidth}{\raggedright\textcolor{red}{#1}}}}%
    \vspace{-\baselineskip}\par}

\newenvironment{outerlist}[1][\enskip\textbullet]%
        {\begin{itemize}[#1,leftmargin=*]}{\end{itemize}%
         \vspace{-.6\baselineskip}}

\newenvironment{lonelist}[1][\enskip\textbullet]%
        {\begin{list}{#1}{%
        \setlength{\partopsep}{0pt}%
        \setlength{\topsep}{0pt}}}
        {\end{list}\vspace{-.6\baselineskip}}

\newenvironment{innerlist}[1][\enskip\textbullet]%
        {\begin{itemize}[#1,leftmargin=*,parsep=0pt,itemsep=0pt,topsep=0pt,partopsep=0pt]}
        {\end{itemize}}

\newenvironment{loneinnerlist}[1][\enskip\textbullet]%
        {\begin{itemize}[#1,leftmargin=*,parsep=0pt,itemsep=0pt,topsep=0pt,partopsep=0pt]}
        {\end{itemize}\vspace{-.6\baselineskip}}

\newcommand{\blankline}{\quad\pagebreak[3]}
\newcommand{\halfblankline}{\quad\vspace{-0.5\baselineskip}\pagebreak[3]}

\newcommand\doilink[1]{\href{http://dx.doi.org/#1}{#1}}
\newcommand\doi[1]{doi:\doilink{#1}}

\providecommand*\url[1]{\href{#1}{#1}}
\renewcommand*\url[1]{\href{#1}{\texttt{#1}}}

\providecommand*\email[1]{\href{mailto:#1}{#1}}

\providecommand\BibTeX{{B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
    \TeX}}
\providecommand\Matlab{\textsc{Matlab}}

\begin{document}
\makeheading[{\includegraphics[width=1.5cm]{photo}}]{Abhimanyu Arora}


\section{Contact Information}

\newlength{\rcollength}\setlength{\rcollength}{2in}
\begin{tabular}[t]{@{}p{\textwidth-\rcollength}p{\rcollength}}
Off no. 123  & 123 456 789  \\
Belgium     & \email{abhi@yahoo.com}\\
\end{tabular}


\section{Research Interests}

Development Economics, Microeconomics

\section{Education}

\textbf{University of Belgium},
\begin{outerlist}

\item[] Ph.D. Student, {Economics}
        \begin{innerlist}
        \item Thesis Topic: \emph{Essays in Development Economics}
        \end{innerlist}
\end{outerlist}

\end{document}

enter image description here

  • Grazie. But how can I change the size of the image, please? It shows error when I use square brackets to specify width as in normal \includegraphics command. – Abhimanyu Arora May 31 '14 at 14:41
  • @AbhimanyuArora: As usual by the optional argument of \includegraphics: \includegraphics[width=1.5cm]{photo} – Marco Daniel May 31 '14 at 14:42
  • 2
    You have to use {\includegraphics[....]{photo}} to protect the inner optional [] from the outer ones – user31729 May 31 '14 at 14:43
  • 1
    @AbhimanyuArora: The the comment of Christian. I improved my answer. – Marco Daniel May 31 '14 at 14:45
  • 2
    @AbhimanyuArora: I also found Marco's solution, with a different scaling however, but he was quicker (;-)), and the picture is on the right side. – user31729 May 31 '14 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.