<div class="foo">Some text.</div>
<div class="bar">Other text.</div>
and then use CSS to determine the
display characteristics of div.foo
and div.bar.
This is really useful.
Is there a LaTeX equivalent?
If not, is there an effort to provide
a LaTeX equivalent?
As a point of comparison, consider the
way \newtheorem works. Instead of having
a core theorem environment that takes a class
option to provide styling info, we define a
new environment. This clutters the name space,
hides dependencies, does not allow multiple
classes, etc.
Thanks,
Alan Isaac
Look at the experimental LaTeX3 code, particularly the template
package.
--
Joseph Wright
Thanks. I think this looks promising.
Is the template package usable with 2e?
Alan Isaac
\foo{Some text.}
\bar{Other text.}
and then use a package to define
the commands \foo and \bar.
If there are things common to \foo and \bar,
formulate \foo and \bar as style changes and
put them into an environment that supplies the
common parts, perhaps named div:
\begin{div}\foo Some text.\end{div}
\begin{div}\bar Other text.\end{div}
Dan
As with all of the current LaTeX3 stuff, it is designed to work as
"l3in2e". You'll need to download the expl3 code as well: the releases
to CTAN in August work together, I think.
--
Joseph Wright
Thanks!
Alan
> <div class="foo">Some text.</div>
> <div class="bar">Other text.</div>
> and then use CSS to determine the
> display characteristics of div.foo
> and div.bar.
> This is really useful.
> Is there a LaTeX equivalent?
Not easily, but as (La)TeX is a programming language as well, it should be
possible to construct one (at least in principle).
You might use a combination of
* optional argument
* ifthen tests
For simplicity (and this is what I need for reStructuredText syntax
highlight), I use an inline element as example.
<span class="foo">Some text.</span>
<span class="bar">Other text.</span>
could translate to
\newcommand*{\span}[2][]{%
\ifthenelse{\equal{#1}{foo}}{\foostyle #2}{}
\ifthenelse{\equal{#1}{bar}}{\barstyle #2}{%
#2}
}
Multiple classes would require looping over the optional argument list
(e.g. with \@for ... \do { } )
Günter
IMO, the point here is not HTML but CSS. With the latter
you can define easily different foo and bar classes depending
on the context. While you can emulate <div></div> with an
environment taking an argument, emulating the contextual
variations of CSS is a lot more difficult.
Javier
----------------------------------------------
http://www.tex-tipografia.com/lc.html