1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
|
\documentclass[a4paper]{article}
%% Language and font encodings
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
%% Sets page size and margins
\usepackage[a4paper,top=3cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
%% Useful packages
\usepackage{ladder}
\usepackage{hyperref}
\usepackage{xcolor}
\usepackage{minted}
\definecolor{LG}{HTML}{F9F9F9}
%% Informations
\title{\textsf{ladder} package}
\author{Aurélien CADIOU \\ \href{mailto:contact@aureliencadiou.fr}{contact@aureliencadiou.fr}}
\begin{document}
\maketitle
\setcounter{tocdepth}{1}
\tableofcontents
\section*{Introduction}
This package permit the creation of simple ladder diagram into TeX documents.
\href{https://github.com/AurelienC/tex-ladder}{Github repository : tex-ladder}
\section{Installation}
Install this package like any other \LaTeX~package.
\section{Dependencies}
This package depends on :
\begin{itemize}
\item \href{https://www.ctan.org/search/?phrase=tikz}{tikz}
\item \href{https://www.ctan.org/pkg/ifthen}{ifthen}
\item \href{https://www.ctan.org/pkg/calc}{calc}
\end{itemize}
\section{Usage}
\subsection{Package}
Add following packages on your document : \mintinline{latex}{\usepackage{tikz} \usepackage{ladder}}.
\subsection{Net}
All contacts and relays are, by default, added in serie.
\begin{itemize}
\item \mintinline{latex}{\ladderLine} begin a new ladder net
\item \mintinline{latex}{\startParallel} begin a parallel segment
\item \mintinline{latex}{\setParallel} begin the new parallel segment
\item \mintinline{latex}{\unsetParallel} end of the parallel segment
\end{itemize}
\subsection{Contacts}
\texttt{type} of contacts may be any letter. Conventionnaly, we use \texttt{P} for rising edge contact and \texttt{N} for falling edge contact.\\
\begin{itemize}
\item \mintinline{latex}{\ladderNO[type]{name}{mnemonic}} Normally Opened contact
\item \mintinline{latex}{\ladderNC[type]{name}{mnemonic}} Normaly Closed contact
\end{itemize}
\subsection{Coils}
\texttt{type} of coils may be any letter. Conventionnaly, we use \texttt{R} for reset coil, \texttt{S} for set coil.\\
\begin{itemize}
\item \mintinline{latex}{\ladderC[type]{name}{mnemonic}} a coil
\end{itemize}
\section{Simple example}
\subsection{Preview}
\begin{figure}[h!]
\begin{tikzpicture}
\ladderLine
\ladderNO{Switch}{I1.0}
\ladderNC{Breaker}{I0.1}
\ladderNO[P]{Start}{M0.0}
\ladderC[S]{Running}{M1.0}
\ladderLine
\ladderNO{Breaker}{I0.1}
\ladderC{Fault}{M10.0}
\end{tikzpicture}
\caption{Example with contacts and coil}
\label{example1}
\end{figure}
\subsection{Code}
Code of figure \ref{example1}.
\begin{minted}[bgcolor=LG, fontsize=\footnotesize]{latex}
\begin{tikzpicture}
\ladderLine
\ladderNO{Switch}{I1.0}
\ladderNC{Breaker}{I0.1}
\ladderNO[P]{Start}{M0.0}
\ladderC[S]{Running}{M1.0}
\ladderLine
\ladderNO{Breaker}{I0.1}
\ladderC{Fault}{M10.0}
\end{tikzpicture}
\end{minted}
\section{Parallel section}
\subsection{Preview}
\begin{figure}[h!]
\begin{tikzpicture}
\ladderLine
\ladderNO[P]{Button}{I1.0}
\startParallel % Begin of section
\ladderNO{Running}{M1.0}
\ladderNC{Fault}{M10.0}
\setParallel
\ladderNO{Manual}{M2.3}
\unsetParallel
\ladderC[S]{Validation}{M1.1}
\end{tikzpicture}
\caption{Example with parallel section}
\label{example2}
\end{figure}
\subsection{Code}
Code of figure \ref{example2}.
\begin{minted}[bgcolor=LG, fontsize=\footnotesize]{latex}
\begin{tikzpicture}
\ladderLine
\ladderNO[P]{Button}{I1.0}
\startParallel % Begin of section
\ladderNO{Running}{M1.0}
\ladderNC{Fault}{M10.0}
\setParallel
\ladderNO{Manual}{M2.3}
\unsetParallel
\ladderC[S]{Validation}{M1.1}
\end{tikzpicture}
\end{minted}
\section{Complete example}
\subsection{Preview}
\begin{figure}[!h]
\begin{tikzpicture}
\ladderLine % Begenning new line
\ladderNO{bla}{I1.0}
% M0 will be in parallel with I1.0 and I1.1
\startParallel
\ladderNC{bli}{M0.0}
\setParallel
\ladderNO{blou}{I1.0}
\ladderNO{blo}{I1.1}
\unsetParallel
\ladderC{blu}{M1} % On met une "bobine"
\ladderNO[P]{ble}{I2.0}
\startParallel
\ladderC[R]{bleu}{M0.1}
\setParallel
\ladderC[S]{bleu}{M1.2}
\unsetParallel
% New section
\ladderLine
\ladderNO{bla}{I3.7}
\startParallel
\ladderNC{bli}{M1.0}
\ladderNO[P]{blou}{I1.0}
\setParallel
\ladderNO{blo}{I1.6}
\unsetParallel
\ladderC{blu}{M4.1}
\ladderNO{ble}{I7.2}
\startParallel
\ladderC{bleu}{M1}{R}
\setParallel
\ladderNO{ble}{I7.3}
\ladderC[S]{bleu}{M4.2}
\unsetParallel
\end{tikzpicture}
\caption{Example of ladder package usage}
\label{example3}
\end{figure}
\subsection{Code}
Code of figure \ref{example3}.
\begin{minted}[bgcolor=LG, fontsize=\footnotesize]{latex}
\begin{figure}
\begin{tikzpicture}
\ladderLine % Begenning new line
\ladderNO{bla}{I1.0}
% M0 will be in parallel with I1.0 and I1.1
\startParallel
\ladderNC{bli}{M0.0}
\setParallel
\ladderNO{blou}{I1.0}
\ladderNO{blo}{I1.1}
\unsetParallel
\ladderC{blu}{M1} % On met une "bobine"
\ladderNO[P]{ble}{I2.0}
\startParallel
\ladderC[R]{bleu}{M0.1}
\setParallel
\ladderC[S]{bleu}{M1.2}
\unsetParallel
% New section
\ladderLine
\ladderNO{bla}{I3.7}
\startParallel
\ladderNC{bli}{M1.0}
\ladderNO[P]{blou}{I1.0}
\setParallel
\ladderNO{blo}{I1.6}
\unsetParallel
\ladderC{blu}{M4.1}
\ladderNO{ble}{I7.2}
\startParallel
\ladderC{bleu}{M1}{R}
\setParallel
\ladderNO{ble}{I7.3}
\ladderC[S]{bleu}{M4.2}
\unsetParallel
\end{tikzpicture}
\caption{Example of ladder package usage}
\end{figure}
\end{minted}
\end{document}
|