I've been reviewing the list of supported languages by listings in the documentation, and notice that C# isn't listed. How critical an issue is this? I've used both the \lstset{language=C} and \lstset{language=VBScript} tags and compiled the document as a PDF and can't see any difference in presentation.
General ⇒ Creating a line break in a code sample
- tripwire45
- Posts: 129
- Joined: Thu Apr 10, 2008 4:35 am
Re: Creating a line break in a code sample
I've been reviewing the list of supported languages by listings in the documentation, and notice that C# isn't listed. How critical an issue is this? I've used both the \lstset{language=C} and \lstset{language=VBScript} tags and compiled the document as a PDF and can't see any difference in presentation.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- tripwire45
- Posts: 129
- Joined: Thu Apr 10, 2008 4:35 am
Re: Creating a line break in a code sample
Any ideas?
Creating a line break in a code sample
It's not a big deal. It's easy to augment the language definition within your TeX to add any words you use that are missing. For example...tripwire45 wrote:Any ideas?
Code: Select all
\lstset{language=Matlab,
morekeywords={xlim,ylim,var,alpha,factorial,poissrnd,normpdf,normcdf,getfield},
morekeywords=[2]{on, off, interp},
morekeywords=[3]{my_function},
morecomment=[l][\color{blue}]{...}}See the listings documentation for more information. In particular, check out the "Language definitions" section 3.2 for information on how to use morekeywords, morecomment, and morestring. Of course, you can define your own new language entirely as well.
In the case of C#, nearly everything is going to be the same as C++ (or even Java), but there might be small differences. For example, C# has its own way of handling mutable class members (the keyword they use escapes me for a second). If you need such a construct, you can add it pretty easily.
And if worse comes to worst, everything is displayed but it's just not displayed as pretty as it could.
- tripwire45
- Posts: 129
- Joined: Thu Apr 10, 2008 4:35 am
Re: Creating a line break in a code sample
-Trip
Creating a line break in a code sample
I've just seen mentioned in another thread that somebody wrote a listing environment for C#. I thought it might interest you.
Cheers,
Tomek
- tripwire45
- Posts: 129
- Joined: Thu Apr 10, 2008 4:35 am