I am brand-new to LaTeX, Sketch, and even using the command line. My purpose is to write assignments as high-quality documents next semester for Physics, Math, Chemistry, and Engineering undergraduate-level courses. I am on break, so I figure it is a good time to learn.

I recently downloaded Sketch to use with LaTex. You will find a simplified piece of working code at the bottom.

By the way, I use Windows 8.

I am trying to create a document which includes code produced by Sketch. Below I will detail my workflow. My question is: Is there a simpler way to do this???

From what I've seen, Sketch is very powerful, and 3D images are easier to write than when using PSTricks alone. I am willing to learn Sketch. However, if there is another software or package that is just as powerful as Sketch, but much simpler to use, that would be great. (Would Inkscape be a good alternative?)

My project file hierarchy is shown below. I making use of the \input{...} command to do this. Pay special attention to the image1 folder.

  • project
    • project.tex
    • content
      • chapter1.tex (I want to include the image here.)
    • formatting
      • packages.tex, etc.
    • images
      • image1
        • sketch.exe
        • Command Prompt (Set to open in this directory.)
        • image1.sk
        • image1_standalone.tex (Contains code for the image such that it can be compiled as a standalone PDF.)
        • image1.tex (Contains the code for the image such that it can be included in the final document via \input{}.)

AFAIK, every image folder, according to my current workflow, needs all these files.

Currently, my workflow goes like this:

  1. Write Sketch code for my image in image1.sk and put global {language tikz} at the end.
    • (AFAIK, not mentioned in the documentation in any clear place. Found the tip here. Without this command, the image was not compiling at all. This might be because without this command, Sketch produces PostScript code?
    • Tangential rant: Documentation expects user knows what the Command Prompt is, how to use it, how to change directories, that the Sketch.exe needs (AFAIK) to be in the directory you are working in, etc. My computer knowledge is basic, and I wish the documentation gave this kind of information. It would have saved me a lot of time.
  2. Open the Command Prompt and type:

    Sketch -T image1.sk -o image1_standalone.tex
    pdflatex image1_standalone.tex
  3. Open the newly created image1_standalone.pdf file, and check whether I like how the image was produced.
    • If I don't like the image, repeat above steps.
  4. From image1_standalone.tex, copy the \usepackage{} and \usetikzlibrary{} commands into my packages.tex file.
  5. Create image1.tex and paste the code \begin{tikzpicture} ... \end{tikzpicture}...possible surrounded by \begin{center} ... \end{center}.
  6. Write \include{./images/image1/image1.tex} into the chapter1.tex file.
  7. Compile final document.

Simple example code:




    \begin{tikzpicture}[line join=round]
  • 1
    OK I am a physicist and teach the same. May be you get some idea.
    – user11232
    Commented Dec 14, 2012 at 1:08
  • 1
    I think Sketch is meant to be used only when you need to do some big graphic and you don't know how to do it quickly (then you give some code to an application and it writes lots and lots of non optimized lines of code for you, but it works). If you are starting, I would try to learn TikZ, because may be it will fit your needs, until you get to very rare situation (like a huge wall you can't jump over) and then use Sketch.
    – Manuel
    Commented Dec 14, 2012 at 1:10
  • 1
    And, if you are plotting functions or data, pgfplots works really well. Tikz language is really easy (and so is pgfplots). About the manual.. I don't know how people learn, but I think the best way is trial and error (and a little bit of deep reeding of the documentation). You need to make a graph? Look around until you achieve it.
    – Manuel
    Commented Dec 14, 2012 at 1:20
  • 3
    You may also consider inkscape as a substitute for sketch. Inkscape can export to tikz. Or you can also add svg files directly into latex.
    – user11232
    Commented Dec 14, 2012 at 1:37
  • 1
    As an example you may look into this : Draw Bohr atomic model with electron shells in TeX?
    – user11232
    Commented Dec 14, 2012 at 1:41

1 Answer 1


I today started to use the combination of lualatex+tikz+sketch, the latter the newest addition. I unpacked sketch.exe to the same directory as my MikTeX binaries as the path has been setup and I will use it in general only with LaTex.

My first attempt at a workflow is by using the following:

% Save the sketch as test-sk.sk 
\begin{filecontents*}{test-sk.sk}% from the sketch manual p13
def n_cyl_segs 20 def n_views 5 def I [1,0,0]
def endopts [fillcolor=lightgray]
repeat { n_views, rotate(180/n_views, [I]) then translate([I] * 2.1) }
sweep[endopts]{ n_cyl_segs<>, rotate(360/n_cyl_segs, [0,1,0]) }

global { language tikz } 
\end{filecontents*}% the last statement was not clear, but it is required.

\immediate\write18{sketch  test-sk.sk -o sk-test.tex } %process the sketch






This renders the same sketch as in manual.

Hope this is of help.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .