I have a weird macro issue that with which would appreciate some help.

Actually, by the time I got 75% through writing this, I figured out
how to resolve my immediate bug.  However, as you'll see my happier
solution still feels sort of hackish.  And as a result I feel a little
uneasy about using latex for the hundreds of use cases like the one
you'll see below.  Any sage advice to either do something like appease
my worries or to convince me to abandon latex in favor of something
more like linux (wrt to linux's transparency and predictability) would
be appreciated.

Okay, now for my story.  By the end of the story you'll see what I am
after...

I use a template to write these schematized (aka templatized) patient
reports as part of my work as a psychology intern.  Sometimes they are
about females, sometimes they are about males.  So, my template.tex
file is agnostic with respect to sex of the patient.  So, I might have
something like this near the top of my template.tex file...

\newcommand{\hisher}[0]{his or her}

\newcommand{\HeShe}[0]{He or She}

...then deep in the body of my report, I might have something like
this...

The following test results are felt to be valid and reliable estimates
of \hisher current functioning.

....or this...

\HeShe was delivered via unplanned C-section.

...So, lets say I need to write a report on a male patient, Joe.
Well, I simply copy my template.tex to joe.tex and then edit joe.tex
such that, in joe.tex, the two macros look like this...

\newcommand{\hisher}[0]{his}
\newcommand{\HeShe}[0]{He}

....sound good?  Well, there's a problem.  The problem is that latex
refuses to put a space after occurences of the macro.  Thus, if I do
...

latex joe.tex

...and then read joe.dvi using my own eyes (via xdvi or somesuch) it
reads like this...

Hewas delivered via unplanned C-section.

...well that ain't right -- we humans like to have spacesbetween
ourwords.  Itmakes things easiertoread....So what do I do?  Well at
this point I must resort to the following hack.  I trick latex into
putting a spaces after each macro.  Instead of writing the macro
thusly...

\newcommand{\HeShe}[0]{He}

...I write it like so...

\newcommand{\HeShe}[0]{He }

...well, that is bad.  For example, suppose I have a sentence in my
template.tex like so...

\HeShe, heavily sedated, did not say very much during the clinical
interview.

...well, then in the .dvi file I'd have something that would look like
this...

He , heavily sedated, did not say very much during the clinical
interview.

...well, that's bad punctuation.  It should look like this...

He, heavily sedated, did not say very much during the clinical
interview.

......HMM, I just got an idea...What if I do the macro like this...

\newcommand{\hisher}[1]{***hisher#1}

...and then, instead of doing calls to the macros the old way, like
this...

The following test results are felt to be valid and reliable estimates
of \hisher current functioning.

...instead, I do them the new way like this...

The following test results are felt to be valid and reliable estimates
of \hisher{} current functioning.

...CHA CHING!!!  That works.  

So, at the end of my story, you should see that, in a sense I am
happy.  In a sense my immediate problem is resolved.  However, my
faith in the transparency of latex has been weakened.  I don't like
programs that behave quirkily (like Windoze, for example (-:).  A
friend of mine who I respect urges me to abandon my attempts to
templatize/semi-automate my report writing activities using latex (the
kind of automation you see above is hopefully merely the tip of a
complex iceberg underconstruction).  He says I should push as much
autoreport generation functionality into perl.

In sum, if someone can show me why all the above latex behavior is
logical, I'll be a little less skeptical of latex.  Or if someone can
convince me to use something else, I'm all ears.

Hrm, as you can prolly tell by the length of this, I don't have much
to do tonight.

Bill









_______________________________________________
Siglinux mailing list
[EMAIL PROTECTED]
http://machito.utacm.org/mailman/listinfo/siglinux

Reply via email to