Widths of digits and letters

Within a minipage environment (of a fixed length) I have a list; each list item consists of a phrase followed by an equal sign followed by a percent. The first percent is 60%.

I want (1) each phrase left aligned (within the minipage) (2) equal signs aligned, (3) the percent is right aligned (within the minipage) and (4) have only one inter word space between the equal sign and the first percent.

In the following attempt, I have tasks (1), (3) and (4) completed but not (2).

\documentclass[12pt]{report}
\begin{document}
\begin{flushleft}
\begin{minipage}{4in}
Midterm Exam \hfill= 60\% \\
Home-work \hfill= 5\% \\
Quizzes\hfill= s\% \\
Report \hfill= S\% \\
Final Exam\hfill= SS\%
\end{minipage}
\end{flushleft}
\end{document}


After spending some time trying to figure out widths of letters and digits, and then spending some more time here at TeX.SX I found a solution. (The following solution also provides the widths of some letters and a digit as a bonus.)

\documentclass[12pt]{report}
\begin{document}
\begin{flushleft}

\newlength{\six}
\settowidth{\six}{6}

\newlength{\s}
\settowidth{\s}{s}

\newlength{\eS}
\settowidth{\eS}{S}

\begin{minipage}{4in}
Midterm Exam \hfill= 60\% \\
Home-work \hfill= \hspace{\six}5\% \\
Quizzes\hfill= \hspace{-\s}\hspace{\six}\hspace{\six}s\% \\
Report \hfill= \hspace{-\eS}\hspace{\six}\hspace{\six}S\% \\
Final Exam\hfill= \hspace{-\eS}\hspace{-\eS}\hspace{\six}\hspace{\six}SS\% \\
\end{minipage}

The width of S = \the\eS\\
The width of 6 = \the\six\\
The width of s = \the\s

\end{flushleft}
\end{document}


My question is:

Is this the best way to do this? I assume not. Then what would be the best way to do this?

(P.s. I tried a tabular environment within the minipage environment. It introduces an left indent that I could not get rid of.)

-
If you just use a minipage to start a paragraph you can remove the regular paragraph indent by issuing \noindent before starting the minipage. Also the tabular spacing can be removed using @{} before the first column as in @celtschk's solution. – Werner Jan 14 '12 at 2:27

I tried a tabular environment within the minipage environment. It introduces an left indent that I could not get rid of.

The length that controls the horizontal cell padding in tabular environments is \tabcolsep. If you reset this length to 0pt inside the minipage, the effects will be local to that minipage. You can also use a tabularx environment instead of a normal tabular as it allows a specified width and provides the X column specifier which will expand a given column to fill any leftover space.

\documentclass[12pt]{report}

\usepackage{lipsum}
\usepackage{tabularx}
\usepackage{tikz}

\begin{document}
\lipsum[1]
\medskip

\noindent\begin{minipage}{4in}
\setlength\tabcolsep{0pt}

\begin{tabularx}{\linewidth}{X@{ = }r}
Midterm Exam & 60\% \tabularnewline
Home-work & 5\% \tabularnewline
Quizzes & s\% \tabularnewline
Report & S\% \tabularnewline
Final Exam & SS\%
\end{tabularx}
\end{minipage}
% Length check
\\\tikz{\draw[|-|] (0,0) -- node[fill=white]{4in} (4in, 0);}

\medskip
\lipsum[2]
\end{document}


Results:

-
If the OP requests "only one inter word space", you could just use @{~} for your column specification. – Werner Jan 14 '12 at 2:31
The "left indentation" is also on the right; just say @{} where you want to suppress the intercolumn space (also before the first column and the last one). – egreg Jan 14 '12 at 9:48
By changing the begin tabular line to \begin{tabularx}{\linewidth}{Xc>{{~}}r} I have got the desired effect. I tried what Werner and @egreg are suggesting but not with desired effect. Can either of you post the begin tabular line with what you are suggesting? – Sony Jan 14 '12 at 17:26
@Sony You're setting \tabcolsep to zero. I suggest, instead, \begin{tabularx}{\textwidth}{@{}Xcr@{}}, which doesn't require any setting; or {@{}Xc@{ }r@{}} to get a normal interword space between the c and the r columns. – egreg Jan 14 '12 at 17:30
Example changed to use @{ = } as the delimiter between the left and right columns. Kept the 0 tabcolsep because it seems more natural to me. – Sharpie Jan 14 '12 at 17:41

Tabular is the right solution. You can get rid of the left indentation by starting your table specification with @{}:

\begin{tabular}{@{}l@{ = }r@{\,\%}}
Midterm Exam & 60 \\
Home-work & 5\\
Quizzes & s\\
Report & S\\
Final Exam & SS
\end{tabular}

-
You could use p{<len>} for the first column to specify the width. – Werner Jan 14 '12 at 2:25
The fixed width (~ 4in from one end to the other end) is not included in this solution. Am I correct to assume @Werner is making a suggestion to fix the solution? I could not get it fixed as suggested. However, if I use p{3in} as a second column (That is, tabular now have three columns) then the output is fine (acceptable). – Sony Jan 14 '12 at 16:59
To get the correct space between the number and the percent use @{\,\%} – Marco Daniel Jan 14 '12 at 17:57
@Sony: Sorry, I overlooked the 4in requirement. Werner's suggestion indeed should fix it (with an appropriate value for len). Maybe you didn't replace the l by p{len} but added the latter? But then, the tabularx solution by Sharpie is better for that requirement. However, I consider @{} better than changing \tabcolsep. – celtschk Jan 14 '12 at 19:53
@MarcoDaniel: Thanks, I've added the \, now. – celtschk Jan 14 '12 at 19:55