[comp.text.tex] fonts? && testing args && changing case

jdm5548@diamond.tamu.edu (James Darrell McCauley) (12/28/90)

Howdy,

I'm writing a LaTeX style and I've run across a few problems.
A few beginner questions for those benevolent TeX, LaTeX and 
METAFONT gurus:

   1.  I need a slanted, small-caps font. Does such
MF     a font exist? I'm not a METAFONT user, so if someone could e-mail 
       me some instructions, I'd really appreciate it.

   2.  | | sing drop.sty by David G. Cantor and Dominik Wujastyk (from
MF     |_| Clarkson), I drop and enlarge the first letter of a paragraph, 
       sort of like at the beginning of this sentence.  It covers about
       2\baselineskip's when I use cmr10 scaled \magstep5.  I need
       a font that will cover 3 lines, or maybe instructions on how
       to build one.

   3.  Floating things use something called makecaption for the captions. 
TeX    I need a dash after figure numbers but a colon after table 
       numbers, e.g.
             Figure 1 -- A picture of a fish.
             Table 1: Fishy numbers.
       More succinctly, I want to test the argument to a macro.
       How do I do this? My humble beginning is below:

       \long\def\@makecaption#1#2{             % !! note - buggy code
         \vskip 10pt 
         \def\tmpcs{Figure \arabic{thefigure}} % trouble starting...
         \ifx{\csname#1\endcsname}\tmpcs       % here's the trouble.
           \def\separator{ -- }                % problem is I don't know 
         \else \def\separator{: }              % how to test argument
         \fi
         \setbox\@tempboxa\hbox{#1\separator #2}
         \ifdim \wd\@tempboxa >\hsize #1\separator #2\par \else \hbox
         to\hsize{\hfil\box\@tempboxa\hfil} 
       \fi} 

   4.  I need to make sure that the first word of a caption is capitalized
TeX    and the rest are lowercase, as in the above examples.  I thought
       that I had seen this before, but I've been unable to reproduce it.
       Maybe a few \if's, a few \catcode's, \uppercase, and \lowercase?
       It must be semi-smart - that is, having this as the input:
       \caption{A Resum\'{e} Of A FISH who Watches {MASH}.}, 
       the result must be 
       "A resum\'{e} of a fish who watches MASH."

   5.  Similar to #4 and with regard to #2, I wish to take the first token
TeX    after the first \section*{} and make it a larger font.  For the style
       that I am writing, the first letter in the first section after
       the abstract is dropped and enlarged.  I've read Ch. 7 of the 
       TeXbook, but I'm still a little confused. Perhaps
       \ifnum\value{section}=1
         <drop next token>
       \fi

Sorry if I overwhelm you with questions.  I've been saving these as
my style file progresses. I really appreciate the willingness of you
folks out in USENET land to answer questions. I've learned a lot of
*neat* things while trying to solve these (#3,4,&5)... just not their
solutions. I've ran out of gas and have thrown my hands up...

Thanks,
Darrell
--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
James Darrell McCauley                 jdm5548@diamond.tamu.edu
Dept of Ag. Engineering                          (409) 845-6484
Texas A&M University, College Station, Texas 77843-2117, USA
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

jg@prg.ox.ac.uk (Jeremy Gibbons) (12/30/90)

jdm5548@diamond.tamu.edu (James Darrell McCauley) asks, among other things,

>    1.  I need a slanted, small-caps font. Does such
> MF     a font exist? I'm not a METAFONT user, so if someone could e-mail 
>        me some instructions, I'd really appreciate it.

Make a copy of cmcsc10.mf, call it cmcscsl10.mf, and change the line that says
`slant = 0' to `slant = 1/4' or to `slant=1/6' depending on whether you want
it to match with italics or slanted text (no, I don't know why they have
different slants either). Then run Metafont on it, to creat a new font. The
precise details of how you do this are system dependent; on my system (Unix) I
can say

   mf "\mode=localfont; input cmcscsl10"

which creates a .tfm and a .300gf file; I then run gftopk to turn the .300gf
into a .300pk, then put them in the correct directories. 

>    2.  [...] I need
>        a font that will cover 3 lines, or maybe instructions on how
>        to build one.

Similarly, I would say

   mf "\mode=localfont; mag=1.5*magstep 5; input cmr10"

and load it into (La)TeX by saying

   \font\dropfont = cmr10 scaled 3700

(or thereabouts)

>    5.  Similar to #4 and with regard to #2, I wish to take the first token
> TeX    after the first \section*{} and make it a larger font.  For the style
>        that I am writing, the first letter in the first section after
>        the abstract is dropped and enlarged.  I've read Ch. 7 of the 
>        TeXbook, but I'm still a little confused. Perhaps
>        \ifnum\value{section}=1
>          <drop next token>
>        \fi

On the right lines. My guess might be

   \newif\if@dropcapital

   \let\original@section\section
   \def\section{\relax
                \ifnum\value{section}=0\@dropcapitaltrue\fi
                \original@section}

(I haven't actually tested this!)



Section commands call a macro `\@afterheading' to deal with vertical skips,
penalties, paragraph indents etc. You can put something in this macro to do
the dropped capital stuff. (Here, the macro \drop picks up the first letter
of the next paragraph and does some \hangindentery with it; I'm not sure if
this is the same as the one you're using, but you should be able to figure
out how to do it from this).

> \def\@afterheading{%
>    \global\@nobreaktrue    
>    \everypar{\let\next\relax
>              \if@nobreak
>                 \global\@nobreakfalse      
>                 \clubpenalty \@M
>                 \if@dropcapital              % added dropped capital stuff
>                    \global\@dropcapitalfalse
>                    \if@afterindent \else {\setbox0=\lastbox}\fi
>                    \let\next\drop
>                 \else
>                    \if@afterindent \else {\setbox0=\lastbox}\fi
>                 \fi
>              \else 
>                 \clubpenalty \@clubpenalty
>                 \everypar{}%
>              \fi
>              \next}%
> }           


I'm afraid I can't help you with the other questions.


Hope that helps...

Jeremy

*-----------------------------------------------------------------------*
|  Jeremy Gibbons (jg@uk.ac.oxford.prg)   Funky Monkey Multimedia Corp  |
*-----------------------------------------------------------------------*