[sword-svn] r2999 - trunk/utilities/diatheke

refdoc at crosswire.org refdoc at crosswire.org
Mon Dec 30 10:29:05 MST 2013


Author: refdoc
Date: 2013-12-30 10:29:05 -0700 (Mon, 30 Dec 2013)
New Revision: 2999

Modified:
   trunk/utilities/diatheke/corediatheke.cpp
Log:
further improvement on diatheke LaTeX output


Modified: trunk/utilities/diatheke/corediatheke.cpp
===================================================================
--- trunk/utilities/diatheke/corediatheke.cpp	2013-12-30 13:10:35 UTC (rev 2998)
+++ trunk/utilities/diatheke/corediatheke.cpp	2013-12-30 17:29:05 UTC (rev 2999)
@@ -384,7 +384,7 @@
 
  		listkey = parser->parseVerseList(ref, "Gen1:1", true);
 		int i;
-
+		
 		if (outputformat == FMT_RTF) {
 			*output << "{\\rtf1\\ansi{\\fonttbl{\\f0\\froman\\fcharset0\\fprq2 Times New Roman;}{\\f1\\fdecor\\fprq2 ";
 			if (font)
@@ -393,12 +393,16 @@
 				*output << "Times New Roman";
 			*output << ";}{\\f7\\froman\\fcharset2\\fprq2 Symbol;}}";
 		}
+
 		else if (outputformat == FMT_LATEX) {
-			*output << "\\documentclass[12pt]{article}\n";
-			*output << "\\usepackage{fontspec}\n";
+			*output << "\\documentclass{article}\n";
 			*output << "\\usepackage{geometry}\n";
 			*output << "\\usepackage{setspace}\n";
 			*output << "\\usepackage{polyglossia}\n";
+			*output << "\\usepackage{lettrine}\n";
+			*output << "\\usepackage[perpage,para]{footmisc}\n";
+			*output << "\\alph{footnote}\n";
+			
 			if (font) {
 				*output << "\\setmainfont{";
 				*output << font;
@@ -407,6 +411,8 @@
 			*output << "\\begin{document}\n";
 			*output << "\\setlength{\\parskip}{3pt} \% 1ex plus 0.5ex minus 0.2ex}\n";
 		}
+
+
 		else if (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML) {
 			*output << "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">";
 		}
@@ -417,7 +423,23 @@
 			  target->setKey(element->getLowerBound());
 				*parser = element->getUpperBound();
 				while (maxverses && *target->getKey() <= *parser) {
-					*output << (char*)target->getKeyText();
+
+					if (outputformat == FMT_LATEX) {
+						VerseKey *outkey = new VerseKey(target->getKey());
+						if (outkey->getVerse() == 1) {
+							*output << "\\lettrine[lines=3]{";
+							*output << outkey->getChapter();
+							*output << "}{ }";
+						}
+						else {	
+							*output << "\\textsuperscript{\\tiny{";
+							*output << outkey->getVerse();
+							*output << "}} ";
+						}
+					}	
+					else { 						
+						*output << (char*)target->getKeyText();
+					}
 					if (font && (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI)) {
 						*output << ": <font face=\"";
 						*output << font;
@@ -426,10 +448,16 @@
 					else if (outputformat == FMT_RTF) {
 						*output << ": {\\f1 ";
 					}
+					else if (outputformat == FMT_LATEX) {
+						*output << " ";
+					}
 					else {
 						*output << ": ";
 					}
+						
 					*output << target->renderText();
+					
+					
 					if (font && (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI)) {
 						*output << "</font>";
 					}
@@ -456,7 +484,24 @@
 			}
 			else {
 				target->setKey(*listkey.getElement(i));
-				*output << (char*)target->getKeyText();
+	
+				if (outputformat == FMT_LATEX) {
+					VerseKey *outkey = new VerseKey(target->getKey());
+					if (outkey->getVerse() == 1) {
+						*output << "\\lettrine[lines=3]{";
+						*output << outkey->getChapter();
+						*output << "}{ }";
+					}
+					else {	
+						*output << "\\textsuperscript{\\tiny{";
+						*output << outkey->getVerse();
+						*output << "}} ";
+					}
+				}	
+				else { 						
+					*output << (char*)target->getKeyText();
+					}
+
 				if (font && (outputformat == FMT_HTML || outputformat == FMT_HTMLHREF || outputformat == FMT_XHTML || outputformat == FMT_THML || outputformat == FMT_CGI)) {
 					*output << ": <font face=\"";
 					*output << font;
@@ -465,6 +510,9 @@
 				else if (outputformat == FMT_RTF) {
 					*output << ": {\\f1 ";
 				}
+				else if (outputformat == FMT_LATEX) {
+					*output << " ";
+				}
 				else {
 					*output << ": ";
 				}
@@ -482,6 +530,8 @@
 					*output << "<milestone type=\"line\"/>";
 				else if (outputformat == FMT_RTF)
 					*output << "\\par ";
+				else if (outputformat == FMT_LATEX)
+					*output << "\n\\paragraph ";
 				else if (outputformat == FMT_GBF)
 					*output << "<CM>";
 




More information about the sword-cvs mailing list