Sie sind auf Seite 1von 12

The thinsp package

Palle Jrgensen
4th December 2007

Summary
The thinsp package provides a stretchable \thinspace to replace LATEXs
normal \thinspace.

Contents
1 Introduction

2 Usage

3 thinsp and other packages

4 Bug reports and comments

5 Copyright and license

A Source code of thinsp.sty

B Source code of this document

Introduction

The normal \thinspace command which LATEX provides as standard is a


fixed space of 0.16667em, with no strething. This gives an akward spacing
when using \thinspace in underfull \hboxs.
Say, I wanted to create a certain box with the name P. A. M. Dirac in it.
To provide a proper spacing between the initials I use a \thinspace between
the letters. Here shown with some \frameboxes.
\noindent\fbox{P.\,A.\,M. Dirac}\\
\framebox[\linewidth][s]{P.\,A.\,M. Dirac created
relativistic quantum mechanics}

Then I would get something looking like this when using the original
\thinspace from LATEX:
P. A. M. Dirac
P. A. M.
Dirac

created

relativistic

quantum

mechanics

In this example with the original spacing if \thinspace the spacing between the initials is the same, whether or not the \hbox is underfull and
need som stretcing or not. This makes the initials to appear unnaturally
close when comparing them to the other characters.
With a \thinspace that is strecthable like the normal space, the resulting
box is appearing more natural.
P. A. M. Dirac
P. A. M.

Dirac

created

relativistic

quantum

mechanics

Usage

The simplest usage of the package is simply adding


\usepackage{ t h i n s p }
to your preamble.
The the \thinspace command as well as the \, shortcut is replaced by
the stretchable \thinspace
The package furthermore provides a command \thinthinspace with half
the width of \thinspace.

2.1

Options

Option

Description

nothinspace

Disables the replacement of \thinspace.


The stretchable thinspace is still available as
\stretchthinspace.
Dummy option as counterpart to nothinspace
Disables the possible1 replacement of
\thinthinspace. The stretchable thinthinspace is
still available as \stretchthinthinspace.
Dummy option as counterpart to nothinthinspace
Provides a stretchable \negthinspace. This is not
default, as \negthinspace may be used with caution anyway, and almost always should be replaced
by a manually \kern. A stretchable \negthinspace
is available as \stretchnegthinspace
Dummy option as counterpart to negthinspace

thinspace
nothinthinspace

thinthinspace
negthinspace

nonegthinspace
onehalf

onethird
twothirds

Ajusting the stretchable \thinspace to half of the


ordinary space. This is default, as it appears just
like the original \thinspace in boxes that are not
stretched.
Ajusting the stretchable \thinspace to one third of
the ordinary space.
Ajusting the stretchable \thinspace to two
thirds of the ordinary space. This is the authors
favourite. . .

thinsp and other packages

As the package amsmath redifines \thinspace as well, there is a minor clash


between these two packages. Hence thinsp redefines \thinspace at the
beginning of the document, and if amsmath is loaded, the \thinspace is
redefined in an amsmath way.

Bug reports and comments

Any comment on this package can be sent to the author on his e-mail address:
hamselv@pallej.dk.
1

Some packages provide a \thinthinspace command

Copyright and license

The thinsp package and this documentation i copyright 2007 by Palle


Jrgensen.
The license of the thinsp package and this documentation is GNU General Public License (GPL).
You should have received a copy of the GNU General Public License
along with this bundle; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Source code of thinsp.sty

% C o p y r i g h t (C) 2007 P a l l e J o r g e n s e n
% This f i l e i s f r e e s o f t w a r e ; you can r e d i s t r i b u t e i t
and/ or modify i t
% under t h e terms o f t h e GNU General P u b l i c L i c e n s e as
p u b l i s h e d by
% t h e Free S o f t w a r e Foundation ; e i t h e r v e r s i o n 2 o f t h e
L i c e n s e , or
% ( a t your o p t i o n ) any l a t e r v e r s i o n .
% This f i l e i s d i s t r i b u t e d i n t h e hope t h a t i t w i l l be
useful , but
% WITHOUT ANY WARRANTY; w i t h o u t even t h e i m p l i e d
wa rran ty o f
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See t h e GNU
% General P u b l i c L i c e n s e f o r more d e t a i l s .
% You s h o u l d have r e c e i v e d a copy o f t h e GNU General
Public License
% a l o n g w i t h t h i s f i l e ; i f not , w r i t e t o t h e Free
S o f t w a r e Foundation ,
% Inc . , 51 F r a n k l i n S t r e e t , F i f t h Floor , Boston , MA
02110 1301 , USA.
\ P r o v i d e s P a c k a g e { t h i n s p } [ 2 0 0 7 / 3 0 / 1 1 v 0 . 1 Package
providing stretchable thinspaces ]
\ newif \ i f @ t h i n s p @ t h i n s p a c e
\ @thinsp@thinspacetrue
\ D e c l a r e O p t i o n { n o t h i n s p a c e }{\ @ t h i n s p @ t h i n s p a c e f a l s e }
\ D e c l a r e O p t i o n { t h i n s p a c e }{\ @ t h i n s p @ t h i n s p a c e t r u e }
\ newif \ i f @ t h i n s p @ t h i n t h i n s p a c e
\ @thinsp@thinthinspacetrue
\ D e c l a r e O p t i o n { n o t h i n t h i n s p a c e }{\
@thinsp@thinthinspacefalse }
\ D e c l a r e O p t i o n { t h i n t h i n s p a c e }{\
@thinsp@thinthinspacetrue }

