LaTeX - Nice listings option for DualSPHysics' xml files?

Hello!

If anyone is using LaTeX, would you be willing to share how you import DualSPHysics xml code into LaTeX? For example encoded as in Notepad++ by default


Kind regards

Comments

  • Hey, this is the way I do it, not sure if it will fulfill your requirements. Put this in your preamble:

    \usepackage{listings}\usepackage{color}
    \definecolor{mygreen}{RGB}{28,172,0} % color values Red, Green, Blue
    \definecolor{mylilas}{RGB}{170,55,241}
    \lstset{language=XML,%Matlab,%basicstyle=\color{red},
        breaklines=true,%
        morekeywords={matlab2tikz},
        keywordstyle=\color{blue},%
        morekeywords=[2]{1}, keywordstyle=[2]{\color{black}},
        identifierstyle=\color{black},%
        stringstyle=\color{mylilas},
        commentstyle=\color{mygreen},%
        showstringspaces=false,
        numberstyle={\tiny \color{black}},% size of the numbers
        numbersep=9pt, % this defines how far the numbers are from the text
        emph=[1]{for,end,break},emphstyle=[1]\color{red}}
    

    Within your document you can use the code:

    \lstinputlisting{CaseDambreakNN_Def.xml}
    
    

    You might want to delete the comments in the xml file, so that the code in your LaTeX does not extend over one line.

  • Thanks, I will test this at a later date!

    Kind regards

Sign In or Register to comment.