lzanini / mdbook-katex

A preprocessor for mdBook, rendering LaTex equations to HTML at build time.
MIT License
205 stars 34 forks source link

Offscreen Tex content #4

Closed Azgrom closed 3 years ago

Azgrom commented 3 years ago

Hi! I noticed the inconvenience of a large line of Tex content continuing after the mdbook page width ends.

Here is a image showing it: offscreen1

With the laptop's touchpad I can scroll right to se the remaining content, such as in the following image: offscreen2 On this second image one can notice the entire content is moved to the left. There is no of that margin defined by mdbook...

I am not sure if it is a mdbook-katex thing. Is there some hidden margin configuration I am not aware? Here is the feedback, Just in case.

lzanini commented 3 years ago

Hello,

I've had this issue before with figures / large tables without equations, so I think it has to do with the way mdbook defines its margins rather than with this preprocessor.

Anyway, you can probably get away with some css code, for example

/* additional.css */
.content main {
    margin-left: 1%;
    margin-right: 1%;
}

and adding to your toml file

[output.html]
additional-css = ["path/to/additional.css"]

If you have some CSS knowledge (I don't) you can probably do something better than this, and adjust the margins dynamically depending on the content size. If you manage to do that, let me know !

Azgrom commented 3 years ago

Hey @lzanini, thank you for the quick response!

I implemented this CSS snippet you suggested, but it seems to work by coincidence on those matrices above. The reason I am saying this is because if I change screen resolution the margins will be different. Which implies that a bit larger mathematical expression, or a bit smaller screen resolution, than 1080p, would not work. Even with the 1% CSS margin.

I also have no CSS knowledge, so there might be a better CSS solution we are not aware.

If I find out it is a Rust thing, I will send you a pull request.

PS: I could just break this large expressions into multiple lines. But I am not counting it as a solution because it would not be possible with a really big matrix. Or whatever mathematical object that cannot be broken into different lines...