BookStack icon indicating copy to clipboard operation
BookStack copied to clipboard

Latex support

Open hyer opened this issue 7 years ago • 20 comments

For Feature Requests

Desired Feature: I wonder if the Latex expression will be support in the future. thanks.

For Bug Reports

  • BookStack Version (Found in settings, Please don't put 'latest'):
  • PHP Version:
  • MySQL Version:
Expected Behavior
Current Behavior
Steps to Reproduce

hyer avatar Dec 27 '17 16:12 hyer

Seems like KaTex could easily be added to the renderer : https://github.com/Khan/KaTeX

Chris3Arcadia avatar Jul 13 '18 04:07 Chris3Arcadia

This would also be quite useful to me!

pedrovhb avatar Jul 31 '18 19:07 pedrovhb

Hi! Please tell me how to install LaTeX support? How to integrate Latex?

Semihal avatar Feb 18 '20 20:02 Semihal

@Semihal this doesn't exist as a feature yet.

homotechsual avatar Feb 18 '20 20:02 homotechsual

It is a pity that there is no support for Latex. The engine then doesn't make sense to me :(

Semihal avatar Feb 18 '20 20:02 Semihal

If this had latex i'd install this in a heartbeat

toomastamm avatar Mar 09 '20 21:03 toomastamm

Not one person has actually expressed what latex support would look like. It's all well-and-good saying "it should have x" but this is open-source - which means:

  1. Provide more detail on what you're looking for if you're expecting other people to put in the effort.

or

  1. Add latex support yourself and submit a PR

Edit:

Are you looking for latex as another editor? Are you looking to be able to add latex expressions within TinyMCE?

homotechsual avatar Mar 10 '20 13:03 homotechsual

I'm looking to include math formulas in the documentation I'm writing. So having the ability to add latex expressions and edit them later if needed within TinyMCE and having them rendered as an image is what I am looking for yes.

This plugin for TinyMCE pretty much replicates what I am looking for: http://latex.codecogs.com/eqneditor/integration/tinymce_v4/install.php

The plugin has a bunch of shortcuts for latex that is not what I need but might be useful for others.

toomastamm avatar Mar 10 '20 13:03 toomastamm

@MikeyMJCO , Hi! @toomastamm suggested a good option or maybe just enable Latex support. I would like to write formulas inside the $latex$ or $$latex$$ (for centered) tag, and after opening the page, they are drawn (this allows KaTeX do).

Semihal avatar Mar 10 '20 13:03 Semihal

It is kind of possible to insert Latex in the BookStack editor right now through the draw.io integration:

  1. Edit your page.
  2. Click the drawing (Shapes) icon in the top editor bar (WYSIWYG editor), Draw.io will open.
  3. In the toolbar at the top enable: Extras > Mathematical Typesetting
  4. Insert a text section and insert latex text like so:
$$\sqrt{3×-1}+(1+x)^2$$
  1. Save the drawing and it'll be inserted in your page.
  2. Double click the drawing to re-edit.

Draw.io page for reference: https://desk.draw.io/support/solutions/articles/16000032875-how-to-use-mathematical-typesetting-

ssddanbrown avatar Mar 10 '20 14:03 ssddanbrown

@ssddanbrown, Hi! How workaround works. But otherwise it is inconvenient (when there are a lot of formulas ).

Semihal avatar Mar 10 '20 15:03 Semihal

This, unfortunately, does not work very correctly:( test

Semihal avatar Mar 10 '20 15:03 Semihal

I managed to get math/latex notation working to a degree:

  1. I just set up bookstack using this docker compose
  2. switched it to markdown-mode in the settings
  3. Went to the settings and added mathjax to the HTML header as described here:
<script type="text/javascript" id="MathJax-script" async
  src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>

this rendered math just fine for me, granted it would require web access but you could download the library locally if you wanted I should imagine.

here's a screenshot:

screenshot

RyanGreenup avatar Jun 03 '20 15:06 RyanGreenup

This, unfortunately, does not work very correctly:( test

Just enlarge the text to get full view.

xind avatar Jul 14 '20 07:07 xind

@ssddanbrown latex integration via draw.io would suffice but if try to do it on the demo site for BookStack - this does not seem to work

Screenshot 2021-04-06 at 10 40 03

even though it is rendered correctly once I double click the diagram:

Screenshot 2021-04-06 at 10 41 25

is it a problem on BookStack side or Draw.io side? thanks

merkliopas avatar Apr 06 '21 07:04 merkliopas

@merkliopas I got the same problem. I guess this is an export problem from drawio. Went to the drawio site and tried to embed it as an image.

app.diagrams.net -> embed -> image (guess this is used for bookstack):

exported image:

When I use export -> png the content is rendered correctly.

For now you can copy the embedded code (image/svg) and paste it in the source of the page. For some reason this works. Hopefully this will be resolved because this is one of the few ways to write math in bookstack 😉

Linbreux avatar Apr 14 '21 21:04 Linbreux

I would love this feature!

joshuabdavid avatar Oct 15 '21 12:10 joshuabdavid

Since this request is still open, here is a possible solution everyone can do themselves.

You can simply add the following scripts to your Custom HTML to render MathJAX. Important to know: This does not work with Exporting the Book/Page. If you print it to a PDF it works fine.

Source: https://www.mathjax.org/#gettingstarted

Hutch79 avatar Jan 13 '23 13:01 Hutch79

It would be great to have a side-by-side editor! Scientists, mathematicians would love to have this feature.

kimkyngt avatar Aug 27 '23 06:08 kimkyngt

The MathJAX script works well, but every time you edit the page (in Markdown mode at least) it somehow strips off the delimiters and turns the LaTeX into just native text characters. Anyone know why this might be or a workaround? I do agree that this is an important feature for various academic uses.

sfahmy avatar Feb 19 '24 08:02 sfahmy