⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mimetex.h

📁 完美的在线教育系统
💻 H
📖 第 1 页 / 共 5 页
字号:
#define	CLOSING		(5)		/* e.g., }    */
#define	PUNCTION	(6)		/* e.g., , (punctuation) */
#define	VARIABLE	(7)		/* e.g., x    */
#define	DISPOPER	(8)		/* e.g., Bigint (displaymath opers)*/
#define	MAXCLASS	(8)		/* just for index checks */
#define	UPPERBIG	DISPOPER	/*how to interpret Bigxxx operators*/
#define	LOWERBIG	DISPOPER	/*how to interpret bigxxx operators*/
/* --- class aliases --- */
#define	ARROW		RELATION
/* --- families for mathchardef (TeXbook, top of pg.431) --- */
#define	CMR10		(1)		/* normal roman */
#define	CMMI10		(2)		/* math italic */
#define	CMMIB10		(3)		/* math italic bold */
#define	CMSY10		(4)		/* math symbol */
#define	CMEX10		(5)		/* math extension */
#define	RSFS10		(6)		/* rsfs \scrA ... \scrZ */
#define	BBOLD10		(7)		/* blackboard bold \mathbb A ... */
#define	STMARY10	(8)		/* stmaryrd math symbols */
#define	NOTACHAR	(99)		/* e.g., \frac */
/* --- dummy argument value for handlers --- */
#define	NOVALUE		(-989898)	/*charnum,family,class used as args*/

/* ---
 * font family information
 * ----------------------- */
STATIC	int  nfontinfo			/* legal font#'s are 1...nfontinfo */
#ifdef INITVALS
  = 7
#endif
  ;
STATIC	struct {char *name; int family; int istext; int class;}
  /* note: class(1=upper,2=alpha,3=alnum,4=lower,5=digit,9=all) now unused */
  fontinfo[]
#ifdef INITVALS
  = {/* --- name family istext class --- */
    { "\\math",	   0,       0,  0 }, /*(0) default math mode */
    { "\\mathcal", CMSY10,  0,  1 }, /*(1) calligraphic, uppercase */
    { "\\mathscr", RSFS10,  0,  1 }, /*(2) rsfs/script, uppercase */
    { "\\textrm",  CMR10,   1, -1 }, /*(3) \rm,\text{abc} --> {\textrm~abc}*/
    { "\\textit",  CMMI10,  1, -1 }, /*(4) \it,\textit{abc}-->{\textit~abc}*/
    { "\\mathbb",  BBOLD10, 0, -1 }, /*(5) \bb,\mathbb{abc}-->{\mathbb~abc}*/
    { "\\mathbf",  CMMIB10, 0, -1 }, /*(6) \bf,\mathbf{abc}-->{\mathbf~abc}*/
    { "\\mathrm",  CMR10,   0, -1 }, /*(7) \mathrm */
    {  NULL,	   0,       0,  0 } }
#endif
  ; /* --- end-of-fonts[] --- */

/* ---
 * additional font attributes (only size is implemented)
 * ----------------------------------------------------- */
/* --- font sizes 0-7 = tiny,small,normal,large,Large,LARGE,huge,Huge --- */
#define	LARGESTSIZE	(7)
#ifdef DEFAULTSIZE
  #ifndef NORMALSIZE
    #define NORMALSIZE (DEFAULTSIZE)
  #endif
#endif
#ifndef	NORMALSIZE
  /*#define NORMALSIZE	(2)*/
  #define NORMALSIZE	(3)
#endif
#ifndef	DISPLAYSIZE
  /* --- automatically sets scripts in \displaystyle when fontsize>= --- */
  /*#define DISPLAYSIZE	(NORMALSIZE+1)*/
  #define DISPLAYSIZE	(3)
#endif

/* ---
aspect ratio is width/height of the displayed image of a pixel
-------------------------------------------------------------- */
#define	ASPECTRATIO	1.0 /*(16.0/9.0)*/
#define	SQRTWIDTH(sqrtht) ((int)(.5*((double)(sqrtht+1))*ASPECTRATIO + 0.5))

/* ---
 * space between adjacent symbols, e.g., symspace[RELATION][VARIABLE]
 * ------------------------------------------------------------------ */
