LaTeX、回忆录、标题图问题

LaTeX、回忆录、标题图问题

我正在写一篇硕士论文,快完成了,但我的导师要求我将表格标题放在左边,图片(图表)标题放在中间。
现在我遇到麻烦了,因为我需要在 2 天内完成,但我无法解决这个问题。

我添加了 caption 包,然后所有的问题就开始了。
基本上我发现我只遇到了图形标题的问题,表格标题工作正常。
在提供的示例中,我删除了所有文本,保留了所有样式设置(我认为它们可能是导致这种情况的原因,某些不兼容性或错误顺序?),如果您注释掉图形标题,它将编译无问题。
注释掉 hyperref 也无济于事。
我正在使用 Texmaker 和 MiKTeX,我更新了 memoir、hyperref 和 caption 包(我在这里读到它们有一些兼容性问题,已经解决了)

下面是 MWE,其下是有关标题行的完整日志:

\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?
pdfmenubar=true,        % show Acrobat’s menu?
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
colorlinks=true,       % false: boxed links; true: colored links
 linkcolor=black,          % color of internal links
 citecolor=black,        % color of links to bibliography
 filecolor=black,      % color of file links
 urlcolor=black           % color of external links
%linkcolor=blue,          % color of internal 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}

日志:

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.

答案1

我认为您不需要收费caption套餐,因为使用memoir字幕格式化选项就足够了。

如果您查阅10 Floats and captionsmemoir文档将找到可用于更改特定标题或定义新标题样式的所有命令。

例如,\tabcaption如果将以下命令用作表格标题,则将打印左对齐。对于图形标题,常规\caption命令将居中。的代码\tabcaption基于第 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?
pdfmenubar=true,        % show Acrobat’s menu?
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
colorlinks=true,       % false: boxed links; true: colored links
 linkcolor=black,          % color of internal links
 citecolor=black,        % color of links to bibliography
 filecolor=black,      % color of file links
 urlcolor=black           % color of external links
%linkcolor=blue,          % color of internal 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}

在此处输入图片描述

相关内容