[Tex/LaTex] Strange \parbox issue: vertical positioning

boxesvertical alignment

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:

enter image description here

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}

Best 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

enter image description here

\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}