# Caption positioned at the side of the figure

I would like to have the caption of the Figure on the side of the figure. Plus I want to control caption width. Also, caption and Figure should be aligned all the way to the left and right of the page, respectively. Some information is provided here. I am not able to align the way I want even after a lot of attempts. Here is what I have so far.

\documentclass[12 pt]{article}
\usepackage{fullpage}
\usepackage[demo]{graphicx}
\usepackage{floatrow}

\begin{document}
\begin{figure}
\floatbox[{\capbeside\thisfloatsetup{capbesideposition= {left,center},capbesidewidth=4cm}}]{figure}[\FBwidth]
{\caption{Figure caption}\label{fig:test}}
{\includegraphics[width=5cm]{name}}
\end{figure}
\end{document}

Here's one possibility (the geometry package with its showframe option was only used to display a frame as a visual guide):

\documentclass[12 pt]{article}
\usepackage[showframe]{geometry}
\usepackage[demo]{graphicx}
\usepackage[singlelinecheck=off]{caption}
\usepackage{floatrow}
\usepackage{lipsum}

\newlength\Myfigwd

\begin{document}

\begin{figure}
\setlength\Myfigwd{5cm}
\floatbox[{\capbeside
justification=justified,
capbesideposition= {left,center},
capbesidewidth=\dimexpr\linewidth-\Myfigwd-1em\relax}}]
{figure}[\FBwidth]
{\caption{Figure caption}\label{fig:test}}
{\includegraphics[width=\Myfigwd]{name}}
\end{figure}
\begin{figure}
\setlength\Myfigwd{7cm}
\floatbox[{\capbeside