无论图像大小如何,我的浮动边框总是比文本宽度宽。减少文本宽度百分比只会使垂直尺寸变小(因为它保持纵横比),但不会使浮动边框变小。查看图像,请注意边框超出了文本宽度:
%DOCUMENT PREPPING%
%Defines Document Class
\documentclass[]{article}
%Load requried packages
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage{hyperref}
\usepackage[style=apa,sortcites=true,sorting=nyt,backend=biber]{biblatex}
\usepackage{lipsum}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{placeins}
\usepackage{float}
%defines foats (i.e. figures/pictures) as having a border
\floatstyle{boxed}
\restylefloat{figure}
%Assigns image directory
\graphicspath{ {images/}}
%declares language mapping
\DeclareLanguageMapping{british}{british-apa}
%defines bib files
\addbibresource{C:/Users/20511181/Google Drive/Learning/Reviews/library.bib}
%Defines command to hide @ for email spam
\newcommand{\at}{\makeatletter @\makeatother}
%
%Figure Information. Note, DOCUMENT INFO OMITTED%
\begin{figure}[!ht]
\includegraphics[trim=0cm 0cm 10cm 0cm, width=0.6\textwidth]{workloadcurve.png}
\caption{Hypothesised workload curve from \parencite{Hart1988}.}
\end{figure}
\FloatBarrier
示例文档:
%DOCUMENT PREPPING%
%Defines Document Class
\documentclass[]{article}
%Load requried packages
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{float}
%defines foats (i.e. figures/pictures) as having a border
\floatstyle{boxed}
\restylefloat{figure}
%DOCUMENT INFORMATION%
%Title Information
\title{Image Test}
\author{Test}
\date{Last Updated: November, 2015}
%Begin document
\begin{document}
\maketitle
%start first section
\section{Introduction}
\clearpage
\begin{figure}[!htb]
\includegraphics[width=0.8\textwidth]{example-image.jpg}
\caption{The paper and pencil version of the NASA-TLX.}
\end{figure}
\end{document}
答案1
浮动盒装样式总是比 略宽\textwidth
。如果您不想让标题周围出现方框,只需在\fbox{..}
图像周围放置一个 即可。
\documentclass{article}
\usepackage{showframe}
\usepackage{mwe}
\begin{document}
\begin{figure}
\fboxsep=1em
\fboxrule=1pt
\fbox{\begin{minipage}{\dimexpr \textwidth -2\fboxsep-2\fboxrule}
\centering\includegraphics[width=0.8\textwidth]{example-image}%
\caption\blindtext
\end{minipage}}
\end{figure}
\end{document}
在这里我将一切都实现为环境。
\documentclass{article}
\usepackage{environ}
\usepackage{showframe}
\usepackage{mwe}
\NewEnviron{boxedfigure}[1][]%
{\begin{figure}[#1]%
\fboxsep=1em
\fboxrule=1pt
\fbox{\begin{minipage}{\dimexpr \textwidth-2\fboxsep-2\fboxrule}
\BODY
\end{minipage}}%
\end{figure}}
\begin{document}
\begin{boxedfigure}
\centering\includegraphics[width=0.8\textwidth]{example-image}%
\caption\blindtext
\end{boxedfigure}
\end{document}