Why is 'pdflatex -halt-on-error -interaction=batchmode' failing?

  • Context: LaTeX 
  • Thread starter Thread starter sineth
  • Start date Start date
  • Tags Tags
    Failing
Click For Summary
SUMMARY

The issue arises when using the command 'pdflatex -halt-on-error -interaction=batchmode' in MATLAB with Dynare to compile a LaTeX file, resulting in a warning that the TeX file did not compile. Users have reported that even after updating MiKTeX and deleting previously generated PDF files, the error persists. To resolve this, it is recommended to compile the LaTeX file manually to identify the specific error messages generated by pdftex. Additionally, modifying the system command to capture and display the console output can aid in diagnosing the issue more effectively.

PREREQUISITES
  • Familiarity with MATLAB programming
  • Understanding of LaTeX document preparation
  • Knowledge of Dynare for economic modeling
  • Experience with MiKTeX installation and updates
NEXT STEPS
  • Learn how to manually compile LaTeX files to troubleshoot errors
  • Explore the use of MATLAB's system command to capture console output
  • Investigate common issues with MiKTeX and LaTeX compilation
  • Review best practices for managing LaTeX auxiliary files in MATLAB
USEFUL FOR

Researchers, economists, and developers using MATLAB and Dynare for model simulations who need to troubleshoot LaTeX compilation issues.

sineth
Messages
3
Reaction score
0
Hi,
I am using Matlab, and Dynare to run a model.
I have the following codes to generate the Latex file. My codes were properly working and I generated the pdf file once. Now I cannot re-generate the same pdf file. I get the warning message ('TeX-File did not compile; you need to compile it manually'
Can someone please identify any issues here? I have updated MiKTeX and checked for updates. No issue is found.
My problem is as I have generated the pdf once, do I need to delete the history files or so. Otherwise how to resolve this iissue.
Thanks
Sineth

write_latex_definitions;
write_latex_parameter_table;
write_latex_original_model;
write_latex_dynamic_model;
write_latex_static_model;
write_latex_steady_state_model;
collect_latex_files;

if system(['pdflatex -halt-on-error -interaction=batchmode ' M_.fname '_TeX_binder.tex'])
warning('TeX-File did not compile; you need to compile it manually')
 
Physics news on Phys.org
First i would save the relevant pdf files that worked previously for backup, then delete them and start again.

It may be that some step skipped over generating some intermediary data and read in the old data that a later step determined didn't match up hence the error.

Beyond that there's not much we can do here since there's little to go on unless one of us at PF has encountered this error with a similar project and recall how we fixed it.
 
  • Like
Likes   Reactions: sineth
Thanks for the reply @jedishrfu. I have tried after deleting all pdf files generated. But get the same error.
 
To determine the cause, compile it manually and look at the actual error message(s) generated by pdftex.
 
  • Like
Likes   Reactions: jedishrfu
Thanks
 
Rather than
Code:
if system(['pdflatex -halt-on-error -interaction=batchmode ' M_.fname '_TeX_binder.tex'])
    warning('TeX-File did not compile; you need to compile it manually')
why not try
Code:
[status,cmdout] = system(['pdflatex -halt-on-error -interaction=batchmode ' M_.fname '_TeX_binder.tex'])
if status
   disp(cmdout)
and if an error occurs MATLAB will print the actual console output of pdftex, removing the need to rerun it manually in order to diagnose the error.
 
  • Like
Likes   Reactions: jedishrfu

Similar threads

  • · Replies 23 ·
Replies
23
Views
3K
  • · Replies 11 ·
Replies
11
Views
6K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
12K
  • · Replies 16 ·
Replies
16
Views
31K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 8 ·
Replies
8
Views
12K