STATIC	int symspace[10][10]
#ifdef INITVALS
 =
 { /* ---------------------------------------------------------------
         Right... ORD OPER  BIN  REL OPEN CLOS PUNC  VAR DISP unused
    Left... ------------------------------------------------------ */
  /*ORDINARY*/	{  2,   3,   3,   5,   3,   2,   2,   2,   3,   0 },
  /*OPERATOR*/	{  3,   1,   1,   5,   3,   2,   2,   2,   3,   0 },
  /*BINARYOP*/	{  2,   1,   1,   5,   3,   2,   2,   2,   3,   0 },
  /*RELATION*/	{  5,   5,   5,   5,   5,   5,   5,   5,   5,   0 },
   /*OPENING*/	{  2,   2,   2,   5,   2,   4,   2,   2,   3,   0 },
   /*CLOSING*/	{  2,   3,   3,   5,   4,   2,   1,   2,   3,   0 },
  /*PUNCTION*/	{  2,   2,   2,   5,   2,   2,   1,   2,   2,   0 },
  /*VARIABLE*/	{  2,   2,   2,   5,   2,   2,   1,   2,   2,   0 },
  /*DISPOPER*/	{  2,   3,   3,   5,   2,   3,   2,   2,   2,   0 },
    /*unused*/	{  0,   0,   0,   0,   0,   0,   0,   0,   0,   0 }
 }
#endif
 ; /* --- end-of-symspace[][] --- */


/* -------------------------------------------------------------------------
subraster (bitmap image, its attributes, overlaid position in raster, etc)
-------------------------------------------------------------------------- */
#define	subraster struct subraster_struct /* "typedef" for subraster_struct*/
subraster
  {
  /* --- subraster type --- */
  int	type;				/* charcter or image raster */
  /* --- character info (if subraster represents a character) --- */
  mathchardef *symdef;			/* mathchardef identifying image */
  int	baseline;			/*0 if image is entirely descending*/
  int	size;				/* font size 0-4 */
  /* --- upper-left corner for bitmap (as overlaid on a larger raster) --- */
  int	toprow, leftcol;		/* upper-left corner of subraster */
  /* --- pointer to raster bitmap image of subraster --- */
  raster *image;			/*ptr to bitmap image of subraster*/
  } ; /* --- end-of-subraster_struct --- */

/* --- subraster types --- */
#define	CHARASTER	(1)		/* character */
#define	STRINGRASTER	(2)		/* string of characters */
#define	IMAGERASTER	(3)		/* image */
#define	ASCIISTRING	(4)		/* ascii string (not a raster) */

/* ---
 * issue rasterize() call end extract embedded raster from returned subraster
 * -------------------------------------------------------------------------- */
subraster *rasterize();			/* declare rasterize */
#define	make_raster(expression,size)	((rasterize(expression,size))->image)


/* -------------------------------------------------------------------------
font family
-------------------------------------------------------------------------- */
#define	fontfamily	struct fontfamily_struct /* typedef for fontfamily */
fontfamily
  {
  /* -----------------------------------------------------------------------
  several sizes, fontdef[0-7]=tiny,small,normal,large,Large,LARGE,huge,HUGE
  ------------------------------------------------------------------------ */
  int	family;				/* font family e.g., 2=math symbol */
  chardef *fontdef[LARGESTSIZE+2];	/*small=(fontdef[1])[charnum].image*/
  } ; /* --- end-of-fontfamily_struct --- */
/* --- dummy font table (for contexts requiring const) --- */
#define dummyfonttable \
  { \
   {   -999, {  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL  } } \
  }


/* -------------------------------------------------------------------------
S t a t i c   F o n t   D a t a   u s e d   b y   M i m e t e x
-------------------------------------------------------------------------- */
#ifdef TEXFONTS
/* ---
 * font info generated for us by gfuntype
 * -------------------------------------- */
#ifdef INITVALS
  #include "texfonts.h"
#endif

/* ---
 * font families (by size), just a table of preceding font info
 * ------------------------------------------------------------ */
/* --- for low-pass anti-aliasing --- */
STATIC	fontfamily aafonttable[]
#ifdef INITVALS
 =
 {/* -----------------------------------------------------------------------------------------
    family     size=0,        1,        2,        3,        4,        5,        6,        7
  ----------------------------------------------------------------------------------------- */
  {   CMR10,{   cmr83,   cmr100,   cmr118,   cmr131,   cmr160,   cmr180,   cmr210,   cmr250}},
  {  CMMI10,{  cmmi83,  cmmi100,  cmmi118,  cmmi131,  cmmi160,  cmmi180,  cmmi210,  cmmi250}},
  { CMMIB10,{ cmmib83, cmmib100, cmmib118, cmmib131, cmmib160, cmmib180, cmmib210, cmmib250}},
  {  CMSY10,{  cmsy83,  cmsy100,  cmsy118,  cmsy131,  cmsy160,  cmsy180,  cmsy210,  cmsy250}},
  {  CMEX10,{  cmex83,  cmex100,  cmex118,  cmex131,  cmex160,  cmex180,  cmex210,  cmex250}},
  {  RSFS10,{  rsfs83,  rsfs100,  rsfs118,  rsfs131,  rsfs160,  rsfs180,  rsfs210,  rsfs250}},
  { BBOLD10,{ bbold83, bbold100, bbold118, bbold131, bbold160, bbold180, bbold210, bbold250}},
  {STMARY10,{stmary83,stmary100,stmary118,stmary131,stmary160,stmary180,stmary210,stmary250}},
  {    -999,{    NULL,     NULL,     NULL,     NULL,     NULL,     NULL,     NULL,     NULL}}
 }
