# Strange \parbox issue: vertical positioning

I'm working on updating my resume and converting it into a LaTeX-based CV. I'm reusing features from several open templates, which I liked, but I'm trying to modify the document per my taste and contents. Long story short, currently I'm experiencing a strange issue, where the content (my researcher identifiers) within a \parbox, for some reason, gets dislocated down from the expected vertical position. I would appreciate help in fixing that. A picture of the issue and the relevant MWE follow. P.S. Please let me know, if you want my QR Code image file.

The issue:

Code (MWE):

\documentclass[12pt]{article}
\RequirePackage[T1]{fontenc}

\usepackage{charter}
\usepackage{calc}
\usepackage[shortcuts]{extdash}

\reversemarginpar

\usepackage[paper=a4paper,
marginparwidth=30.5mm,
marginparsep=1.5mm,
margin=25mm,
includemp]{geometry}

\setlength{\parindent}{0in}

\usepackage[shortlabels]{enumitem}
\usepackage{graphicx}

% I wasn't sure, if I could omit 'fancyhdr'-related
% code for the MWE purposes, so included just in case
\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}
\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}{2pt}%
\end{minipage}}

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

\usepackage{url}
\urlstyle{same}

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

\begin{document}
\makeheading{Aleksandr~L.~Blekh}

\section{Contact Information}

\newlength{\rcollength}\setlength{\rcollength}{1.85in}%
\newlength{\spacewidth}\setlength{\spacewidth}{20pt}
%
\begin{tabular}[t]{@{}p{\textwidth-\rcollength-\spacewidth}@{}p{\spacewidth}@{}p{\rcollength}}%

