# [Tex/LaTex] parbox vertical alignment

boxesvertical alignment

The following code uses parboxes and hrules to vertically align two rectangles of different heights. The hrule seem a bit hackish to me. Is there a more elegant solution?

\documentclass{article}
\begin{document}
\begin{minipage}[t]{4in}
\parbox[t]{2cm}{\hrule height 0pt width 0pt \rule{1cm}{1cm}}
\parbox[t]{2cm}{\hrule height 0pt width 0pt \rule{1cm}{3cm}}
\end{minipage}
\end{document}


My apologies. I tried to simplify the problem and only obfuscated it. The real problem is vertical alignment of two figures, each created in separate Tikz environments. I would like the y's to be at the same height, but I'd like to accomplish this outside of tikz.

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
\draw (0,0)--(0,1) node[above]{$y$};
\end{tikzpicture}

\begin{tikzpicture}
\draw (0,0)--(0,3) node[above]{$y$};
\end{tikzpicture}

\end{document}


\documentclass{article}
\begin{document}

\begin{minipage}[t]{4in}
\parbox[t]{2cm}{\rule[-1cm]{1cm}{1cm}}
\parbox[t]{2cm}{\rule[-3cm]{1cm}{3cm}}
\end{minipage}

or simpler

\begin{minipage}[t]{4in}
\rule[-1cm]{1cm}{1cm}\hspace{1cm}%
\rule[-3cm]{1cm}{3cm}
\end{minipage}

\end{document}