Git Product home page Git Product logo

jlcode's Introduction

jlcode.sty

Short Package Description

The jlcode.sty is a latex package, which contains a Julia language definition for the listings package.
To make use of it, copy the jlcode.sty file to same folder of your latex file and add the following line to your latex document header:

\usepackage{jlcode}

Check out the latex example example.tex, which imports some Julia code from testfile.jl and produces the pdf-file example.pdf as output.

Current State

Current version of the jlcode package: 2.2.
Date of creation: 2018/01/25
Date of last modification: 2018/12/04

Keywords

All keywords, literals and built-ins for this language definition were taken from the file
https://github.com/isagalaev/highlight.js/blob/master/src/languages/julia.js.

Colors

All colors for this language definition were taken from the files
https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css and
https://docs.julialang.org/en/latest/assets/documenter.css.

Special Unicode Characters

All unicode characters that are supported by Julia can be found under
https://docs.julialang.org/en/latest/manual/unicode-input/.

Right now the following of them have already been added to jlcode package, too:

  • most common special characters that appear in latin languages
  • all greek capital letters
  • all greek small letters
  • all superscripts
  • all subscripts (except for the latin small letter schwa)
  • some mathematical operators

Known Managable Issues

Since it is rather difficult to handle special unicode characters with the listings package, there are some issues that can appear in special cases when using the jlcode package.
Most of them have to do with the fact that the listings package does not seem to offer an option, that makes it possible to force a special unicode character, for example a small greek beta, to be treated like a normal letter. Having said this the command

\lstdefinelanguage{julia}
{
  % ...
  alsoletter={β},
  % ...
}

of the listings package unfortunately causes an error.
However the problems that can occur due to this circumstance can be repaired manually. For that purpose two commands have been implemented in the jlcode package. The easiest way to show how they work is giving some examples. So here are the known managable issues and how to fix them with the jlcode package:
(See the provided example files).

  • identifier name with a number that follows directly behind a special unicode character:

    • example:

        myβ2ndvar = 2 * 0.12E-2 * xʸ
      
    • latex command for fixing it:

        \addlitjlbase{myβ2ndvar}{my$\beta$2ndvar}{9}
      
  • identifier name, which contains a γ, π or φ:

    • example:

        myφvar₊ = sqrt(2)
        approx4π = 3.142
      
    • latex command for fixing it:

        \addlitjlbase{myφvar₊}{my$\phi$var${\scriptstyle {}_{+}}$}{7}
        \addlitjlbase{approx4π}{approx4$\pi$}{8}
      
  • identifier name, which contains a chracter from a latin language:

    • example:

        löwe = 8
        checkin€ = 27.99
      
    • latex command for fixing it:

        \addlitjlbase{löwe}{l{\"o}we}{4}
        \addlitjlbase{checkin€}{checkin\euro}{8}
      
  • numbers in E-notation wihtout using a + sign:

    • example:

        evar = 3.99e400
        evar₂ = 3.99E400
      
    • latex commands for fixing it:

        \addlitjlstring{e400}{e400}{4}
        \addlitjlstring{E400}{E400}{4}
      
  • single characters:

    • example:

        mychar = 'W'
        mychar⁽²⁾ = '€'
        mychar⁽³⁾ = 'ϰ'
      
    • latex commands for fixing it:

        \addlitjlstring{'W'}{\textquotesingle W\textquotesingle}{3}
        \addlitjlstring{'€'}{\textquotesingle \euro\textquotesingle}{3}
        \addlitjlstring{'ϰ'}{\textquotesingle $\varkappa$\textquotesingle}{3}
      

Feel Free to Contribute

Please feel free to contribute and report bugs!
It would be especially appreciated if you helped me adding support for more special unicode characters.

jlcode's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.