![子浮动标题比图片更宽](https://linux22.com/image/335374/%E5%AD%90%E6%B5%AE%E5%8A%A8%E6%A0%87%E9%A2%98%E6%AF%94%E5%9B%BE%E7%89%87%E6%9B%B4%E5%AE%BD.png)
subfloat
我在使字幕比其描述的图片更宽时遇到了麻烦。这是 MWE:
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{subfig}
\begin{document}
\begin{figure}
\centering
\subfloat[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec porttitor, arcu quis interdum ultricies, est mauris eleifend est, sit amet ornare diam odio id ante. Donec mattis finibus hendrerit. Etiam rhoncus nunc nec lectus tincidunt, nec rhoncus erat convallis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer elementum neque quis arcu pellentesque accumsan. Proin quis felis sollicitudin dolor blandit sodales sed ut nunc. Cras euismod leo turpis, nec molestie diam placerat et. In feugiat pulvinar dolor vel posuere. Nulla in dolor non ligula accumsan sollicitudin non tincidunt velit. Fusce auctor tellus tortor, nec commodo lectus interdum aliquet. Maecenas in scelerisque magna. In rhoncus est eget sagittis eleifend. Nulla aliquet eleifend purus, vel faucibus sem gravida porttitor. Nullam pellentesque velit non nulla molestie, quis ultricies dolor fermentup]{
\includegraphics[width=0.2\textwidth]{uefaeuro16.png}
}
\hspace{0.3\textwidth}
\subfloat[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec porttitor, arcu quis interdum ultricies, est mauris eleifend est, sit amet ornare diam odio id ante. Donec mattis finibus hendrerit. Etiam rhoncus nunc nec lectus tincidunt, nec rhoncus erat convallis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer elementum neque quis arcu pellentesque accumsan. Proin quis felis sollicitudin dolor blandit sodales sed ut nunc. Cras euismod leo turpis, nec molestie diam placerat et. In feugiat pulvinar dolor vel posuere. Nulla in dolor non ligula accumsan sollicitudin non tincidunt velit. Fusce auctor tellus tortor, nec commodo lectus interdum aliquet. Maecenas in scelerisque magna. In rhoncus est eget sagittis eleifend. Nulla aliquet eleifend purus, vel faucibus sem gravida porttitor. Nullam pellentesque velit non nulla molestie, quis ultricies dolor fermentu]{
\includegraphics[width=0.2\textwidth]{uefaeuro16.png}
}
\end{figure}
\end{document}
以及它给出的输出:
基本上,我想让标题使用额外的空间,就像当图片单独出现在图形环境中时一样
。我尝试将其括起来
subfloat
,minipage
但没有产生预期的结果。
答案1
我刚刚添加
- 包
grffile
,因为我的徽标名称包含_
一条线
\captionsetup[subfigure]% %{margin=-1cm} {width=7cm} % choose width or margin
\hspace*{1cm}
就在之前\includegraphics
我承认,您必须在标题设置中使用边距或宽度,但您可以使用比图像更宽的子浮动标题:
这是代码:
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{subfig, grffile}
\captionsetup[subfigure]%
%{margin=-1cm}
{width=7cm}
\begin{document}
\begin{figure}
\centering
\subfloat[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec porttitor, arcu quis interdum ultricies, est mauris eleifend est, sit amet ornare diam odio id ante. Donec mattis finibus hendrerit. Etiam rhoncus nunc nec lectus tincidunt, nec rhoncus erat convallis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer elementum neque quis arcu pellentesque accumsan. Proin quis felis sollicitudin dolor blandit sodales sed ut nunc. Cras euismod leo turpis, nec molestie diam placerat et. In feugiat pulvinar dolor vel posuere. Nulla in dolor non ligula accumsan sollicitudin non tincidunt velit. Fusce auctor tellus tortor, nec commodo lectus interdum aliquet. Maecenas in scelerisque magna. In rhoncus est eget sagittis eleifend. Nulla aliquet eleifend purus, vel faucibus sem gravida porttitor. Nullam pellentesque velit non nulla molestie, quis ultricies dolor fermentup]{
\hspace*{1cm}\includegraphics[width=0.2\textwidth]{426px-Uefa_Euro_2016_logo.png}
}
\hspace{0.3\textwidth}
\subfloat[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec porttitor, arcu quis interdum ultricies, est mauris eleifend est, sit amet ornare diam odio id ante. Donec mattis finibus hendrerit. Etiam rhoncus nunc nec lectus tincidunt, nec rhoncus erat convallis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer elementum neque quis arcu pellentesque accumsan. Proin quis felis sollicitudin dolor blandit sodales sed ut nunc. Cras euismod leo turpis, nec molestie diam placerat et. In feugiat pulvinar dolor vel posuere. Nulla in dolor non ligula accumsan sollicitudin non tincidunt velit. Fusce auctor tellus tortor, nec commodo lectus interdum aliquet. Maecenas in scelerisque magna. In rhoncus est eget sagittis eleifend. Nulla aliquet eleifend purus, vel faucibus sem gravida porttitor. Nullam pellentesque velit non nulla molestie, quis ultricies dolor fermentu]{
\hspace*{1cm}\includegraphics[width=0.2\textwidth]{426px-Uefa_Euro_2016_logo.png}
}
\end{figure}
\end{document}