#endif
 ; /* --- end-of-aafonttable[] --- */

/* --- for super-sampling anti-aliasing --- */
#ifdef SSFONTS
 STATIC fontfamily ssfonttable[]
 #ifdef INITVALS
  =
  {/* -----------------------------------------------------------------------------------------
    family     size=0,        1,        2,        3,        4,        5,        6,        7
   ----------------------------------------------------------------------------------------- */
   {  CMR10,{  cmr250,  cmr1200,  cmr1200,  cmr1200,  cmr1200,  cmr1200,  cmr1200,  cmr1200}},
   { CMMI10,{ cmmi250,  cmmi100,  cmmi118,  cmmi131,  cmmi160,  cmmi180,  cmmi210,  cmmi250}},
   {CMMIB10,{cmmib250, cmmib100, cmmib118, cmmib131, cmmib160, cmmib180, cmmib210, cmmib250}},
   { CMSY10,{ cmsy250,  cmsy100,  cmsy118,  cmsy131,  cmsy160,  cmsy180,  cmsy210,  cmsy250}},
   { CMEX10,{ cmex250,  cmex100,  cmex118,  cmex131,  cmex160,  cmex180,  cmex210,  cmex250}},
   { RSFS10,{ rsfs250,  rsfs100,  rsfs118,  rsfs131,  rsfs160,  rsfs180,  rsfs210,  rsfs250}},
  { BBOLD10,{bbold250, bbold100, bbold118, bbold131, bbold160, bbold180, bbold210, bbold250}},
 {STMARY10,{stmary250,stmary100,stmary118,stmary131,stmary160,stmary180,stmary210,stmary250}},
   {   -999,{    NULL,     NULL,     NULL,     NULL,     NULL,     NULL,     NULL,     NULL}}
  }
 #endif
  ; /* --- end-of-ssfonttable[] --- */
#else
 /*GLOBAL(fontfamily,ssfonttable[],dummyfonttable);*/
 STATIC fontfamily ssfonttable[]
 #ifdef INITVALS
  = dummyfonttable
 #endif
  ;
#endif  /* #ifdef SSFONTS */
#else
 /*GLOBAL(fontfamily,aafonttable[],dummyfonttable);*/
 /*GLOBAL(fontfamily,ssfonttable[],dummyfonttable);*/
 STATIC fontfamily
	aafonttable[]
	#ifdef INITVALS
	 = dummyfonttable
	#endif
	,
	ssfonttable[]
	#ifdef INITVALS
	 = dummyfonttable
	#endif
	;
#endif  /* #ifdef TEXFONTS */

/* --- select current font table (for lowpass or supersampling) --- */
#ifndef ISSUPERSAMPLING
  #define ISSUPERSAMPLING 0
#endif
GLOBAL(fontfamily,*fonttable,(ISSUPERSAMPLING?ssfonttable:aafonttable));

/* --- supersampling shrink factors corresponding to displayed sizes --- */
STATIC	int shrinkfactors[]		/*supersampling shrinkfactor by size*/
#ifdef INITVALS
 =
    {  3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
  /*{ 15,13,11, 9, 7, 5, 3, 1 }*/
#endif
 ;

/* ---
 * handler functions for math operations
 * ------------------------------------- */
subraster *rastflags();			/* set flags, e.g., for \rm */
subraster *rastfrac();			/* handle \frac \atop expressions */
subraster *rastackrel();		/* handle \stackrel expressions */
subraster *rastmathfunc();		/* handle \lim,\log,etc expressions*/
subraster *rastoverlay();		/* handle \not */
subraster *rastspace();			/* handle math space, \hspace,\hfill*/
subraster *rastnewline();		/* handle \\ newline */
subraster *rastarrow();			/* handle \longrightarrow, etc */
subraster *rastuparrow();		/* handle \longuparrow, etc */
subraster *rastsqrt();			/* handle \sqrt */
subraster *rastaccent();		/* handle \hat \vec \braces, etc */
subraster *rastfont();			/* handle \cal{} \scr{}, etc */
subraster *rastbegin();			/* handle \begin{}...\end{} */
subraster *rastleft();			/* handle \left...\right */
subraster *rastmiddle();		/* handle \left...\middle...\right */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -