Sunday, August 26, 2012

Linux - associating TeX files with TexMaker

I write a lot of scripts to reduce data from .mdf files into .tex files and then into a .pdf report, formatted for ASME standards.  
If I really trust my processes, I call pdflatex to generate the .pdf.  That's rare.  Almost all the time I'm adding something to the report or developing a new analysis, so, being paranoid, I look at the .tex output TexMaker first.  TexMaker is a free & GPL'd cross platform TeX tool that will compile your .pdf with a button click.

Ubuntu didn't have an option to associate .tex files with TexMaker, which means double clicking a .tex file launched my default text editor instead... not what I wanted.  Here's how to get the association working:

1.  create a texmaker launcher by creating the file /usr/share/applications/texmaker.desktop:

[Desktop Entry]
Encoding=UTF-8
Categories=Office;Programming;
Comment=LaTeX development environment
Comment[fr]=Environnement de développement LaTeX
Comment[pl]=Åšrodowisko edutorskie LaTeXa
Exec=texmaker %U
GenericName=LaTeX Editor
GenericName[fr]=Editeur LaTeX
GenericName[pl]=Edytor LaTeXa
Icon=texmaker
MimeType=text/x-tex;
Name=Texmaker
Terminal=false
Type=Application

2.  add texmaker as a gui-clickable option by editing the file /home/<you>/.local/share/applications/mimeapps.list:
text/x-tex=texmaker.desktop;shotwell.desktop;totem.desktop;

3.  then, via nautilus (my usual gui file manager), associate texmaker with .tex files. 
Right click... Open With... Other Application:

Worked for me, hope it'll work for you too.

- nzvyyx