Search Comments and Ratings

go

   
Date File Comment by Comment Rating
23 Jun 2014 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@Yiang: Maybe try comment out the "upquote=true" statement in mcode.sty ...

23 Jun 2014 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@Michael: Nope, read the listings package docs why.

29 Apr 2014 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

Cheeky indeed. But good work! About time someone did this properly.

14 Apr 2014 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@Ofelie: I suspect something with file and/or font encodings. Try this. Find this line in your local mcode.sty "{delta}{{\tiny$\Delta$}}1 % \Delta" and insert this below "{µ}{{$\mu$}}1 % \mu" (without the quotes of course). Does that help?

By the way, adding a "µ" to the mcode demo document half-works. While it doesn't seem to render on screen, it also doesn't break compilation...

09 Apr 2014 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@Ofelie: "An error" is not very descriptive of the problem...

09 Apr 2014 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@Sevada: Have a look at the documentation (top of the mcode.sty file), in particular the "useliterate" option.

05 Nov 2013 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@JH: As I said many times before, please have a look at the listings documentation (type "texdoc listings" in a command prompt, or find it here: http://mirrors.ctan.org/macros/latex/contrib/listings/listings.pdf), Section 4.8 in particular.

05 Nov 2013 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@Tony Almeida: Thanks for the pointer. The font size is static for each code block / inline code is static (it's set in the .sty file), so it doesn't change with context (such as in a footnote). As a remedy, I've updated the package for you to include a new \mcodefn{} command, which produces the inline code in footnotesize. Have a look at the mcode.sty for more details, in case you want to further adapt it for your particular application.

05 Nov 2013 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@Alex: Not sure what your question is, but you can use this package for that purpose, provided you disable line numbering.

08 Oct 2013 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

Hi Tintin, not sure what the issue is. Try using the demo file provided and work your way on from there...

10 Sep 2013 Arrowhead arrowh draws a solid 2D arrow head into the current plot. Author: Florian Knorn Florian Knorn

@Miguel - sorry I can't. But it's quite easy, I just plotted the analytical solution of a 2D ODE with complex eigenvalues using initial conditions placed on a circle...

08 Sep 2013 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@Mike - automatic line breaking [especially with comments] is not supported by the listings package (which does the work under the hood). You unfortunately have to do that manually...

14 Aug 2013 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ Jean: Have a look at the listings documentation (type "texdoc listings" in a command prompt, or find it here: http://mirrors.ctan.org/macros/latex/contrib/listings/listings.pdf), Section 4.4 in particular and the "linerange" option.

12 Jul 2013 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

Well, I'm an Apple Macintosh user and like TeXShop, but I'm not sure if the editor itself has anything to do with it.

I would try to compile the demo document that comes with the package first, and take it from there. Oftentimes it's simply a clashing between packages.

09 Jul 2013 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@Alon: Sorry, but I cannot help you with BaKoMa TeX. LaTeX just isn't made for WYSIWYG, you're better off using the more traditional approach to this wonderful typesetting system.

29 May 2013 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

Hi Bob,

That means there's still something wrong with your TeX installation (textcomp requires more than just a .sty file chucked in the same path).

If you can't get it working, you can also disable it, by removing / commenting out the following in mcode.sty:

\ifx\textquotesingle\undefined%
\RequirePackage{textcomp}%
\fi

as well as

upquote=true, % upright quotes

09 Apr 2013 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ kevin: Strange, I haven't observed this behaviour. Can you email me a minimal working example that reproduces the problem?

06 Feb 2013 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ Jon: Yeah, there's something wrong with your LaTeX installation. In particular, you are missing the "pcr" font (that's the Courier font used by the package to display stuff in monospaced font, similar to Matlab...).

26 Oct 2012 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

Thanks @Eric. I've had a look at getting the slim line working. Half got there using this "literate programming" string:

{\%\%}{{{\color[gray]{.85}{\makebox[0em][l]{\raisebox{2ex}[0pt][0pt]{\rule{\linewidth}{.4pt}}}}}\%\%}}{2}

Problem: Cell comment (%%) must begin on the beginning of the line, but worse: the remainder of the line no longer gets printed in green. Not sure how you can use the "literate programming" feature but still trigger the comment-formatting...

30 Aug 2012 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@Juan: Not sure why you are having this issue. The package should load the textcomp package in case \textquotesingle is not defined already. Try manually including the textcomp package before loading mcode to see if that helps...

30 Apr 2012 EzyFit 2.42 A free curve fitting toolbox for Matlab Author: Frederic Moisy Florian Knorn

Oh, just one question. Maybe it's just me, but I can figure out a way to use constants in an Ezfit FUN expression. Sure, I could use subs to replace known variables by their numerical values before using ezfit, but it would be very handy, in particular for scripting, if you could tell ezfit which variables *not* to consider unknown but rather use the currently assigned value for...

30 Apr 2012 EzyFit 2.42 A free curve fitting toolbox for Matlab Author: Frederic Moisy Florian Knorn

Very useful, as good as an "original" Matlab toolbox. Frédéric, you really should put a PayPal donation button on your page for me and other people to click! Your work and efforts very much deserve it.

17 Apr 2012 Zoom Functionality in MATLAB and Simulink Using Mouse Wheel Enable zoom in/out in MATLAB Command window, Simulink models, and Simulink dialogs using mouse wheel Author: Hamid Satarboroujeni Florian Knorn

Great tool and works as advertised.

May I make a suggestion though: The tool seems to reset the font used*). Can you please make it so this doesn't happen (i.e. just the font size is changed, not the font itself)?

Thank you!

*) I personally prefer to use the Droid Sans Mono font which is probably as beautiful a monospaced font is ever going to be.

