# Using Lcapy with LaTeX¶

Lcapy can generate .pgf image files for both schematics and plots. These have the advantage is that they use the same fonts as the document.

Lcapy can also generate expressions using LaTeX math markup. These can be automatically embedded using the sympytex LaTeX package (see http://elec.otago.ac.nz/w/index.php/SympyTeX).

Here’s a bare bones example that includes a figure generated by schtex (see schtex) and equations generated with sympytex:

\documentclass[a4paper, 12pt]{article}
\usepackage{sympytex}
\usepackage{circuitikz}
\usepackage{amsmath}

\begin{document}

\begin{figure}
\centering
\input{demo1.pgf}
\caption{RLC network.}
\end{figure}

\begin{sympysilent}
from lcapy import Circuit, s, t
cct = Circuit('demo1.sch')
\end{sympysilent}

$$V_C(s) = \sympy{cct.C.V(s).simplify()}$$

$$v_C(t) = \sympy{cct.C.V(t).simplify()}$$

\end{document}