void CmdLogo(int code) /****************************************************************************** purpose : converts the LaTeX, TeX, SLiTex, etc logos to RTF ******************************************************************************/ { int dnsize; changeTexMode(MODE_HORIZONTAL); fprintRTF("{\\plain "); switch (code) { case CMD_TEX: TeXlogo(); break; case CMD_LATEX: LaTeXlogo(); break; case CMD_SLITEX: fprintRTF("{\\scaps Sli}"); TeXlogo(); break; case CMD_BIBTEX: fprintRTF("{\\scaps Bib}"); TeXlogo(); break; case CMD_LATEXE: LaTeXlogo(); dnsize = (int) (0.3 * CurrentFontSize() + 0.45); fprintRTF("2{\\dn%d", dnsize); putUnicodeChar(0x03,0xF5,'e'); fprintRTF("}"); break; case CMD_AMSTEX: fprintRTF("{\\i AmS}-"); /* should be calligraphic */ TeXlogo(); break; case CMD_AMSLATEX: fprintRTF("{\\i AmS}-"); /* should be calligraphic */ LaTeXlogo(); break; case CMD_LYX: dnsize = (int) (0.3 * CurrentFontSize() + 0.45); fprintRTF("L{\\dn%d Y}X", dnsize); break; } fprintRTF("}"); }
static void put_cedilla_char(char c) { int down = CurrentFontSize() / 4; fprintRTF("{\\field{\\*\\fldinst EQ \\\\O(%c",c); fprintRTF("%c\\\\S(\\dn%d\\'b8))}", g_field_separator,down); fprintRTF("{\\fldrslt }}"); }
static void put_breve_char(char c) { int num = RtfFontNumber("MT Extra"); int upsize = CurrentFontSize()/2; fprintRTF("{\\field{\\*\\fldinst EQ \\\\O(%c",c); fprintRTF("%c\\\\S(\\up%d\\f%d \\\\())}", g_field_separator, upsize, num); fprintRTF("{\\fldrslt }}"); }
void CmdFootNote(int code) /****************************************************************************** purpose: converts footnotes from LaTeX to Rtf params : code specifies whether it is a footnote or a thanks-mark ******************************************************************************/ { char *number, *text; static int thankno = 1; int text_ref_upsize, foot_ref_upsize; int DefFont = DefaultFontFamily(); diagnostics(4,"Entering ConvertFootNote"); number = getBracketParam(); /* ignored by automatic footnumber generation */ text = getBraceParam(); if (number) free(number); text_ref_upsize = (int) (0.8 * CurrentFontSize()); foot_ref_upsize = (int) (0.8 * CurrentFontSize()); switch (code) { case FOOTNOTE_THANKS: thankno++; fprintRTF("{\\up%d %d}\n", text_ref_upsize, thankno); fprintRTF("{\\*\\footnote \\pard\\plain\\s246\\f%d",DefFont); fprintRTF("\\fs%d {\\up%d %d}", CurrentFontSize(), foot_ref_upsize, thankno); break; case FOOTNOTE: fprintRTF("{\\up%d\\chftn}\n", text_ref_upsize); fprintRTF("{\\*\\footnote \\pard\\plain\\s246\\f%d",DefFont); fprintRTF("\\fs%d {\\up%d\\chftn}", CurrentFontSize(), foot_ref_upsize); break; case FOOTNOTE_TEXT: fprintRTF("{\\*\\footnote \\pard\\plain\\s246\\f%d",DefFont); fprintRTF("\\fs%d ", CurrentFontSize()); break; } ConvertString(text); fprintRTF("}\n "); diagnostics(4,"Exiting CmdFootNote"); free(text); }
static void LaTeXlogo(void) /****************************************************************************** purpose : prints the LaTeX logo in the RTF-File (D Taupin) ******************************************************************************/ { float FloatFsize; int upsize, Asize; if (CurrentFontSize() > 14) FloatFsize = (float) (0.8 * CurrentFontSize()); else FloatFsize = (float) (0.9 * CurrentFontSize()); Asize = (int) (FloatFsize + 0.45); upsize = (int) (0.25 * CurrentFontSize() + 0.45); fprintRTF("L{\\up%d\\fs%d A}", upsize, Asize); TeXlogo(); }
static void TeXlogo(void ) /****************************************************************************** purpose : prints the Tex logo in the RTF-File (D Taupin) ******************************************************************************/ { int dnsize; dnsize = (int) (0.3 * CurrentFontSize() + 0.45); fprintRTF("T{\\dn%d E}X", dnsize); }
void CmdTextNormal(int code) /**************************************************************************** purpose: handle \textnormal{text} {\normalfont ...} commands F_TEXT_NORMAL for \normalfont ... F_TEXT_NORMAL_1 F_TEXT_NORMAL_2 for \textnormal{...} F_TEXT_NORMAL_3 for \begin{normalfont} ... \end{normalfont} ******************************************************************************/ { int true_code = code & ~ON; diagnostics(5, "CmdTextNormal (before) depth=%d, family=%d, size=%d, shape=%d, series=%d", FontInfoDepth, RtfFontInfo[FontInfoDepth].family, RtfFontInfo[FontInfoDepth].size, RtfFontInfo[FontInfoDepth].shape, RtfFontInfo[FontInfoDepth].series); if (true_code == F_TEXT_NORMAL_3 && !(code & ON)) return; if (getTexMode() == MODE_VERTICAL) changeTexMode(MODE_HORIZONTAL); if (code == F_TEXT_NORMAL_2) fprintRTF("{"); if (CurrentFontShape() != DefaultFontShape()) CmdFontShape(DefaultFontShape()); if (CurrentFontSeries() != DefaultFontSeries()) CmdFontSeries(DefaultFontSeries()); if (CurrentFontSize() != DefaultFontSize()) CmdFontSize(DefaultFontSize()); if (CurrentFontFamily() != DefaultFontFamily()) CmdFontFamily(DefaultFontFamily()); if (code == F_TEXT_NORMAL_2) { char *s; s = getBraceParam(); ConvertString(s); free(s); fprintRTF("}"); } diagnostics(5, "CmdTextNormal (after) depth=%d, family=%d, size=%d, shape=%d, series=%d", FontInfoDepth, RtfFontInfo[FontInfoDepth].family, RtfFontInfo[FontInfoDepth].size, RtfFontInfo[FontInfoDepth].shape, RtfFontInfo[FontInfoDepth].series); }
void CmdSubscript(int code) /****************************************************************************** purpose : Handles superscripts ^\alpha, ^a, ^{a} ******************************************************************************/ { char *s = NULL; int size, newsize, upsize; if ((s = getBraceParam())) { size = CurrentFontSize(); newsize = size / 1.2; upsize = size / 3; fprintRTF("{\\dn%d\\fs%d ",upsize,newsize); ConvertString(s); fprintRTF("}"); free(s); } }
void CmdStackrel(int code) /****************************************************************************** purpose : Handles \stackrel{a}{=} ******************************************************************************/ { char * numer, *denom; int size; size = CurrentFontSize()/1.2; numer = getBraceParam(); denom = getBraceParam(); diagnostics(4, "CmdStackrel() ... \\stackrel{%s}{%s}", numer,denom); fprintRTF(" \\\\a ({\\fs%d ",size); ConvertString(numer); fprintRTF("}%c", g_field_separator); ConvertString(denom); fprintRTF(") "); free(numer); free(denom); }
int TexFontNumber(const char *Fname) /**************************************************************************** purpose: returns the RTF font number for a particular LaTeX font example: TexFontNumber("Roman") ****************************************************************************/ { ConfigEntryT **p; int number=0; if (strcmp(Fname,"CurrentFontSize")==0) return CurrentFontSize(); if (strcmp(Fname,"DefaultFontSize")==0) return DefaultFontSize(); p = SearchCfgEntry(Fname, FONT_A); if (p) number = (**p).original_id; diagnostics(6,"TexFontNumber for '%s' is %d", Fname, number); return number; }
void CmdFrenchAbbrev(int code) /****************************************************************************** purpose: makes \\ier, \\ieme, etc ******************************************************************************/ { float FloatFsize; int up, size; char *fuptext; if (code == INFERIEURA) { fprintRTF("<"); return; } if (code == SUPERIEURA) { fprintRTF(">"); return; } if (code == FRENCH_LQ) { fprintRTF("\\lquote"); return; } if (code == FRENCH_RQ) { fprintRTF("\\rquote"); return; } if (code == FRENCH_OG) { fprintRTF("\\'AB\\'A0"); return; } /* guillemotleft */ if (code == FRENCH_FG) { fprintRTF("\\'BB"); return; } /* guillemotright */ if (code == FRENCH_LQQ) { fprintRTF("\\ldblquote"); return; } if (code == FRENCH_RQQ) { fprintRTF("\\rdblquote"); return; } if (code == POINT_VIRGULE) { fprintRTF(";"); return; } if (code == POINT_EXCLAMATION) { fprintRTF("!"); return; } if (code == POINT_INTERROGATION) { fprintRTF("?"); return; } if (code == DITTO_MARK) { fprintRTF("\""); return; } if (code == DEUX_POINTS) { fprintRTF(":"); return; } if (code == LCS || code == FCS) { char *abbev = getBraceParam(); fprintRTF("{\\scaps "); ConvertString(abbev); free(abbev); fprintRTF("}"); return; } if (code == NUMERO) fprintRTF("n"); if (code == NUMEROS) fprintRTF("n"); if (code == CNUMERO) fprintRTF("N"); if (code == CNUMEROS) fprintRTF("N"); if (code == PRIMO) fprintRTF("1"); if (code == SECUNDO) fprintRTF("2"); if (code == TERTIO) fprintRTF("3"); if (code == QUARTO) fprintRTF("4"); FloatFsize = (float) CurrentFontSize(); if (FloatFsize > 14) FloatFsize = (float) (FloatFsize * 0.75); up = (int) (0.3 * FloatFsize + 0.45); size = (int) (FloatFsize + 0.45); fprintRTF("{\\fs%d\\up%d ", size, up); switch (code) { case NUMERO: fprintRTF("o"); break; case CNUMERO: fprintRTF("o"); break; case NUMEROS: fprintRTF("os"); break; case CNUMEROS: fprintRTF("os"); break; case PRIMO: fprintRTF("o"); break; case SECUNDO: fprintRTF("o"); break; case TERTIO: fprintRTF("o"); break; case QUARTO: fprintRTF("o"); break; case IERF: fprintRTF("er"); break; case IERSF: fprintRTF("ers"); break; case IEMEF: fprintRTF("e"); break; case IEMESF: fprintRTF("es"); break; case IEREF: fprintRTF("re"); break; case IERESF: fprintRTF("res"); break; case FUP: fuptext = getBraceParam(); ConvertString(fuptext); free(fuptext); break; } fprintRTF("}"); }