...

# User-defined HTML or STYLE tags

colby2152
05-10-2009, 03:48 AM
This is a fairly general question, but is there any way that I could do the following in HTML w/CSS?

Let's say there is a website that spits out LaTeX images based on what code you put in the website URL.

For example: ....com/mimetex.cgi?\sum_{i=1}^nf(x)

The part in the bold, red is the code that the user defines. The website generates a LaTeX image based on such code.

I would like to have some tag created where I can write <TAG>\sum_{i=1}^nf(x)</TAG> and have the image pulled. I feel that if this can be done, then it can be done with CSS. Is this possible?

colby2152
05-11-2009, 03:04 PM
Sixty-one views and not one response as to whether this can even be accomplished?

colby2152
05-12-2009, 03:17 PM
nothing yet?

VIPStephan
05-12-2009, 03:39 PM
I don’t quite understand what you want as I have no experience with LaTeX but it sounds more like you want to use XML (and possibly XSLT?).

Are you trying to write <TAG>\sum_{i=1}^nf(x)</TAG> through a stylesheet? Or are you literally trying to write <tag></tag> or is that just a placeholdeer for any element? If so you’d just write a span, for example, and style this with CSS.

abduraooft
05-12-2009, 03:50 PM
For example: ....com/mimetex.cgi?\sum_{i=1}^nf(x)

The part in the bold, red is the code that the user defines. The website generates a LaTeX image based on such code.

I would like to have some tag created where I can write <TAG>\sum_{i=1}^nf(x)</TAG> and have the image pulled. I feel that if this can be done, then it can be done with CSS. Is this possible? Do you have the program to make the image, by processing such LaTeX statements?

A wild guess
<img src="http://yoursite.com/mimetex.cgi?\sum_{i=1}^nf(x)" /> :)

colby2152
05-12-2009, 05:58 PM
Thank you for responding (both of you). I am referring to another website's LaTeX program, but I will be using my own in the future. Changing every single image src can take a lot of time, and I feel that this can be done in style sheets.

I was using <TAG></TAG> merely as an example. Basically, I would want to call such images using some type of reference. Second thought, this must be possible if it can be done in discussion forums.

VIPStephan
05-13-2009, 12:56 AM
Changing every single image src can take a lot of time, and I feel that this can be done in style sheets.

Changing anything in the code (e. g. the image path or HTML elements) is usually done with some server side script such as PHP or ASP. CSS is only able to style the HTML that is already there.

So for example basically you would, as abduraooft suggested, use an img element and have a “placeholder” PHP function in the source attribute’s value. PHP function would then be parsed on the server and output regular HTML that is displayed on a website:

<img src="<?php echo imagepath(); ?>" alt="" />
<!-- where imagepath() is a function that may be storing all image paths in an array or whatever and output them one by one in each image. -->

I’m not at all good in PHP, this is just a thought.

oesxyl
05-13-2009, 01:42 PM
This is a fairly general question, but is there any way that I could do the following in HTML w/CSS?

Let's say there is a website that spits out LaTeX images based on what code you put in the website URL.

For example: ....com/mimetex.cgi?\sum_{i=1}^nf(x)

The part in the bold, red is the code that the user defines. The website generates a LaTeX image based on such code.

I would like to have some tag created where I can write <TAG>\sum_{i=1}^nf(x)</TAG> and have the image pulled. I feel that if this can be done, then it can be done with CSS. Is this possible?

http://www.cse.ohio-state.edu/~gurari/TeX4ht/

I didn't search but propably you find the proper answer or something relevant on CTAN or TUG.

best regards

colby2152
05-13-2009, 04:05 PM
Changing anything in the code (e. g. the image path or HTML elements) is usually done with some server side script such as PHP or ASP. CSS is only able to style the HTML that is already there.

So for example basically you would, as abduraooft suggested, use an img element and have a “placeholder” PHP function in the source attribute’s value. PHP function would then be parsed on the server and output regular HTML that is displayed on a website:

<img src="<?php echo imagepath(); ?>" alt="" />
<!-- where imagepath() is a function that may be storing all image paths in an array or whatever and output them one by one in each image. -->

I’m not at all good in PHP, this is just a thought.

Would this example work?

<img src="<?php echo imagepath(TEX); f(x)>" alt="" />
<!-- where imagepath() is a function that may be storing all image paths in an array or whatever and output them one by one in each image. -->

I assume that imagepath would have to externally referenced in some php file?

VIPStephan
05-13-2009, 10:39 PM
I assume that imagepath would have to externally referenced in some php file?

Either this or at the top of the HTML (actually PHP) file.

I really don’t know what your latex code does – is this a function that outputs a certain value already: “{i=1}^nf(x)”?
Here is a simple example of a PHP array:

<?php
$variable = array('index1' => 'value', 'index2' => 'value'); ?> <img src="<?php echo$variable['index1']; ?>" alt="" />

This is a simple array that is written statically and the value of the first index will be output in the image source. This all would happen in a PHP file (same as a plain HTM file but with .php extension). With a little more advanced PHP you could fill that array dynamically with the image paths and output it automatically as well. But really, that would belong into the PHP forum.