Debian Codegraph @

texmf-dist/doc/latex/ladder/ladder.tex

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