TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can I compile .tex to .html from within AUCTeX? What are the keybindings?


share|improve this question
What are you using to compile to html? latex2html? I don't know what options are available... – Seamus Nov 30 '10 at 18:20
@Seamus I am using htlatex, but I am not committed to it; it doesn't play nicely with files generated by pdflatex. – David LeBauer Nov 30 '10 at 18:25
up vote 5 down vote accepted

Well, you can do it directly from emacs without having to use AUCTeX: M-x compile and then change the Compile command: to the appropriate latex2html command. If you are going to be doing the .html rendering a lot, you can add the following code to the end of your .tex file:

% Local Variables:
% compile-command: "latex2html yourfile.tex"

From then on, whenever you load your .tex file the M-x compile command will default to the correct latex2html command.

You can bind M-x compile to a keyboard shortcut by adding something like (global-set-key "\C-xc" 'compile) to your .emacs file.

share|improve this answer
will this work alongside Auctex? Currently, it loads PDFLatex major mode when I open a .tex file. – David LeBauer Nov 30 '10 at 18:27
I am fairly certain that it will not affect AUCTeX at all. – ESultanik Nov 30 '10 at 18:32
Also, you can obviously put whatever command you want (e.g., htlatex) as the compile-command; it does not need to be latex2html. – ESultanik Nov 30 '10 at 21:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.