我需要减少横向模式下两张图片之间的距离。我认为如果没有不必要的间距,它们应该可以放在页面上。 \hspace{.25cm} 也不起作用。请参阅下面的代码。并附上两张图片,如果有帮助的话...
\documentclass[a4paper, 12pt]{article}
\DeclareUnicodeCharacter{FB01}{fi}
\DeclareUnicodeCharacter{FB02}{fl}
%\usepackage[space]{grffile}
\usepackage{apacite}
\usepackage{makecell}
\usepackage{afterpage}
\usepackage{dblfloatfix}
\usepackage[referable]{threeparttablex}
\usepackage[paper=portrait,pagesize]{typearea}
\usepackage{mleftright}
\usepackage{lscape}
\usepackage{a4wide}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[onehalfspacing]{setspace}
\usepackage{float, afterpage, rotating, graphicx}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz, epstopdf,pgfplots}
\usepackage{longtable, booktabs, tabularx}
\usepackage{fancyvrb, moreverb, relsize}
\usepackage{eurosym, calc, chngcntr}
\usepackage{amsmath, amssymb, amsfonts, amsthm, bm}
\usepackage{mathtools}
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator*{\argmax}{arg\,max}
\usepackage[labelfont={bf}, skip=5pt]{caption}
\usepackage{mdwlist}
\usepackage{tabularx, booktabs}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage{xfrac}
\usepackage{setspace,geometry}
\usepackage{xcolor}
\usepackage{lmodern}
\usepackage{upgreek}
\usepackage{afterpage}
\usepackage{wrapfig}
\usepackage{pdflscape}
\usepackage{multirow, booktabs, makecell, caption}
\usepackage{fancyhdr}
\usepackage[toc]{glossaries}
\usepackage{subcaption}
\usepackage{lipsum}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{eurosym}
\usepackage{amsfonts}
\usepackage{booktabs}
\usepackage{abstract}
\usepackage{dcolumn}
\usepackage{graphicx}
\usepackage[hyphens]{url}
\usepackage{acronym}
\usepackage[english]{babel}
\usepackage[round, sort&compress]{natbib} %sort&compress orders in text citation automatically
\usepackage{pgfplots}
\usepackage{threeparttable}
\usepackage{siunitx} %setze S in Tabelle, um nach dem Punkt auszurichten
\usepackage[export]{adjustbox}
\usepackage{etoolbox}
\usepackage[hyperfootnotes=false]{hyperref}
\usepackage{footnotebackref}
\usepackage{appendix}
\usepackage[bottom,hang,flushmargin]{footmisc} %footnotes always appear on bottom and not end of text on single page
\geometry{a4paper, top=30mm, left=30mm, right=30mm, bottom=30mm,headsep=10mm, footskip=12mm}
%try to prevent widows and orphans (single lines on top/bottom of page)
\widowpenalty10000
\clubpenalty10000
\begin{document}
\newgeometry{top=30mm, left=10mm, right=10mm, bottom=30mm,headsep=10mm, footskip=12mm}
\begin{landscape}
\begin{figure}
\begin{subfigure}{0.7\hsize}\centering
\includegraphics[width=0.9\hsize]{heatmap_bull_unscaled.png}\hspace{.25cm}
\caption{Sub figure A}
\label{fig:sub1}
\end{subfigure}%
%\hfill <-- it is superfluous
\begin{subfigure}{0.7\hsize}\centering
\includegraphics[width=0.9\hsize]{heatmap_bear_unscaled.png}
\caption{Sub figure B}
\label{fig:sub2}
\end{subfigure}
\caption{Figure in landscape orientation}
\label{fig:sub2}
\end{figure}
\end{landscape}
\restoregeometry
\end{document}
我希望它们彼此相邻,就像这里一样,但它们之间没有间距:
答案1
graphicx
我无法使用带有选项的包提供的测试图像重现您的结果demo
。
\documentclass[a4paper, 12pt]{article}
\usepackage{geometry}
\geometry{a4paper, top=30mm, left=30mm, right=30mm, bottom=30mm,headsep=10mm, footskip=12mm}
\usepackage[demo, export]{adjustbox}
\usepackage{subcaption}
\usepackage{pdflscape}
\begin{document}
\newgeometry{top=30mm, left=10mm, right=10mm, bottom=30mm,headsep=10mm, footskip=12mm}
\begin{landscape}
\begin{figure}
\begin{subfigure}{0.49\linewidth}
\includegraphics[width=\linewidth]{heatmap_bull_unscaled.png}
\caption{Sub figure A}
\label{fig:sub1}
\end{subfigure}
\hfill
\begin{subfigure}{0.49\linewidth}
\includegraphics[width=\linewidth]{heatmap_bear_unscaled.png}
\caption{Sub figure B}
\label{fig:sub2}
\end{subfigure}
\caption{Figure in landscape orientation}
\label{fig:sub2}
\end{figure}
\end{landscape}
\restoregeometry
\end{document}
如果你无法用实际图像重现类似的结果,则意味着图像周围有空白。你可以使用 enclose \incledegraphics...
into 来检查这一点\fbox
:
\begin{subfigure}{0.49\linewidth}
\fbox{
\includegraphics[width=\linewidth]{heatmap_bull_unscaled.png}
}
\caption{Sub figure A}
\label{fig:sub1}
\end{subfigure}
如果存在空白,您可以用生成它们的程序中的工具将其修剪掉,或者使用其他工具或使用以下选项的适当trim
设置\includegraphics
:
\includegraphics[trim={5cm 0 0 0},clip]{example-image-a}
在哪里修剪修改文件中指定的边界框。这四个值指定要从原始框的左侧、底部、右侧和顶部移除的数量;以及夹子将图形剪贴到边界框(用 trim 指定)