2017-07-03 128 views
0

缩进subcaption看到这个MWE:乳胶:图环境

% !TeX spellcheck = en_US 
\documentclass[12pt]{article} 
\usepackage[onehalfspacing]{setspace} 
\usepackage[a4paper, margin=2.5cm]{geometry} 
\usepackage{mathptmx} 
\usepackage{amsmath} 
\usepackage{graphicx} 
\usepackage[hang]{caption} 
\usepackage{subcaption} 
\usepackage[bottom]{footmisc} 
\usepackage{dcolumn} %makes r output work 
\usepackage{tabularx} 
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}} 
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} 
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}} 
\newcommand{\possessivecite}[1]{\citeauthor{#1}'s (\citeyear{#1})} 
\usepackage{pdfpages} 
\usepackage{hyperref} 
\usepackage{pdflscape} 
\usepackage{xcolor} 
\usepackage{tikz} 
\usetikzlibrary{calc} 

\begin{document} 

\begin{landscape} 
    \setcapmargin[2cm] 

\begin{figure}[] 
    \captionsetup{justification=centering} 
    \caption{Main Caption. } 
    \label{fig:val_efcts} 
    \begin{subfigure}{0.55\textwidth} 
     \caption{X} 
     \includegraphics[width=\textwidth] {example-image-a} 
    \end{subfigure} 
    \begin{subfigure}{0.55\textwidth} 
     \caption{Y} 
     \includegraphics[width=\textwidth] {example-image-b} 
    \end{subfigure} 
    \begin{subfigure}{0.55\textwidth} 
     \caption{Z} 
     \includegraphics[width=\textwidth] {example-image-c} 
    \end{subfigure} 
    \captionsetup{justification=raggedright} \subcaption*{This subcaption is supposed to be ragged right and intented by 4 cm. \\ This is in a new line.} 
\end{figure} 

\end{landscape} 

\end{document} 

它应该是不言自明的居多。我希望图片下面的最后一个子标题正好是粗糙的,但缩进了2厘米。我尝试使用\ setcapmargin,但这不起作用,创建“未定义的控制序列”错误(所以它是一个未知的命令)。

+1

您应该将此问题移至[TeX SE](https://tex.stackexchange.com/)。 – Nick

回答

0

既然你写的标题不带编号,将其设置在一个\parbox,你必须在放置一些控制和调整:

enter image description here

\documentclass{article} 

\usepackage{graphicx} 
\usepackage[hang]{caption} 
\usepackage{subcaption} 

\begin{document} 

\begin{figure}[] 
    \captionsetup{justification=centering} 
    \caption{Main Caption. } 
    \label{fig:val_efcts} 
    \begin{subfigure}{0.3\textwidth} 
     \caption{X} 
     \includegraphics[width=\linewidth] {example-image-a} 
    \end{subfigure}\hfill 
    \begin{subfigure}{0.3\textwidth} 
     \caption{Y} 
     \includegraphics[width=\linewidth] {example-image-b} 
    \end{subfigure}\hfill 
    \begin{subfigure}{0.3\textwidth} 
     \caption{Z} 
     \includegraphics[width=\linewidth] {example-image-c} 
    \end{subfigure} 

    \hspace*{4cm}% 
    \parbox{\dimexpr\linewidth-8cm}{\raggedright 
    \strut This subcaption is supposed to be ragged right and indented by 4cm. \\ 
    This is in a new line.\strut% 
    } 
\end{figure} 

\end{document} 

注意使用\strut s到在处理\parbox es中的文本时支持正确的基线对齐。有关详情,请参阅How to keep a constant baseline skip when using minipages (or \parboxes)?