Giter Club home page Giter Club logo

Comments (10)

alphapapa avatar alphapapa commented on July 28, 2024

I'm guessing that this would be possible, but I don't know anything about it, so I'll have to look into it. I have very little knowledge of LaTeX as well... :)

from org-rifle.

stardiviner avatar stardiviner commented on July 28, 2024

To toggle LaTeX fragments preview in Org-mode buffer, there is an option (setq org-startup-with-latex-preview t) or function org-toggle-latex-fragment to toggle latex fragments preview.

from org-rifle.

stardiviner avatar stardiviner commented on July 28, 2024

I tried (add-hook 'helm-org-rifle-after-init-hook #'org-toggle-latex-fragment) But it report error:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  looking-at(nil)
  org-element-context()
  org-toggle-latex-fragment()
  run-hooks(h-after-init-hook157)
  helm-log-run-hook(h-after-init-hook157)

I remember that this seems because org-toggle-latex-fragment does not support in non-file buffer.

from org-rifle.

alphapapa avatar alphapapa commented on July 28, 2024

Adding it to that hook won't work, because when that hook is run, the Helm buffer is empty.

However, I just pushed the branch https://github.com/alphapapa/helm-org-rifle/tree/latex-preview which calls org-preview-latex-fragment in the fontifying function. I doubt that it will work, but please give it a try and let me know. :)

from org-rifle.

stardiviner avatar stardiviner commented on July 28, 2024

It does not work after tested.

from org-rifle.

alphapapa avatar alphapapa commented on July 28, 2024

Thanks. I can't promise anything, but if you have time, could you send me a small sample Org file with some LaTeX fragments that you would want to show up?

from org-rifle.

stardiviner avatar stardiviner commented on July 28, 2024
#+STARTUP: latexpreview

* LaTeX symbol -- \[ \LaTeX \]

#+BEGIN_SRC latex
\LaTeX
#+END_SRC


* Mathematics

** Complex Formulas Examples -- \[ \begin{equation} .. \end{equation} \]

\begin{equation}
\operatorname{dist}_c = \frac{2}{N(N+1)} \sum_{i \leqslant N} \sum_{j \geqslant i} \operatorname{dist}(i,j)
\end{equation}


\begin{equation}
C(i) = \frac{3(K-2)}{4(K-1)} \approx \frac34
\end{equation}


\begin{eqnarray*}
\hat{f}(x) & \propto & \sum_{\nu} \frac{|F(\nu)H(\nu)|^2}{|N(\nu)|^2}  
           \frac{G(\nu)}{H(\nu)} e^{\frac{2 \pi i \nu x}{N}}\\
           & \propto & \sum_{\nu} \frac{|F(\nu)|^2}{|N(\nu)|^2} H(\nu) H^*(\nu) 
           \frac{G(\nu)}{H(\nu)} e^{\frac{2 \pi i \nu x}{N}}\\
           & \propto & \sum_{\nu} H^*(\nu) G(\nu) e^{\frac{2 \pi i \nu x}{N}}
\end{eqnarray*}

** Symbols

- [[file+sys:Data/docs/The%20Comprehensive%20LaTeX%20Symbol%20List.pdf][The Comprehensive LaTeX Symbol List (PDF)]]

*** Operators

- \[ \pm \]
- \[ \mp \]
- \[ \times \]
- \[ \div \]
- \[ \cdot \]
- \[ \ast \]
- \[ \star \]
- \[ \dagger \]
- \[ \ddagger \]
- \[ \land \]
- \[ \wedge \]
- \[ \vee \]
- \[ \amalg \]
- \[ \cap \]
- \[ \cup \]
- \[ \uplus \]
- \[ \sqcap \]
- \[ \sqcup \]
- \[ \oplus \]
- \[ \ominus \]
- \[ \otimes \]
- \[ \circ \]
- \[ \bullet \]
- \[ \diamond \]
- \[ \lhd \]
- \[ \rhd \]
- \[ \unlhd \]
- \[ \unrhd \]
- \[ \oslash \]
- \[ \odot \]
- \[ \bigcirc \]
- \[ \triangleleft \]
- \[ \triangleright \]
- \[ \Diamond \]
- \[ \bigtriangleup \]
- \[ \bigtriangledown \]
- \[ \Box \]
- \[ \setminus \]
- \[ \wr \]
- \[ x^{\circ} \]

from org-rifle.

stardiviner avatar stardiviner commented on July 28, 2024

@alphapapa Have you tried my org file example?

from org-rifle.

alphapapa avatar alphapapa commented on July 28, 2024

Hi, sorry for the wait. I just did some experimenting, but I don't think it is feasible to do this.

Generating a preview for a fragment is slow, requiring writing multiple files to disk (at least 3, IIUC: one for the temporary org buffer, one for the generated DVI file, and another for the converted PNG file). This would be very slow for showing a number of fragments.

It might be possible to show already-generated fragment previews, but I'd have to 1) learn how Emacs handles displaying images in buffers, 2) figure out how to find images in buffers, 3) find out how to associate them with fragments that are in search results, and then 4) try to display them in a Helm buffer as a candidate. And I'm not sure if 4 is even possible.

If it is possible, it would be many hours of work for a feature that I don't think many people would use (and I wouldn't have any use for it, myself).

I'm sorry to disappoint you. I'd like to add it and make it more useful for you, but it's not feasible for me to do so. I'll leave the feature request open in case someone else wants to try someday. :)

P.S. If you have a few minutes, I'd appreciate help testing #11. :)

from org-rifle.

stardiviner avatar stardiviner commented on July 28, 2024

I see, thanks for your diving in. I might try this someday.

from org-rifle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.