GeneralHow to adjust fbox separation spacing?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
hzmonte
Posts: 17
Joined: Sun Nov 16, 2008 8:05 am

How to adjust fbox separation spacing?

Post by hzmonte »

I tried \setlength{\fboxsep}{1pt} for example but it affects only the horizontal spacing, i.e., the spacing between the text and the box border on the left and right sides, but not the vertical spacing, i.e. top and bottom.
My figure is written as follows:

Code: Select all

\begin{figure*}[!ht]
\begin{center}
\setlength{\fboxsep}{1pt}%%%%%%%%
\fbox{\footnotesize%
\parbox{4.5in}{\tt
\begin{tabbing}
\hspace*{0.5ex}\=xx\=xxxxxxxxxxxx\=xx\=xx\=xx\=\+\kill
%
$\mathtt {struct~MCB~\{}$\\
\>$\mathtt {... \>//other members}$\\
$\mathtt {\};}$
\end{tabbing}
}}
%
\end{center}
\caption{Struct MCB.}
\label{fig:MCB}
\end{figure*}
Does any of the other stuff, such as parbox, math and tabbing, affect the failure of fboxsep to adjust the vertical spacing?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How to adjust fbox separation spacing?

Post by localghost »

Of course a modification of the length \fboxsep affects horizontal and vertical spaces. Take the following example.

Code: Select all

\setlength{\fboxsep}{0pt}
\fbox{%
  \rule{4cm}{3cm}
}

\setlength{\fboxsep}{10pt}
\fbox{%
  \rule{4cm}{3cm}
}
As you can see, horizontal space is not eliminated completely. At the moment I'm not aware of a workaround.

The fact that your code gives me some errors and the look of the result makes me suggest you the listings package for typesetting program code.


Best regards
Thorsten¹
Post Reply