\ProvidesPackage{mytools}[2003/05/13 Basic package of my macros] \RequirePackage{xspace} \RequirePackage{linespace} \RequirePackage{centerpg} % % Simpler macro for defining word shortcuts, that uses xspace. % \def\@ifendswithchar#1#2#3#4{% \def\@@ifendswithchar##1#2\@nextchar##2\@stop{% \def\@@ifendswithch@r{##2}% \ifx\@@ifendswithch@r\@empty } \@@ifendswithchar#1\@nextchar#2\@nextchar\@stop#4\else#3\fi } \newcommand{\alias}[2]{\@ifendswithchar{#2}{.}% {\@dotalias{#1}{#2}}{\def#1{#2\xspace}}% } \def\@dotalias#1#2{\def#1{#2\futurelet\@let@token\@gobbledot}} \def\@gobbledot{\ifx\@let@token.\expandafter\@gobble \else\@\expandafter\xspace\fi} % % First-line parser. Picks out the first few words that follow and attempts to % identify an inital phrase so that it may be restyled (say, in small caps). % \newcounter{phrasewords} \setcounter{phrasewords}{7} \def\list@of@conjunctions{and,or,but,yet} \def\list@of@articles{a,an,the,these,those,this,that} \def\list@of@prepositions{on,in,of,with,to} \def\list@of@verbs{am,is,are,was,were} \newcommand\findphrase{% \@tempcnta=\c@phrasewords \def\@phrasewords{}% \read@phrase@words } \def\read@phrase@words#1 { \edef\@phrasewords{\@phrasewords #1}% \advance\@tempcnta\m@one \ifnum\@tempcnta=0 % TODO: Finish this function. \else \expandafter\read@phrase@words \fi } % % Macro for acronyms % \newif\if@ucacronyms \@ucacronymsfalse \let\ucacronyms\@ucacronymstrue % Acronyms are uppercased \let\scacronyms\@ucacronymsfalse % Acronyms are in small caps \newcommand{\ac}[1]{% \if@ucacronyms \MakeUppercase{#1}% \else \textsc{\MakeLowercase{#1}}% \fi } % % Macro for stuff that needs to be done. % \def\todo#1{% \ifdim\overfullrule=\z@ \errmessage{There is a todo in the input:^^J^^J#1^^J^^J}% \else \immediate\write\@unused{^^JTodo: #1\on@line^^J}% \fi \textbf{#1}% } % % Trace the output so we can read the boxes. % \showboxdepth=5 \showboxbreadth=5 \def\showoutput{% \showboxdepth=10000 \showboxbreadth=10000 \tracingoutput=1 } \ifnum\tracingoutput=0 \immediate\message{Set \noexpand\showoutput to show output} \fi % % Flush paragraphs (last line is same length as others) % \def\flushpar@c{\rightskip=\z@\@plus0.5\hsize\leftskip=\rightskip}% \def\flushpar@l{\rightskip=\z@\@plus\hsize}% \def\flushpar@r{\leftskip=\z@\@plus\hsize}% % In case we've used MakeUppercase or something \let\flushpar@L\flushpar@l \let\flushpar@C\flushpar@c \let\flushpar@R\flushpar@r \def\flushpar@setparams#1{% \csname flushpar@#1\endcsname\relax \pretolerance=9999 \spaceskip=\fontdimen2\font \parfillskip\z@ \parindent\z@ \parskip\baselineskip %\def\\{\@testopt\flushpar@lbr\z@}% %\def\flushpar@lbr[##1]{\unskip\vspace{##1}\penalty-10000\relax}% } \newcommand{\flushvbox}[2][l]{\vbox{\flushpar@setparams{#1}\ignorespaces#2}} \newcommand{\flushvtop}[2][l]{\vtop{\flushpar@setparams{#1}\ignorespaces#2}} \newenvironment{flushpar}[1][l]{% \par\leavevmode \flushpar@setparams{#1} }{% \par }% \newcommand{\declareflushpar}[1][l]{\flushpar@setparams{#1}} \def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else \thispagestyle{empty}\hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi} % % four dots % \DeclareTextCommandDefault{\fourldots}{% .\kern\fontdimen3\font .\kern\fontdimen3\font .\kern\fontdimen3\font .\kern\fontdimen3\font} % % % Parameters % \frenchspacing % Don't add extra space after periods, etc. \endinput