3

I should preface this by saying I've had little to no exposure to LaTeX or Python until the past 24 hours where I've been trying madly trying to figure out what command, function, etc. means what! I've scoured countless threads as well which have helped but I'm afraid I'm stuck at this point. Apologies in advance if I'm misusing vocabulary!

I'm currently using Anki (2.1) to study for the MCAT and customized my cards to look a certain way. I wanted to edit the appearance of the LaTeX equations that I'm inputting (formulas I want to memorize) so that it looks neater on my cards. I managed to figure out how to make the background transparent (I installed the "Edit Latex build process" add-on) but I can't figure out how to change the font to something similar to a type-writer-ish font and how to change the font color to white (or at least some color I want).

In the header (preamble?) I've put:

\documentclass[12pt]{article}
\setmainfont{lmtt}
\fontfamily{lmtt}\selectfont
\special{papersize=3in,5in}
\usepackage[utf8]{inputenc}
\usepackage{amssymb,amsmath}
\pagestyle{empty}
\setlength{\parindent}{0in}
\usepackage{xcolor}
\textcolor{white}
\begin{document}

At this point I have no idea if I'm even inputting code in the right place or not...

Any help would be very much appreciated – thank you in advance! :)

0

1 Answer 1

2

Here is one possible template you can extend. I tried to keep it pretty minimal while supporting the specific features you requested. It’s possible to get a lot fancier. This should be straightforward to add cards to, though.

\documentclass[12pt]{article}
% Sets up the geometry of each page to fit on one of your cards:
\usepackage[paperwidth=5in, paperheight=3in]{geometry}
% Supports the same color names as HTML and CSS:
\usepackage[svgnames, Svgnames, HTML]{xcolor}
% Loads amsmath plus some extra stuff.
\usepackage{mathtools}
% Enables modern, Unicode fonts:
\usepackage{unicode-math}

% Make all the fonts in the document match each other’s height:
\defaultfontfeatures{ Scale = MatchUppercase, Ligatures = TeX }

% I would not normally advise you to use a monospaced font as your main font,
% but if you want to, here is how:
\setmainfont{Anonymous Pro}[Scale = 1.0]
\setmonofont{Anonymous Pro}

% If you want to select a monospace font only some of the time, you might try
% the alltt package.

% You will also need a math font.  This sets the letters in math mode to the
% same as your text font, and declares a fallback for the rest:
\setmathfont{GFS Neohellenic Math}
\setmathfont[range=up]{Anonymous Pro}
\setmathfont[range=it]{Anonymous Pro Italic}
\setmathfont[range=bfup]{Anonymous Pro Bold}
\setmathfont[range=bfit]{Anonymous Pro Bold Italic}

% You would declare your foreground and background colors here.

\begin{document}
\section*{\color{Navy}Trigonometric identities}

\begin{align*}
 &\text{SOH} & &\text{CAH} \\
   \sin^2 x &= 1 - \cos^2 x &
   \cos^2 x &= 1 - \sin^2 x \\
 \csc x &= \frac{1}{\sin x} &
   \sec x &= \frac{1}{\cos x} \\
 \sin (-x) &= - \sin x &
   \cos (-x) &= \cos x
\end{align*}
\clearpage

\section*{\color{Navy}Law of Sines and Cosines}

\begin{itemize}
  \item \( \frac{\sin \alpha}{\Alpha} = 
           \frac{\sin \beta}{\Beta} =
           \frac{\sin \gamma}{\Gamma} \)
  \item \( C^2 = A^2 + B^2 - 2AB \cdot \cos c \)
\end{itemize}

\end{document}

Card 1

Card 2

Because it uses modern, Unicode fonts, it will only compile with lualatex or xelatex.

Although I don’t demonstrate it here, as you wouldn’t be able to see it in the sample images, \nopagecolor sets the background transparent, and you can put \color{white} sets the foreground color. Both commands are from xcolor.

For Backward-Compatibility

Since you don’t have the anonymouspro package and seem to be restricted to PDFLaTeX, here is a version using legacy packages:

\documentclass[12pt]{article}
% Sets up the geometry of each page to fit on one of your cards:
\usepackage[paperwidth=5in, paperheight=3in]{geometry}
% Sets up the legacy 8-bit font encodings:
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[utf8]{inputenc} % The default since 2018.
% Loads some common math symbols.  Mostly overwritten by newtx.
\usepackage{amssymb}
% Loads newtx math with newtxtt as the default text font:
\usepackage[ttdefault]{newtxtt}
\usepackage{newtxmath}
% Uses the text font for math symbols:
\usepackage{mathastext}
% Supports the same color names as HTML and CSS:
\usepackage[svgnames, Svgnames, HTML]{xcolor}
% Loads amsmath plus some extra stuff.
\usepackage{mathtools}
% If you need additional \mathscr, \mathcal, \mathfrak or \mathbb alphabets,
% consider loading mathalfa here.  This template also would need to load some
% extra packages to support Greek.

% You would declare your foreground and background colors here.

\begin{document}
\section*{\color{Navy}Trigonometric identities}

\begin{align*}
 &\text{SOH} & &\text{CAH} \\
   \sin^2 x &= 1 - \cos^2 x &
   \cos^2 x &= 1 - \sin^2 x \\
 \csc x &= \frac{1}{\sin x} &
   \sec x &= \frac{1}{\cos x} \\
 \sin (-x) &= - \sin x &
   \cos (-x) &= \cos x
\end{align*}
\clearpage

\section*{\color{Navy}Law of Sines and Cosines}

\begin{itemize}
  \item \( \frac{\sin a}{A} = 
           \frac{\sin b}{B} =
           \frac{\sin c}{C} \)
  \item \( C^2 = A^2 + B^2 - 2AB \cdot \cos c \)
\end{itemize}

\end{document}

Card 1 Card 2

20
  • I put in the code as you've written but it's still not changing the appearance of any formulas I put in... I should also note I'm using a Mac (Anki says it uses LaTeX) so would that change anything?
    – wuhoo
    Feb 1, 2019 at 22:53
  • @wuhoo Make sure you have the anonymouspro package installed, that you’re compiling with lualatex or xelatex, and that you’re actually generating a new output file instead of failing with an error and not updating the PDF.
    – Davislor
    Feb 2, 2019 at 0:14
  • If you’re unable to use LuaTeX or XeTeX, the code I wrote could be adapted to PDFTeX with a few modifications to the preamble.
    – Davislor
    Feb 2, 2019 at 0:17
  • How do I install the anonymouspro package? Also, I'm not sure how to use lualatex or xelatex with Anki... how do I adapt it for pdftex? The error I'm getting is telling me that it can't be run with pdftex so I think I have to adapt it.
    – wuhoo
    Feb 2, 2019 at 0:19
  • @wuhoo Okay, I’m not familiar with Anki, so I’d look in the settings for an option to run LuaLaTeX or XeLaTeX instead. Your LaTeX distribution should come with a package manager, but you haven’t said what that is. I’ll get on a revised version when I have the chance.
    – Davislor
    Feb 2, 2019 at 0:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .