Skip to main content
Working from scratch, following simplicity

LaTeX and 2D structural mechanics diagrams

Sometimes it's necessary to add to your reports several drawings in order to facilitate the comprehension of the calculus and data. LaTeX can solve this issue without using any external software but only through the Graphics packages. I show you how TikZ-MEC, a custom library written by Francesco Clemente, can help in the description of mechanical problems related to (internally and externaly) loaded structures.

Since I had been written my master thesis, I wanted to understand how to instruct LaTeX for drawing directly, taking all the advantages of the "TeX-approach to Typesetting" for my graphics1 :

  • quick creation of simple graphics;
  • precise positioning, quoting and scaling.

However only writing the small project for the Structure Standing Still: The Statics of Everyday Objects course promoted by Coursera and University of Florida, I have had the chance to learn and try TikZ and TikZ-MEC. In actual fact it exists and it's more complete: pst-stru, a PSTricks package to draw structural schemes in civil engineering analysis (beams, portals, archs, piles), yet it does not work with pdftex nor with any other driver that produces anything but PostScript code1 , in fact it is necessary to use latex+dvips+ps2pdf in order to generate a PDF. Also in my opinion the learning curve is steeper and the code is more logical and readable than PSTricks.

 Project instructions  Final Project edited using TikZ-MEC
Project instructions: determine the design, the cost and the axial forces of a statically-determinate truss structure of your own design capable of supporting a 10 kN load hangingmidway across an 8 meter span (see figure above). My final project (a simple and common Warren truss structure)

As usual I put the instruction to install it in your system (Ubuntu and derivatives only) and the possibility to try it online thanks to writeLaTeX and an edited code written by John Lees-Miller2 .

Read it on-line using writeLaTeX: TikZ-MEC Test


Typically TikZ is included in the texlive-pictures3 package, but if you want to use TikZ-MEC, you have to download it and following the instructions in the README.txt in order to generate the library file tikzlibrarymec.code.tex and the documentation file tikz-mec.pdf. Thus avoiding warnings and errors, I suggest you to install these packages: texlive-science3 (it contains SIunits), cm-super3  and cm-super-minimal3 . Although I have installed all the packages, I always obtained a lot of errors and warnings while generating the documentation file, but keep calm and carry on: I put this problematic PDF file in my repository on GitHub.

How to learn it

The first impact with TikZ and TikZ-MEC is problematic, but if you read the Part I: Tutorials and Guidelines of the manual1 , you can understand quickly the code and the power of this Graphics Package.

All the files of this article are in my GitHub repository: TikZ_MEC
  • 1 a b c TikZ and pgf - Manual for version 1.18 - downloadable here
  • 2Because at the moment writeLaTeX removes all but the last dot in file names (in order to avoid a bug in includegraphics with files that contain multiple dots) and so it also broke custom TikZ libraries like "tikzlibrarymec.code.tex" that becomes after uploading "tikzlibrarymec_code.tex".
  • 3 a b c d In Ubuntu and derivatives a faster method to install packages is writing this command in the terminal:

    sudo apt-get install PACKAGE_NAME

Add new comment

The content of this field is kept private and will not be shown publicly.

Plain text

  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Sponsored Links

Nicola Rainiero

A civil geotechnical engineer with the ambition to facilitate own work with free software for a knowledge and collective sharing. Also, I deal with green energy and in particular shallow geothermal energy. I have always been involved in web design and 3D modelling.