LaTeX forum ⇒ LyXUse TikZ with LyX

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
SenZe
Posts: 1
Joined: Wed Jan 13, 2010 6:52 pm

Use TikZ with LyX

Postby SenZe » Wed Jan 13, 2010 7:04 pm

Hello to all,

I am quite new to using LaTeX and even newer to using it with LyX. However, I tried to use the TikZ package from LyX.

I did it the following way:
1. download the package and extract the file content to Program Files\MikTeX\
2. Insert one of the example codes (see link above) in TeXnic Center - works.
3. Insert the same example code as a new TeX code block ('Insert TeX code') into LyX. When Compiling, i get a few errors, mainly 'Can be used only in preamble' and 'Environment tikzpicture undefined', and a few others.
4. I fixed these errors by deleting the \documentclass and \enddocument commands. In addition, I inserted the \usepackage and the \usetikzlibrary commands in the document settings (Document -> Settings -> Latex preamble). Of course, i deleted these lines from the code.
5. I still get errors when compiling:
A few of them are like 'Missing } or \cr' inserted.
The others go like 'Package error: No shape named base is known'. Sometimes, it says 'M' instead of 'shape'.

What can i do to solve these problems?

Thank you a lot in advance for your help!

/EDIT: corrected the error messages

pooz
Posts: 65
Joined: Sat Apr 11, 2009 10:47 am

Postby pooz » Fri Jan 15, 2010 7:23 pm

Maybe you need to include the "pgfplots" package?

I guess TikZ depends on it.

This is working for me in the LyX-Preamble:
  1. \usepackage{tikz}
  2. \usepackage{pgfplots}
  3. % recommended as of Pgfplots 1.3:
  4. \pgfplotsset{compat=newest}

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany

Postby localghost » Sat Jan 16, 2010 3:05 pm

pooz wrote:Maybe you need to include the "pgfplots" package?

I guess TikZ depends on it. [...]

It's right the other way round. The pgfplots package depends on pgf/tikZ.
SenZe wrote:[...] download the package and extract the file content to Program Files\MikTeX\ [...]

Just use the MiKTeX Package Manager to install packages subsequently.


Best regards and welcome to the board
Thorsten
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1


Return to “LyX”

Who is online

Users browsing this forum: alsanadm and 3 guests