Suggestion Add code tag to [code] [/code] block

1. Sep 9, 2010

jackmell

Hi. Is there a way to add a tag to code blocks to identify what type of code it is? For example, in the code:

Code (Text):

this is mathematica code

I think it would look classy if the word "code" above the block could be an editable field and I could get it to say "Mathematica Code". That way, I wouldn't have to explicitly tell the reader what type of code it is.

2. Sep 9, 2010

Greg Bernhardt

This would be easy to add. Anyone else?

3. Sep 9, 2010

jackmell

Ok, thanks for replying. I assume when you update the software, you post a list of enhancement. I'll keep an eye out to see if you've decided to add this to the list of enhancements.

4. Sep 9, 2010

yuiop

If I wrap the code for the quote below in CODE tags:

I get:

Code (Text):

[QUOTE=yuiop]
$$\sqrt{1-\frac{v^2}{c^2}}$$
[/QUOTE]

The forum software is obviously still interpreting what is inside the code box. Shouldn't the CODE wrap disable all interpretation and reproduce what is inside the CODE box without interference?

If I wrap the same code in PHP tags I get:
PHP:

[QUOTE=yuiop]
$$\sqrt{1-\frac{v^2}{c^2}}$$
[/QUOTE]

This is closer to a faithful reproduction and what the CODE wrap should be doing, but it is still not perfect because it strips out the backslash before \sqrt for example.

To simulate what (I think) the CODE wrap should be doing, I have added comment prime symbols:

PHP:
'

[QUOTE=yuiop]
$$\sqrt{1-\frac{v^2}{c^2}}$$
[/QUOTE]

'
Is that what the CODE wrap should ideally be doing? I think it would be useful if it did faithfully reproduce whatever was put inside it. Being able to show exactly what code is used would be useful when helping newcomers to the forum, because you can show them exactly what to type in. I seem to recall there is some code to disable interpretation, but I cannot find any reference to it here.

I also think a TEX wrapper button or at least an ITEX button in the advanced editor would be handy for wrapping inline tex symbols in ITEX tags.

Last edited: Sep 10, 2010
5. Sep 10, 2010

jackmell

Not sure what you're trying to do there. But I can think of two suggestions to implement this:

(1) Just have a [/mathematica], [/matlab], [/cpp], etc., operators that would label the blocks of text as Mathematica Code, Matlab Code, C++ Code, and so forth.

(2) Provide a parameter to the code command so that I can include any string to precede the word code. For example, I could write [code{Mathematica}] or [code{mynewcode}] and it would print Mathematica Code or mynewcode Code as a label for the block.