Skip to content

This is simply a language definition file for NCAR Command Language (NCL) to use with TeX's and LaTeX's listings package.

Notifications You must be signed in to change notification settings

thymaro/ncl-tex-listings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

NCL language definition for use with the LaTeX "listings" package

A pretty version of this page is available at https://thymaro.github.io/ncl-tex-listings/, unless you're already there, in which case it won't get any prettier than this.

If you use minted, I can't help you (yet). You can request this feature, but if noone asks I won't develop it as long as I don't need it myself. So, without question, it's unlikely this will ever be implemented.

To use it, just download the .tex (right-click and choose "save destination file" or similar), put it next to your main .tex document in the same directory and write the following line in your preamble:

\input{ncl-tex-listings}

If you found this page, I figure you already know this, but in case you don't: you also need to load the listings package and you also might want to add settings to your listings. For instance, I use the following in combination with NCL:

\usepackage{listings}

\lstset{ <-- add a percent sign here, but I can't do it, it breaks github pages compilation.
        language=ncl,
	escapeinside={(*}{*)},
	% FRAME
	frame=single,
	backgroundcolor=\color{gray!15},
	% SURROUNDINGS
	numberfirstline=true,
	firstnumber=1,
	numbers=left,
	numbersep=5pt,
	numberstyle=\tiny,
	stepnumber=5,
	captionpos=b,
	% CODE EMBELLISHMENTS
	breakatwhitespace=false,
	breaklines=true,
	keepspaces=false,
	showstringspaces=false,
	showtabs=true,
	tab=\rightarrowfill,
	tabsize=3,
	% FONT STYLES
	basicstyle=\small\ttfamily,
	commentstyle=\color{green!70!black}\itshape,
	keywordstyle=\color{teal!70!black}\bfseries,
	stringstyle=\color{red!65!black},
	identifierstyle=\color{orange!30!black},
}

If you are using TeXstudio (like I am), hit and hold Ctrl, then click on ncl-tex-listings (which has now magically morphed into a clickable link) to check, if the file is found. If it isn't, I can think of three error sources

  • you didn't download the file
  • you downloaded the file to another directory than the one you should have. Please check your 'downloads' directory.
  • you changed the name of the file. Why?
    • okay, I don't really wanna know. Anyways, in this case, change \input{ncl-tex-listings} to \input{whatever-shabby-name-you-named-your-file} and it should work.

Learn how to access the file anyway. Look it up on tex.se or whencever you get your TEX-knowledge.

Ok, nuff kiddin'. I know nobody will ever read this. I mean, who on earth uses TeX and NCL in one sitting?! You nerds!

Nevertheless, if you see a way to improve on this file, please feel free to fork it and add a pull request.

About

This is simply a language definition file for NCAR Command Language (NCL) to use with TeX's and LaTeX's listings package.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages