w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

preamble.c File Reference
#include <stdlib.h>
#include <string.h>
#include "main.h"
#include "convert.h"
#include "util.h"
#include "preamble.h"
#include "l2r_fonts.h"
#include "cfg.h"
#include "encode.h"
#include "parser.h"
#include "funct1.h"
#include "lengths.h"
#include "ignore.h"
#include "commands.h"
#include "counters.h"
#include "xref.h"
#include "direct.h"
#include "style.h"
Include dependency graph for preamble.c:

Go to the source code of this file.

Functions

static void setPaperSize (char *size)
 
static void setDocumentOptions (char *optionlist)
 
static void WriteFontHeader (void)
 
static void WriteStyleHeader (void)
 
static void WritePageSize (void)
 
void setPackageBabel (char *option)
 
void setPackageInputenc (char *option)
 
static void setPackageFont (char *font)
 
static void setThree (char *s, int ten, int eleven, int twelve)
 
static void setPointSize (char *option)
 
void CmdDocumentStyle (int code)
 
void CmdUsepackage (int code)
 
void CmdTitle (int code)
 
void CmdMakeTitle (int code)
 
void CmdPreambleBeginEnd (int code)
 
void PlainPagestyle (void)
 
void CmdPagestyle (int code)
 
void CmdHeader (int code)
 
void CmdThePage (int code)
 
void RtfHeader (int where, char *what)
 
void CmdHyphenation (int code)
 
static void WriteHeadFoot (void)
 
void CmdHeadFoot (int code)
 
static void WriteColorTable (void)
 
static void WriteInfo (void)
 
void WriteRtfHeader (void)
 

Variables

static bool g_preambleTwoside = 0
 
static bool g_preambleTwocolumn = 0
 
static bool g_preambleTitlepage = 0
 
static bool g_preambleLandscape = 0
 
static char * g_preambleTitle = NULL
 
static char * g_preambleAuthor = NULL
 
static char * g_preambleDate = NULL
 
static char * g_preambleEncoding = NULL
 
static char * g_preambleCFOOT = NULL
 
static char * g_preambleLFOOT = NULL
 
static char * g_preambleRFOOT = NULL
 
static char * g_preambleCHEAD = NULL
 
static char * g_preambleLHEAD = NULL
 
static char * g_preambleRHEAD = NULL
 

Function Documentation

◆ CmdDocumentStyle()

void CmdDocumentStyle ( int  code)

purpose: parse \documentstyle[options]{format} or \documentclass[options]{format}

Definition at line 464 of file preamble.c.

References diagnostics(), format, FORMAT_ARTICLE, FORMAT_BOOK, FORMAT_LETTER, FORMAT_REPORT, FORMAT_SLIDES, fprintf, free, g_document_type, getBraceParam(), getBracketParam(), options, setDocumentOptions(), strcmp(), and strdup_noblanks().

◆ CmdHeader()

void CmdHeader ( int  code)

purpose: converts the \markboth and \markright Command in Header information parameter: code: BOTH_SIDES, RIGHT_SIDE

globals : twoside,

Definition at line 735 of file preamble.c.

References BOTH_SIDES, diagnostics(), g_preambleTwoside, LEFT_SIDE, NULL, RIGHT_SIDE, RtfHeader(), and WARNING__.

◆ CmdHeadFoot()

void CmdHeadFoot ( int  code)

purpose: performs \cfoot, \lfoot, \rfoot, \chead, \lhead, \rhead commands (fancyhdr) adapted from code by Taupin in ltx2rtf

Definition at line 986 of file preamble.c.

References CFOOT, CHEAD, diagnostics(), free, g_preambleCFOOT, g_preambleCHEAD, g_preambleLFOOT, g_preambleLHEAD, g_preambleRFOOT, g_preambleRHEAD, g_processing_preamble, getBraceParam(), getBracketParam(), LFOOT, LHEAD, NULL, RFOOT, RHEAD, and WriteHeadFoot().

