Comments (3)
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.
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.
Thank you very much @wg030. I will try soon.
from jlcode.
Related Issues (20)
- Tens of errors when used with other listings code HOT 2
- The \approx symbol not working HOT 2
- color of line numbers HOT 4
- Complex{Int64} problem HOT 2
- How to make this work with 2-column documents HOT 7
- Error in compiling HOT 1
- Customize code block length HOT 2
- FR: Provide environment HOT 4
- Color of functions containing "!" HOT 4
- Line breaking is bad HOT 8
- Highlighting of macros HOT 4
- Avoid clutteting LaTeX project HOT 7
- Does not respect linewidth HOT 9
- Get utf-8 error with degree symbol HOT 7
- \approx error HOT 4
- Plenty of error messages involving xcolor HOT 7
- interaction with beamer overlays HOT 3
- \pm problems HOT 2
- Illegal parameter number in definition of \iterate HOT 2
- REPL format: Colorize `julia>` if any HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jlcode.