JoeStat1986
JoeStat1986

Reputation: 79

Math Latex horizontally aligned with text

So I am using the flashcard software Anki which uses LaTex for its math equation formatting

So when I write an equation with a fraction in the same line as standard text, it automatically allignts the lowest point of the equation, in the case the denomitor of the fraction, with the bottom the normal text. How can I get the equation and text to be horizontally aligned.

Some text before an equation: [$]\frac{x^2}{y}[/$]

Upvotes: 2

Views: 2277

Answers (2)

trimitri
trimitri

Reputation: 41

As the LaTeX snippets are finally rendered as images, this is a CSS issue. The equations become centered when you add the following rule to your card CSS:

img[src*="latex"] {
    vertical-align: middle;
}

This CSS rule matches all images whose file name contains the string latex and centers them in their respective line of text. It thus matches all anki-generated latex images.

If needed, I can supply info on how to edit the card CSS or on how to make Anki and Latex work together.

Upvotes: 1

DrLulz
DrLulz

Reputation: 146

What I did was to make the equation itself a bit smaller to better match the text around it.

To add it for all equations go to: Tools > Manage Note Types > Options > Header
Or you could place it inline: [$]\tiny[/$]

An excellent writeup on sizing text this way can be found at tex.stackexchange
And you may be able to get better results by changing the font itself.

Upvotes: 1

Related Questions