diff --git a/source/java/writer2latex/xhtml/TextConverter.java b/source/java/writer2latex/xhtml/TextConverter.java
index fecaf35..e50d92c 100644
--- a/source/java/writer2latex/xhtml/TextConverter.java
+++ b/source/java/writer2latex/xhtml/TextConverter.java
@@ -474,27 +474,34 @@ public class TextConverter extends ConverterHelper {
String sName = Misc.getAttribute(onode,XMLString.TEXT_NAME);
String sStyleName = Misc.getAttribute(onode,XMLString.TEXT_STYLE_NAME);
////closePageSection
- Element div = converter.createElement("div");
- //close page before enter
- hnode = GreenstoneTags.closePage(hnode);
-
- hnode.appendChild(div);
- converter.addTarget(div,sName+"|region");
- StyleInfo sectionInfo = new StyleInfo();
- getSectionSc().applyStyle(sStyleName,sectionInfo);
- applyStyle(sectionInfo,div);
- sections.push(onode);
- //open page after enter
- div = (Element) GreenstoneTags.openPage(div, pageNum);
+ Element div = (Element) hnode;
+ if (headingTags == null) {
+ div = converter.createElement("div");
+ // close page before enter
+ hnode = GreenstoneTags.closePage(hnode);
+
+ hnode.appendChild(div);
+ converter.addTarget(div, sName + "|region");
+ StyleInfo sectionInfo = new StyleInfo();
+ getSectionSc().applyStyle(sStyleName, sectionInfo);
+ applyStyle(sectionInfo, div);
+ sections.push(onode);
+ //open page after enter
+ div = (Element) GreenstoneTags.openPage(div, pageNum);
+ }
+
Node newhnode = traverseBlockText(onode, div);
+ Node result = null;
+ if (headingTags == null) {
//close page before exit
newhnode = GreenstoneTags.closePage(newhnode);
-
- Node result = newhnode.getParentNode();
+ result = newhnode.getParentNode();
//Open page after exit
- result = (Element) GreenstoneTags.openPage(result, pageNum);
-
- sections.pop();
+ result = (Element) GreenstoneTags.openPage(result, pageNum);
+ sections.pop();
+ } else {
+ result = newhnode;
+ }
return result;
}