% Address box
\parbox{\textwidth-\rcollength-\spacewidth}{%
\textit{Mobile:} +1-111-111-1111 \\
\textit{E-mail:} \email{first.last@gmail.com} \\
\textit{E-mail:} \email{second@email.edu} \\
\textit{Web:\ \ \ \ } \href{http://www.aleksandrblekh.com}{www.aleksandrblekh.com}
}

&
{\vrule width 0.5pt}
\parbox[m][5\baselineskip]{\spacewidth}{} &

\parbox{\rcollength}{
\href{http://linkedin.com/in/ablekh}{LinkedIn}\\
\href{https://www.researchgate.net/profile/Aleksandr_Blekh}{ResearchGate}\\
\href{http://quora.com/Aleksandr-Blekh}{Quora}\\
\href{http://stackexchange.com/users/3422261/aleksandr-blekh?tab=accounts}{StackExchange}\\
\href{https://github.com/abnova}{GitHub}
}

\end{tabular}

\section{Researcher Identification}

\begin{tabular}[t]{@{}p{\textwidth-\rcollength-\spacewidth}@{}p{\spacewidth}@{}p{\rcollength}}%

\parbox{\textwidth-\rcollength-\spacewidth}{%
\textit{ORCID:\ \ \ \ \ \ \ \ \ } 0000-0003-4596-8376 $\rightarrow$ \\
\textit{ResearcherID:} P-1489-2014
}

&
%{\vrule width 0.5pt}
\parbox[m][5\baselineskip]{\spacewidth}{} &

\parbox{\rcollength}{
\includegraphics[scale=0.15]{MyOrcidQRcode}
}

\end{tabular}

\end{document}

• The options for \parbox are [c] (default, vertical centering), [t] (top alignment) or [b] (bottom alignment); [m] is not defined. Apr 10 '15 at 10:17
• @egreg: Sorry, I don't quite understand: I have two identical \parbox statements and first parbox works as expected, but the second one doesn't. That seems strange to me, considering the absolutely identical code. Apr 10 '15 at 10:26
• You have used [m] in some cases (which is an error although it does not generate an error message). Probably you want top alignment [t] in all your \parbox although it isn't clear why you are using \parbox at all since the text is a p column which is already \parbox[t] Apr 10 '15 at 10:33
• "does not work as expected" is not very informative, the parboxes all work as I expect, so if you are expecting something else you need to say what that is. Apr 10 '15 at 10:34
• The image you have added shows the parbox with the default centre alignment so the centre of the block starting Mobile, is aligned with the centre of the block starting linkedin, the space above mobile is because that block is smaller, so to align the centres you need space above and below. which is why I said above you wanted [t] but since p column is same as \parbox[t] I just removed them in my answer below. Apr 10 '15 at 22:58

## 1 Answer

You haven't said what "the issue" is. If you use no option, or [c] then the alignment point for the parbox is its vertical centre. If you use [t] the alignment point is the baseline of its top row.

As far as I can tell none of the \parbox in the example code are needed as they are just duplicating the p columns.

I guess you want something like

\documentclass[12pt]{article}
\RequirePackage[T1]{fontenc}

\usepackage{charter}
\usepackage{calc}
\usepackage[shortcuts]{extdash}

\reversemarginpar

\usepackage[paper=a4paper,
marginparwidth=30.5mm,
marginparsep=1.5mm,
margin=25mm,
includemp]{geometry}

\setlength{\parindent}{0in}

\usepackage[shortlabels]{enumitem}
\usepackage{graphicx}

% I wasn't sure, if I could omit 'fancyhdr'-related
% code for the MWE purposes, so included just in case
\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}
\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}{2pt}%
\end{minipage}}

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

\usepackage{url}
\urlstyle{same}

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

\begin{document}
\makeheading{Aleksandr~L.~Blekh}

\section{Contact Information}

\newlength{\rcollength}\setlength{\rcollength}{1.85in}%
\newlength{\spacewidth}\setlength{\spacewidth}{20pt}
%
\begin{tabular}[t]{@{}p{\textwidth-\rcollength-\spacewidth}@{\hspace{\spacewidth}}p{\rcollength}@{}}%

% Address box
\textit{Mobile:} +1-111-111-1111 \newline
\textit{E-mail:} \email{first.last@gmail.com} \newline
\textit{E-mail:} \email{second@email.edu} \newline
\textit{Web:\ \ \ \ } \href{http://www.aleksandrblekh.com}{www.aleksandrblekh.com}

&
\href{http://linkedin.com/in/ablekh}{LinkedIn}\newline
\href{https://www.researchgate.net/profile/Aleksandr_Blekh}{ResearchGate}\newline
\href{http://quora.com/Aleksandr-Blekh}{Quora}\newline
\href{http://stackexchange.com/users/3422261/aleksandr-blekh?tab=accounts}{StackExchange}\newline
\href{https://github.com/abnova}{GitHub}

\end{tabular}

\section{Researcher Identification}

\begin{tabular}[t]{@{}p{\textwidth-\rcollength-\spacewidth}@{\hspace{\spacewidth}}p{\rcollength}@{}}%

\textit{ORCID:\ \ \ \ \ \ \ \ \ } 0000-0003-4596-8376 $\rightarrow$ \newline
\textit{ResearcherID:} P-1489-2014
&
\rule{.5cm}{.5cm}%\includegraphics[scale=0.15]{MyOrcidQRcode}

\end{tabular}

\end{document}


Although I wouldn't use ORCID:\ \ \ \ \ \ \ \ \ to fake alignment, use an inner tested tabular to line up those fields.

using a tabular to avoid using \ \ \ \ and to add the vertical rule

\documentclass[12pt]{article}
\RequirePackage[T1]{fontenc}

\usepackage{charter}
\usepackage{calc}
\usepackage[shortcuts]{extdash}

\reversemarginpar

\usepackage[paper=a4paper,
marginparwidth=30.5mm,
marginparsep=1.5mm,
margin=25mm,
includemp]{geometry}

\setlength{\parindent}{0in}

\usepackage[shortlabels]{enumitem}
\usepackage{graphicx}

% I wasn't sure, if I could omit 'fancyhdr'-related
% code for the MWE purposes, so included just in case
\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}
\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}{2pt}%
\end{minipage}}

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

\usepackage{url}
\urlstyle{same}

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

\begin{document}
\makeheading{Aleksandr~L.~Blekh}

\section{Contact Information}

\newlength{\rcollength}\setlength{\rcollength}{1.85in}%
\newlength{\spacewidth}\setlength{\spacewidth}{20pt}
%
\begin{tabular}[t]{@{}p{\textwidth-\rcollength-\spacewidth}@{\hspace{\spacewidth}}p{\rcollength}@{}}%
\begin{tabular}[t]{@{}ll@{\quad}|}
\textit{Mobile:}& +1-111-111-1111 \\
\textit{E-mail:}& \email{first.last@gmail.com} \\
\textit{E-mail:}& \email{second@email.edu} \\
\textit{Web}& \href{http://www.aleksandrblekh.com}{www.aleksandrblekh.com}
\end{tabular}
&
\href{http://linkedin.com/in/ablekh}{LinkedIn}\newline
\href{https://www.researchgate.net/profile/Aleksandr_Blekh}{ResearchGate}\newline
\href{http://quora.com/Aleksandr-Blekh}{Quora}\newline
\href{http://stackexchange.com/users/3422261/aleksandr-blekh?tab=accounts}{StackExchange}\newline
\href{https://github.com/abnova}{GitHub}

\end{tabular}

\section{Researcher Identification}

\begin{tabular}[t]{@{}p{\textwidth-\rcollength-\spacewidth}@{\hspace{\spacewidth}}p{\rcollength}@{}}%

\textit{ORCID:\ \ \ \ \ \ \ \ \ } 0000-0003-4596-8376 $\rightarrow$ \newline
\textit{ResearcherID:} P-1489-2014
&
\rule{.5cm}{.5cm}%\includegraphics[scale=0.15]{MyOrcidQRcode}

\end{tabular}

\end{document}

• I appreciate your nice answer (+1 and most likely Accept). Actually, I've said what the issue is: "the content (my researcher identifiers) within a \parbox, for some reason, gets dislocated down from the expected vertical position". Anyway, I've updated my question with an image of the issue, which makes it clear. As far as the use of \parbox, it might be that the template uses them due to the optional vertical line, which is absent in your answer, but present in my code. Also, think you for the tabular advice for text alignment - I thought about it, but wanted a quick hack, hence the code. Apr 10 '15 at 22:54
• Introducing back the vertical line breaks the correct alignment. Perhaps, this and the need to have some spacing around that line were the reasons for using parbox in the first place. I would appreciate some advice on how to fix the problem. Apr 11 '15 at 1:29
• @AleksandrBlekh added example with vertical rule Apr 11 '15 at 21:09
• Got it. Much appreciated! Apr 11 '15 at 21:57