# \hrule screws up minipage right indent

\documentclass[12pt]{article}
\usepackage[
top=0.75in, bottom=0.75in, left=0.75in, right=0.75in,
textheight=8.75in
]{geometry}

\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}
\pagestyle{empty}

\begin{document}
\begin{minipage}{0.4\linewidth}
{\LARGE\textsc{My Name}}
\end{minipage}
\begin{minipage}[b]{0.4\linewidth}
\begin{flushright}
\footnotesize\texttt{myemail@abc.edu}
\end{flushright}
\end{minipage}
\smallskip
\hrule
\bigskip

{\textsc{ABC University}}

\end{document}


My code is above... if I remove the \hrule the email aligns correct to the right; however as soon as I add it it screws up. Any suggestions on how to fix this?

-

## migrated from stackoverflow.comApr 26 '12 at 9:38

This question came from our site for professional and enthusiast programmers.

I get essentially the same result in both cases. –  egreg Apr 26 '12 at 9:43
I'm not quite sure what you mean by "right indent" in the question's title. Have you tried inserting a \noindent right before the minipage? –  Mico Apr 26 '12 at 10:51

Actually you do not need a minipage here.

\documentclass[12pt]{article}
\usepackage[
top=0.75in, bottom=0.75in, left=0.75in, right=0.75in,
textheight=8.75in
]{geometry}

\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}
\pagestyle{empty}

\begin{document}
{\LARGE\textsc{My Name}}
\hfill
\footnotesize\texttt{myemail@abc.edu}
\smallskip
\hrule
\bigskip
{\textsc{ABC University}}

\end{document}


In case you want to retain your minipages, you should make their width almost half of the textwidth as \begin{minipage}[b]{0.495\linewidth}.

\documentclass[12pt]{article}
\usepackage[
top=0.75in, bottom=0.75in, left=0.75in, right=0.75in,
textheight=8.75in
]{geometry}

\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}
\pagestyle{empty}

\begin{document}
\begin{minipage}{0.495\linewidth}
{\LARGE\textsc{My Name}}
\end{minipage}
\begin{minipage}[b]{0.495\linewidth}
\begin{flushright}
\footnotesize\texttt{myemail@abc.edu}
\end{flushright}
\end{minipage}%
\smallskip
\hrule
\bigskip
{\textsc{ABC University}}

\end{document}


Or you can issue a \hfill inbetween the minipages like

\begin{minipage}{0.4\linewidth}
{\LARGE\textsc{My Name}}
\end{minipage}\hfill % ,----here
\begin{minipage}[b]{0.4\linewidth}
\begin{flushright}
\footnotesize\texttt{myemail@abc.edu}
\end{flushright}
\end{minipage}%
\smallskip
\hrule
\bigskip
{\textsc{ABC University}}


to get the same effect as mentioned in the comment by @egreg.

-
It doesn't matter how wide the two minipages are, as long as they contain the required text. Rather put \hfil between them and add \par after the second one. However, the minipage free solution is better, albeit a bit faulty with respect to line spacing. –  egreg Apr 26 '12 at 10:45
I followed that (without using the minipage), however it doesn't flush perfectly with the right hand side. (i.e. the email ends before the line ends). However if I add a \linebreak it flushes perfectly, however then that would add too much vertical spacing. Why is this? How can I fix this? Thanks!! –  user1358251 Apr 27 '12 at 3:05
@user1358251: Add % immediately after your email to align it flush with the right margin. –  Werner Apr 27 '12 at 3:30
thanks that fixed it!! can you give me an explanation why tho? –  user1358251 Apr 27 '12 at 22:29