I want to have my sections in independent .txt
files in the folder of my assignment. So I use \input{text.txt}
. The problem is, I write in Danish and we have the 'æ' 'ø' 'å' characters that aren't normally recognized by LaTeX. I fixed it within the master .tex
file, so when I write the letters, it shows up nicely in my document. It does not however show up nicely, if I put one of the characters in the file name or within the .txt
files. Now, I don't mind that I have to avoid them in file names, but I really need them to be recognized within the file.
\documentclass[10pt,a4paper]{article}
\usepackage[danish]{babel}
\renewcommand{\danishhyphenmins}{22}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage[danish=quotes]{csquotes}
\begin{document}
æ ø å
\input{text.txt}
\end{document}
I can't upload the .txt
file, but if you copy the three letters, put it in a document called text.txt
file and put it in the folder, you'll see what I mean.
If I delete \input{text.txt}
from the document, or avoid using those three letters in the input file, everything works perfectly and it writes 'æ ø å' in the output file.
I asked this question on another forum, but they weren't much help. They talked about it being the wrong encoding and told me, that if I saved it as .tex
files there would be a dialogue that would enable me to change the encoding of the input document so it would be compatible, however there is no such thing in the 'Save as' dialogues I get from TeXworks. I also have it set to utf8
in my preferences in TeXworks, however that doesn't seem to influence much of anything.
test.tex
in the wrong encoding. Open the file in texworks. At the bottom there is button with encoding informations. Choose there utf8 and then save the file again.