# How to integrate Tikz code in SW?

I'd like to know how to insert Tikz code in Scientific Workplace tex file. Since SW doesn't support Tikz directly, now I just create Tikz code in another tex editor and export as pdf. Then I convert pdf to images, and import images into SW.

• Sorry, I have problems understanding your question. You are working with something that does not support TikZ directly, and you tell us your workaround. So what is your question? – user121799 Feb 3 '18 at 20:46
• Someone says that he knows how to do it. Read tex.stackexchange.com/questions/413572/…. So I am waiting for answer. – Math Wizard Feb 3 '18 at 22:03
• You should link to your earlier question in this one. Note that the answer there already gives you a workaround, since you could export to regular .tex and then add in TikZ. – cfr Feb 3 '18 at 22:15
• I want to remain in SW because I like SW interface and I don't have many figures. – Math Wizard Feb 3 '18 at 22:22
• Related :) tex.stackexchange.com/questions/413309 – Dr. Manuel Kuehner Feb 3 '18 at 22:58

A simple web search finds instructions from SWP's developers. These are untested as I have no access to SWP, but, if they don't work, you should contact them to ask for updated information.

1. TikZ: This Scientific WorkPlace v5.5 question started with an academic who's been on our mailing list since 2002 Emailing to say:

I hope you don’t mind me asking a quick question. I hoped that when I include the text below as an encapsulated TeX file in my SWP file that it would produce a figure for me. Instead it is giving me error messages. Is there any quick fix for this? What is the general advice if I want to include TeX (or otherwise) produced mathematical figures?

and including the code for a TikZ picture. In our replies we said:

If you want to include tikz pictures... you will need the tikz-cd package which is available at https://www.ctan.org/pkg/tikz-cd. Have you added the tikz-cd package to your document (Typeset – Options & Packages – Package Options)? Because tikz-cd is not supplied with Scientific WorkPlace, you will need to GoNative to add it.

You also need to ensure that the tikz package is available on your computer, together with the packages it requires (xkeyval, pgf and everyshi). You can obtain any further packages you require from CTAN, but we have put the zip files you'll need here: tikz-cd, xkeyval, pgf and everyshi (right-click – SaveAs). Simply unzip these files, and save the folders they contain as C:\sw[p]55\TCITeX\TeX\LaTeX\contrib\tikz-cd\ etc; you should first delete the old version of PGF in the folder C:\sw[p]55\TCITeX\TeX\LaTeX\contrib\pgf. The sample .tex file here will then compile to produce this PDF. You can put the TikZ TeX field in a Display for centering and better spacing.

The instructions above are for v5.5. For v6.0, the only package you need to add is tikz-cd; the sample .sci file here will then compile to produce this PDF (intentionally showing a different graphic). When you add the TeX Field in v6.0, the dialog asks you which packages it requires; in this case, simply enter tikz-cd. You also need to make sure that tikz-cd is available on your TeX Live installation (see Item 4 below).

Once you get our sample .tex or .sci files working, why not try with your own TikZ graphics, or code obtained online? There are lots of fun examples available at http://www.texample.net/tikz/examples/ – though you'll need to remember than anything before the \begin{document} probably needs to go into the Preamble!

2. Adding TeXLive packages (v6.0): Following on from Item 3 above, let's add the package tikz-cd as an example:

Windows – TeX Live Manager (instructions copied from our December 2015 mailing Item 4):

1. Double click the executable file tlmgr-gui.exe in the c:\TeXLive\2015\bin\win32 folder or 2016 (or later)
2. Click the "Load default" button and wait
3. Scroll through the list of Package names, locate whichever package is to be added and check the box (here adding the subfigure package)
4. Click the "Install" button

You might need to update the TexLive Manager first.

Mac – TeX Live Utility:

1. Use the Finder to navigate to /Applications/MacKichan/local/bin/TeXLiveUtility
2. Click to open, and then click on Updates to see if any need installing
3. Click on Packages, and scroll down to tikz-cd (or enter it in the Search box).
4. Select the packages you wish to install using Cmd – Click (in our example, just tikz-cd)
5. Right-click and select Install Selected Packages
6. After a few seconds you will see the Install Succeeded message

Note that the suggestion to add the subfigure package is nonsense: this has been obsolete for ages. Use subcaption or, failing that, subfig. If SWP requires subfigure with a recent TeX installation, that's a bug on SWP's side and should be reported.