![如何左对齐子图标题](https://linux22.com/image/433084/%E5%A6%82%E4%BD%95%E5%B7%A6%E5%AF%B9%E9%BD%90%E5%AD%90%E5%9B%BE%E6%A0%87%E9%A2%98.png)
如何让子图标题左对齐?下面有一个最小演示,其中有一个示例展示了该图的效果。我尝试将标题的 raggedright 和 check single line 选项设置为 false,但似乎无法正常工作。有人知道如何通过这个示例让它工作吗?
\documentclass{cas-dc}
\usepackage{subcaption}
\begin{document}
\maketitle
\begin{figure*}[h!]
\centering
\begin{subfigure}[h]{0.45\textwidth}
\centering
\includegraphics[width=\linewidth]{thumbnails/cas-twitter.jpeg}
\caption{}
\end{subfigure}
\begin{subfigure}[h]{0.45\textwidth}
\centering
\includegraphics[width=\linewidth]{thumbnails/cas-facebook.jpeg}
\caption{}
\end{subfigure}
\caption{How do I left align this caption? Lorem Ipsum dolor sit amet, consectetuer adipiscingelit. Duis tellus. Donec ante dolor, iaculis nec, gravidaac, cursus in, eros. Mauris vestibulum, felis et egestasullamcorper, purus nibh vehicula sem, eu egestas antenisl non justo. Fusce tincidunt, lorem nev dapibusconsectetuer, leo orci mollis ipsum, eget suscipit erospurus in ante. At ipsum vitae est lacinia tincidunt. Maecenas elit orci,gravida ut, molestie non, venenatis vel, lorem. Sedlacinia. Suspendisse potenti. Sed ultricies cursuslectus. }
\label{fig:asdf}[![enter image description here][1]][1]
\end{figure*}
\end{document}
答案1
编辑:
本文档类 ( cas-dc
) 期望 \begin{figure*} 不遵循浮动位置,[ht]
而是[width=\textwidth]
简单的无或组合
\begin{figure*}[width=\textwidth, ht]
或者对于一列文本(就像你的情况一样)简单
\begin{figure}[ht]
目前还不完全清楚,如果您喜欢有两列文档 - 在这种情况下,一个可能的解决方案是:
\documentclass[twocolumn]{cas-dc} % had to be added option `twocolumn`
\usepackage{lipsum}% For dummy text. Don't use in a real document
\usepackage{natbib} % had to be loaded
\usepackage{subcaption}
\begin{document}
\begin{figure*}[width=\textwidth, ht] % <---
\centering
\begin{subfigure}[h]{0.45\textwidth}
\includegraphics[width=\linewidth]{example-image-duck}%{thumbnails/cas-twitter.jpeg}
\caption{}
\end{subfigure}%
\hfil
\begin{subfigure}[h]{0.45\textwidth}
\includegraphics[width=\linewidth]{example-image-duck}%{thumbnails/cas-facebook.jpeg}
\caption{}
\end{subfigure}
\caption{\lipsum[66]}
\label{fig:asdf}
\end{figure*}
\lipsum
\end{document}
或使用文档类的一列文档cas-dc
,其解决方案是
\documentclass{cas-dc}
\usepackage{lipsum}% For dummy text. Don't use in a real document
\usepackage{natbib} % had to be loaded
\usepackage{subcaption}
\begin{document}
%\maketitle
\begin{figure}[ht] % <---
\centering
\begin{subfigure}[h]{0.45\textwidth}
\centering
\includegraphics[width=\linewidth]{example-image-duck}%{thumbnails/cas-twitter.jpeg}
\caption{}
\end{subfigure}
\hfil
\begin{subfigure}[h]{0.45\textwidth}
\centering
\includegraphics[width=\linewidth]{example-image-duck}%{thumbnails/cas-facebook.jpeg}
\caption{}
\end{subfigure}
\caption{\lipsum[66]}
\label{fig:asdf}
\end{figure} % <---
\lipsum
\end{document}
如果您喜欢将子图标题左对齐,例如
那么你只需要加载subcaption
包:
\usepackage[singlelinecheck=false]{subcaption}