As per the subject, when a heading line is included within a `#+BEGIN_EXPORT backend ... #+END_EXPORT' block, it breaks the parsing of the block, which is instead split into multiple `paragraph' elements.
See the attached example (test.org), and associate exports (test.tex) and (test.html). Tested with `emacs -Q -l minimal-org.el', with the org package installed from http://orgmode.org/elpa/, org-20161102.
* Test heading #+BEGIN_EXPORT latex Text which should appear in \LaTeX{} exports, but not HTML. #+END_EXPORT #+BEGIN_EXPORT html * HTML only heading Text which should appear in HTML exports, but not \LaTeX{}. #+END_EXPORT
% Created 2016-11-03 Thu 11:34 % Intended LaTeX compiler: pdflatex \documentclass[11pt]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{graphicx} \usepackage{grffile} \usepackage{longtable} \usepackage{wrapfig} \usepackage{rotating} \usepackage[normalem]{ulem} \usepackage{amsmath} \usepackage{textcomp} \usepackage{amssymb} \usepackage{capt-of} \usepackage{hyperref} \date{\today} \title{} \hypersetup{ pdfauthor={}, pdftitle={}, pdfkeywords={}, pdfsubject={}, pdfcreator={Emacs 25.1.1 (Org mode 9.0)}, pdflang={English}} \begin{document} \tableofcontents \section{Test heading} \label{sec:org0b53ca6} Text which should appear in \LaTeX{} exports, but not HTML. \#+BEGIN\(_{\text{EXPORT}}\) html \section{HTML only heading} \label{sec:org14261e8} Text which should appear in HTML exports, but not \LaTeX{}. \#+END\(_{\text{EXPORT}}\) \end{document}
Table of Contents
1 Test heading
#+BEGINEXPORT html
2 HTML only heading
Text which should appear in HTML exports, but not \LaTeX{}. #+ENDEXPORT
Created: 2016-11-03 Thu 11:34
(setq user-emacs-directory "C:/Data/Documents/emacs.d/") (package-initialize) (require 'org)