2017-07-03 113 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)?