Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\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?

share|improve this question

migrated from stackoverflow.com Apr 26 '12 at 9:38

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

1  
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
add comment

1 Answer 1

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}

enter image description here

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}

enter image description here

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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