I am using \readline
to paste the contents of a plain text file to a LaTeX document, which works fine. This is what the plain text file looks like:
This is the first line.
This is the second line.
However, when I use fontspec
to specify a font for the text, I get undesired white boxes at the end of each line – see below
Question: How do I remove the white box?
Adding linebreaks, \par
or similar in the .tex file doesn't solve the problem. This problem is not specific to the selected font, e.g., I also get it for Arial, Georgia and other fonts. If I remove the command \myfont
, then the problem does not occur.
My code:
\documentclass[12pt]{article}
\usepackage{pgffor}
\usepackage{fontspec}
\makeatletter
\newread\myread
\newcount\linecnt
\openin\myread=some_list.txt
\@whilesw\unless\ifeof\myread\fi{%
\advance\linecnt by \@ne
\readline\myread t\expandafter o\csname description\number\linecnt\endcsname
}
\makeatother
\newfontfamily\myfont{Amiri}
\begin{document}
\myfont
\foreach[] \n in {1,...,2}{
{\csname description\n\endcsname}\par%
}
\end{document}