# Subscripts and Greek letters in LaTeX?

I have a text file with similar lines as this one:

I am using:

\usepackage[utf8x]{inputenc}%
\usepackage{textalpha} % <--- Greek letters in text


But still the output looks like this:

How can I make it work?

Here is the code

\documentclass{article}%
\usepackage[utf8]{inputenc}%
\usepackage{textalpha} % <--- Greek letters in text

\begin{document}%
\begingroup %I am using that because I am actually importing a text file
\noindent
\obeyline
\input{aᵢ₁x₁ + aᵢ₂x₂ + ... + aₙ₁xₙ = bᵢ}%
\endgroup%

\end{document}


BTW: If I open the text file with Word Pad, it looks like this:

Here is the complete text file: https://ufile.io/rxs84

• Can you please add code for the strange line instead of a picture? – egreg Oct 7 '18 at 13:29
• @egreg I added the code – james Oct 7 '18 at 13:38
• What's the problem with inputting $a_{i1}x_1+a_{i2}x_2+\dots+a_{in}x_n=b_i$? Instead of all those wrong letters? – egreg Oct 7 '18 at 13:58
• I'm confused. Your title talks about Greek letters but your example text contains only the Roman letters a, b and x. – David Richerby Oct 7 '18 at 18:14

problèmes que l'ensemble vide. Voici un nouveau paragraphe, une vraie
logorrhée mathématique et on va tester au passage si l'ensemble
{$&~#$&~#$&~#éàçè§è} donne autant de problèmes que l'ensemble vide. Voici un nouveau paragraphe, une vraie logorrhée mathématique et on va tester au passage si l'ensemble {$&~#$&~#$&~#éàçè§è} donne autant de
problèmes que l'ensemble vide.

Ok alors essayons quelques trucs en Unicode:

ασδφγηηξκμ

⇒☛«»❮❯‱❝❞€☂☃.

Ligature: -- ? non, tout va bien n'est-ce pas?

(fin de la démonstration de l'Hypothèse du continu)
\end{filecontents*}

\begin{document}
Text before (serif)
\myVerbInput{\jobname.txt}
Text after (serif)
\end{document}

% Local variables:
% TeX-engine: xetex
% End:


As usual there is the problem of an OpenType font with wide enough glyph coverage, this is why I chose DejaVu Sans. The Serif one is lacking some of the glyphs used above.

• Sorry for the late reply ! Thank you so much !! This seems to work! One question: Could I change the font to Helvetica ? – james Oct 10 '18 at 9:01
• on my Mac, the system provides fonts Helvetica and Helvetica Neue. But they appear to be lacking the U+2099 glyph (LATIN SUBSCRIPT SMALL LETTER N). I also tried TeX Gyre Heros which comes with TeX distributions but it is lacking ₁ and ₂ additionally to U+2099. Apart from that, using another font is as simple as replacing in my code DejaVu Sans by what you want in the \DejaVuSansWithNoTeXLigatures line. You may also prefer to rename that font macro. – user4686 Oct 10 '18 at 10:20
• A question: Would it be possible to convert the math part of the text it to math form ? – james Oct 14 '18 at 6:31
• sort of, but inside math, the braces { and } will have to revert to their standard meanings. This becomes more complicated that your initial question, so you should try to formulate another, focused, question. Because one wonders if your only problem isn't to have correct font. Do you really have any backslash or & or # that LaTeX doesn't like in your text? apart from math? and then why use math mode at all if your equations are written in Unicode without any LaTeX mark-up? – user4686 Oct 14 '18 at 8:11
• Thank you very much for your comment ! :) I would like to create math, because it looks nice in LaTeX, that's all. I might post a new focused question. :) – james Oct 14 '18 at 8:17

If you want to input a utf-8 encoded text file and just have it mostly work without caring too much what it looks like, then I'd suggest using a combination of

• a unicode TeX engine (lualatex or xelatex)
• a font with wide unicode coverage (e.g., Free Serif)
• some verbatim environment that allows line breaking (e.g., fancyvrb in combination with fvextra)

Compile this with lualatex or xelatex. This will allow lines to be automatically broken at spaces. I'm not sure how to make the text justified, but perhaps your don't care too much.

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Free Serif}[NFSSFamily=freeserif]
\usepackage{fancyvrb}
\usepackage{fvextra}
\begin{document}
\VerbatimInput[fontfamily=freeserif,breaklines,breaksymbol={}]{3.txt}
\end{document}


## Output

• Thank you so much !! This seems to work. The problem that I have know, is that the text is not automatically adjusted to the page width. It just keeps going over the edge. Do you have any idea of how to fix that ? – james Oct 7 '18 at 14:36
• @james, I just saw your file. Just wrap your text files first. Either your editor should be able to do this or use fold (unix.stackexchange.com/a/25174) – David Purton Oct 7 '18 at 14:39
• Thank you very much for your help. Do you see any method to do that directly in the current latex script ? – james Oct 7 '18 at 14:55
• @jfbu, do you know how to justify \VerbatimInput? All the solutions I can find on this site involve running macros within a Verbatim environment to set up justification. – David Purton Oct 8 '18 at 3:30
• @jbfu, still missing glyphs! That's a pity. Finding a suitable font or using substitution is a pain. I didn't use \input because I wasn't sure all characters were TeX safe. – David Purton Oct 8 '18 at 7:04