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)  

equation.c File Reference
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "main.h"
#include "convert.h"
#include "commands.h"
#include "stack.h"
#include "l2r_fonts.h"
#include "cfg.h"
#include "ignore.h"
#include "parser.h"
#include "equation.h"
#include "counters.h"
#include "funct1.h"
#include "lengths.h"
#include "util.h"
#include "graphics.h"
#include "xref.h"
Include dependency graph for equation.c:

Go to the source code of this file.

Functions

int script_shift (void)
 
int script_size (void)
 
void CmdNonumber (int code)
 
static char * SlurpDollarEquation (void)
 
static void SlurpEquation (int code, char **pre, char **eq, char **post)
 
static int EquationNeedsFields (char *eq)
 
static void WriteEquationAsComment (char *pre, char *eq, char *post)
 
static char * SaveEquationAsFile (char *pre, char *eq_with_spaces, char *post)
 
void WriteLatexAsBitmap (char *pre, char *eq, char *post)
 
static void PrepareRtfEquation (int code, int EQ_Needed)
 
static void FinishRtfEquation (int code, int EQ_Needed)
 
static void ConvertOverToFrac (char **equation)
 
static void WriteEquationAsRTF (int code, char **eq)
 
void CmdEquation (int code)
 
void CmdRoot (int code)
 
void CmdFraction (int code)
 
void CmdArrows (int code)
 
void CmdLim (int code)
 
void CmdIntegral (int code)
 
void SubSupWorker (bool big)
 
void CmdSuperscript (int code)
 
void CmdSubscript (int code)
 
void CmdLeftRight (int code)
 
void CmdArray (int code)
 
void CmdMatrix (int code)
 
void CmdStackrel (int code)
 

Variables

int g_equation_column = 1
 

Function Documentation

◆ CmdArray()

void CmdArray ( int  code)

purpose : Handles \begin{array}[c]{ccc} ... \end{array}

Definition at line 1169 of file equation.c.

References diagnostics(), fprintRTF(), free, g_processing_arrays, getBraceParam(), getBracketParam(), n, ON, and s.

◆ CmdArrows()

void CmdArrows ( int  code)

converts: amssymb \leftrightarrows and \rightleftarrows

Definition at line 787 of file equation.c.

References ConvertString(), CurrentFontSize(), fprintRTF(), g_field_separator, int(), LEFT_LEFT, LEFT_RIGHT, LONG_LEFTRIGHT, LONG_RIGHTLEFT, RIGHT_LEFT, RIGHT_RIGHT, and size.

◆ CmdEquation()

◆ CmdFraction()

void CmdFraction ( int  code)

◆ CmdIntegral()

void CmdIntegral ( int  code)

purpose: converts integral symbol and the "exponent" and "subscript" fields parameter: type of operand

Definition at line 884 of file equation.c.

References command, ConvertString(), diagnostics(), ERROR, FALSE, fprintRTF(), free, g_field_separator, g_fields_use_EQ, getBraceParam(), getNonBlank(), getSimpleCommand(), limits, no_limits, NULL, PushSource(), RtfFontNumber(), script_shift(), script_size(), strcmp(), TRUE, ungetTexChar(), and WARNING__.

◆ CmdLeftRight()

void CmdLeftRight ( int  code)

purpose : Handles \left \right to properly handle \left. or \right. would require prescanning the entire equation.

Definition at line 1095 of file equation.c.

References ConvertString(), diagnostics(), ERROR, fprintRTF(), g_fields_use_EQ, getLeftRightParam(), getNonSpace(), getTexChar(), putRtfChar(), SubSupWorker(), and TRUE.

◆ CmdLim()

void CmdLim ( int  code)

purpose: handles \lim parameter: 0=\lim, 1=\limsup, 2=\liminf

Definition at line 837 of file equation.c.

References ConvertString(), fprintRTF(), free, g_field_separator, g_fields_use_EQ, getBraceParam(), getNonBlank(), NULL, s, script_shift(), script_size(), strdup, and ungetTexChar().

◆ CmdMatrix()

void CmdMatrix ( int  code)

purpose : Does not handle plain tex \matrix command, but does not produce improper RTF either.

Definition at line 1201 of file equation.c.

References fprintRTF(), free, and getBraceParam().

◆ CmdNonumber()

void CmdNonumber ( int  code)

purpose : Handles \nonumber to suppress numbering in equations

Definition at line 59 of file equation.c.

References g_processing_eqnarray, g_processing_tabular, g_suppress_equation_number, and TRUE.

◆ CmdRoot()

void CmdRoot ( int  code)

purpose: converts \sqrt{x} or \root[\alpha]{x+y}

Definition at line 714 of file equation.c.

References ConvertString(), fprintRTF(), free, g_field_separator, g_fields_use_EQ, getBraceParam(), getBracketParam(), NULL, power, root, RtfFontNumber(), script_shift(), script_size(), and strlen().