\ newif \ i f @ t h i n s p @ n e g t h i n s p a c e
\ @thinsp@negthinspacefalse
\ D e c l a r e O p t i o n { n o n e g t h i n s p a c e }{\
@thinsp@negthinspacefalse }
\ D e c l a r e O p t i o n { n e g t h i n s p a c e }{\ @ t h i n s p @ n e g t h i n s p a c e t r u e }
\ def \ thinsp@thinamount { . 5 }
\ def \ t h in s p@ t hi n th in a mo u nt { . 2 5 }
\ D e c l a r e O p t i o n { o n e t h i r d }{%
\ def \ thinsp@thinamount { . 3 3 3 }%
\ def \ t h in s p@ t hi n th in a mo u nt { . 1 6 7 }%
}
\ D e c l a r e O p t i o n { o n e h a l f }{%
\ def \ thinsp@thinamount { . 5 }%
\ def \ t h in s p@ t hi n th in a mo u nt { . 2 5 }%
}
\ D e c l a r e O p t i o n { t w o t h i r d s }{%
\ def \ thinsp@thinamount { . 6 6 7 }%
\ def \ t h in s p@ t hi n th in a mo u nt { . 3 3 3 }%
}
\ ProcessOptions
\ def \ s t r e t c h t h i n s p a c e {%
\nobreak\ hskip \ thinsp@thinamount \fontdimen2\ font%
\ @plus \ thinsp@thinamount \fontdimen2\ font%
\@minus\ thinsp@thinamount \fontdimen4\ font%
\ relax%
}
\ def \ s t r e t c h n e g t h i n s p a c e {%
\nobreak\hskip\thinsp@thinamount \fontdimen2\ font%
\ @plus \ thinsp@thinamount \fontdimen4\ font%
\@minus\ thinsp@thinamount \fontdimen3\ font%
\ relax%
}
\ def \ s t r e t c h t h i n t h i n s p a c e {%
\nobreak\ hskip \ t h in s p@ t hi n th i na mo u nt \fontdimen2\ font%
\ @plus \ t hi n sp @ th i nt h in am o un t \fontdimen3\ font%
\@minus\ t h in s p@ t hi nt h in a mo u nt \fontdimen4\ font%
6

\ relax%

\ AtBeginDocument {%
\ if@thinsp@thinspace
\ P a c k a g e I n f o { t h i n s p }{ R e d e f i n i n g \ string \ thinspace }
\ l e t \ thinspace \ s t r e t c h t h i n s p a c e
\ @ i f p a c k a g e l o a d e d {amsmath}{%
\ P a c k a g e I n f o { t h i n s p }{And now r e d e f i n i n g AMSmath s
\ string \ thinspace }
\ def \ , { \ifmmode\mskip\thinmuskip\ e l s e \
s t r e t c h t h i n s p a c e \ f i }%
\ l e t \ thinspace \ ,%
}
\fi
%
\ if@thinsp@negthinspace
\ P a c k a g e I n f o { t h i n s p }{ R e d e f i n i n g \ string \ negthinspace }
\ l e t \ negthinspace \ s t r e t c h n e g t h i n s p a c e
\ @ i f p a c k a g e l o a d e d {amsmath}{%
\ P a c k a g e I n f o { t h i n s p }{And now r e d e f i n i n g AMSmath s
\ string \ negthinspace }
\ def \ ! { \ ifmmode\mskip\thinmuskip\ e l s e \
s t r e t c h n e g t h i n s p a c e \ f i }%
\ l e t \ negthinspace \ !%
}
\fi
%
\ if@thinsp@thinthinspace
\ @ i f u n d e f i n e d { t h i n t h i n s p a c e }{}{%
\ P a c k a g e I n f o { t h i n s p }{ R e d e f i n i n g \ string \
t h i n t h i n s p a c e }}
\ let \ thinthinspace \ stretchthinthinspace
\fi
}
\endinput

Source code of this document

\ pdfoutput 1
\documentclass [ a4 paper , 1 1 pt , b r i t i s h ] { a r t i c l e }
\usepackage [T1 ] { f o n t e n c }
\usepackage{ babel , t h i n s p , l i s t i n g s , t a b u l a r x , booktabs ,
r a g g e d 2 e , h y p e r r e f , textcomp }
\author{ P a l l e J\o r g e n s e n }
\ t i t l e {The \ t h i n s p \ package }
\ def \ o r i g t h i n s p a c e {\kern . 1 6 6 6 7em }
\ def \ o r i g n e g t h i n s p a c e {\kern .16667em }
\ def \ t h i n s p {\ texttt { t h i n s p }}
\ def \ s t r t h i n s p a c e {\ texttt {\ string \ thinspace }}
\ l s t s e t { l a n g u a g e =[ l a t e x ] tex , b r e a k l i n e s=t r u e }
\ setcounter { t o c d e p t h }{1}
\ begin{ document }
\ maketitle
\ section {Summary}
\ l a b e l { s e c : summary}
The \ t h i n s p \ package p r o v i d e s a s t r e t c h a b l e \
s t r t h i n s p a c e \ to r e p l a c e
\LaTeX s normal \ s t r t h i n s p a c e .
\ tableofcontents
\ section { I n t r o d u c t i o n }
\ label { sec : i n t r o d u c t i o n }
The normal \ s t r t h i n s p a c e \ command which \LaTeX\
provides as standard
i s a f i x e d s p a c e o f 0 . 1 6 6 6 7em , with no s t r e t h i n g . This
g i v e s an akward
s p a c i n g when u s i n g \ s t r t h i n s p a c e \ i n u n d e r f u l l \verb+\
hbox+ s .
Say , I wanted t o c r e a t e a c e r t a i n box with t h e name P
. \ ,A. \ ,M. D i r a c
i n i t . To p r o v i d e a p r o p e r s p a c i n g between t h e i n i t i a l s
I use a
\ s t r t h i n s p a c e \ between t h e l e t t e r s . Here shown with
some
8

\verb+\framebox+ e s .
\ begin{ verbatim }
\noindent\fbox{P . \ ,A. \ ,M. D i r a c }\\
\framebox [ \ linewidth ] [ s ] { P . \ ,A. \ ,M. D i r a c c r e a t e d
r e l a t i v i s t i c quantum mechanics }
\end{ verbatim }
Then I would g e t something l o o k i n g l i k e t h i s when u s i n g
the o r i g i n a l
\ s t r t h i n s p a c e \ from \LaTeX\medskip :
\noindent\fbox{P . \ o r i g t h i n s p a c e A. \ o r i g t h i n s p a c e M.
D i r a c }\\ \framebox [ \ linewidth ] [ s ] { P . \ o r i g t h i n s p a c e A
.\ origthinspace
M. D i r a c c r e a t e d r e l a t i v i s t i c quantum mechanics }\
medskip
In t h i s example with t h e o r i g i n a l s p a c i n g i f \
s t r t h i n s p a c e \ the
s p a c i n g between t h e i n i t i a l s i s t h e same , whether o r
not t h e
\verb+\hbox+ i s u n d e r f u l l and need som s t r e t c i n g o r not
. This makes
t h e i n i t i a l s t o appear u n n a t u r a l l y c l o s e when
comparing them t o
the other c h a r a c t e r s .
With a \ s t r t h i n s p a c e \ t h a t i s s t r e c t h a b l e l i k e t h e
normal space , t h e
r e s u l t i n g box i s a p p e a r i n g more n a t u r a l . \ medskip
\noindent\fbox{P . \ ,A. \ ,M. D i r a c }\\
\framebox [ \ linewidth ] [ s ] { P . \ ,A. \ ,M. D i r a c c r e a t e d
r e l a t i v i s t i c quantum
mechanics }\medskip
\ section { Usage }
\ label { sec : usage }
The s i m p l e s t u s a g e o f t h e package i s s i m p l y adding
\ begin{ l s t l i s t i n g }
\usepackage{ t h i n s p }
\end{ l s t l i s t i n g }
9

t o your preamble .
The t h e \ s t r t h i n s p a c e \ command a s w e l l a s t h e \verb+\,+
shortcut i s
r e p l a c e d by t h e s t r e t c h a b l e \ s t r t h i n s p a c e
The package f u r t h e r m o r e p r o v i d e s a command
\verb+\ t h i n t h i n s p a c e+ with h a l f t h e width o f \
strthinspace .
\ s u b s e c t i o n { Options }
\ label { sec : options }
\ begin{ t a b u l a r x }{\ linewidth }{>{\ ttfamily } l >{\
RaggedRight }X}
\ toprule
\textrm{ Option } & D e s c r i p t i o n \\
\ midrule
nothinspace & Disables the replacement of \
strthinspace .
The s t r e t c h a b l e t h i n s p a c e i s s t i l l a v a i l a b l e a s
\ texttt {\ string \ s t r e t c h t h i n s p a c e } . \ \
t h i n s p a c e & Dummy o p t i o n a s c o u n t e r p a r t t o \ texttt {
n o t h i n s p a c e }\\
n o t h i n t h i n s p a c e & D i s a b l e s t h e p o s s i b l e \footnotemark\
replacement of
\ texttt {\ string \ t h i n t h i n s p a c e } . The s t r e t c h a b l e
thinthinspace is
s t i l l a v a i l a b l e a s \ texttt {\ string \
stretchthinthinspace }.\\
t h i n t h i n s p a c e & Dummy o p t i o n a s c o u n t e r p a r t t o
\ texttt { n o t h i n t h i n s p a c e }\\
n e g t h i n s p a c e & P r o v i d e s a s t r e t c h a b l e \ texttt {\ string
\ negthinspace } .
This i s not d e f a u l t , a s \ texttt {\ string \ negthinspace }
may be used
with c a u t i o n anyway , and a l m o s t always s h o u l d be
r e p l a c e d by a
manually \ texttt {\ string \kern } . A s t r e t c h a b l e
10

\ texttt {\ string \ negthinspace } i s a v a i l a b l e a s


\ texttt {\ string \ s t r e t c h n e g t h i n s p a c e }\\
n o n e g t h i n s p a c e & Dummy o p t i o n a s c o u n t e r p a r t t o
\ texttt { n e g t h i n s p a c e }\\
\ midrule
onehalf & Ajusting the s t r e t c h a b l e \ s t r t h i n s p a c e \ to
h a l f of the
o r d i n a r y s p a c e . This i s d e f a u l t , a s i t a p p e a r s j u s t
l i k e the
o r i g i n a l \ s t r t h i n s p a c e \ i n boxes t h a t a r e not
stretched .\\
onethird & Ajusting the s t r e t c h a b l e \ s t r t h i n s p a c e \ to
one t h i r d o f
the ordinary space .\\
twothirds & Ajusting the s t r e t c h a b l e \ s t r t h i n s p a c e \
t o two t h i r d s o f
t h e o r d i n a r y s p a c e . This i s t h e author s f a v o u r i t e \
dots \\
\ bottomrule
\end{ t a b u l a r x }
\ footnotetext {Some p a c k a g e s p r o v i d e a \ texttt {\ string \
thinthinspace }
command}
\ section {\ t h i n s p \ and o t h e r p a c k a g e s }
\ l a b e l { s e c : t h i n s p o t h e r pack }
As t h e package \ texttt {amsmath} r e d i f i n e s \ s t r t h i n s p a c e
\ as well ,
t h e r e i s a minor c l a s h between t h e s e two p a c k a g e s .
Hence \ t h i n s p \
r e d e f i n e s \ s t r t h i n s p a c e \ at the beginning of the
document , and i f
\ texttt {amsmath} i s loaded , t h e \ s t r t h i n s p a c e \ i s
r e d e f i n e d i n an
\ texttt {amsmath} way .
\ section {Bug r e p o r t s and comments}
\ l a b e l { s e c : bugr e p o r t s comments}
11

Any comment on t h i s package can be s e n t t o t h e a u t h o r


on h i s em a i l
a d d r e s s : \ u r l { h a m s e l v @ p a l l e j . dk } .
\ section { Copyright and l i c e n s e }
\ l a b e l { s e c : c o p y r i g h t l i c e n s e }
The \ t h i n s p \ package and t h i s documentation i c o p y r i g h t
\ t e x t c o p y r i g h t \ 2007 by P a l l e J\o r g e n s e n .
The l i c e n s e o f t h e \ t h i n s p \ package and t h i s
documentation i s GNU
Ge n e r a l P u b l i c L i c e n s e (GPL) .
You s h o u l d have r e c e i v e d a copy o f t h e GNU G e ne r a l
Public License
a l o n g with t h i s bundle ; i f not , w r i t e t o t h e Free
S o f t w a r e Foundation ,
I n c . , 51 F r a n k l i n S t r e e t , F i f t h Floor , Boston , MA
02110 1301 , USA.
\ appendix
\ clearpage
\ section { S o u r c e code o f \ texttt { t h i n s p . s t y }}
\ l a b e l { s e c : s o u r c e codet h i n s p . s }
\ l s t i n p u t l i s t i n g { thinsp . sty }
\ clearpage
\ section { S o u r c e code o f t h i s document }
\ l a b e l { s e c : s o u r c e codet h i s }
\ l s t i n p u t l i s t i n g {\jobname . t e x }
\end{ document }
%%%
%%%
%%%
%%%

Local Variables :
mode : l a t e x
TeXmaster : t
End :
12

Das könnte Ihnen auch gefallen