(Q) Replace {\em foo} by [foo] in LaTeX?

(Q) Replace {\em foo} by [foo] in LaTeX?

Post by Robin Fairbair » Tue, 07 Dec 1993 21:00:49



|> [...] possible to create a macro or change the catcodes etc (I don't
|> know TeX) to enable me to write:
|>
|>     This is [the best] way to go, instead of
|>     This is {\em the best} way to go.

Formally, the answer is yes.  However, since [] brackets are used in
*as they stand, implementing such a thing would likely be a
nightmare: I advise against trying.  (Note also that you should in any
case have said `{\em the best\/}' - italic corrections are important!)

|>    (( This is a line ))
|>    instead of
|>    \begin{center}  this is a line \end{center}

This might more nearly be possible, provided you were willing to
insert a pair of ligatures for (( and )) in every font, and to make ((
active.  However, it still (imho) remains a theoretical rather than a
practical proposition.

|> I have looked in the*manual but there doesn't seem to be anything
|> obvious there.

Even were the change practicable, it's not the sort of thing Lamport
believes you ought to be trying to do, so you wouldn't find it in his
manual...
--

U of Cambridge Computer Lab, Pembroke St, Cambridge  CB2 3QG, UK

 
 
 

(Q) Replace {\em foo} by [foo] in LaTeX?

Post by Timothy Lark » Tue, 07 Dec 1993 23:26:43




>     This is [the best] way to go, instead of
>     This is {\em the best} way to go.

in TeX style, you can include in the preamble

\catcode`\[=\active
\def[#1]{{\em#1}}

HOWEVER, this will mean that you can't use [ for anything else. In fact, I
think that even*optional arguments will no longer work.

You can do something similar for the centering problem, if you can find
some single character, instead of the double (, for the delimiter.

--

Timothy Larkin
otior ergo sum

 
 
 

(Q) Replace {\em foo} by [foo] in LaTeX?

Post by Joel M. Hoffm » Wed, 08 Dec 1993 01:29:11




>|>    (( This is a line ))
>|>    instead of
>|>    \begin{center}  this is a line \end{center}

>This might more nearly be possible, provided you were willing to
>insert a pair of ligatures for (( and )) in every font, and to make ((
>active.  However, it still (imho) remains a theoretical rather than a
>practical proposition.

I think the way to do this is to make ( into a letter, and define it
something like:

        \def((#1)){\center{#1}}

But I don't know what that might do to other parts of the system.  You
might also

         \def(

to check if the next char. is another parend, and if so, to enter the
text up until )), and otherwise simply to print a (.  

(BTW, ignore the incorrect syntax in the examples above.)

-Joel

--
-----------------------------------------------------------------------------
|_|~~ Germany, Europe. 1943.    "The diameter of the bomb was 30 centimeters,
__|~| 16 Million DEAD.           and the diameter of its destruction, about 7
                                meters, and in it four killed and 11 wounded.
 cnc  Bosnia, Europe. 1993.     And around these, in a larger circle of  pain
 cnc  HOW MANY MORE?          and time,  are scattered two  hospitals and one
                          cemetery.   But the young woman who was  buried  in
                    the place from where she came, at a distance of more than
             than 100 kilometers, enlarges the circle considerably.   And the
      lonely man who is mourning her death in a distant  country incorporates
into the circle the whole world.  And I won't speak of the cry of the orphans
that reaches God's chair and from there makes the circle endless and godless."
-----------------------------------------------------------------------------

 
 
 

(Q) Replace {\em foo} by [foo] in LaTeX?

Post by J-D Mountj » Tue, 07 Dec 1993 17:56:15


Hi

I have been using*for some time now, and I was wondering whether
it is possible to create a macro or change the catcodes etc (I don't
know TeX) to enable me to write:

    This is [the best] way to go, instead of
    This is {\em the best} way to go.

also

   (( This is a line ))
   instead of
   \begin{center}  this is a line \end{center}

I have looked in the*manual but there doesn't seem to be anything
obvious there.

Thank you

J-D
--

 
 
 

(Q) Replace {\em foo} by [foo] in LaTeX?

Post by Robin Fairbair » Wed, 08 Dec 1993 19:13:21





|> >|>    (( This is a line ))
|> >|>    instead of
|> >|>    \begin{center}  this is a line \end{center}
|> >
|> >This might more nearly be possible, provided you were willing to
|> >insert a pair of ligatures for (( and )) in every font, and to make ((
|> >active.  However, it still (imho) remains a theoretical rather than a
|> >practical proposition.

Donald Arseneau (in private correspondence) points out that even my
`solution' isn't, because of the point at which ligatures are combined
in TeX.

|> I think the way to do this is to make ( into a letter, and define it
|> something like:
|>
|>   \def((#1)){\center{#1}}

The character after \def has either to be a control-sequence-
introducer or an active character.  What's proposed here doesn't work.

|> But I don't know what that might do to other parts of the system.  You
|> might also
|>
|>    \def(
|>
|> to check if the next char. is another parend, and if so, to enter the
|> text up until )), and otherwise simply to print a (.  

Requires that `(' is an active character.  Would probably work, except
that fiddling with catcodes (to make a *very* common character active,
in this case) is generally a no-no, because of the unexpected side-
effects.

|> (BTW, ignore the incorrect syntax in the examples above.)

Aww - Missed that!  Ignore my whole post!
--

U of Cambridge Computer Lab, Pembroke St, Cambridge  CB2 3QG, UK

 
 
 

(Q) Replace {\em foo} by [foo] in LaTeX?

Post by Ian Colli » Sat, 11 Dec 1993 21:02:04



>                                     (Note also that you should in any
>case have said `{\em the best\/}' - italic corrections are important!)

Which reminds me...  why can't TeX do italic corrections by itself?

Ian Collier

 
 
 

(Q) Replace {\em foo} by [foo] in LaTeX?

Post by Douglas W. Ear » Mon, 13 Dec 1993 09:49:38



>I have been using*for some time now, and I was wondering whether
>it is possible to create a macro or change the catcodes etc (I don't
>know TeX) to enable me to write:
>    This is [the best] way to go, instead of
>    This is {\em the best} way to go.

Try this:

    \let\langle=<
    \def\makelangleother{\catcode`\<=12 \relax}
    \def\makelangleactive{\catcode`\<=\active\relax}
    {\catcode`\<=\active



    }








course, as usual.  Sorry about the inscrutible command names, but I don't
want to change them for fear of making a typo.)

These lines define the command you want as <...> instead of [...], to
avoid conflict with LaTeX's optional argument syntax, which uses [...].

\em.

The < also inserts the italic correction \/ before everything but a comma,
period, or \null.  The \null case is useful for saying \foo{<...>\null}
to avoid the error message you get when you say \foo{<...>}.  In the
latter case, \futurelet tries to look ahead at the next character,
but the next character is the } that TeX strips off during argument
handling, so there's nothing for it to look at, and TeX complains.

Another embellishment is that you can say "<>" to get \vert.  You can
replace \vert above with whatever else you want <> to mean.

Also, tell TeX to deactivate < in math mode by adding \makelangleother
to \everymath:

    \everymath={...\makelangleother}

where "..." is whatever \everymath is normally on your system (I
think it's {} in LaTeX).  You can say \emphasize{...} to get the same
effect as <...> in math mode (or anywhere else).

Since the above definitions don't make < active, put
\makelangleactive some place where it will be expanded after all
commands have been defined--like the end of your style file, the end
of the \begindocument command definition, or the beginning of your
manuscript's text.  You don't want < active while reading style files
or defining commands, because \ifnum, \ifdim, etc., as well as some
other command definitions, expect < to have a catcode of 12.

If you must read in a command definition that uses < after < has been
made active, say \makelangleother first, read it, then say
\makelangleactive. If you need < in a non-math definition, use \langle.
But I find that these cases are rare, and usually I can use <...>
without any special trouble.

--Doug

 
 
 

1. whats needed to go from foo.tex to foo.ps with psnfss?

I recently got psnfss in order to use postscript fonts for my documents.
However, I cannot get the .ps file (I'm using dvips5.514) from the .dvi file.
I was able to get simple.dvi from simple.tex after obtaining the pgsr*.vf and
.tfm files, but I cannot get simple.ps.
Below is the error I get from dvips.
What files *exactly* do I need in order to use the various *.sty files that
come with psnfss? Where do I get the needed files?

Thanks.  

--Floyd
------------------------------------------------------------------
This is dvips 5.514 Copyright 1986, 1993 Radical Eye Software
' TeX output 1993.03.29:2102' -> simple.ps
- MakeTeXPK rpgsr 300 300 magstep\(0.0\)
mf "\mode:=imagen; mag:=magstep(0.0); scrollmode; input rpgsr" </dev/null
This is METAFONT, C Version 2.7

! I can't find file `rpgsr'.
<*> ... mag:=magstep(0.0); scrollmode; input rpgsr

Please type another input file name:
! Emergency stop.
<*> ... mag:=magstep(0.0); scrollmode; input rpgsr

Transcript written on mfput.log.
Metafont failed for some reason on rpgsr.300gf
dvips: Font rpgsr.300pk not found, characters will be left blank.
dvips: Can't open font metric file rpgsr.tfm
dvips: I will use cmr10.tfm instead, so expect bad output.
dvips: Checksum mismatch in rpgsr.tfm
<tex.pro><texps.pro>. [1]

--

Regards,

Floyd Simpson
=================================

Tel:    407-364-3272            
Fax:    407-364-3904
=================================

2. using TeX as a filter

3. : (em)TeX associated to foo.tex in windows ?

4. Beta Email address

5. Drag and drop FOO.TEX on LATEX.CMD?

6. Q: decstation 5000/133

7. LaTeX cannot determine size of graphic in foo.pdf (no BoundingBox)!

8. MacOS SDK CD #2?

9. Titlepage (\thanks{foo})?

10. \usepackage{amsthm} and \ref{foo} suggestion

11. hyperref package and \footnotemark[\ref{foo:bar}] -- error?

12. \setbox 2 = \epsbox{foo.ps} in plain TeX

13. Wrapper newcommand to handle \foo*{...