◆ CmdStackrel()

void CmdStackrel ( int  code)

purpose : Handles \stackrel{a}{=}

Definition at line 1215 of file equation.c.

References ConvertString(), CurrentFontSize(), diagnostics(), fprintRTF(), free, g_field_separator, g_fields_use_EQ, getBraceParam(), size, and WARNING__.

◆ CmdSubscript()

void CmdSubscript ( int  code)

purpose : Handles subscripts _\alpha, _a, _{a}, code=0 \textsubscript{script} code=1

Definition at line 1072 of file equation.c.

References ConvertString(), FALSE, fprintRTF(), free, g_fields_use_EQ, getBraceParam(), NULL, s, script_shift(), script_size(), SubSupWorker(), and ungetTexChar().

Referenced by Convert().

◆ CmdSuperscript()

void CmdSuperscript ( int  code)

purpose : Handles superscripts ^\alpha, ^a, ^{a} code=0 \textsuperscript{a} code=1

Definition at line 1049 of file equation.c.

References ConvertString(), FALSE, fprintRTF(), free, g_fields_use_EQ, getBraceParam(), NULL, s, script_shift(), script_size(), SubSupWorker(), and ungetTexChar().

Referenced by Convert().

◆ ConvertOverToFrac()

static void ConvertOverToFrac ( char **  equation)
static

purpose : Convert {A \over B} to \frac{A}{B}

Definition at line 573 of file equation.c.

References diagnostics(), first, free, isalpha, last, malloc, NULL, p, s, strcpy(), strlen(), strncpy(), strstr(), and t.

Referenced by WriteEquationAsRTF().

◆ EquationNeedsFields()

static int EquationNeedsFields ( char *  eq)
static

purpose : Determine if equation needs EQ field for RTF conversion

Definition at line 188 of file equation.c.

References strstr().

Referenced by WriteEquationAsRTF().

◆ FinishRtfEquation()

◆ PrepareRtfEquation()

◆ SaveEquationAsFile()

static char* SaveEquationAsFile ( char *  pre,
char *  eq_with_spaces,
char *  post 
)
static

◆ script_shift()

int script_shift ( void  )

Definition at line 48 of file equation.c.

References CurrentFontSize().

Referenced by CmdIntegral(), CmdLim(), CmdRoot(), CmdSubscript(), and CmdSuperscript().

◆ script_size()

◆ SlurpDollarEquation()

static char* SlurpDollarEquation ( void  )
static

purpose : reads an equation delimited by $...$ this routine is needed to handle $ x \mbox{if $x$} $

Definition at line 69 of file equation.c.

References even(), free, getTexChar(), i, malloc, s, strdup, strncmp(), t, and u.

Referenced by SlurpEquation().

◆ SlurpEquation()

static void SlurpEquation ( int  code,
char **  pre,
char **  eq,
char **  post 
)
static

◆ SubSupWorker()

void SubSupWorker ( bool  big)

purpose : Stack a superscript and a subscript together

Definition at line 993 of file equation.c.

References ConvertString(), CurrentFontSize(), diagnostics(), fprintRTF(), free, g_field_separator, getBraceParam(), getNonBlank(), NULL, script_size(), ungetTexChar(), and WARNING__.

Referenced by CmdLeftRight(), CmdSubscript(), and CmdSuperscript().

◆ WriteEquationAsComment()

static void WriteEquationAsComment ( char *  pre,
char *  eq,
char *  post 
)
static

purpose : Writes equation to RTF file as text of COMMENT field

Definition at line 215 of file equation.c.

References fprintRTF(), pre, and putRtfChar().

Referenced by CmdEquation().

◆ WriteEquationAsRTF()

static void WriteEquationAsRTF ( int  code,
char **  eq 
)
static

purpose : Translate equation to RTF

Definition at line 624 of file equation.c.

References ConvertOverToFrac(), ConvertString(), EquationNeedsFields(), FinishRtfEquation(), and PrepareRtfEquation().

Referenced by CmdEquation().

◆ WriteLatexAsBitmap()

void WriteLatexAsBitmap ( char *  pre,
char *  eq,
char *  post 
)

purpose : Convert LaTeX to Bitmap and write to RTF file

Definition at line 277 of file equation.c.

References diagnostics(), g_png_equation_scale, g_png_figure_scale, name, NULL, p, pre, PutLatexFile(), SaveEquationAsFile(), scale, strcmp(), strlen(), and strstr().

Referenced by CmdEquation(), CmdFigure(), CmdMusic(), and CmdPicture().

Variable Documentation

◆ g_equation_column

int g_equation_column = 1

Definition at line 46 of file equation.c.

Referenced by CmdSlashSlash(), Convert(), FinishRtfEquation(), and PrepareRtfEquation().