Beispiel #1
0
void 
CmdMusic(int code)
/******************************************************************************
  purpose: Process \begin{music} ... \end{music} environment
 ******************************************************************************/
{
	char *contents;
	char endmusic[] = "\\end{music}";

	if (!(code & ON)) {
		diagnostics(4, "exiting CmdMusic");
		return;
	}

	diagnostics(4, "entering CmdMusic");
	contents = getTexUntil(endmusic, TRUE);
	CmdEndParagraph(0);
	CmdVspace(VSPACE_SMALL_SKIP);
	CmdIndent(INDENT_NONE);
	CmdStartParagraph(FIRST_PAR);
	WriteLatexAsBitmap("\\begin{music}",contents,endmusic);
	ConvertString(endmusic);	
	CmdEndParagraph(0);
	CmdVspace(VSPACE_SMALL_SKIP);
	CmdIndent(INDENT_INHIBIT);
	free(contents);		
}
Beispiel #2
0
void 
CmdPicture(int code)
/******************************************************************************
  purpose: handle \begin{picture} ... \end{picture}
           by converting to png image and inserting
 ******************************************************************************/
{
	char *pre, *post, *picture;	
	
	if (code & ON) {
		pre = strdup("\\begin{picture}");
		post = strdup("\\end{picture}");
		picture=getTexUntil(post,0);
		WriteLatexAsBitmap(pre,picture,post);
		ConvertString(post);  /* to balance the \begin{picture} */
		free(pre);
		free(post);
		free(picture);
	}
}
Beispiel #3
0
void
CmdEquation(int code)
/******************************************************************************
 purpose   : Handle everything associated with equations
 ******************************************************************************/
{
	char *pre, *eq, *post;
	int inline_equation, number, true_code;

	true_code = code & ~ON;	
			
	if (!(code & ON)) return ;

	SlurpEquation(code,&pre,&eq,&post);
	
	diagnostics(4, "Entering CmdEquation --------%x\n<%s>\n<%s>\n<%s>",code,pre,eq,post);

	inline_equation = (true_code == EQN_MATH) || (true_code == EQN_DOLLAR) || (true_code == EQN_RND_OPEN);
	
	number=getCounter("equation");
	
	if (g_equation_comment)
		WriteEquationAsComment(pre,eq,post);
	
	diagnostics(4,"inline=%d  inline_bitmap=%d",inline_equation,g_equation_inline_bitmap);
	diagnostics(4,"inline=%d display_bitmap=%d",inline_equation,g_equation_display_bitmap);
	diagnostics(4,"inline=%d  inline_rtf   =%d",inline_equation,g_equation_inline_rtf);
	diagnostics(4,"inline=%d display_rtf   =%d",inline_equation,g_equation_display_rtf);

	if ((inline_equation && g_equation_inline_bitmap)  || 
		(!inline_equation && g_equation_display_bitmap) ) {
			if (true_code != EQN_ARRAY) {
				PrepareRtfEquation(true_code,FALSE);
				WriteLatexAsBitmap(pre,eq,post);
				FinishRtfEquation(true_code,FALSE);
			} else {
				char *s, *t;
				s=eq;
				diagnostics(4,"eqnarray whole = <%s>",s);
				do {
					t=strstr(s,"\\\\");
					if (t) *t = '\0';
					diagnostics(4,"eqnarray piece = <%s>",s);
					if (strstr(s,"\\nonumber"))
						g_suppress_equation_number = TRUE;
					else
						g_suppress_equation_number = FALSE;

					PrepareRtfEquation(true_code,FALSE);
					WriteLatexAsBitmap("\\begin{eqnarray*}",s,"\\end{eqnarray*}");
					FinishRtfEquation(true_code,FALSE);
					if (t) s = t+2;
				} while (t);
			}
	}

	if ((inline_equation && g_equation_inline_rtf)  || 
		(!inline_equation && g_equation_display_rtf) ) {
		setCounter("equation",number);
		WriteEquationAsRTF(true_code,&eq);	
	}

/* balance \begin{xxx} with \end{xxx} call */	
	if (true_code == EQN_MATH     || true_code == EQN_DISPLAYMATH   ||
		true_code == EQN_EQUATION || true_code == EQN_EQUATION_STAR ||
		true_code == EQN_ARRAY    || true_code == EQN_ARRAY_STAR      )
			ConvertString(post);
	
	free(pre);
	free(eq);
	free(post);
	
}