14 Apr 2012 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@Mikkel, Sorry, not quite sure what you mean. Why would you want to break a path (?)

26 Mar 2012 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@Adam: Thanks! That's exactly what I designed it for. Quick and easy deployment. Save other people the hassle of tweaking the listings package's settings.

20 Mar 2012 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@Dan: Try replacing the command defining the default font to be used by something like this:

\def\lstbasicfont{\fontfamily{pcr}\fontsize{8}{8}\selectfont}

In the \fontsize command, the first number is the fontsize and the second is the line spacing (roughly speaking), so play around with the numbers a bit until you like the result.

It appears, however, that some number combinations don't play nicely with framed listings. I don't know why this is the case; this is an issue with the listings package.

15 Feb 2012 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

Hi there, can't investigate this right now, but to remove this feature just uncomment line 228 of the current version (2.2) of mcode.sty.

24 Nov 2011 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@Maxi: You can indeed do this provided you use the original command provided by the listings package. So have a look at the .sty how the \mcode command is defined. Basically, in your example, instead of using \mcode, use this:

\lstinline[basicstyle=\lstbasicfont\small]|Test={'hans' 'peter'}|

17 Nov 2011 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ Axel: Sorry, still not sure I understand your question. Can you email me directly? Thanks.

16 Nov 2011 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ Axel: Thanks for your kind words. Have a look at the demo-document included in the package. It shows quite clearly how you can get LaTeX to parse fancy stuff in your comments.

12 Oct 2011 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ Niko: Again, my package isn't doing any work, it just configures the listings package for you. Anyway, I just had a look at the listings documentation for you. I didn't see an option for this directly, but what you can do is add in your case firstnumber=6 to the \lstinputlisting options to have the numbering start with 6. This will do what you want.

13 Sep 2011 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ Oscar -- sorry to disappoint you, but the listings package doesn't handle unicode, as far as I know.

10 Aug 2011 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ Emil: Comment out Line 229.

02 May 2011 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@Sweidan: So far no; might look into it one day, but have no time for that right now, sorry!

15 Mar 2011 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ Petr: Thanks for the hint. I could have seen this earlier ;-) Anyway, just revised the package to include this (check documentation).

02 Dec 2010 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ David: Sorry, try to install the listings package properly; the package requires more than just the .sty file as far as I know...

01 Dec 2010 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ Nick: Ok, figured it out -- your m-file needs to be in UTF-8 encoding for some reason (the one you sent me was Windows Latin 1). Not 100% sure why this makes a difference (but I suspect it has to do with the way the section sign § is encoded), but this will fix it for you. As an alternative, you could try to use a different math-escape character.

01 Dec 2010 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

Hm, looks like you do have the most recent version of listings. I've just tried it myself with the demo document, including some external .m file with § \LaTeX § in it and it works fine...

