# LaTeX, memoir, caption figure problem

I'm writing an master thesis, and I'm almost finished, but my promoter asked me to allign the table captions to the left, and pictures (figures) captions to the center.
Now I'm in trouble because I need to finish this within 2 days and I can't solve this.

I added the caption package end then all my problems started.
Basically what I figured out is that I have only a problem with figure captions, the table captions work ok.
In the sample provided I cut out all text, left all my style settings (I think they might be causing this, some incompatibility or wrong order?), if You comment out the figure caption it will compile without problems.
Commenting out hyperref doesn't help either.
I'm using Texmaker, and MiKTeX, I updated memoir, hyperref and caption packages (I read here somewhere that they had some compatibility problems that have been resolved)

Below is the MWE, and under it the whole log regarding the caption line:

\documentclass[12pt, a4paper, oneside]{memoir}  %twoside
\setsecnumdepth{subsubsection}
\maxtocdepth{subsection}

\usepackage[MeX]{polski}
\usepackage[utf8]{inputenc}
\usepackage{fullpage}
\usepackage{listings}
\usepackage{graphicx}
\usepackage{float}
\usepackage{multirow}
\usepackage{pbox}
\usepackage{pdfpages}

\usepackage{paralist}
\usepackage{indentfirst}

\usepackage{appendix}

\chapterstyle{section}

\makeatletter
\renewcommand{\fnum@figure}[1]{\small{\figurename~\thefigure}.  \sffamily}
\makeatother

\usepackage{caption}
\captionsetup[table]{justification=raggedright, singlelinecheck=off}
\captionsetup[figure]{justification=raggedright, singlelinecheck=off}
\captiondelim{. }

\usepackage{hyperref}
\usepackage[all]{hypcap}
\hypersetup{
unicode=true,          % non-Latin characters in Acrobat’s bookmarks
pdftoolbar=true,        % show Acrobat’s toolbar?
pdffitwindow=false,     % window fit to page when opened
pdfstartpage={1},
pdfstartview={FitH},    % fits the width of the page to the window
pdftitle={Master thesis},    % title
pdfauthor={me},     % author
pdfsubject={},   % subject of the document
pdfcreator={Creator},   % creator of the document
pdfproducer={Producer}, % producer of the document
pdfkeywords={keywords}, % list of keywords
pdfnewwindow=true,      % links in new window
citecolor=black,        % color of links to bibliography
filecolor=black,      % color of file links
urlcolor=black           % color of external links
%citecolor=green,        % color of links to bibliography
%filecolor=magenta,      % color of file links
%urlcolor=blue           % color of external links
}

\usepackage{color}
\usepackage{geometry}
\newgeometry{tmargin=2.5cm, bmargin=2.5cm, lmargin=3.5cm, rmargin=2cm}

\begin{document}
\rmfamily
\frontmatter
\pagenumbering{Roman}

\clubpenalty=10000
\widowpenalty=10000
\brokenpenalty=10000
\exhyphenpenalty=999999

\pagestyle{empty}

\tableofcontents

\pagestyle{plain}
\mainmatter

\begin{figure}[H]
\centering
\label{Some label}
\includegraphics[width=15.4cm]{./graphic/Drawing.PNG}
\caption{My description, should be alligned to the left}
\end{figure}

\begin{table}[H]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{lll}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{tabular}
\end{table}

\end{document}


Log:

This is pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9.6100 64-bit) (preloaded format=pdflatex 2016.11.23) 23 NOV 2016 10:27

