Академический Документы
Профессиональный Документы
Культура Документы
Palle Jrgensen
4th December 2007
Summary
The thinsp package provides a stretchable \thinspace to replace LATEXs
normal \thinspace.
Contents
1 Introduction
2 Usage
Introduction
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
2.1
Options
Option
Description
nothinspace
thinspace
nothinthinspace
thinthinspace
negthinspace
nonegthinspace
onehalf
onethird
twothirds
Any comment on this package can be sent to the author on his e-mail address:
hamselv@pallej.dk.
1
% 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
\ 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
Local Variables :
mode : l a t e x
TeXmaster : t
End :
12