# Installing Latex on Android

I am trying to install latex on my Android device (no root). I didn't find an application to compile tex documents offline. By following instructions from this website (https://williewong.wordpress.com/2017/06/30/texlive-on-android/) I installed termux from play store and installed texlive using the command;

pkg install texlive


Process was successful. But I don't know if I am able to compile my documents now. Please help me. What should I do to compile tex documents offline?

(I know that there are many questions on this l topic. But they are seriously outdated and solutions provided don't work for me. That is why I open this question)

• Your question is basically: how do i use LaTeX? Which would be answered by: Read an introduction. – Johannes_B Jan 2 at 9:18
• After your installation, did any command like tex is found and return something ? – R. N Jan 2 at 10:07
• @R. N I don't remember actually. So I just entered the command again. Following is what I seen. upgraded, 0 newly installed, 0 to remove and 15 not upgraded. \$ – ACA Jan 2 at 12:40
• @Johannes_B Sorry I still don't understand – ACA Jan 2 at 12:43
• Why do you want to compile documents on an Android device? – Johannes_B Jan 2 at 12:47

If you have file named test.tex which contains :

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\begin{document}
toto
\end{document}


Then to compile it offline from your termux on android enter the following command in the folder (directory) containing your file:

pdflatex ./test.tex


Finally go into your directory (some new files should be present as the results of the compilation) and click on the PDF file to open it with your favourite PDF reader

• Thanks for the answer. I created local tex file document.tex using VerbTex. Moved the file to internal storage/downloads. The command didn't work for me. I don't understand the line " enter the following command in the folder..." What is meant by folder? – ACA Jan 2 at 16:24
• Please don't miss a single step from opening termux to opening document.pdf I have a very little knowledge about it. Please – ACA Jan 2 at 16:30
• @ACA folder or directory if you prefer: that means the command ls should return . .. ./test.tex. Then go into your directory (storage/downloads if you put the file there) and click on the PDF file to open it with your favourite PDF reader. Otherwise what do you mean by the command didn't work for me ? What was the prompt output ? – R. N Jan 2 at 17:14
• Is pdflatex on the PATH or whatever it's called there? Basically, what happens, if you call it? You should see something like This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=pdflatex) restricted \write18 enabled. ** and you'd be able to get out with Ctrl-D. – Oleg Lobachev Jan 2 at 17:50
• @ACA, I watched and commented there. – Sigur Jan 4 at 14:08

I never thought I would be able to answer this question (Created by my self). It is simple to compile your LaTex documents offline with your Android phone/Tablet. I created two videos of what I did to work with LaTex on my Android device. You may check them

This includes following steps

• Install Termux from Google Play Store
• Give Termux the permission to access your storage from settings
• Run ’pkg install texlive-full’
• Run ’pkg install ’texlive-tlmgr’
• Create .tex file using editor like VerbTex (Download it from Play Store) if you don't have .tex file in your storage
• Run ’pdflatex’
• After double asterisks input your storage location
• Once the pdf is created you can open it by ’termux-open file.tex --view’

If you are interested you can check these answers too

https://tex.stackexchange.com/a/522898/193507

https://tex.stackexchange.com/a/522823/193507

• @R. N May I know why? – ACA Jan 4 at 14:16
• I am a bit disturbed by the fact that (according to what I understand) you can not go to the directory of your abc.tex and compile there. So I wonder where is the abc.pdf produced and where are the TexLive installation ? perhaps you are missing one environment variable. Thus if you compile in your home folder where the TeXlive folder is also present everything is fine but if you compile somewhere else you get the previous error we discussed with files not found. – R. N Jan 4 at 14:20
• @R. N I used VerbTex to create a local .tex file. Then searched in files to find out where it is stored. From my experience I understand that where you store your tex file doesn't matter. You should know the correct path to reach the file. I don't know where my pdf files are stored. But after I could open them using above commands it was there in internal storage>Download. I don't know how or why. But it worked! That is what all I know. – ACA Jan 4 at 14:28
• If it is good for you it is good for me. It was just to avoid you some side effects. Enjoy LateX on your Android ! – R. N Jan 4 at 14:32
• @R. N Thank you. – ACA Jan 4 at 14:41