-
Notifications
You must be signed in to change notification settings - Fork 43
How to include FidoCadJ schematics into LaTeX documents using PGF format export.
Including a circuit drawn with FidoCadJ into a professional LaTeX document is quite easy and with this wiki page we will explain how to do it.
We will assume that the reader already some knowledges of LaTeX markup language, however we will remind about some basic concepts about LaTeX writing in order to avoid some errors. For those who would like (or need) to learn how to use LaTeX, please see section External Links.
If you are going to include some text into your FidoCadJ drawing, if you want to use mathematical formulas in the text labels, in order to make the LaTeX editor able to compile your code, you have to remember to enclose each text label with the sign $. In fact, text attributes are not processed during the pgf export by FidoCadJ and are given to LaTeX as they are.
For example, if you want to include the text label "FidoCadJ" in your drawing, you may write it as "FidoCadJ", in the text mode. If you want to write R_2 in mathematical mode, you would have to write it as "
Keep in mind that the LaTeX editor will translate this text following the LaTeX's rules: Non italic text label in math mode may also be enclosed with the \text directive:
$\text{FidoCadJ}$
and bold labels have to be enclosed with the \textbf directive:
\textbf{FidoCadJ}
and so on..
The following is a simple circuit FidoCadJ code, ready to be exported to a PGF file:
[FIDOCAD]
FJC C 1.5
FJC A 0.35
MC 35 35 0 0 ey_libraries.genvis1
MC 60 35 1 0 ey_libraries.pasres0
LI 35 30 35 25 0
LI 35 25 60 25 0
LI 60 25 60 30 0
LI 35 45 35 50 0
LI 35 50 60 50 0
LI 60 50 60 45 0
SA 60 50 0
MC 60 50 0 0 elettrotecnica.ms05
TY 18 34 4 3 0 0 0 Bitstream++Charter $V_1$
TY 68 34 4 3 0 0 0 Bitstream++Charter $R_1$
Once the circuit/schematics representation is drawn (as in Step 1), the export to a PGF file is accomplished using the Export option from the Menu Bar File or using the shortcut Ctrl + E.
After having exported your PGF file from FidoCadJ, all you need to worry is check if the package pgfplots is already included in your .tex file.
If not, you can include it by inserting the directive:
\usepackage{pgfplots}
before the
\begin{document}
directive. Please keep in mind that the package pgfplots has to be installed on your computer.
Once the package is included, you just need to copy and paste the code of the PGF file into your LaTeX document file.
However, there are 2 alternative ways to include the exported code into the LaTeX code.
The method described just above, the copy-paste way, could generate a lot of code and more lines into your .tex file, especially if you have a large drawing. This could make your code more difficult to read, and the compiler will need more time to compile your code..
A useful way to maintain the code easy to read is including the PGF file with the \input directive:
\input{\file}
when you can store all the PGF file into a unique folder. Please refer to the straightforward following LaTeX example:
% let's define our path to pgf files
\newcommand{\pfgplotsDir}{/path/to/pgf_files}
% more text ...
% include pgf file
\begin{center}
\input{\pfgplotsDir/file.pgf}
\end{center}
Here we have used the \newcommand directive to declare a path to the folder where the PGF file could be stored. It could be useful to avoid writing the same path each time.
However, the best way is to compile directly the PGF script and the including it as graphics. Suppose you have already exported the PGF code with FidoCadj: the first thing to do is to compile it from a simple .tex file as such:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{amsmath}
\begin{document}
% PGF exported code from fidocadj goes here
\end{document}
If you compile it using pdflatex it should create a PDF file whit your image and its size (file.pdf). Then, you can include the PDF file as images in your main .tex document file as:
\begin{center}
\includegraphics[scale=1]{/path/to/file.pdf}
\center{\footnotesize{Note for the image}
\end{center}
The above code should center the image but of course you can include as you prefer.