Printing a Julia source with unicode from Atom

Is there an accepted way to print a Julia source file keeping the Unicode intact? Thanks.

That sounds more like a font issue when printing…Can you change the font used in printing? I didn’t see a “print” option in atom did you install a package? Are you on Windows or Linux? Printing can be very OS specific.

I am on the mac. I installed PanDocs, which is supposed to convert to pdf via latex libraries. I do not have the stomach to do this, so I wanted a quick solution. It is hard to believe that a software as sophisticated as Atom is being used by developers who never print.

Thanks!

Gordon

Sorry, I don’t have a mac. My guess would be PanDocs is using a different font that the editor, and that font doesn’t have all the symbols you use in your source code.

I agree. Good guess. I have to believe that among this Julia group that some people own macs who print! Perhaps there is a better subgroup to post to.

I wonder if you are talking about pandoc. It is pretty easy to figure out if you follow the error messages: you have to use an engine other than pdflatex, and pick a font that has the desired characters. Eg the markdown with the YAML header

---
mainfont: DejaVuSerif
sansfont: DejaVuSans
monofont: DejaVuSansMono
mathfont: TeXGyreDejaVuMath-Regular
---

# Test

```julia
α + Γ → κ
```

invoked with

pandoc -t latex --pdf-engine=lualatex -o test.pdf test.md

works fine for me.

If it doesn’t, please provide an MWE and the error messages. Strictly speaking you may get better support for this at the pandoc forums, but I guess it is fine to ask here.

Great! I will certainly try this out.m Thanks!

Ok, the test, from the command line works. I note that you used a markdown file. But the files in Atom are jl files, and the unicode text are not contained within ``` symbols. So I would like a pandoc command line that operates directly on files that have the .jl extension.

No MWE yet. Or rather: any julia file. Your file without the triple quotes would do with the jl extension.

Last question for now: Pandoc converts different Markdown formats. Julia is not a markdown format. What am I missing as far as concepts? Thanks.

Unfortunately I don’t use Atom, so I cannot help you further with this. I hope someone will come along who can reproduce the error.

Ok, I did it!! Literate was the key. But I also had to install the package “markdown-to-pdf” using Atom’s package installer.

Step 1: I created a small Julia program called:

using DataFrames
using Literate
Literate.markdown("covid_gordon.jl", "."; documenter=false)

Then, inside an Atom window, open up the markdown file “covid_gordon.md”, and right-click to access the menu item “Convert to pdf” along with a shortcut key. The pdf then generates in your working directory.

Pandoc does not work because the Latex on my system cannot handle the unicode characters in the markdown file. I think Latex is overkill for this particular task.

Thank you for the help!

1 Like