◆ CmdHyphenation()

void CmdHyphenation ( int  code)

purpose: discard all hyphenation hints since they really only make sense when used with TeX's hyphenation algorithms

Definition at line 797 of file preamble.c.

References free, and getBraceParam().

◆ CmdMakeTitle()

void CmdMakeTitle ( int  code)

purpose: Creates a title page based on saved values for author, title, and date

Definition at line 615 of file preamble.c.

References alignment, CENTERED, CmdEndParagraph(), ConvertString(), CurrentFontSize(), FALSE, fprintRTF(), g_preambleAuthor, g_preambleDate, g_preambleTitle, g_preambleTitlepage, JUSTIFIED, NULL, PopTrackLineNumber(), PushTrackLineNumber(), snprintf, and strcmp().

◆ CmdPagestyle()

void CmdPagestyle ( int  code)

LEG030598 purpose: sets page numbering in rtf-output parameter:

globals : headings set to TRUE if the pagenumber is to go into the header pagenumbering set to TRUE if pagenumbering is to occur- default

Produces latex-like headers and footers. Needs to be terminated for:

  • headings chapter, section informations and page numbering
  • myheadings page nunmbering, combined with markboth, markright.

Definition at line 696 of file preamble.c.

References diagnostics(), FALSE, fprintRTF(), getBraceParam(), headings, pagenumbering, PlainPagestyle(), strcmp(), style, TRUE, and WARNING__.

◆ CmdPreambleBeginEnd()

void CmdPreambleBeginEnd ( int  code)

purpose: catch missed \begin{document} command

Definition at line 655 of file preamble.c.

References CallParamFunc(), diagnostics(), ERROR, free, getBraceParam(), ON, and strcmp().

◆ CmdThePage()

void CmdThePage ( int  code)

purpose: handles \thepage in headers and footers

Definition at line 753 of file preamble.c.

References diagnostics(), and fprintRTF().

◆ CmdTitle()

void CmdTitle ( int  code)

purpose: saves title, author or date information

Definition at line 587 of file preamble.c.

References g_preambleAuthor, g_preambleDate, g_preambleTitle, g_preambleTitlepage, getBraceParam(), TITLE_AUTHOR, TITLE_DATE, TITLE_TITLE, TITLE_TITLEPAGE, TRUE, and UpdateLineNumber().

◆ CmdUsepackage()

◆ PlainPagestyle()

void PlainPagestyle ( void  )

LEG030598 purpose: sets centered page numbering at bottom in rtf-output

globals : pagenumbering set to TRUE if pagenumbering is to occur, default

Definition at line 670 of file preamble.c.

References DefaultFontFamily(), fc-lang::fn, fprintRTF(), g_preambleTwoside, pagenumbering, and TRUE.

Referenced by CmdPagestyle().

◆ RtfHeader()

void RtfHeader ( int  where,
char *  what 
)

purpose: generates the header command in the rtf-output parameter: where: RIGHT_SIDE, LEFT_SIDE -handed page, BOTH_SIDES what: NULL - Convert from LaTeX input, else put "what" into rtf output

Definition at line 764 of file preamble.c.

References BOTH_SIDES, Convert(), diagnostics(), ERROR, fc-lang::fn, fprintRTF(), LEFT_SIDE, NULL, RIGHT_SIDE, TexFontNumber(), and gen-indic-table::what.

Referenced by CmdHeader().

◆ setDocumentOptions()

◆ setPackageBabel()

◆ setPackageFont()

static void setPackageFont ( char *  font)
static

Definition at line 177 of file preamble.c.

References fprintf, InitializeDocumentFont(), RtfFontNumber(), strcmp(), and strstr().

Referenced by CmdUsepackage().

◆ setPackageInputenc()

void setPackageInputenc ( char *  option)

◆ setPaperSize()

static void setPaperSize ( char *  option)
static

Should also try to reset some of the other sizes at this time

Definition at line 224 of file preamble.c.

