LaTeX display math alignment in Anki

Frank's Avatar

Frank

08 Nov, 2016 09:24 PM

I've been trying to create mathematics flashcards. Naturally, I wanted LaTeX to be the default typesetting system for those cards. In order to do so, I created a new basic note type named *basic math*. Here's my options header:

    \documentclass[10pt]{article}
    \usepackage[paperwidth=5in, paperheight=100in]{geometry}
    \usepackage[utf8]{inputenc}
    \usepackage{amssymb,amsmath,amsfonts,mathrsfs,color}
    \pagestyle{empty}
    \setlength{\parindent}{0in}
    \newcommand{\C}{\mathbb{C}}
    \newcommand{\N}{\mathbb{N}}
    \newcommand{\Q}{\mathbb{Q}}
    \newcommand{\R}{\mathbb{R}}
    \newcommand{\Z}{\mathbb{Z}}
    \renewcommand{\Re}{\operatorname{Re}}
    \renewcommand{\Im}{\operatorname{Im}}
    \begin{document}

My card type front (in French) is:

     [latex]{{Recto}}[/latex]

My card type back (in French) is:

    {{FrontSide}}
    
    <hr id=answer>
    <br />
    
    [latex]{{Verso}}[/latex]

Finally, here's my card type style:

    .card {
    font-family: arial;
    font-size: 10px;
    text-align: center;
    color: black;
    background-color: white;
    }
    img {
    width: auto;
    height: auto;
    max-height:1000px;
    }

Here's a card front (in French):

    Vrai ou faux ?
    \[
    z-\overline{z}=2\Im z
    \]

and its back:

    Faux. En général,
    \[
    z-\overline{z}=2{\color{red}i}\Im z
    \]

Alas, the rendering shown in the attached file "Anki_Problem" makes it clear that something's weird with the alignment of the display math. If I change the back of the card for this:

    Faux. En général, bla bla bla bla bla bla bla bla bla bla bla
    \[
    z-\overline{z}=2{\color{red}i}\Im z
    \]

then the equation is properly centered (as it should normally be by default with LaTeX): see the attached file "Anki_Problem2".

Therefore, I'd like to know how to get the proper center alignment (as in "Anki_Problem2"), like the Anki math environment [$$][/$$] would give?

  1. Support Staff 1 Posted by Damien Elmes on 09 Nov, 2016 06:32 AM

    Damien Elmes's Avatar

    Hi Frank,

    I'm afraid we can not provide official support for LaTeX, so I'll move your post to the community section.

Comments are closed, but you can start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac