0

I would like to write this piece of code using listings package:

Dev-C++ style

However I have some problems:

  • I cannot set the grouper symbol;
  • The 0 does not have the diagonal slash.

The size of the code has to be \scriptsize or something like that.

The MWE that I use is this ShareLaTeX document.

Or is there any snippet created that copy the style of Dev-C++?

Thanks!

  • 1
    Are you searching for solutions only for pdfLaTeX or other engines too? With XeLaTeX/LuaLaTeX it's pretty easy to use a slashed zero in code listings and (if you want to) a non-slashed zero otherwise. – TeXnician Jul 21 '18 at 8:59
  • Unfortunately I use pdfLaTeX. – manooooh Jul 21 '18 at 9:09
1

Regarding the 0 with a diagonal slash: You have to use the right (monospace) font for that. The easiest options for this might be Inconsolata or one of GoMono / TXTT / Anonymous Pro.

This question helps with how to set the font: Just load the monopsace font after your normal font (if any) with \usepackage{inconsolata} and use \lstset{basicstyle=\footnotesize\ttfamily} to setup your listing. Of course, you can use \scriptsize instead of \footnotesize to make it even smaller.

  • Yes, your solution works! Btw: 1) Is it possible to keep the same font of the listings package? (You see that I don't touch the basicstyle only for the size). 2) I have indented my code using TAB, but now the output does not show this indentation. 3) The are no more spaces between words. Do you know how to fix that or which link do you recommend? – manooooh Jul 21 '18 at 20:13
  • 1
    Great to hear! 1) To use the monospace font for the whole document use \renewcommand*\familydefault{\ttdefault} 2)/3) Try using \lstset{keepspaces=true} or search for questions like this one – mh333 Jul 22 '18 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.