Esempio n. 1
0
 public void remove() {
   if (keyLaTeX != null)
     try {
       JLaTeXMathCache.removeCachedTeXFormula(keyLaTeX);
     } catch (Exception ee) {
       ee.printStackTrace();
     }
 }
Esempio n. 2
0
  public Object getCachedLaTeXKey(
      String latex, int fontSize, int style, ColorAdapter fgColorAdapter) {
    Object newKey;
    try {

      newKey =
          JLaTeXMathCache.getCachedTeXFormula(
              latex,
              TeXConstants.STYLE_DISPLAY,
              style,
              fontSize,
              1 /* inset around the label*/,
              (AwtColorAdapter) fgColorAdapter);
    } catch (ParseException e) {
      if (keyLaTeX != null) {
        // remove old key from cache
        try {
          JLaTeXMathCache.removeCachedTeXFormula(keyLaTeX);
        } catch (Exception ee) {
          ee.printStackTrace();
        }
      }
      throw e;
    }
    if (keyLaTeX != null && !keyLaTeX.equals(newKey)) {
      // key has changed, remove old key from cache
      try {
        JLaTeXMathCache.removeCachedTeXFormula(keyLaTeX);
      } catch (Exception ee) {
        ee.printStackTrace();
      }
      // Application.debug("removing");
    }

    keyLaTeX = newKey;
    return keyLaTeX;
  }