References g_preambleLandscape, setLength(), setThree(), strcmp(), and TRUE.

Referenced by setDocumentOptions().

◆ setPointSize()

static void setPointSize ( char *  option)
static

Definition at line 361 of file preamble.c.

References InitializeDocumentFont(), setLength(), and strcmp().

Referenced by setDocumentOptions().

◆ setThree()

static void setThree ( char *  s,
int  ten,
int  eleven,
int  twelve 
)
static

Definition at line 211 of file preamble.c.

References DefaultFontSize(), n, s, setLength(), and ten.

Referenced by setPaperSize().

◆ WriteColorTable()

static void WriteColorTable ( void  )
static

<colortbl> '{' \colortbl <colordef>+ '}' <colordef> \red ? & \green ? & \blue ? ';'

Definition at line 1022 of file preamble.c.

References fprintRTF().

Referenced by WriteRtfHeader().

◆ WriteFontHeader()

static void WriteFontHeader ( void  )
static

purpose: writes fontnumbers and styles for headers into Rtf-File

\fcharset0: ANSI coding (codepage 1252) \fcharset1: MAC coding \fcharset2: PC coding (codepage 437) \fcharset3: PCA coding (codepage 850) \fcharset204: Cyrillic (codepage 1251) \fcharset238: E. European (codepage 852, 1250)

Definition at line 808 of file preamble.c.

References CfgNext(), CfgStartIterate(), FONT_A, font_name, font_type, fprintRTF(), g_fcharset_number, i, NULL, and strncmp().

Referenced by WriteRtfHeader().

◆ WriteHeadFoot()

static void WriteHeadFoot ( void  )
static

\headerl The header is on left pages only. \headerr The header is on right pages only. \headerf The header is on the first page only. \footerl The footer is on left pages only. \footerr The footer is on right pages only. \footerf The footer is on the first page only.

Definition at line 935 of file preamble.c.

References ConvertString(), fprintRTF(), g_preambleCFOOT, g_preambleCHEAD, g_preambleLFOOT, g_preambleLHEAD, g_preambleRFOOT, g_preambleRHEAD, and getLength().

Referenced by CmdHeadFoot(), and WriteRtfHeader().

◆ WriteInfo()

static void WriteInfo ( void  )
static

\title The title of the document \subject The subject of the document

Author
The author of the document \operator The person who last made changes to the document \keywords Selected keywords for the document \comment Comments; text is ignored
Version
<N> The version number of the document \doccomm Comments displayed in Word's Summary Info dialog

