macros missing?

classic Classic list List threaded Threaded
4 messages Options
施 昊 施 昊
Reply | Threaded
Open this post in threaded view
|

macros missing?

Thanks for your amazing work.
I found some commands such as the one used to change size and pmatrix doesn't works on my platform.
For example:

 \tiny as  ---------------

\frac{a}{b} ------------- 


\large f^\prime(x)\ =\lim_{\Delta x\to0}\frac{f(x+\Delta x)-f(x)}{\Delta x}  ----- 


the source code is:

  protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("image/jpeg");
        TeXFormula formula = new TeXFormula(true, EscapeUnescape.unescape(request.getParameter("q")));
        TeXIcon icon = formula.createTeXIcon(TeXConstants.STYLE_DISPLAY, 20);
        icon.setInsets(new Insets(5, 5, 5, 5));
        BufferedImage image = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2 = image.createGraphics();
        JLabel jl = new JLabel();
        jl.setForeground(new Color(0, 0, 0));
        icon.paintIcon(null, g2, 0, 0);
        //g2.setColor(Color.white);
        //g2.fillRect(0, 0, icon.getIconWidth(), icon.getIconHeight());
        try {
            ImageIO.write(image, "png", response.getOutputStream());
        } catch (IOException ex) {
        }
    }


This is far away from mimetex. Did I do something wrong? thank you again.
Calixte Denizet-2 Calixte Denizet-2
Reply | Threaded
Open this post in threaded view
|

Re: macros missing?

Le jeudi 21 avril 2011 à 02:08 +0800, 施 昊 a écrit :

> Thanks for your amazing work.
> I found some commands such as the one used to change size and pmatrix
> doesn't works on my platform.
> For example:
>
>
>  \tiny as  ---------------
>
>
> \frac{a}{b} -------------
>
>
>
>
> \large f^\prime(x)\ =\lim_{\Delta x\to0}\frac{f(x+\Delta
> x)-f(x)}{\Delta x}  -----
>
>
>

Hi,


>
> the source code is:
>
>
>   protected void processRequest(HttpServletRequest request,
> HttpServletResponse response)
>             throws ServletException, IOException {
>         response.setContentType("image/jpeg");
>         TeXFormula formula = new TeXFormula(true,
> EscapeUnescape.unescape(request.getParameter("q")));
>         TeXIcon icon =
> formula.createTeXIcon(TeXConstants.STYLE_DISPLAY, 20);
>         icon.setInsets(new Insets(5, 5, 5, 5));
>         BufferedImage image = new BufferedImage(icon.getIconWidth(),
> icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
>         Graphics2D g2 = image.createGraphics();
>         JLabel jl = new JLabel();
>         jl.setForeground(new Color(0, 0, 0));
>         icon.paintIcon(null, g2, 0, 0);
>         //g2.setColor(Color.white);
>         //g2.fillRect(0, 0, icon.getIconWidth(),
> icon.getIconHeight());
>         try {
>             ImageIO.write(image, "png", response.getOutputStream());
>         } catch (IOException ex) {
>         }
>     }
>
>

In my mind the faulty code is :
EscapeUnescape.unescape(request.getParameter("q"))

test with new TeXFormula(true, "\\large f^\\prime(x)\\ =\\lim_{\\Delta x
\\to0}\\frac{f(x+\\Delta x)-f(x)}{\\Delta x}"); and you'll that all is
ok.

Give me a feedback.

Best regards,

Calixte

>
>
> This is far away from mimetex. Did I do something wrong? thank you
> again.


Calixte Denizet-2 Calixte Denizet-2
Reply | Threaded
Open this post in threaded view
|

Re: macros missing?

In reply to this post by 施 昊
Le jeudi 21 avril 2011 à 02:59 +0800, 施 昊 a écrit :
> Oh,I forget the error message
> org.scilab.forge.jlatexmath.XMLResourceParseException: Error creating the temporary command 'f' while constructing the predefined command 'newcommand'!

Weird... :/

What is the jlatexmath version ? What is your OS ? What is your java
version ?

Could you make a try with a git version ?
http://forge.scilab.org/index.php/p/jlatexmath/source/tree/master/

Calixte

