diff --git a/source/java/writer2latex/xhtml/PageSplitter.java b/source/java/writer2latex/xhtml/PageSplitter.java
index 4acf852..3012fc4 100644
--- a/source/java/writer2latex/xhtml/PageSplitter.java
+++ b/source/java/writer2latex/xhtml/PageSplitter.java
@@ -513,11 +513,11 @@ public class PageSplitter {
//SPB FOUND
if (checkSoftPageBreak(paraChildNode, false)){
if (nodeName.equals(XMLString.TEXT_SOFT_PAGE_BREAK)){
- // remove inner soft page break node
- paraNode.removeChild(paraChildNode);
+
+
//Next node in paragraph. If it is text node go further
- Node paraNextNode = paraChildNodes.item(i);
+ Node paraNextNode = paraChildNodes.item(i+1);
Node paraPrevNode = paraFirstPart.getLastChild();
String nextText = null;
String prevText = null;
@@ -550,6 +550,15 @@ public class PageSplitter {
}
}
}
+ // In case paragraph is empty add space to prevent it's removing
+ if (paraNextNode == null && paraPrevNode == null){
+ Document doc = paraNode.getOwnerDocument();
+ Node space = doc.createTextNode(" ");
+ paraNode.insertBefore(space, paraChildNode);
+ }
+
+ // remove inner soft page break node
+ paraNode.removeChild(paraChildNode);
/* Check if next node in para is text and first char is a letter
* Check if last node in paraFirstPart is text and last char is a letter