[Tex/LaTex] Left justified comment in table caption without caption package

captionshorizontal alignmenttables

I need to left justify long table captions, without overwriting all the special formatting (font etc.) of the style file I am required to use.

I tried to use

\usepackage{caption}
\captionsetup[table]{singlelinecheck=false}

but this affects everything. I want to just change a couple of problematic captions.

Is there any way to change the alignment just within a single caption? flushleft did not work.

Best Answer

Just issue a \raggedright within the \caption in question:

\documentclass{article}
\begin{document}

\begin{table}
  % This caption will be \raggedright.
  \caption[First caption]{\raggedright Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
  Phasellus ac magna eu risus consectetur fringilla vitae at mi. 
  Suspendisse nunc massa, maximus sit amet dignissim et, sodales at enim. 
  Nullam eleifend tincidunt sem, sed posuere ligula auctor sed. 
  Duis vitae tincidunt erat, id varius felis.}
\end{table}

\begin{table}
  % This caption will be justified.
  \caption[Second caption]{Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
  Phasellus ac magna eu risus consectetur fringilla vitae at mi. 
  Suspendisse nunc massa, maximus sit amet dignissim et, sodales at enim. 
  Nullam eleifend tincidunt sem, sed posuere ligula auctor sed. 
  Duis vitae tincidunt erat, id varius felis.}
\end{table}

\end{document}

Since the captions are long, you're bound to use the optional argument to set something shorter in the LoT. As such, there should be no concern about \protection for the alignment.