If you compile the code given below, then the row which states "Average Pre-Authentication Response Time" is justified with a lot of spacing between the words. I want it to be left-aligned. Also, if a line breakage is required, then can I ask LaTeX to prefer keeping the word as a whole and shifting it to the next line if space is available? In this case, there is a hyphen and the word is breaking, but there is enough space for the whole word to shift down.

%% maxwidth is the original width if it is less than linewidth
%% otherwise use linewidth (to make sure the graphics do not exceed the margin)
\def\maxwidth{ %

\definecolor{fgcolor}{rgb}{0.345, 0.345, 0.345}

\definecolor{shadecolor}{rgb}{.97, .97, .97}
\definecolor{messagecolor}{rgb}{0, 0, 0}
\definecolor{warningcolor}{rgb}{1, 0, 1}
\definecolor{errorcolor}{rgb}{1, 0, 0}
\newenvironment{knitrout}{}{} % an empty environment to be redefined in TeX


%% for inline R code: if the inline code is not correctly parsed, you will see a message
\newcommand{\rinline}[1]{SOMETHING WRONG WITH knitr}



  \caption{Brief overview of the Results}
    Metrics for machine  & \textbf{Result} \\
    Failure Rate & 0.00\% \\
    Lorema LoremLore Lore & 0.0 sec \\
    Average Pre-Authentication (ASD) Response Time & 0.0 sec \\
    Overall Result & \cellcolor{passGood}Passed \\

  • 3
    Use >{\raggedright}XX so the first column will be typeset ragged right. Remove the flushleft environment around table which does nothing good. – egreg Oct 7 '13 at 20:53
  • 1
    By default, the material in an X column is typeset fully justified. If you want to have it typeset ragged-right while preserving the ability of TeX to hyphenate words, load the ragged2e package and use the column specification >{\RaggedRight}XX. (Note the two uppercase R's in "RaggedRight".) – Mico Oct 7 '13 at 20:56
  • @Mico: I used > \begin{tabularx}{0.75\textwidth}{{\RaggedRight}XX} after adding the package. It gives an Error: Illegal pream-token (\RaggedRight): `c' used. Any comments? – Alastor Moody Oct 7 '13 at 21:37
  • 1
    You're missing a > symbol before {\RaggedRight}XX. (Think of the > symbol as "pushing" its argument, {\RaggedRight}, into the specs for the column type X...) – Mico Oct 7 '13 at 21:39
  • 1
    If you do not want to allow hyphenation in a ragged-right environment, use \raggedright instead of \RaggedRight. However, be prepared for some fairly short and ragged-looking lines... – Mico Oct 7 '13 at 22:04

Collecting some of the information contained in the comments to the posting:

  • Text typeset in a column of type X is "fully justified". Depending on the (non)availabability of permissible hyphenation break points, this can lead to unsightly columns with either too little or too much text squeezed into the available space.

  • To typeset the text material in the first column of the table in "ragged-right" manner without permitting hyphenation, replace the column specifier X with


    Think of the > symbol as "pushing" its argument, \raggedright, into the column specification of X.

  • A downside of using the \raggedright specification is that the resulting material can look, well, extremely ragged. To enable ragged-right typesetting while also allowing LaTeX to insert line breaks at hyphenation points within words, be sure to load the ragged2e package (which is already done in your code) and to use the column specification


    Note the two uppercase-R letters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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