# My figure float border is always larger than the textwidth

My float border, regardless of the image size, is always wider than the textwidth. Reducing the textwidth percentage simply makes the vertical size small (as it keeps aspect ratio) but does not make the float border any smaller See image, note the border extends beyond the textwidth:

%DOCUMENT PREPPING%
%Defines Document Class
\documentclass[]{article}
\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
%Defines command to hide @ for email spam
\newcommand{\at}{\makeatletter @\makeatother}
%
%Figure Information. Note, DOCUMENT INFO OMITTED%
\begin{figure}[!ht]
\end{figure}
\FloatBarrier


Example document:

%DOCUMENT PREPPING%
%Defines Document Class
\documentclass[]{article}
\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}

• Welcome to the site! It would help if you made your example a document that people could test (removing presumably irelevant packages such as lipsum, csquotes etec, and using example-image as the image name (which is a sample image that most people have already in their tex distribution) – David Carlisle Nov 19 '15 at 9:02
• Is there a suggested protocol for uploading an example document? – Michael Anderson Nov 19 '15 at 9:12
• Weirdly in the example image, the border is going wider than the textwidth. This perplexes me. – Michael Anderson Nov 19 '15 at 9:21
• In the complete document as posted in the edited question the border is textwidth exactly. – David Carlisle Nov 19 '15 at 9:28

The float boxed style is always slightly wider than \textwidth. If you don't want the box around the caption, just put an \fbox{..} around the image.

\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}


Here I implemented everything as an environment.

\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}
`