Formatting Code in Forum Posts

Here's a tip for new IgorExchange users. For Igor code to show up correctly in posts, you should use the Insert Code Snippet toolbar widget:

Insert Code Snipped Toolbar Widget

Clicking it will open an editor where you can enter Igor code.

You also need to choose the Igor language from the popup menu at the top of the widget:

Insert Igor Code Widget Hello World

Click OK to see the result in your posting:

Print "Hello World"


More importantly, without using the Insert Code Snippet widget, your code may be garbled because the < character is interpreted as HTML.

On this subject, one feature that escapes me is how to get the IgorExchange tab settings for its Igor code to match that of the original Igor code.

I generally try to align my Igor code // comment delimiters along tab stops, but the tab spacing in IgorExchange is bigger. Similarly, the Igor one-tab code indentations get enlarged in IgorExchange. I would like to see the default settings made compatible.
I just joined IgorExchange today and made my first post and was wondering about this. I put code in my post but not the "igor" tag.
This is a good tip!
Thanks,

Matt
s.r.chinn wrote:
On this subject, one feature that escapes me is how to get the IgorExchange tab settings for its Igor code to match that of the original Igor code.

I generally try to align my Igor code // comment delimiters along tab stops, but the tab spacing in IgorExchange is bigger. Similarly, the Igor one-tab code indentations get enlarged in IgorExchange. I would like to see the default settings made compatible.

The size of a tab character is determined by your web browser. As far as I know there is nothing that IgorExchange could do to make it smaller. Likewise, because the font used in your web browser and in your Igor procedure window are likely not the same size and face, the alignment may be different in the two. I think this is made worse by the fact that Igor's default font in procedure windows is not a fixed width font, but the font used on IgorExchange within igor tags is fixed width. I don't know why Igor doesn't use a fixed width font like most all other code editors do.
For those new to IgorExchange or if you have forgotten, see the top of this topic for instructions on formatting Igor code in posts.
hrodstein wrote:
For those new to IgorExchange or if you have forgotten, see the top of this topic for instructions on formatting Igor code in posts.

Thanks--A few days ago I posted my first entry--without reading the instructions. Some kind person fixed it for me. I thank them
Is there a way to indent code quickly? The tab button switches focus in the browser window. While I can write up code in Igor and then copy it to the posting, if I write the code in here then I've resorted to entering ~5 spaces in place of a tab. Or is there something obvious I'm missing?
tkessler wrote:
Is there a way to indent code quickly? The tab button switches focus in the browser window. While I can write up code in Igor and then copy it to the posting, if I write the code in here then I've resorted to entering ~5 spaces in place of a tab. Or is there something obvious I'm missing?

Handling of the tab key is a function of your browser. I recommend you write your code in Igor or another text editor first. That's what I typically do.
In addition to copying a tab from somewhere and pasting it into the browser you can use the HTML entity code &#09;:
Not indented
&#09;Indented&#09;// Uses HTML entity &#38;#09;


&#09; works in Safari 5.17 and Internet Explorer 9.07 but may not work in all browsers.