Adafruit Holiday Shipping Deadlines 2018: Attention! Please place all UPS Next Day orders by Monday 12/17/2018 11 AM EST
0

Adafruit Blog Upgrade: LaTeX Rendering!

[latex]

\quicklatex{color=”#000000″ size=100}

{A^{d}\alpha}\oint_r u_i \cdot T!}

[/latex]

Yesterday, I published a post about opamps here on the blog. This post utilized a new feature here at Adafruit: rendered LaTeX equations. For those that are unfamiliar, LaTeX is a markup language for the TeX system, originally developed by legendary computer scientist Donald Knuth. LaTeX (pronounced “Lay-Tek”), is used by scientists, educators and engineers around the world to format equations so that they look nice and neat, and are easy to read.

About a month ago, in the course of originally drafting that opamp article, I started looking around at LaTeX plugins for WordPress. There are several of these available. All of them have their strengths and weaknesses, but eventually I settled on WP-QuickLaTeX by Pavel Holoborodko, Dmitriy Gubanov and Kim Kirkpatrick.

WPQL supports automatic equation numbering, has built in tikz and pgfplots support, can render alpha-channel PNGs, and supports LaTeX markup in blog comments, which means that the conversation can go both ways. TeX and LaTeX have been around a long time, so there is information all over the place about how to use it, but here are a few tutorials (1, 2)

What this means for you is that we can more easily do technical posts on the blog, and drop transfer functions like this:

[latex]

\begin{equation}

\frac{V_o}{V_i} = \frac{(g_m R_{g})^2} { (s C R_f)^2 + 2 s C R_{g} g_m + (R_{g} g_m)^2}

\end{equation}

[/latex]

Or plots like this:

[latex]

\begin{tikzpicture}
[+preamble]
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
[/preamble]
\begin{axis}
\addplot3[surf,domain=0:360,samples=40] {sin(2*x)*cos(y)};
\end{axis}
\end{tikzpicture}

[/latex]

We’re super-excited to have this new functionality here, and we hope you are too. If you want to take LaTeX for a test drive in the comments, you can use the ![latex] and [/latex] tags at the beginning and end of your LaTeX statements. If you want to make sure your code works before you post it, you can test it at quicklatex.com (include the preamble under “choose options” — thanks, zerth!)

Try it out now!

 


Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, or even use Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for MakeCode, CircuitPython, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.

Join 9,200+ makers on Adafruit’s Discord channels and be part of the community! http://adafru.it/discord

CircuitPython – Python on Microcontrollers is here!

Have an amazing project to share? Join the SHOW-AND-TELL every Wednesday night at 7:30pm ET on Google+ Hangouts.

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Follow Adafruit on Instagram for top secret new products, behinds the scenes and more https://www.instagram.com/adafruit/


Maker Business — Japanese word working and more in December’s issue of HackSpace magazine!

Wearables — Solder-less magic

Electronics — = != ==.

Biohacking — Finding Bliss with Anandamide

Python for Microcontrollers — sysfs is dead! long live libgpiod! libgpiod for linux & Python running hardware @circuitpython @micropython @ThePSF #Python @Adafruit #Adafruit

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !



