2

I am trying to compile a LaTeX source file within Emacs (26.1) using AUCTeX and view the resulting PDF output within an Emacs buffer. I'm using the Windows 10 OS and have downloaded the latest Texlive distribution as well as pdftools package in emacs.

Other software that I have downloaded include minGW, Ghostscripts and Strawberryperl as per installation instructions found here

When I enter the appropriate compile command (C-c C-a) in a LaTex buffer I am prompted in the minibuffer to enter the command C-c C-l to view the results of the compilation.

This command opens a second window but rather than displaying the output of the source file in PDF it displays a lengthy error message of which what looks like the most important part I have pasted below

!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on pdflatex.log.
fmtutil [ERROR]: running `pdftex -ini   -jobname=pdflatex -progname=pdflatex -translate-file=cp227.tcx *pdflatex.ini <nul' return status 1
fmtutil [ERROR]: return error due to options --strict
fmtutil [INFO]: Disabled formats: 6
fmtutil [INFO]: Not selected formats: 32
fmtutil [INFO]: Failed to build: 1 (pdftex/pdflatex)
fmtutil [INFO]: Total formats: 39
fmtutil [INFO]: exiting with status 1
D:\TexLive\2018\bin\win32\runscript.tlu:803: command failed with exit code 1:
perl.exe d:\TexLive\2018\texmf-dist\scripts\texlive\fmtutil.pl  --user --byfmt pdflatex
Running the command D:\TexLive\2018\bin\win32\fmtutil-user.exe
I can't find the format file `pdflatex.fmt'!

kpathsea: Running mktexfmt pdflatex.fmt

The command name is D:\TexLive\2018\bin\win32\mktexfmt

TeX Output exited abnormally with code 1 at Tue Oct  9 18:06:02
D:\emacs-26.1-x86_64\bin

Any ideas what I missing here?

*edit non-default values contained on my file path

D:\MinGW\bin;D:\texlive\2018\bin\win32;D:\Programs\StrawberryPerl\c\bin;D:\Programs\StrawberryPerl\perl\site\bin;D:\Programs\StrawberryPerl\perl\bin;D:\emacs-26.1-x86_64\bin;D:\TexLive\2018\tlpkg\tlgs\bin;

**Edit: as described in the comments running a fresh install of Miktex and emacs fixed the issue. I suspect it was a corrupted installation of the Texlive distribution.

***Edit: problem solved by reinstalling TeXLive. Problem most likely due to faulty installation of TeXLive distribution.

  • Welcome to TeX S.E! Did you install MikTeX or texlive ? Emacs is not shipped with TeX and you have to install it on your own. – sztruks Oct 9 '18 at 17:29
  • Have you tested the obvious test first? That you can compile your document from the command line without the use of emacs and auctex. To me this looks like a latex issue not auctex, hence asking for the test. – daleif Oct 9 '18 at 17:31
  • And welcome to the site btw – daleif Oct 9 '18 at 17:31
  • @sztruks Thanks! Indeed I did install TexLive distribution although I did not place it in the default C drive but rather a directory in the D drive. Would that make a difference or cause the error? – esc123 Oct 9 '18 at 17:37
  • @daleif cheers! You are spot on, it seems like a latex issue as it failed to compile in the command prompt as well. I entered the command "pdftex filename.tex" and it gives the output "This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018/W32TeX) (preloaded format=pdftex) restricted \write18 enabled. entering extended mode (./preview.tex ! Undefined control sequence. l.1 \documentclass [11pt]{article} ? ! Undefined control sequence." Shall I try reinstall TexLive? – esc123 Oct 9 '18 at 17:41
1

To keep an emacs installation simple until you gain confidence to make modifications the first step is to download and install a working tex distro either MiKTeX or Tex live both of which now have a built in TeXworks editor and viewer (MiKTeX is favoured because it is lighter for the initial download and in my opinion easy to uninstall/reinstall if it gets corrupted) To ensure pdfLaTeX is working you can fire up TeXworks and load the standard sample, to save you searching (and ensure it is not affected by earlier attempts to edit) download & save to documents When you open it, TeXworks may hiccup, but if you proceed, all being well you see the compiled PDF. IF not you have a basic problem with either MiKTeX or Tex Live and need to raise questions against those.

For emacs download links go to https://www.gnu.org/software/emacs/download.html I recommend the 32 bit as its universal for both 32 and 64 bit windows so follow the link FIRST download the README then open current / latest folder (at this time emacs-26) and download and unzip either emacs-26.1-x86_64.zip or the 32 bit emacs-26.1-i686.zip

Read the readme and install as directed (at this stage you do not need Msys2). To fire up vanilla emacs use your shortcut to runemacs or emacs.exe. In order to add Auctex press Alt-x and in the lower command window after M-x add list-packages and hit enter.As its not installed you can select auctex (currently 12.1.1)

enter image description here

Install it but you will not see any change to the editor until you open the previous sample2e.tex file, when the editor toolbar interface changes to add extra TeX related commands. enter image description here

You used TeXworks to check the distro worked so now you have a .tex and .pdf from before in the same folder. Clicking on the spectacles icon will open the previously compiled pdf. Thus at this stage you can check if you can see output. If not you need to check your pdf viewer. If all is well close the pdf and in the editor add your name underneath the line that starts \maketitle. From the menu select Command > Compile and View and you should now see the test page with your name at the start of the textual content. That's your first successful edit, good luck.

  • Thanks for that. I'm also having some other problems with my machine which will most likely require me to do a clean install of Windows. Once I have that done I will implement the steps you outline above and report back – esc123 Oct 10 '18 at 14:52
  • Perhaps to help others amend your question to explain problems with first run and if a system reset was needed to clear your specific problems – KJO Oct 10 '18 at 15:16
  • I followed your instructions and uninstalled minGW and strawberryperl to boot. I ran a new install of emacs 32 bit along with Miktex distro. Tested the distro first with TexWorks and the pdf appeared as expected. I then opened the latex source file in Emacs with auctex installed and compiled it and sure enough the PDF appeared. Thank you! On a slight tangent, I have Tex Live working on another win10 machine and would like uniformity. Is there a big diference between Miktex and TexLive or should they function identically thereby I can avoid another attempt at installing Texlive on this machine? – esc123 Oct 11 '18 at 13:09
  • There are some distinct differences and as discussing in another thread never try to install both on one machine, since even I occasionally have problems with both on same portable drive. Its entirely up to you. I do favour MiKTeX for its convenience but usually install in portable form to a single directory similar to TeXLive. Both admin & single user have their own maintenance issues so "basic" MiKTeX portable just seems generally easier. emacs is effectively "portable" so can generally behave with either way. But with MiKTeX there can be potential hiccups whilst loading packages on the fly. – KJO Oct 11 '18 at 13:38
  • Just to be clear if your wanting to re attempt to use TeX live on this machine. First use MiKTeX-console "cleanup" function to 1) Reset and 2)uninstall prior to installing TeX Live – KJO Oct 11 '18 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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