3

Is there a extension of tikz library that allows one to draw thermodynamic cycles easily? For example the picture you see in the link: http://en.wikipedia.org/wiki/Carnot_heat_engine#mediaviewer/File:Carnot_heat_engine_2.svg

If there is no library can someone suggest a easy way to go about this? Maybe provide an example? I have used LaTeX for a little over a year now but am just starting to draw in LaTeX with tikz.

  • 1
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Sep 10 '14 at 0:45
5

This is one possibility where pic with 3 arguments, known as nodea, nodeb and nodec are designed here -- #1=color, #2=label and #3=internal node label.

enter image description here

Code

\documentclass[border=10pt]{standalone}%{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\tikzset{%
pics/.cd,
nodea/.style args={#1#2#3}{
  code={\node[minimum height=2cm] (#3) {\color{#1}#2};
       \draw[thick] (#3.south west) -| (#3.north east)--(#3.north west);
  }
},
%pics/.cd,
nodeb/.style args={#1#2#3}{
  code={\node[minimum height=2cm] (#3) {\color{#1}#2};
       \draw[thick] (#3.south east) -| (#3.north west)--(#3.north east);
  }
},
%pics/.cd,
nodec/.style args={#1#2#3}{
  code={\node[draw,thick,shape=circle,inner sep=1cm] (#3) {\color{#1}#2};
  }
},
}
\begin{document}
  \begin{tikzpicture}[scale=2]
    \pic at (0,0) {nodea={red}{$T_H$}{L}};
    \pic at (2,0) {nodec={black}{}{C}};
    \pic at (4,0) {nodeb={blue}{$T_C$}{R}};
 \draw[->,>=latex](L)--node[midway,above]{$\mathbf{Q_H}$}(C); 
 \draw[->,>=latex](C)--node[midway,above]{$\mathbf{Q_C}$} (R);
 \draw[->,>=latex](C)--node[midway,left]{$\mathbf{W}$} ++(0,-2cm);
  \end{tikzpicture}
\end{document}
  • Thank you so much! This is just the kind of example I needed to learn how to do the problem. – o0BlueBeast0o Sep 10 '14 at 2:20
  • 1
    Glad, it is an example you need. Welcome. – Jesse Sep 10 '14 at 2:56
  • +1: It seems you have learned fast the pic operation :) – Claudio Fiandrino Sep 10 '14 at 7:47
  • Yes, I have tried to use pic, following experts advices here – Jesse Sep 10 '14 at 8:27
2

This is a solution with PSTricks just for fun.

\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{pst-node}
\begin{document}
\begin{pspicture}[shortput=nab](-4,-3)(4,1)
    \cnode{1}{c}
    \pnode(-3,0){l}\pnode(3,0){r}\pnode(0,-3){b}
    \rput(l){\psline(-1,-1)(0,-1)(0,1)(-1,1)}
    \rput{180}(r){\psline(-1,-1)(0,-1)(0,1)(-1,1)}
    \psset{arrows=->}
    \ncline{l}{c}^{$Q_H$}\ncline{c}{r}^{$Q_C$}\ncline{c}{b}_{$W$}
    \uput[180](l){\color{red}$T_H$}\uput[0](r){\color{blue}$T_C$}
\end{pspicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.