18 Comments

  1. w00t!
    [latex]i_t \cdot re^{a}lly \times \omega0rk_{s}![/latex]

  2. hmmm…

    \[ \cos(\theta + \phi) = \cos \theta \cos \phi
    – \sin \theta \sin \phi \]

  3. $sigh$

  4. Oops, missed that last part about latex tags being needed…

    [latex]
    \[ \cos(\theta + \phi) = \cos \theta \cos \phi
    – \sin \theta \sin \phi \]
    [/latex]

  5. Hmm…

    [latex]\int_-\infty^\infty \! e^{-x^2} \mathrm{d} x = \sqrt{\pi}[/latex]

  6. hrm…

    [latex]
    [samepage, fontsize=, frame=single, label=Sierpinski Sieve] def sierpinski(expr a, b, n) = if n = 0: fill a–(b rotatedabout(a, 60))–b–cycle; else: sierpinski(a, 0.5[a,b], n-1); sierpinski(0.5[a,b], b, n-1); sierpinski(0.5[a,b rotatedabout(a, 60)], 0.5[a rotatedabout(b, -60),b], n-1); fi; enddef;

    [/latex]

  7. @zerth: you have to tell it what packages to use or it cannot render graphics.

  8. Leonhard Euler

    [latex]

    e^{i \pi} – 1 = 0

    [/latex]

  9. Leonhard Euler

    Hmmm. I just looked at my post. The latexpage order apparently didn’t work. Do I need to do a slash-close order at the end?

  10. I fixed the Euler equation so that it would display correctly. We seem to be having a problem with latexpage in the comments. In the meantime, you can wrap your equations in the ![latex] and [/latex] tags and it will render correctly.

  11. [latex]
    \begin{tikzpicture}
    [+preamble]
    \usepackage[usenames,dvipsnames,pdftex]{xcolor}
    \usepackage{tikz,ifthen}
    [/preamble]
    \coordinate (A) at (0,0);
    \coordinate (B) at (-60:12cm);
    \coordinate (C) at (240:12cm);
    \foreach \density in {20,30,…,160}{%
    \draw[fill=MidnightBlue!\density] (A)–(B)–(C)–cycle;
    \path
    (A) coordinate (X)
    — (B) coordinate[pos=.15](A)
    — (C) coordinate[pos=.15](B)
    — (X) coordinate[pos=.15](C);
    }
    \end{tikzpicture}
    [/latex]

  12. whoa!

  13. Okie, try again.

    [latex]
    [preamble]
    \usepackage{tikz}
    \usetikzlibrary{lindenmayersystems}
    \usetikzlibrary[shadings]
    [/preamble]

    \pgfdeclarelindenmayersystem{Koch curve}{
    \rule{F -> F-F++F-F}}
    \pgfdeclarelindenmayersystem{Sierpinski triangle}{
    \rule{F -> G-F-G}
    \rule{G -> F+G+F}}
    \pgfdeclarelindenmayersystem{Fractal plant}{
    \rule{X -> F-[[X]+X]+F[+FX]-X}
    \rule{F -> FF}}
    \pgfdeclarelindenmayersystem{Hilbert curve}{
    \rule{L -> +RF-LFL-FR+}
    \rule{R -> -LF+RFR+FL-}}

    \begin{tikzpicture}
    \shadedraw[shading=color wheel]
    [l-system={Koch curve, step=2pt, angle=60, axiom=F++F++F, order=4}]
    lindenmayer system — cycle;
    \end{tikzpicture}

    [/latex]

  14. gah, stupid shift key. Last try.

    [latex]
    [preamble]
    \usepackage{tikz}
    \usetikzlibrary{lindenmayersystems}
    \usetikzlibrary[shadings]
    [/preamble]

    \pgfdeclarelindenmayersystem{Koch curve}{
    \rule{F -> F-F++F-F}}
    \pgfdeclarelindenmayersystem{Sierpinski triangle}{
    \rule{F -> G-F-G}
    \rule{G -> F+G+F}}
    \pgfdeclarelindenmayersystem{Fractal plant}{
    \rule{X -> F-[[X]+X]+F[+FX]-X}
    \rule{F -> FF}}
    \pgfdeclarelindenmayersystem{Hilbert curve}{
    \rule{L -> +RF-LFL-FR+}
    \rule{R -> -LF+RFR+FL-}}

    \begin{tikzpicture}
    \shadedraw[shading=color wheel]
    [l-system={Koch curve, step=2pt, angle=60, axiom=F++F++F, order=4}]
    lindenmayer system — cycle;
    \end{tikzpicture}

    [/latex]

  15. For anyone who wants to proof before posting: http://quicklatex.com/

    Although you have to put your preamble in under “choose options” and if you mistype your WP tags, it won’t tell you.

  16. Also, I’m pretty sure it’s a plus in the Euler equation. [latex]e^{i*\pi} + 1 = 0[/latex]

  17. Leonhard Euler

    Harry,

    I just checked my hand written notes, and you are correct. I have trouble using keyboards since they haven’t been invented yet.

    Regards,
    Leonhard

  18. [latex]
    \begin{split*}
    &\left( \epsilon \frac{d}{d\zeta} – \frac{d^{2}}{d\zeta^{2}} \right) (\bar{T}_{1}(\zeta) +\epsilon \bar{T}_{2}(\zeta) +…)\\
    & = \epsilon^{2} \mathfrak{D} ( \bar{T}_{b} – \bar{T}_{1} (\zeta) -\epsilon \bar{T}_{2} (\zeta)+… )exp \left( -\frac{1}{\epsilon ( \bar{T}_{1}(\zeta) + \epsilon\bar{T}_{2}(\zeta)+… ) } \right)
    \end{split*}
    [\latex]

    Yay, part of the assignment I’ve been working on for the last couple of days! Basically trying to write an equation for flame speed and thickness… (hopefully not the only non-EE here)

Sorry, the comment form is closed at this time.