[Tex/LaTex] Flushright and whitespace

horizontal alignmentitemize

I'm using minipage and flushleft/right in an item to achieve an item with some left aligned text and a right aligned date associated with it. However, the right alignment is problematic. The first problem is white space after lines, but if I use % then I can remove this, although it would be nice if I didn't have to litter %'s everywhere. The second problem is the last element is further right aligned. Also, if I use \break after any item, it is fully right aligned (but there is obviously an undesired new line). I discovered removing the \vspace command causes correct right alignment, but I want to reduce the vertical space.

\newcommand{\resitemwithdate}[2]{
    \vspace{-3pt}
    \item {
        \begin{minipage}[t]{.80\linewidth}
            \flushleft #1
        \end{minipage}
        \hfill
        \begin{minipage}[t]{.15\linewidth}
            \flushright #2%
        \end{minipage}%
    }%
}

\begin{itemize}
    \resitemwithdate{A}{B}
    \resitemwithdate{A}{B}%
    \resitemwithdate{A}{B}\break
    \resitemwithdate{A}{B}
\end{itemize}

Screenshot of output

Best Answer

\flushright etc. introduce additional vertical white space, making \vspace 'necessary', I recommend \raggedright etc. for this.

\item does not have a mandatory argument!

In addition, I recommend the enumitem package for fine control of the vertical spacings in an itemize list.

\documentclass{article}

\usepackage{enumitem}

\usepackage{showframe}% Remove this later on

\newcommand{\resitemwithdate}[2]{%
\item 
  \begin{minipage}[t]{.80\linewidth}
    \raggedright #1%
  \end{minipage}
  \hfill
  \begin{minipage}[t]{.15\linewidth}
    \raggedleft #2%
  \end{minipage}
}

\begin{document}
\begin{itemize}[itemsep=0pt]
    \resitemwithdate{A}{B}
    \resitemwithdate{A}{B}
    \resitemwithdate{A}{B}
\end{itemize}
\end{document}

enter image description here