2

I have a .plt plot that I would like to insert into a tex document. Are there any packages that will allow this, and what is the syntax required?

Rmano
  • 40,848
  • 3
  • 64
  • 125
  • Welcome to [tex.se]! Can you explain what at plt plot is? If you can output it as standard graphics format, then \includegraphics from the graphicx package would be the standard tool. – Andrew Swann Feb 23 '17 at 17:04
  • .plt(Printer Command Language) is the format that LTspice (electronic circuit simulation software) exports plots as. – user405561 Feb 23 '17 at 17:11
  • Hmmm... for what I know, .plt files are "plot settings" files, they do not contain the traces nor the circuit. To save the plot, you can "print" it on a PDF virtual printer, or "export" data points to a text file and redo the plot with, for example, pgfplots. – Rmano Feb 23 '17 at 17:21
  • I see. I prefer not to use the PDF because it vertically stretches the plot to A4 size. There is also the option for a .raw file, however, is that useful? – user405561 Feb 23 '17 at 17:29

2 Answers2

3

you can save your image of waveforms in LTspice in .emf format, click on Tools-> write image in to .emf file, so with the image in this format you can do an online conversion to pdf and then insert the pdf image into your document. The result will be surprising. It is advisable to change the font size two axes, for this Tools -> Control panel -> Waveforms and then you can change the font type, size (in my case I put 20) and the width of the stroke that in size 2 gets better , no grid on the graph also results in better visualization.

2

In LTspice the .plt files are just format specifier --- they do not contain the real data for drawing the graph. My suggestion, to have high quality graphics, is to save the data and produce them directly with pgfplots.

Example: I save data for V4 and I(V1) here (you can access that dialog by selecting the graphic windows in LTSpice, then use File->Export data as text); in this example I am saving the data as a file named jfet_mixer2.txt:

LTspice save

And then I use this snippet:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}\pgfplotsset{compat=1.13}
\usetikzlibrary{arrows.meta,positioning,calc}

% Style to select only points from #1 to #2 (inclusive) \pgfplotsset{select coords between index/.style 2 args={ x filter/.code={ \ifnum\coordindex<#1\def\pgfmathresult{}\fi \ifnum\coordindex>#2\def\pgfmathresult{}\fi } }}

\begin{document} \begin{tikzpicture}[ ] \begin{axis}[ xlabel=$t$, ylabel=$V_4$, axis y line*=left, ] \addplot[color=green, select coords between index={1}{400}, filter discard warning=false, unbounded coords=discard ] table [x index=0, y index=1]{jfet_mixer2.txt}; \end{axis} \begin{axis}[ xlabel=$t$, ylabel=$I(V_1)$, axis y line*=right, axis x line=none, ] \addplot[color=blue, select coords between index={1}{400}, filter discard warning=false, unbounded coords=discard ] table [x index=0, y index=2]{jfet_mixer2.txt}; \end{axis} \end{tikzpicture} \end{document}

to obtain:

Output graph

caveat:

Normally you have a huge number of lines in the saved files, you have to trim them. You can check various way and suggestion --- you can skip data (but take care of aliasing!), use more complex methods, just plot a bit like in my case (reference).

Rmano
  • 40,848
  • 3
  • 64
  • 125