diff --git a/matlab/dynare_estimation.m b/matlab/dynare_estimation.m
index 07f1300e16aebb28287eff6fd728720b9e8ae680..1f9d804acd1f081c86733b0f4a84826387b02d2d 100644
--- a/matlab/dynare_estimation.m
+++ b/matlab/dynare_estimation.m
@@ -12,7 +12,7 @@ function oo_recursive_=dynare_estimation(var_list,dname)
 % SPECIAL REQUIREMENTS
 %   none
 
-% Copyright (C) 2003-2020 Dynare Team
+% Copyright (C) 2003-2021 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -43,6 +43,19 @@ if ~isempty(strmatch('dsge_prior_weight',M_.param_names))
     options_.dsge_var = 1;
 end
 
+% The TeX option crashes MATLAB R2014a run with "-nodisplay" option
+% (as is done from the testsuite).
+% Since we can’t directly test whether "-nodisplay" has been passed,
+% we test for the "TOP_TEST_DIR" environment variable, which is set
+% by the testsuite.
+% Note that it was not tested whether the crash happens with more
+% recent MATLAB versions, so when OLD_MATLAB_VERSION is increased,
+% one should make a test before removing this workaround.
+if options_.TeX && ~isoctave && matlab_ver_less_than('8.4') && ~isempty(getenv('TOP_TEST_DIR'))
+    warning('Disabling TeX option due to a bug in MATLAB R2014a with -nodisplay')
+    options_.TeX = false;
+end
+
 var_list = check_list_of_variables(options_, M_, var_list);
 options_.varlist = var_list;
 
diff --git a/matlab/dynare_identification.m b/matlab/dynare_identification.m
index c843f1b808195687c569b8b2502fcbc83ff8b92b..196ae7d5e354c6ba4e7f0faaab749344357f753d 100644
--- a/matlab/dynare_identification.m
+++ b/matlab/dynare_identification.m
@@ -46,7 +46,7 @@ function [pdraws, STO_REDUCEDFORM, STO_MOMENTS, STO_DYNAMIC, STO_si_dDYNAMIC, ST
 %    * skipline
 %    * vnorm
 % =========================================================================
-% Copyright (C) 2010-2020 Dynare Team
+% Copyright (C) 2010-2021 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -66,6 +66,19 @@ function [pdraws, STO_REDUCEDFORM, STO_MOMENTS, STO_DYNAMIC, STO_si_dDYNAMIC, ST
 
 global M_ options_ oo_ bayestopt_ estim_params_
 
+% The TeX option crashes MATLAB R2014a run with "-nodisplay" option
+% (as is done from the testsuite).
+% Since we can’t directly test whether "-nodisplay" has been passed,
+% we test for the "TOP_TEST_DIR" environment variable, which is set
+% by the testsuite.
+% Note that it was not tested whether the crash happens with more
+% recent MATLAB versions, so when OLD_MATLAB_VERSION is increased,
+% one should make a test before removing this workaround.
+if options_.TeX && ~isoctave && matlab_ver_less_than('8.4') && ~isempty(getenv('TOP_TEST_DIR'))
+    warning('Disabling TeX option due to a bug in MATLAB R2014a with -nodisplay')
+    options_.TeX = false;
+end
+
 store_options_ = options_; % store options to restore them at the end
 fname = M_.fname; %model name
 dname = M_.dname; %model name
@@ -949,4 +962,4 @@ end
 
 fprintf('\n==== Identification analysis completed ====\n\n')
 
-options_ = store_options_; %restore options set
\ No newline at end of file
+options_ = store_options_; %restore options set
diff --git a/matlab/method_of_moments/method_of_moments.m b/matlab/method_of_moments/method_of_moments.m
index 5ea218c2939230e4a6bd7aeaeab9879defe0697c..c83bae21bedf054b18cc2f0b05649ce6befca048 100644
--- a/matlab/method_of_moments/method_of_moments.m
+++ b/matlab/method_of_moments/method_of_moments.m
@@ -94,6 +94,24 @@ function [oo_, options_mom_, M_] = method_of_moments(bayestopt_, options_, oo_,
 % - [ ] improve check for duplicate moments by using the cellfun and unique functions
 % - [ ] dirname option to save output to different directory not yet implemented
 % - [ ] add analytic_jacobian option for mode_compute 4 and 101
+
+% The TeX option crashes MATLAB R2014a run with "-nodisplay" option
+% (as is done from the testsuite).
+% Since we can’t directly test whether "-nodisplay" has been passed,
+% we test for the "TOP_TEST_DIR" environment variable, which is set
+% by the testsuite.
+% Note that it was not tested whether the crash happens with more
+% recent MATLAB versions, so when OLD_MATLAB_VERSION is increased,
+% one should make a test before removing this workaround.
+if options_.TeX && ~isoctave && matlab_ver_less_than('8.4') && ~isempty(getenv('TOP_TEST_DIR'))
+    warning('Disabling TeX option due to a bug in MATLAB R2014a with -nodisplay')
+    options_.TeX = false;
+end
+if isfield(options_mom_, 'TeX') && options_mom_.TeX && ~isoctave && matlab_ver_less_than('8.4') && ~isempty(getenv('TOP_TEST_DIR'))
+    warning('Disabling TeX option due to a bug in MATLAB R2014a with -nodisplay')
+    options_mom_.TeX = false;
+end
+
 % -------------------------------------------------------------------------
 % Step 0: Check if required structures and options exist
 % -------------------------------------------------------------------------
diff --git a/matlab/stoch_simul.m b/matlab/stoch_simul.m
index 218d081791a29a339947bd37dcae86b5dd628370..3ec1c933920ac6434f1a02923df3a3103d1893c5 100644
--- a/matlab/stoch_simul.m
+++ b/matlab/stoch_simul.m
@@ -1,6 +1,6 @@
 function [info, oo_, options_, M_] = stoch_simul(M_, options_, oo_, var_list)
 
-% Copyright (C) 2001-2020 Dynare Team
+% Copyright (C) 2001-2021 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -22,6 +22,19 @@ if isequal(options_.order,0)
     error('stoch_simul:: The order of the Taylor approximation cannot be 0!')
 end
 
+% The TeX option crashes MATLAB R2014a run with "-nodisplay" option
+% (as is done from the testsuite).
+% Since we can’t directly test whether "-nodisplay" has been passed,
+% we test for the "TOP_TEST_DIR" environment variable, which is set
+% by the testsuite.
+% Note that it was not tested whether the crash happens with more
+% recent MATLAB versions, so when OLD_MATLAB_VERSION is increased,
+% one should make a test before removing this workaround.
+if options_.TeX && ~isoctave && matlab_ver_less_than('8.4') && ~isempty(getenv('TOP_TEST_DIR'))
+    warning('Disabling TeX option due to a bug in MATLAB R2014a with -nodisplay')
+    options_.TeX = false;
+end
+
 if M_.exo_nbr==0
     error('stoch_simul:: does not support having no varexo in the model. As a workaround you could define a dummy exogenous variable.')
 end