> 在 2011-4-21,上午2:17, Calixte Denizet 写道:
>
> > Le jeudi 21 avril 2011 à 02:08 +0800, 施 昊 a écrit :
> >> Thanks for your amazing work.
> >> I found some commands such as the one used to change size and pmatrix
> >> doesn't works on my platform.
> >> For example:
> >>
> >>
> >> \tiny as  ---------------
> >>
> >>
> >> \frac{a}{b} -------------
> >>
> >>
> >>
> >>
> >> \large f^\prime(x)\ =\lim_{\Delta x\to0}\frac{f(x+\Delta
> >> x)-f(x)}{\Delta x}  -----
> >>
> >>
> >>
> >
> > Hi,
> >
> >
> >>
> >> the source code is:
> >>
> >>
> >>  protected void processRequest(HttpServletRequest request,
> >> HttpServletResponse response)
> >>            throws ServletException, IOException {
> >>        response.setContentType("image/jpeg");
> >>        TeXFormula formula = new TeXFormula(true,
> >> EscapeUnescape.unescape(request.getParameter("q")));
> >>        TeXIcon icon =
> >> formula.createTeXIcon(TeXConstants.STYLE_DISPLAY, 20);
> >>        icon.setInsets(new Insets(5, 5, 5, 5));
> >>        BufferedImage image = new BufferedImage(icon.getIconWidth(),
> >> icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
> >>        Graphics2D g2 = image.createGraphics();
> >>        JLabel jl = new JLabel();
> >>        jl.setForeground(new Color(0, 0, 0));
> >>        icon.paintIcon(null, g2, 0, 0);
> >>        //g2.setColor(Color.white);
> >>        //g2.fillRect(0, 0, icon.getIconWidth(),
> >> icon.getIconHeight());
> >>        try {
> >>            ImageIO.write(image, "png", response.getOutputStream());
> >>        } catch (IOException ex) {
> >>        }
> >>    }
> >>
> >>
> >
> > In my mind the faulty code is :
> > EscapeUnescape.unescape(request.getParameter("q"))
> >
> > test with new TeXFormula(true, "\\large f^\\prime(x)\\ =\\lim_{\\Delta x
> > \\to0}\\frac{f(x+\\Delta x)-f(x)}{\\Delta x}"); and you'll that all is
> > ok.
> >
> > Give me a feedback.
> >
> > Best regards,
> >
> > Calixte
> >
> >>
> >>
> >> This is far away from mimetex. Did I do something wrong? thank you
> >> again.
> >
> >
> >
> >
>



Calixte Denizet-2 Calixte Denizet-2
Reply | Threaded
Open this post in threaded view
|

Re: macros missing?

In reply to this post by 施 昊
Did you recompile jlatexmath with tools to obfuscate or to optimize ? If
yes this is not a good idea since I use Java reflection.

Le jeudi 21 avril 2011 à 02:59 +0800, 施 昊 a écrit :

> Oh,I forget the error message
> org.scilab.forge.jlatexmath.XMLResourceParseException: Error creating the temporary command 'f' while constructing the predefined command 'newcommand'!
> 在 2011-4-21,上午2:17, Calixte Denizet 写道:
>
> > Le jeudi 21 avril 2011 à 02:08 +0800, 施 昊 a écrit :
> >> Thanks for your amazing work.
> >> I found some commands such as the one used to change size and pmatrix
> >> doesn't works on my platform.
> >> For example:
> >>
> >>
> >> \tiny as  ---------------
> >>
> >>
> >> \frac{a}{b} -------------
> >>
> >>
> >>
> >>
> >> \large f^\prime(x)\ =\lim_{\Delta x\to0}\frac{f(x+\Delta
> >> x)-f(x)}{\Delta x}  -----
> >>
> >>
> >>
> >
> > Hi,
> >
> >
> >>
> >> the source code is:
> >>
> >>
> >>  protected void processRequest(HttpServletRequest request,
> >> HttpServletResponse response)
> >>            throws ServletException, IOException {
> >>        response.setContentType("image/jpeg");
> >>        TeXFormula formula = new TeXFormula(true,
> >> EscapeUnescape.unescape(request.getParameter("q")));
> >>        TeXIcon icon =
> >> formula.createTeXIcon(TeXConstants.STYLE_DISPLAY, 20);
> >>        icon.setInsets(new Insets(5, 5, 5, 5));
> >>        BufferedImage image = new BufferedImage(icon.getIconWidth(),
> >> icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
> >>        Graphics2D g2 = image.createGraphics();
> >>        JLabel jl = new JLabel();
> >>        jl.setForeground(new Color(0, 0, 0));
> >>        icon.paintIcon(null, g2, 0, 0);
> >>        //g2.setColor(Color.white);
> >>        //g2.fillRect(0, 0, icon.getIconWidth(),
> >> icon.getIconHeight());
> >>        try {
> >>            ImageIO.write(image, "png", response.getOutputStream());
> >>        } catch (IOException ex) {
> >>        }
> >>    }
> >>
> >>
> >
> > In my mind the faulty code is :
> > EscapeUnescape.unescape(request.getParameter("q"))
> >
> > test with new TeXFormula(true, "\\large f^\\prime(x)\\ =\\lim_{\\Delta x
> > \\to0}\\frac{f(x+\\Delta x)-f(x)}{\\Delta x}"); and you'll that all is
> > ok.
> >
> > Give me a feedback.
> >
> > Best regards,
> >
> > Calixte
> >
> >>
> >>
> >> This is far away from mimetex. Did I do something wrong? thank you
> >> again.
> >
> >
> >
> >
>