diff --git a/matlab/write_table_short.m b/matlab/write_table_short.m
index cb7c8855c43bab158e548ed6a3000b545a999f4c..9b69fa0596d7b682e11afffd1d83ddb361eb4a38 100644
--- a/matlab/write_table_short.m
+++ b/matlab/write_table_short.m
@@ -1,4 +1,4 @@
-function write_table_short(datafile, texfilename)
+function write_table_short(datafile, texfilename, nopng)
 
 % Produce a table of results with LaTex compiled as a pdf file and converted to a png file.
 %
@@ -11,6 +11,10 @@ function write_table_short(datafile, texfilename)
 
 % Copyright (C) 2024 Dynare Team
 
+if nargin<3
+    nopng = true;
+end
+
 stack_solve_algo = [0, 1, 2, 3, 4, 5];
 id = 1:length(stack_solve_algo);
 
@@ -148,6 +152,17 @@ fclose(fid);
 
 cd(sprintf('%stables', rootfolder));
 system(sprintf('pdflatex %s', texfilename));
-system(sprintf('convert -density 600 %s.pdf %s.png', texfilename, texfilename));
+if ~nopng
+    system(sprintf('convert -density 600 %s.pdf %s.png', texfilename, texfilename));
+end
+cd(cfolder);
+
 
+%
+% Cleanup
+%
+
+cd(sprintf('%stables', rootfolder));
+system(sprintf('rm %s.log', texfilename));
+system(sprintf('rm %s.aux', texfilename));
 cd(cfolder);