Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Code Tags

Status
Not open for further replies.
I did a little fiddling this morning:
Capture.PNG

You can get the color to change, but cannot change back easily.

Code:
movlw      ETO,f
movwf      AACC
call       Santa
nop
NOP
'This almost works'
But, it doesn't work well
 
Last edited:
In my last post including code I tried the same with bad results.
 
I have tried various things too. One complication is that there are reserved "words" like "NOP" and "call" as illustrated. Single quotes seem to make the code magenta and are reversible. I will probably just use them for highlighting.

The only option I found that works with the color tag is to exit the colored code section and begin another that is not colored. That is not very satisfactory to me.

John
 
I resort now to this: get the excerpt with Irfan View and highlight / scratch with Paint. Maybe less than two minutes (search in the PC not counting).


Sample for John P.png
 
In Win7, I just use the "clip/capture" function that also allows editing. You can even erase using a white marker, but then it is easy to lose track of where the cursor is. The problem is that with lengthy code, a posted image is quite long; whereas, posted code opens in a window that can be scrolled. Of course, both approaches are workarounds.

John
 
The problem is that with lengthy code, a posted image is quite long; whereas, posted code opens in a window that can be scrolled.

Yes, you have a point there.
 
Hi,

I am happy to see a discussion about code tags.

The problem i always have is the spacing of the letters gets all messed up. For example, if i type out a word like "Hello" and then 10 spaces, then another word "Goodby" when i go to read it most of the 10 spaces will be gone, only one space maybe, or maybe what looks like a couple. This normally happens when i paste text though, so if i type that hello/goodby line with 10 spaces in Notepad for example then copy and paste it into the text editor here, it always messes up the spacing.
Any thoughts one what i can do to prevent this? It usually requires a lot of work to go back and retype all the spaces. This is especially a problem if i want to show a table or a text based schematic.
It used to work just fine several years back. Am i doing something wrong or what?
 
Do a snip/image and paste it.

If it is code, remember that you can direct the editor to use different formats depending on the type of code. At least that works for Assembly (i.e., {code=asm}) and C. Haven't tried or don't know about other languages.

John
 
Hi guys, I'm doing a little digging and will keep you posted.

I have also brought this thread to Dave's attention.

Thanks,
Matt
 
I believe to do tables there is an add-on package for Zenforo that does this. Don't think we have it.

Regards,
Les
 
FYI, when you want to post examples of tags I.E. [code] but not have them interpreted you can use the [plain] tags.

Mike.
 
Code:
line 1
line 2
line 3
[PLAIN][B]line4[/B][/PLAIN]
line 5
 
FYI, when you want to post examples of tags I.E. [code] but not have them interpreted you can use the [plain] tags.

Mike.

As you can see from post #13 "PLAIN" will remove all formatting from whatever is withing the tags, so you won't be able to make it bold or change the color that way.
 
Code:
movlw     line 1
movlw     line 2
movlw    [PLAIN]line 4[/PLAIN]
line 5     [B]line 5[/B]

The PLAIN tags may work outside code tags, and that is good to know, but they do not seem to affect what goes on inside code tags. In other words, the BOLD tags within code tags don't work even without the plain tags.

If I were guessing, CODE tags must have a priority property higher than FONT/TYPEFACE or COLOR tags.

John
 
I wasn't posting it for use within code tags, just as a tag that most people don't seem to know exists.

Mike.
 
As you can see, spaces are all messed up:

Code:
o---R1---+---o
                   |
                   C1
                   |
o---------+---o


o---R1---+---o
  |
  C1
  |
o--------+---o

One LP filter was typed here, the other pasted from an external editor. The problem only seems to be that the spaces are not right.

Capture.PNG
 
Pommie, I understood you to mean outside the code tags, but it was still worth testing.
MrAl
I don't think there is any way to get hyphens, underscores, and such to line up WYSIWYG in a forum. I think the only way is to post an image. I tried to figure out the rgb # for ETO's background so the image looks like text. This is as close as I could get:

Capture.PNG


Maybe Dave will give us the proper hex value.

John
 
Pommie, I understood you to mean outside the code tags, but it was still worth testing.
MrAl
I don't think there is any way to get hyphens, underscores, and such to line up WYSIWYG in a forum. I think the only way is to post an image. I tried to figure out the rgb # for ETO's background so the image looks like text. This is as close as I could get:

View attachment 96580

Maybe Dave will give us the proper hex value.

John

John, background color is HEX #F5F5FF, or RGB (245, 245, 255). I expect text is simply black (#000000)
 
Pommie, I understood you to mean outside the code tags, but it was still worth testing.
MrAl
I don't think there is any way to get hyphens, underscores, and such to line up WYSIWYG in a forum. I think the only way is to post an image. I tried to figure out the rgb # for ETO's background so the image looks like text. This is as close as I could get:

View attachment 96580

Maybe Dave will give us the proper hex value.

John

Hi John,

Well there's no problem with the hyphens and other chars, just with the spaces. The spaces are not right. It's like you type a Courier New space (which is a proportional font) and you get a Arial font space instead. It's just nuts too.
Not only that, but it WORKED FINE for years and years, until they switched to this new software which broke this functionality. It's probably easy to fix too.

Just to mention a few details..

Courier New is a proportional font, so everything typed has the same horizontal width. This is often used in programming environments where text lines up vertically because in any lines typed the chars have the same width. I could show countless examples.

MOST other fonts are not proportional, so they produce different widths depending on the character. For example, the capital "M" will be usually fairly wide, while the period "." will be very narrow. That means if you type an M on one line and a dot on the next line, the very next char you type on each line will not line up with the one above or below it because the first char was of a variable width. Fonts that cause this are like Arial, MS Sans Serif, Verdana, Times New Roman, etc.

Now the 'space' character in any of these non proportional fonts is much more narrow then the other characters except maybe small ones like punctuation. For that one font however, Courier New, the space is EXACTLY the same width as the other characters, including the M and the period, because that is the way the font is designed.

Now before the 'new' software, typing a space with Courier New would act just like in any other editor, it would be the same width as the other chars. Once the new software came in, the space now types (and pastes) differently, so that it acts like a non proportional font space would act.
If this space char would be fixed when using the Courier New font, all would be well again.

It's kind of ridiculous when you think about it, because EVERY editor i use does the space correctly, such as Notepad and Wordpad.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top