Re: package the right way?
- From: Steve Hicks <stephenhicks@xxxxxxxxx>
- Date: Thu, 7 Aug 2008 18:15:14 -0700 (PDT)
On Aug 7, 8:41 pm, danmc91 <s...@xxxxxxxxxxxx> wrote:
I've been a user of LaTeX for many years and am looking at doing
something a bit more structured than I have in the past and want to
see if I'm thinking about things correctly.
I'm compiling a bunch of notes I have on various plants. For each
species, I'll have things listed like scientific name, common name(s),
leaf type, leaf shape, etc. I hope to grow the # of species to a
moderately large number over several years but want to maintain
consistent formatting.
So, is the right approach here to create a new package, say "plants"
and for each chapter or section in my notes I'd have something like:
\begin{species}{Acer negundo}
% list of common names
\cname{boxelder}
\cname{ashleaf maple}
\cname{Manitoba maple}
% list of identifying attributes. Not all may be listed
\leaftype{pinnately compound}
\leafmargin{lobed}
\leafscar{.....}
\stipularscar{....}
\description{\species\ is a species of maple native to North
America. More detailed description here}
\end{species}
Then my species package would spit out all the information in the
order and formatting I want.
Is this the "right" way or best practices way to go about this (write
a package and define a new environment to let me identify data as
being of a particular type)? If not, is there a better way? Any good
pointers to a nice "starter" package to look at to learn from?
My goal is to spend time on compiling the information and not a lot of
time reformatting things manually to maintain consistency.
This seems to me like a perfectly good way to go about this. If
you're following this sort of markup strictly then just about anything
should work, and it would be easy to write a perl script to reformat
things if you needed to change at a later time. You could also even
export to XML and use some sort of XSLT to change it into any other
sort of format, but I don't know anything about that (beyond the
discussion going on in a nearby thread).
Maybe you're already thinking of this, but in case you weren't, it
would certainly be a piece of cake to have \species defined here as
\textit{A. negundo} by simply grabbing the first letter and then using
a delimited argument to discard everything up to the first space.
But since LaTeX is supposed to be a markup language, I would say
you're definitely on the right track in designing your own markup to
fit in with it. Oh, and be careful with spaces in that sort of thing
- all the close-braces can cause lots of unwanted space, and I've seen
some horrible hacks to deal with it when usually something more like
\ignorespaces would have worked a lot better.
Cheers,
steve
.
- References:
- package the right way?
- From: danmc91
- package the right way?
- Prev by Date: package the right way?
- Next by Date: tex eps error
- Previous by thread: package the right way?
- Next by thread: Re: package the right way?
- Index(es):
Relevant Pages
|