Tagged: latex RSS

  • John 3:48 pm on April 14, 2009 Permalink | Reply
    Tags: latex,   

    SVN Log to Latex 

    Needed to add a table of my svn log into my project write up so created a simple style sheet that would parse the xml output from svn. The xslt only generates the table

    svnlog-gen.sh

    #usage svnlog-gen.sh [repo-path] [output-file]
    svn log --xml $1 > tmp.out; xsltproc svnlog.xslt tmp.out > $2; rm tmp.out
    

    svnlog.xslt

    Example Output

     
    • Markus 5:44 am on October 6, 2009 Permalink | Reply

      This is exactly what I needed! Thank you very much!!!

      • Matthew Leingang 5:04 am on February 19, 2010 Permalink | Reply

        What Markus said.

        You should be able to avoid the temp file with a pipe, viz:

        svn log –xml $1 | xsltproc svnlog.xslt > $2

  • John 3:09 pm on April 9, 2009 Permalink | Reply
    Tags: , latex   

    C# Style for lstinputlisting 

    After getting latex to format my code nicely I noticed that it did not have build in support for C#, which read of the manual and knocked one up. Share and Enjoy

    \lstdefinelanguage{cs}
      {morekeywords={abstract,event,new,struct,as,explicit,null,switch
    		base,extern,object,this,bool,false,operator,throw,
    		break,finally,out,true,byte,fixed,override,try,
    		case,float,params,typeof,catch,for,private,uint,
    		char,foreach,protected,ulong,checked,goto,public,unchecked,
    		class,if,readonly,unsafe,const,implicit,ref,ushort,
    		continue,in,return,using,decimal,int,sbyte,virtual,
    		default,interface,sealed,volatile,delegate,internal,short,void,
    		do,is,sizeof,while,double,lock,stackalloc,
    		else,long,static,enum,namespace,string, },
    	  sensitive=false,
    	  morecomment=[l]{//},
    	  morecomment=[s]{/*}{*/},
    	  morestring=[b]",
    }
    

    Usage

    \lstinputlisting[language=cs]{test-class.cs}
    
     
  • John 6:04 pm on March 25, 2009 Permalink | Reply
    Tags: latex   

    Latex Coloured Code Listings 

    Easy way to include code in your latex document and have the syntax coloured correctly

    \usepackage{color}
    \usepackage{listings}
    
    \lstset{
    	tabsize=4,
    	language=matlab,
            basicstyle=\scriptsize,
            %upquote=true,
            aboveskip={1.5\baselineskip},
            columns=fixed,
            showstringspaces=false,
            extendedchars=true,
            breaklines=true,
            prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
    	frame=single,
            showtabs=false,
            showspaces=false,
            showstringspaces=false,
            identifierstyle=\ttfamily,
            keywordstyle=\color[rgb]{0,0,1},
            commentstyle=\color[rgb]{0.133,0.545,0.133},
            stringstyle=\color[rgb]{0.627,0.126,0.941},
    	language=Java
    }
    \begin{document}
    \lstinputlisting[title=\textbf{Source Code: filename.java}]{filename.java}
    \end{document}
    
     
    • korbsan 12:35 am on May 18, 2009 Permalink | Reply

      very helpful, thanks!

    • Nick 2:07 pm on April 18, 2010 Permalink | Reply

      Thank you. Isn’t it strange, though, that there are no default colored modes for any language?

c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel

Powered by Web Design Company Plugins