2

I am trying to include some Maple code in a LaTeX using the minted package. I know it is not possible to choose Maple as programming language, so I am trying to find a substitute that looks somewhat similar, with red color for instance and blue color for output.

Also, is it possible to define your own language and make it look like Maple code?

4
  • minted uses pygments as a "backend" to handle the highlighting, so perhaps you just have to find and install a new lexer for Maple. First hit on Google was github.com/wetneb/pygments_maple Sep 4, 2016 at 20:05
  • I am using sharelatex, so how can I implement this?
    – lala_12
    Sep 5, 2016 at 10:55
  • You can't. You would need to ask the ShareLaTeX people if they're willing to install this (or some other lexer for Maple if you can find one/make one yourself). Sep 5, 2016 at 10:59
  • As an alternative to what @Torbjørn suggested, you could try convincing the Pygments maintainers that they should revamp their plugin architecture. This is a major undertaking and not likely well received, but the fact that you cannot just drop language definitions etc into your working directory for Pygments to find is irksome, to say the least. Sep 6, 2016 at 8:33

1 Answer 1

2

you could use the listings package if what you have is just code. It does not have the definition for Maple, however, lucky for you, Alexander Shapiro already ran into that problem. The following is taken from Here, and should go in your preamble.

%% 
%% Maple definitions (c) 2008 Alexander Shapiro 
%% 
\lst@definelanguage{Maple}% 
{morekeywords={and,assuming,break,by,catch,description,do,done,% 
elif,else,end,error,export,fi,finally,for,from,global,if,% 
implies,in,intersect,local,minus,mod,module,next,not,od,% 
option,options,or,proc,quit,read,return,save,stop,subset,then,% 
to,try,union,use,uses,while,xor},% 
sensitive=true,% 
morecomment=[l]\#,% 
morestring=[b]",% 
morestring=[d]"% 
}[keywords,comments,strings]% 

If you want to include whole worksheets with inputs and outputs, then look into maple2e. The file maple2e.sty is supplied by Maplesoft, and you should move it to the proper folder on your machine look here for instructions.

Documentation of maple2e can be found Here and here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .