Giter Club home page Giter Club logo

Comments (3)

wg030 avatar wg030 commented on June 9, 2024 2

Well, to be honest, I don't have much experience with LuaLaTeX, but I have figured out how to do it.
As far as I understand, the basic problem is that LuaLaTeX handles utf-8 characters differently than pdflatex. The listings package was desgined at a time where people did not care about those characters. This is also the reason why we must literate those characters here.
What you would need to do for LuaLaTeX besides literating is telling the listings packages that it can safely process those characters. You can do it like this (I did it for a few characters to show you the effect) by adding the following lines to the preamble of your document (or modifying the jlcode pakcage).

\makeatletter
\lst@InputCatcodes
\def\lst@DefEC{%
 \lst@CCECUse \lst@ProcessLetter
  ^^^^00dc% Ü
  ^^^^00f6% ö
  ^^^^00df% ß
  ^^^^00e4% ä
  ^^^^20ac% €
  ^^^^03b1% α
  ^^^^03b2% β
  ^^^^03b3% γ
  ^^^^00b2% ²
  ^^^^0394% Δ
  ^^^^2093% ₓ
  ^^^^0308% two dots above
  ^^^^03a5% Υ
  ^^^^212f% ℯ
  ^^^^0303% tilde above
  ^^^^00d7% ×
  ^^^^00f7% ÷
  ^^^^2286% ⊆
  ^^00}
\lst@RestoreCatcodes
\makeatother

The bad news of course is that you would need to add each unicode character that your code uses separatley if you really wanted to make that effort. The page www.compart.com might be helpful in order to get the correct utf encodings for all those characters.

from jlcode.

wg030 avatar wg030 commented on June 9, 2024 1

I am happy to announce that since the latest version 6.0 there is now support for LuaLaTeX (as well as XeLaTeX)!

I wrote the script createucclist.jl, which can create all tex encodings for the most common Unicode characters so that I could add them easily to this package as shown in my small example above.
Moreover we make use of the new JuliaMono font (https://github.com/cormullion/juliamono), so that we esentially have all important Unicode characters.
When compiling your document with LuaLaTeX there is nothing speical to do other than putting the JuliaMono-*.tff files into the directory of your tex document or setting \usepackage[defaultmonofont=false]{jlcode} and going with whatever font you like the most. However, make sure that the font supports the Unicode characters that appear in your code.

from jlcode.

carlosal1015 avatar carlosal1015 commented on June 9, 2024

Thank you very much @wg030. I will try soon.

from jlcode.

Related Issues (20)

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.