- 1

Does anyone know how to write LaTex files in Python?

I was writing a LaTex file in Python (for school). But when I opened the LaTex file, it had some weird symbols ( ÄŚ I think) instead of Č that I wanted. I know its porbably a problem in encoding, but Python was written in utf-8, the file in python was open in utf-8 and LaTex was set to utf8. Does anynone have any idea what could be wrong?

21st May 2021, 4:46 PM
Gašper Koželj
Gašper Koželj - avatar
2 odpowiedzi
+ 4
Sounds like an encoding issue... Perhaps your editor is set to open in another encoding? Falling back to \v{c} etc is perhaps an option if you only need a few escaped characters or if you want to have real backwards compatibility with ancient systems...
24th May 2021, 8:04 PM
::sк::
::sк:: - avatar
+ 1
Yes. I tried yesterday to write the file without set encoding and it worked I tried this and it didnt work: with open(file, 'w', encoding='utf-8') But this worked: with open(file, 'w')
24th May 2021, 8:09 PM
Gašper Koželj
Gašper Koželj - avatar