! Extra }, or forgotten \endgroup.
\sbox ...hbox {\color@setgroup #2\color@endgroup }
l.83 ...scription, should be alligned to the left}
I've deleted a group-closing symbol because it seems to be
spurious, as in $x}$'. But perhaps the } is legitimate and
you forgot something else, as in \hbox{$x}'. In such cases the way to recover is to insert both the forgotten and the deleted material, e.g., by typing I$}'.
! Extra }, or forgotten \endgroup.
\@begin@tempboxa ...begingroup #2\color@endgroup }
\def \width {\wd \@tempbox...
l.83 ...scription, should be alligned to the left}
I've deleted a group-closing symbol because it seems to be
spurious, as in $x}$'. But perhaps the } is legitimate and
you forgot something else, as in \hbox{$x}'. In such cases the way to recover is to insert both the forgotten and the deleted material, e.g., by typing I$}'.
! Missing } inserted.
<inserted text>
}
l.83 ...scription, should be alligned to the left}
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing 2' now; then
my insertion and my current dilemma will both disappear.
! Missing } inserted.
<inserted text>
}
l.83 ...scription, should be alligned to the left}
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing 2' now; then
my insertion and my current dilemma will both disappear.


I think you don't need to charge caption package because using memoir caption formatting options is enough.

If you consult chapter 10 Floats and captions from memoir documentation will find all commands that you can use to change a particular caption or define new caption styles.

As an example, following \tabcaption command which if it's used as a table caption will print aligned to the left. For figure captions, the regular \caption command will be centered. The code for \tabcaption is based on the example in page 187.

\documentclass[12pt, a4paper, oneside]{memoir}  %twoside
\setsecnumdepth{subsubsection}
\maxtocdepth{subsection}

\usepackage[MeX]{polski}
\usepackage[utf8]{inputenc}
\usepackage{fullpage}
\usepackage{listings}
\usepackage{graphicx}
\usepackage{float}
\usepackage{multirow}
\usepackage{pbox}
\usepackage{pdfpages}

\usepackage{paralist}
\usepackage{indentfirst}

\usepackage{appendix}

\chapterstyle{section}

\makeatletter
\renewcommand{\fnum@figure}[1]{\small{\figurename~\thefigure}.  \sffamily}
\makeatother

%\usepackage{caption}
%\captionsetup[table]{justification=raggedright, singlelinecheck=off}
%\captionsetup[figure]{justification=raggedright, singlelinecheck=off}
%\captiondelim{. }

\usepackage{hyperref}
\usepackage[all]{hypcap}
\hypersetup{
unicode=true,          % non-Latin characters in Acrobat’s bookmarks
pdftoolbar=true,        % show Acrobat’s toolbar?
pdffitwindow=false,     % window fit to page when opened
pdfstartpage={1},
pdfstartview={FitH},    % fits the width of the page to the window
pdftitle={Master thesis},    % title
pdfauthor={me},     % author
pdfsubject={},   % subject of the document
pdfcreator={Creator},   % creator of the document
pdfproducer={Producer}, % producer of the document
pdfkeywords={keywords}, % list of keywords
pdfnewwindow=true,      % links in new window
citecolor=black,        % color of links to bibliography
filecolor=black,      % color of file links
urlcolor=black           % color of external links
%citecolor=green,        % color of links to bibliography
%filecolor=magenta,      % color of file links
%urlcolor=blue           % color of external links
}

\usepackage{color}
\usepackage{geometry}
\newgeometry{tmargin=2.5cm, bmargin=2.5cm, lmargin=3.5cm, rmargin=2cm}

\makeatletter
\newcommand{\tabcaption}[2][\@empty]{%
\captionstyle{\raggedright}
\captiondelim{. }
\ifx \@empty#1 \caption{#2}\else \caption[#1]{#2}\fi}
\makeatother

\begin{document}
\rmfamily
\frontmatter
\pagenumbering{Roman}

\clubpenalty=10000
\widowpenalty=10000
\brokenpenalty=10000
\exhyphenpenalty=999999

\pagestyle{empty}

\tableofcontents

\pagestyle{plain}
\mainmatter

\begin{figure}[H]
\centering
\label{Some label}
\includegraphics[width=15.4cm]{example-image}
\caption{My description, should be alligned to the left}
\end{figure}

\begin{table}[H]
\centering
%\captionstyle{\raggedright}
%\captiondelim{. }
\tabcaption{My caption}
\label{my-label}
\begin{tabular}{lll}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{tabular}
\end{table}

\end{document}


• This in deed does the trick and as I have no time to loose I will use this solution, but still if anyone would be interested in troubleshooting this I will continue this. – Jaack Nov 23 '16 at 10:36