{\info {\title This is a page} {

Author
\'ca}}

Definition at line 1049 of file preamble.c.

Referenced by WriteRtfHeader().

◆ WritePageSize()

static void WritePageSize ( void  )
static

\paperw<N> The paper width (the default is 12,240). \paperh<N> The paper height (the default is 15,840). \margl<N> The left margin (the default is 1,800). \margr<N> The right margin (the default is 1,800). \margt<N> The top margin (the default is 1,440). \margb<N> The bottom margin (the default is 1,440).

\facingp Facing pages (activates odd/even headers and gutters). \gutter<N> The gutter width (the default is 0). \margmirror Switches margin definitions on left and right pages. \landscape Landscape format. \pgnstart<N> The beginning page number (the default is 1). \widowctrl Widow control.

\headery<N> The header is <N> twips from the top of the page (the default is 720). \footery<N> The footer is <N> twips from the bottom of the page (the default is 720).

Definition at line 886 of file preamble.c.

References diagnostics(), fprintRTF(), g_preambleLandscape, g_preambleTwocolumn, g_preambleTwoside, getCounter(), getLength(), and n.

Referenced by WriteRtfHeader().

◆ WriteRtfHeader()

void WriteRtfHeader ( void  )

purpose: writes header info for the RTF file

\rtf1 <charset> \deff? <fonttbl> <filetbl>? <colortbl>? <stylesheet>? <listtables>? <revtbl>?

Definition at line 1066 of file preamble.c.

References DefaultFontFamily(), diagnostics(), family, fprintRTF(), WriteColorTable(), WriteFontHeader(), WriteHeadFoot(), WriteInfo(), WritePageSize(), and WriteStyleHeader().

Referenced by ConvertWholeDocument().

◆ WriteStyleHeader()

static void WriteStyleHeader ( void  )
static

– | {\stylesheet{\fs20 \sbasedon222\snext10{keycode \shift...} A—| {\s1 \ar \fs20 \sbasedon0\snext1 FLUSHRIGHT}{\s2\fi...}

| \sbasedon0snext2 IND:}}

...

| \widowctrl\ftnbj\ftnrestart \sectd \linex0\endnhere | \pard\plain \fs20 This is Normal style. B—|

\pard\plain \s1
| This is right justified. I call this style FLUSHRIGHT. |
\pard\plain \s2

| This is an indented paragraph. I call this style IND...

}

Definition at line 850 of file preamble.c.

References CfgNext(), CfgStartIterate(), CurrentFontSize(), diagnostics(), fprintRTF(), InsertBasicStyle(), NULL, style, STYLE_A, and TRUE.

Referenced by WriteRtfHeader().

Variable Documentation

◆ g_preambleAuthor

char* g_preambleAuthor = NULL
static

Definition at line 50 of file preamble.c.

Referenced by CmdMakeTitle(), and CmdTitle().

◆ g_preambleCFOOT

char* g_preambleCFOOT = NULL
static

Definition at line 54 of file preamble.c.

Referenced by CmdHeadFoot(), and WriteHeadFoot().

◆ g_preambleCHEAD

char* g_preambleCHEAD = NULL
static

Definition at line 57 of file preamble.c.

Referenced by CmdHeadFoot(), and WriteHeadFoot().

◆ g_preambleDate

char* g_preambleDate = NULL
static

Definition at line 51 of file preamble.c.

Referenced by CmdMakeTitle(), and CmdTitle().

◆ g_preambleEncoding

char* g_preambleEncoding = NULL
static

Definition at line 52 of file preamble.c.

Referenced by setPackageInputenc().

◆ g_preambleLandscape

bool g_preambleLandscape = 0
static

Definition at line 47 of file preamble.c.

Referenced by setPaperSize(), and WritePageSize().

◆ g_preambleLFOOT

char* g_preambleLFOOT = NULL
static

Definition at line 55 of file preamble.c.

Referenced by CmdHeadFoot(), and WriteHeadFoot().

◆ g_preambleLHEAD

char* g_preambleLHEAD = NULL
static

Definition at line 58 of file preamble.c.

Referenced by CmdHeadFoot(), and WriteHeadFoot().

◆ g_preambleRFOOT

char* g_preambleRFOOT = NULL
static

Definition at line 56 of file preamble.c.

Referenced by CmdHeadFoot(), and WriteHeadFoot().

◆ g_preambleRHEAD

char* g_preambleRHEAD = NULL
static

Definition at line 59 of file preamble.c.

Referenced by CmdHeadFoot(), and WriteHeadFoot().

◆ g_preambleTitle

char* g_preambleTitle = NULL
static

Definition at line 49 of file preamble.c.

Referenced by CmdMakeTitle(), and CmdTitle().

◆ g_preambleTitlepage

bool g_preambleTitlepage = 0
static

Definition at line 46 of file preamble.c.

Referenced by CmdMakeTitle(), CmdTitle(), and setDocumentOptions().

◆ g_preambleTwocolumn

bool g_preambleTwocolumn = 0
static

Definition at line 45 of file preamble.c.

Referenced by setDocumentOptions(), and WritePageSize().

◆ g_preambleTwoside

bool g_preambleTwoside = 0
static

Definition at line 44 of file preamble.c.

Referenced by CmdHeader(), PlainPagestyle(), setDocumentOptions(), and WritePageSize().