diff --git a/source/distro/changelog.txt b/source/distro/changelog.txt
index d6961bb..acbf321 100644
--- a/source/distro/changelog.txt
+++ b/source/distro/changelog.txt
@@ -2,6 +2,9 @@ Changelog for Writer2LaTeX version 1.0 -> 1.2
---------- version 1.1.3 ----------
+[w2l] Now exports apostrophe, single and double quotes using ' and ` characters (this creates nicer looking LaTeX files and
+ fixes a problem with hyphenation of words containing apostrophes)
+
[w2x] New style map "heading" to map styles applied to headings to custom styles.
[w2x] The option "use_list_hack" has been renamed to "list_formatting" with the new values "css1", "css1_hack" and "hard_labels".
diff --git a/source/java/writer2latex/api/ConverterFactory.java b/source/java/writer2latex/api/ConverterFactory.java
index 80d150d..79139cb 100644
--- a/source/java/writer2latex/api/ConverterFactory.java
+++ b/source/java/writer2latex/api/ConverterFactory.java
@@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
- * Version 1.2 (2010-05-09)
+ * Version 1.2 (2010-05-11)
*
*/
@@ -33,7 +33,7 @@ public class ConverterFactory {
// Version information
private static final String VERSION = "1.1.3";
- private static final String DATE = "2010-05-09";
+ private static final String DATE = "2010-05-11";
/** Return the Writer2LaTeX version in the form
* (major version).(minor version).(patch level)
diff --git a/source/java/writer2latex/latex/i18n/ClassicI18n.java b/source/java/writer2latex/latex/i18n/ClassicI18n.java
index c8a8327..fc6ec27 100644
--- a/source/java/writer2latex/latex/i18n/ClassicI18n.java
+++ b/source/java/writer2latex/latex/i18n/ClassicI18n.java
@@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
- * Version 1.2 (2010-03-15)
+ * Version 1.2 (2010-05-11)
*
*/
@@ -452,7 +452,8 @@ public class ClassicI18n extends I18n {
private void convert(String s, int nStart, int nEnd, boolean bMathMode, String sLang, StringBuffer buf, int nFontenc) {
int nCurFontenc = nFontenc;
ucparser.reset(table,s,nStart,nEnd);
- boolean bProtectDashes = true;
+ boolean bIsFirst = true; // Protect all dangerous characters at the start
+ char cProtect = '\u0000'; // Current character to protect
boolean bTempMathMode = false;
while (ucparser.next()) {
char c = ucparser.getChar();
@@ -465,7 +466,7 @@ public class ClassicI18n extends I18n {
bTempMathMode = true;
}
buf.append(convertMathChar(c,nFontenc));
- bProtectDashes = false;
+ cProtect = '\u0000';
}
else if (table.hasTextChar(c)) {
if (bTempMathMode) { // switch to text mode
@@ -477,14 +478,12 @@ public class ClassicI18n extends I18n {
// The text character is valid in the current font encoding
// Note: Change of font encoding is greedy - change?
- // Prevent unwanted --- ligatures
- if (table.isDashes(c)) {
- if (bProtectDashes) { buf.append("{}"); }
- bProtectDashes = true;
- }
- else {
- bProtectDashes = false;
+ // Prevent unwanted ligatures (-, ', `)
+ char cProtectThis = table.getProtectChar(c);
+ if (cProtectThis!='\u0000' && (cProtectThis==cProtect || bIsFirst)) {
+ buf.append("{}");
}
+ cProtect = cProtectThis;
setFlags(c,nCurFontenc);
if (ucparser.hasCombiningChar()) {
@@ -504,7 +503,7 @@ public class ClassicI18n extends I18n {
else {
// The text character is valid in another font encoding
- bProtectDashes = table.isDashes(c);
+ cProtect = table.getProtectChar(c);
int nFontenc1 = getFontenc(nFontencs);
setFlags(c,nFontenc1);
@@ -534,6 +533,8 @@ public class ClassicI18n extends I18n {
else {
buf.append(notFound(c,nCurFontenc));
}
+
+ bIsFirst = false;
}
if (bTempMathMode) { // turn of math mode
diff --git a/source/java/writer2latex/latex/i18n/UnicodeCharacter.java b/source/java/writer2latex/latex/i18n/UnicodeCharacter.java
index aa34938..8e8fa96 100644
--- a/source/java/writer2latex/latex/i18n/UnicodeCharacter.java
+++ b/source/java/writer2latex/latex/i18n/UnicodeCharacter.java
@@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
- * Copyright: 2002-2007 by Henrik Just
+ * Copyright: 2002-2010 by Henrik Just
*
* All Rights Reserved.
*
- * Version 0.5 (2007-07-24)
+ * Version 1.2 (2010-05-11)
*
*/
@@ -37,7 +37,7 @@ class UnicodeCharacter implements Cloneable {
String sMath; // LaTeX representation in math mode
String sText; // LaTeX representation in text mode
int nFontencs; // Valid font encoding(s) for the text mode representation
- boolean bDashes; // This character is represented by dashes (-,--,---)
+ char cProtect; // This character is represented by this character which may produce unwanted ligatures (-, ', `)
protected Object clone() {
UnicodeCharacter uc = new UnicodeCharacter();
@@ -45,7 +45,7 @@ class UnicodeCharacter implements Cloneable {
uc.sMath = this.sMath;
uc.sText = this.sText;
uc.nFontencs = this.nFontencs;
- uc.bDashes = this.bDashes;
+ uc.cProtect = this.cProtect;
return uc;
}
}
diff --git a/source/java/writer2latex/latex/i18n/UnicodeTable.java b/source/java/writer2latex/latex/i18n/UnicodeTable.java
index 3158aeb..149a1e9 100644
--- a/source/java/writer2latex/latex/i18n/UnicodeTable.java
+++ b/source/java/writer2latex/latex/i18n/UnicodeTable.java
@@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
- * Copyright: 2002-2007 by Henrik Just
+ * Copyright: 2002-2010 by Henrik Just
*
* All Rights Reserved.
*
- * Version 0.5 (2007-07-24)
+ * Version 1.2 (2010-05-11)
*
*/
@@ -87,12 +87,12 @@ class UnicodeTable {
}
// Add a single text character to the table
- protected void addTextChar(char c, String sLaTeX, int nFontencs, boolean bDashes){
+ protected void addTextChar(char c, String sLaTeX, int nFontencs, char cProtect){
int nRow=c/256; int nCol=c%256;
createEntry(nRow,nCol);
table[nRow].entries[nCol].sText=sLaTeX;
table[nRow].entries[nCol].nFontencs=nFontencs;
- table[nRow].entries[nCol].bDashes=bDashes;
+ table[nRow].entries[nCol].cProtect=cProtect;
}
// Retrieve entry for a character (or null)
@@ -144,11 +144,11 @@ class UnicodeTable {
return entry.nFontencs;
}
- // Get dashes for text character
- public boolean isDashes(char c) {
+ // Get ligature protect character for text character
+ public char getProtectChar(char c) {
UnicodeCharacter entry = getEntry(c);
- if (entry==null) return false;
- return entry.bDashes;
+ if (entry==null) return '\u0000';
+ return entry.cProtect;
}
// Get number of defined characters
diff --git a/source/java/writer2latex/latex/i18n/UnicodeTableHandler.java b/source/java/writer2latex/latex/i18n/UnicodeTableHandler.java
index 0f7af58..73c49d4 100644
--- a/source/java/writer2latex/latex/i18n/UnicodeTableHandler.java
+++ b/source/java/writer2latex/latex/i18n/UnicodeTableHandler.java
@@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
- * Copyright: 2002-2009 by Henrik Just
+ * Copyright: 2002-2010 by Henrik Just
*
* All Rights Reserved.
*
- * Version 1.2 (2009-03-26)
+ * Version 1.2 (2010-05-11)
*
*/
@@ -102,17 +102,18 @@ public class UnicodeTableHandler extends DefaultHandler{
table.addMathChar(c,table.getMathChar(eqc));
}
if (table.hasTextChar(eqc)) {
- table.addTextChar(c,table.getTextChar(eqc),table.getFontencs(eqc),table.isDashes(eqc));
+ table.addTextChar(c,table.getTextChar(eqc),table.getFontencs(eqc),table.getProtectChar(eqc));
}
}
else {
String sType=attributes.getValue("char-type");
String sMath=attributes.getValue("math");
String sText=attributes.getValue("text");
- boolean bDashes="true".equals(attributes.getValue("dashes"));
+ String sProtect=attributes.getValue("protect");
+ char cProtect = sProtect!=null && sProtect.length()>0 ? sProtect.charAt(0) : '\u0000';
if (sType!=null) table.addCharType(c,sType);
if (sMath!=null) table.addMathChar(c,sMath);
- if (sText!=null) table.addTextChar(c,sText,nFontencs,bDashes);
+ if (sText!=null) table.addTextChar(c,sText,nFontencs,cProtect);
}
}
}
@@ -125,7 +126,7 @@ public class UnicodeTableHandler extends DefaultHandler{
table.addMathChar(c,Character.toString(c));
}
if ("text".equals(sMode) || "both".equals(sMode)) {
- table.addTextChar(c,Character.toString(c),nFontencs,false);
+ table.addTextChar(c,Character.toString(c),nFontencs,'\u0000');
}
}
}
@@ -143,7 +144,7 @@ public class UnicodeTableHandler extends DefaultHandler{
table.addMathChar(c,Character.toString(c));
}
if (bText) {
- table.addTextChar(c,Character.toString(c),nFontencs,false);
+ table.addTextChar(c,Character.toString(c),nFontencs,'\u0000');
}
}
}
diff --git a/source/java/writer2latex/latex/i18n/symbols.xml b/source/java/writer2latex/latex/i18n/symbols.xml
index a6a6962..dee02c2 100644
--- a/source/java/writer2latex/latex/i18n/symbols.xml
+++ b/source/java/writer2latex/latex/i18n/symbols.xml
@@ -1,6 +1,6 @@
-
+
@@ -961,18 +961,18 @@ PART I: Common symbols, ascii only
-
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
+
+
@@ -2750,7 +2750,7 @@ definitions to the range 00-FF.
-
+
@@ -2949,7 +2949,7 @@ definitions to the range 00-FF.
-
+
@@ -3025,8 +3025,8 @@ definitions to the range 00-FF.
-
-
+
+
@@ -3704,7 +3704,7 @@ definitions to the range 00-FF.
-
+