Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've done ab bit of web-searching and found nothing. Are there any attempts on using CSS for LaTeX formatting? For example:

body { font-family: Helvetica,Arial,sans-serif; }
section { font-size: 16pt; }
/* or: */
h1 { font-size: 16pt; }

I know that this approach is limited compared to the classic approach, but it could be a nice attempt. So are there any published papers or code pieces?

I'd like to write in the preamble of my LaTeX document: \usestylefile{foo.css} and have the text rendered as written in the given style file (and its linked style files).

share|improve this question
2  
Could you be a bit more specific about the background of your approach? Most of these things can be set up, but none of them so simple as in CSS and in some cases it is not even a good idea to do it the css way. –  Matthias Pospiech Nov 21 '11 at 13:56
8  
Using CSS directly is not likely to be possible. You might, however, be interested in things such as the work on a 'LaTeX3 database' to define relationships between document items. –  Joseph Wright Nov 21 '11 at 14:05
1  
Does it have to be css or are you happy to use a css-like configuration. For example, if you define a consistent key-value driven configuration system for your style (for example, as done in ConTeXt), then you can set-up the configuration and let a script (possibly a lua script) read the "css" and convert it into the appropriate tex code. For example head .section {text-color: blue; text-style: bold} could be translated to \setuphead[section][textcolor=blue, textstyle=bold], so you will get the corresponding style in the output. –  Aditya Nov 21 '11 at 19:48
4  
OK, let me clarify. Does it has to be CSS tuned to HTML or it can be any valid CSS. The snippet that I posted is actually valid CSS (if you replace text-color by color). So, IMO, all you need to do is come up with a consistent, key-value driven document mode. Then translating CSS style to TeX style is easy. –  Aditya Nov 21 '11 at 22:14
3  
Here's an example. This uses CSS to style an HTML page like the default LaTeX style. Enjoy! –  user19535 Oct 4 '12 at 18:29

1 Answer 1

up vote 5 down vote accepted

I'll take the comments as "there is no css-TeX yet".

share|improve this answer
3  
I think/hope the key word here is "yet". –  Bruno Le Floch Feb 4 '12 at 23:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.