Have you tried including just a very simple m-file? Do you still get the same problem?

It's hard to debug things this way, maybe you can throw together a minimal non-working example so I can see for myself...

01 Dec 2010 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ Nick: Hm, works find for me... What version of the listings package are you using (try "texdoc listings" in a command line)

25 Oct 2010 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ Zhenyu -- glad you like the package. Replacing "delta" by "Δ" is actually intentional. But If you don't want that, simply remove the line "{delta}{{\tiny$\Delta$}}1% \Delta" from the file.

13 Sep 2010 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ Ken H — thanks for your positive comment. I've had a look at your problem, but I can't reproduce it. Using my demo document (see link at the top), leaving mathescape=false as set by default in the document and including the tipa package, I can simply type §\textpipe§ to get the pipe showing up just fine. Not sure why this is not working for you... Try with the demo document, as this is a very barebones document. If it works there, but doesn't with your document, then it's almost sureley some package clash...

08 Sep 2010 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ Thomas — There's no difference between the operating systems. The easiest way would be to just put it in the same path as your .tex file . . .

23 Aug 2010 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ Ariel — How the heck can I know which keyboard you are using? That § symbol is called "Section Sign" (http://en.wikipedia.org/wiki/Section_sign) and on my Mac Keyboard (US layout) I can get it by pressing Alt + 6

01 Jun 2010 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ Fritz: Sorry, as far as I know the listings package doesn't support automatic line wrapping... This means, you'll have to manuall edit your code to make it fit into your code "box" (for me that's about 78 characters for instance). A little tip: Over in the MATLAB editor you can set a character per line number after which you can have stuff automatically wrapped, or you can wrap things manually but use the vertical line it produces in the editor as a guide...

12 Apr 2010 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ durg ch: Please see the file description above, at the end of it is a download link to a small demo document (including LaTeX sources) where you can see how the package is used . . .

17 Jan 2010 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

Hi Viktor, I don't think the listings package has that feature, sorry ...

I don't know how exactly you have to specify the path on Windows systems, but I always thought Windows uses backslashes ( \ ) in the path names, not forward slashes ... Could that be the problem?

Otherwise, I can't really help you, sorry ! Maybe ask the developers of the listings package ...

14 Jan 2010 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

Updated the demo document.

@ Rasmus: I've shuffeled things around a little bit in the source code, and added a description to make it really clear how to change the font size.

@ turker: I've modified the "solution" to the end/end problem; you can now use "iend" in the source code to get "end" typeset in black (when used to reference the last element in vector...)

@ All: If you use the LaTeX escape functionality in comments, there's now an easy way of getting that typeset in the same style as the rest of the comment, see the demo document ...

10 Dec 2009 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ Cat: Replace the "\footnotesize" in that line by "\tiny". That's as small as it gets with standard fontsize commands. If you need even smaller fontsize, you'll need to remove this "\footnotesize" and replace the first line in the Config-Section with something like "\def\lstbasicfont{\fontfamily{pcr}\fontsize{3}{4.6}\selectfont}"...

24 Nov 2009 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ Lagrange: I've used the package in the appendix many times and it works fine. I suspect (because of the upquote error message) that you have a slightly outdated version of the listings package installed. Make sure you have the latest version.

@ Daniel: I know, I know, I'd love to have this fixed too, but such functionality appears to be quite unique to the Matlab scripting language, and the listings package (which does all the work) does not support such behaviour. I've mailed the package maintainer already, but he never got back to me...

20 Aug 2009 M-code LaTeX Package Easily include nicely syntax highlighted m-code in your LaTeX documents. Author: Florian Knorn Florian Knorn

@ Alvin: Sorry, I never got the error you have. But thanks for pointing out a work-around, for those that do not have a "proper" TeX installation, including all fonts and map-files. You're right, the 'textcomp' package is only there for the upquotes. The idea of using that comes straight from the listings documentention (Section 4.7).

@ turker: Thank you very much for sharing your work-around for the 'end'-issue. While it's not too sleek, it works very well! Unfortunately there's little I can do to fix this in a more elegant way. As I said many times, the actual work is done by the listings pacakge, and as far as I can see it doesn't support different colouring of the same keyword...

Contact us