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.

I am working on a list of courses that I have taken. The following code:

Math 100--Trivialities \hfill Professor Jane Doe
\begin{flushright}
Grade: A
\end{flushright}

produces

enter image description here

Notice that there is an extra line space between the professor's name and grade. Is it possible to remove that space so that the Grade appears on the next line as if it were typed in a paragraph? In my mind, I'm thinking of it looking something like:

Math 100-Trivialities        Professor Jane Doe
                                       Grade: A
share|improve this question
add comment

1 Answer 1

up vote 6 down vote accepted

Here are two options for achieving your requested output:

enter image description here

\documentclass{article}
\begin{document}
\noindent Math 100--Trivialities \hfill Professor Jane Doe \par
\hfill Grade: A

\bigskip

\noindent Math 100--Trivialities \hfill
\begin{tabular}[t]{r@{}}
  Professor Jane Doe \\
  Grade: A
\end{tabular}
\end{document}

\noindent ensures that the left entry is flush with the left margin.

The first inserts a paragraph break and then flushes Grade: A to the right using \hfill. The second uses the fact that a tabular is traditionally [c]enter-aligned and overriding that with [t]op. Using a column specification of r@{} adds the contents right-aligned with no column separation on the right.

If you're using a document style that has a non-zero \parskip, you can revert this in the first approach, if needed. My MWE provides no \parskip.


Another, perhaps "overkill-ish" way of obtaining the output would be to use flushright and setting the first entries (on the same line) in a box of width \linewidth:

\begin{flushright}
\makebox[\linewidth]{Math 100--Trivialities \hfill Professor Jane Doe}
Grade: A
\end{flushright}
share|improve this answer
    
What about a tabular*? –  egreg Nov 20 '12 at 20:35
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.