Questions on macro writing in TeX to modify an existing style file: fancybox.sty
I'd do something like this to parameterise the macro
\documentclass{article}
\usepackage{fancybox}
\usepackage{keyval}
\makeatletter
\define@key{myfb}{inner}{\def\myfb@inner{#1}}
\define@key{myfb}{outer}{\def\myfb@outer{#1}}
\define@key{myfb}{sep}{\def\myfb@sep{#1}}
\newcommand\mydoublebox[1][]{%
\def\myfbkeys{\setkeys{myfb}{#1}}%
\VerbBox\@doublebox}
\def\@doublebox#1{%
\begingroup
\def\myfb@inner{.75\fboxrule}%
\def\myfb@outer{2\fboxrule}%
\def\myfb@sep{\fboxrule+.5pt}%
\myfbkeys
\setbox\@fancybox\hbox{{#1}}%
\fboxrule\dimexpr\myfb@inner\relax
\setbox\@fancybox\hbox{\fbox{\box\@fancybox}}%
\fboxrule\dimexpr\myfb@outer\relax
\fboxsep\dimexpr\myfb@sep\relax
\fbox{\box\@fancybox}%
\endgroup}
\makeatother
\begin{document}
\mydoublebox{hello}
\mydoublebox[inner=4pt,sep=10pt]{hello}
\end{document}
Also don't do this
{\huge A HISTORY OF\\
THE\\
MYERS\\
OVERSTREET\\
and\\
GRAY\\
FAMILIES\\}
As that ends the font size before paragraph ends so sets huge text on a normal baseline. (You do the same with \small
and possibly some other size changes)
I am providing a more general answer to your questions:
How to a create a parametric version of
\doublebox
?
In the absence of any pre-defined hooks in an existing macro, you have three choices:
- Re-write the existing macro fully.
- Inject code via using the LaTeX2e macro
\g@addto@macro
or using similar macros from theetoolbox
package. - Use the existing macro and add parameters, using a key-value interface.
I personally prefer a combination of 1) and 3), which I will explain in detail below using the LaTeX macro \rule
as an example, which might come handy for your particular case.
The normal command has the format:
\rule[<raised>]{<width>}{<height>}
Personally, I have trouble remembering if the width
comes first or the height
when calling the macro, also it would be nice if one can set the color as well. A command of the form:
\Rule[rule color = thegray,
rule thickness = 1pt,
rule raised = 2pt,
rule width = 85pt]
is preferable, as the key values can be typed in any order and also one can set default values at the beginning of a document. If you notice I capitalized the name of the macro as it is considered good practice to try and not change existing macros, if possible.
I also use PGF
keys, as I find it quicker to code them.
\documentclass{article}
\usepackage{pgf}
\definecolor{thegray} {rgb}{0.9,0.9,0.9}
\def\setcolor#1{\color{#1}}
% create family of keys called rule
\pgfkeys{/rule/.is family}
\def\cxset{\pgfqkeys{/rule}}
\cxset{rule width/.store in = \rulewidth@my,
rule thickness/.store in=\rulethickness@my,
rule color/.code ={\setcolor{#1}},
rule raised/.store in = \ruleraised@my
}
\cxset{rule thickness = 10pt,
rule raised = 2pt,
rule width = 45pt}
\newcommand\Rule[1][rule color = thegray,
rule thickness = 1pt,
rule raised = 2pt,
rule width = 85pt]{%
\colorlet{originalcolor}{.}%
\cxset{#1}%
\begingroup
\rule{\rulewidth@my}{\rulethickness@my}%
\endgroup
\color{originalcolor}}
\begin{document}
\Rule
\Rule[rule width=60pt,
rule color= purple]
test
\end{document}
See if you can use this approach and modify \doublebox
to your requirements. If you succeed post the answer.