File: proof.c

package info (click to toggle)
latex2rtf 2.3.18a-5
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,392 kB
  • sloc: ansic: 20,424; makefile: 660; sh: 478; perl: 22
file content (55 lines) | stat: -rwxr-xr-x 1,548 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* proof.c - LaTeX to RTF conversion program

This file contains a function used to display data within \begin{proof} ... \end{proof}
environment.

Authors:
    2018 Alex Itkes
*/

#include <stdlib.h>
#include "main.h"
#include "chars.h"
#include "parser.h"
#include "commands.h"
#include "vertical.h"
#include "convert.h"
#include "cfg.h"

/* This function writes the text within \begin{proof} ... \end{proof} environment
   to RTF.
   First it writes the word "Proof" translated to a proper language, then
   converts the text within the environment just as any other text block,
   and then terminates the with a square mark.
   Actually all the work is done while processing the begin tag.
*/
void CmdProof (int code)
{
    if (code & ON) {
        /* Get the text until the end tag. */
        char * proof = getTexUntil ("\\end{proof}", 0);

        diagnostics(4, "Entering CmdProof");

        startParagraph ("Normal", PARAGRAPH_GENERIC);

        /* The PROOFNAME command will display the "Proof" word translated to the right language. */
        fprintRTF("{\\i ");
        ConvertBabelName("PROOFNAME");
        fprintRTF("}. ");

        /* Transform all text until the end tag. */
        ConvertString (proof);

        /* A square marks the end of a proof. */
        CmdUnicodeChar (9633);

        CmdEndParagraph(0);
        ConvertString ("\\end{proof}");

        diagnostics(4, "Exiting CmdProof");

        /* The getTexUntil () function returns the pointer created by strdup (), so free it. */
        free (proof);
    }
}