parpalak / upmath.me

Markdown and LaTeX online editor - create text for web with equations and diagrams
https://upmath.me/
MIT License
323 stars 40 forks source link

feature request: add latex package quiver #35

Closed yiran-frank-mao closed 2 months ago

yiran-frank-mao commented 2 months ago

Hi, thanks for upmath.me, this is really fantastic! As doing math a lot, especially commutative diagrams, can you add the latex package quiver to upmath.me? Many thanks and appreciate this awesome work!

parpalak commented 2 months ago

Hello, thanks for your reply.

You can include the code from quiver as usual latex code. If it is not rendered correctly, you can prepend the contents of quiver.sty in the formula. Here is an example%0A%20%20%20%20and%20(%24(%5Ctikztostart)!1-%5Cpv%7Bpos%7D!(%5Ctikztotarget)!%5Cpv%7Bheight%7D!270%3A(%5Ctikztotarget)%24)%0A%20%20%20%20..%20(%5Ctikztotarget)%5Ctikztonodes%7D%7D%2C%0A%20%20%20%20settings%2F.code%3D%7B%5Ctikzset%7Bquiver%2F.cd%2C%231%7D%0A%20%20%20%20%20%20%20%20%5Cdef%5Cpv%23%231%7B%5Cpgfkeysvalueof%7B%2Ftikz%2Fquiver%2F%23%231%7D%7D%7D%2C%0A%20%20%20%20quiver%2F.cd%2Cpos%2F.initial%3D0.35%2Cheight%2F.initial%3D0%7D%0A%25%20TikZ%20arrowhead%2Ftail%20styles.%0A%5Ctikzset%7Btail%20reversed%2F.code%3D%7B%5Cpgfsetarrowsstart%7Btikzcd%20to%7D%7D%7D%0A%5Ctikzset%7B2tail%2F.code%3D%7B%5Cpgfsetarrowsstart%7BImplies%5Breversed%5D%7D%7D%7D%0A%5Ctikzset%7B2tail%20reversed%2F.code%3D%7B%5Cpgfsetarrowsstart%7BImplies%7D%7D%7D%0A%25%20TikZ%20arrow%20styles.%0A%5Ctikzset%7Bno%20body%2F.style%3D%7B%2Ftikz%2Fdash%20pattern%3Don%200%20off%201mm%7D%7D%0A%5C%5B%5Cbegin%7Btikzcd%7D%0A%09Gx%20%26%20Fx%20%26%20Gx%20%26%20Fx%20%5C%5C%0A%09Gy%20%26%20Fy%20%26%20Gy%20%26%20Fy%0A%09%5Carrow%5B%22%7B%5Cbeta_x%7D%22%2C%20from%3D1-1%2C%20to%3D1-2%5D%0A%09%5Carrow%5B%22%22%7Bname%3D0%2C%20anchor%3Dcenter%2C%20inner%20sep%3D0%7D%2C%20%221%22%2C%20curve%3D%7Bheight%3D-24pt%7D%2C%20from%3D1-1%2C%20to%3D1-3%5D%0A%09%5Carrow%5B%22Gf%22'%2C%20from%3D1-1%2C%20to%3D2-1%5D%0A%09%5Carrow%5B%22%7B%5Calpha_x%7D%22%2C%20from%3D1-2%2C%20to%3D1-3%5D%0A%09%5Carrow%5B%22Ff%22%7Bdescription%7D%2C%20from%3D1-2%2C%20to%3D2-2%5D%0A%09%5Carrow%5B%22%7B%5Cbeta_x%7D%22%2C%20from%3D1-3%2C%20to%3D1-4%5D%0A%09%5Carrow%5B%22Gf%22%7Bdescription%7D%2C%20from%3D1-3%2C%20to%3D2-3%5D%0A%09%5Carrow%5B%22Ff%22%2C%20from%3D1-4%2C%20to%3D2-4%5D%0A%09%5Carrow%5B%22%7B%5Cbeta_f%7D%22%2C%20shorten%20%3C%3D4pt%2C%20shorten%20%3E%3D4pt%2C%20Rightarrow%2C%20from%3D2-1%2C%20to%3D1-2%5D%0A%09%5Carrow%5B%22%7B%5Cbeta_y%7D%22'%2C%20from%3D2-1%2C%20to%3D2-2%5D%0A%09%5Carrow%5B%22%7B%5Calpha_f%7D%22%2C%20shorten%20%3C%3D4pt%2C%20shorten%20%3E%3D4pt%2C%20Rightarrow%2C%20from%3D2-2%2C%20to%3D1-3%5D%0A%09%5Carrow%5B%22%7B%5Calpha_y%7D%22'%2C%20from%3D2-2%2C%20to%3D2-3%5D%0A%09%5Carrow%5B%22%22%7Bname%3D1%2C%20anchor%3Dcenter%2C%20inner%20sep%3D0%7D%2C%20%221%22'%2C%20curve%3D%7Bheight%3D24pt%7D%2C%20from%3D2-2%2C%20to%3D2-4%5D%0A%09%5Carrow%5B%22%7B%5Cbeta'f%7D%22%2C%20shorten%20%3C%3D4pt%2C%20shorten%20%3E%3D4pt%2C%20Rightarrow%2C%20from%3D2-3%2C%20to%3D1-4%5D%0A%09%5Carrow%5B%22%7B%5Cbeta_y%7D%22'%2C%20from%3D2-3%2C%20to%3D2-4%5D%0A%09%5Carrow%5B%22%7B%5Cvarepsilon_x%7D%22%2C%20%3E%3D3pt%2C%20Rightarrow%2C%20from%3D1-2%2C%20to%3D0%5D%0A%09%5Carrow%5B%22%7B%5Ceta_y%7D%22'%2C%20shorten%20%3C%3D4pt%2C%20Rightarrow%2C%20from%3D1%2C%20to%3D2-3%5D%0A%5Cend%7Btikzcd%7D%5C%5D).

In Upmath, packages are included automatically based on the content of a formula. For example, if it contains \begin{tikzpicture}, then the tikz package is included. I do not see what content can trigger automatic inclusion of quiver.sty. If you see a better solution, please let me know.

yiran-frank-mao commented 2 months ago

Oh I see, thanks!