diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/ladder/README.md | 29 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/ladder/ladder.pdf | bin | 0 -> 211838 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/ladder/ladder.tex | 268 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/ladder/ladder.sty | 127 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-pictures.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/ladder.tlpsrc | 0 |
7 files changed, 426 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/ladder/README.md b/Master/texmf-dist/doc/latex/ladder/README.md new file mode 100644 index 00000000000..3634746fab4 --- /dev/null +++ b/Master/texmf-dist/doc/latex/ladder/README.md @@ -0,0 +1,29 @@ +# Lader TeX package +_This package permit the creation of simple ladder diagram into TeX documents._ + +[Example](https://github.com/AurelienC/tex-ladder/blob/master/ladder.pdf) + +## Usage +The code must be inserted between en `tikzpicture` section. + +Add the packages : + \usepackage{tikz} + \usepackage{Ladder} + + + +### Net +_All contacts and relays are, by default, added in series_ +* `LadderLine` begin a new ladder net +* `startParallel` begin a parallel segment +* `setParallel` begin the new parallel segment +* `unsetParallel` end of the parallel segment + +### Contacts +* `LadderNO[type]{name}{mnemonic}` a Normally Opened contact +* `LadderNC[type]{name}{mnemonic}` a Normaly Closed contact +_Type may be P (rising edge), N (falling edge)..._ + +### Relays +* `LadderB[type]{name}{mnemonic}` a relay +_Type may be R (reset), S (set)..._ diff --git a/Master/texmf-dist/doc/latex/ladder/ladder.pdf b/Master/texmf-dist/doc/latex/ladder/ladder.pdf Binary files differnew file mode 100644 index 00000000000..8ab3233ae7b --- /dev/null +++ b/Master/texmf-dist/doc/latex/ladder/ladder.pdf diff --git a/Master/texmf-dist/doc/latex/ladder/ladder.tex b/Master/texmf-dist/doc/latex/ladder/ladder.tex new file mode 100644 index 00000000000..33bff63fc2d --- /dev/null +++ b/Master/texmf-dist/doc/latex/ladder/ladder.tex @@ -0,0 +1,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}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/ladder/ladder.sty b/Master/texmf-dist/tex/latex/ladder/ladder.sty new file mode 100644 index 00000000000..cd537d71770 --- /dev/null +++ b/Master/texmf-dist/tex/latex/ladder/ladder.sty @@ -0,0 +1,127 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% LADDER %% +%% Aurélien CADIOU %% +%% contact@aureliencadiou.fr %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Licence : MIT licence +%% Repository : https://github.com/AurelienC/tex-ladder + +\NeedsTeXFormat{LaTeX2e}[1999/01/01] +\ProvidesPackage{ladder}[2017/05/17] + + +% Packages required +\RequirePackage{tikz} +\RequirePackage{ifthen} +\RequirePackage{calc} + + +\newcounter{nextY}% +\newcounter{nextYPar}% +\newcounter{nextX}% +\newcounter{currentY}% +\newcounter{currentX}% +\newcounter{tempCurrentY}% +\newcounter{startPar}% +\newcounter{stopPar}% +\newcounter{memCurrentX}% +\newcounter{memCurrentY}% + + +%%% NEW LINE %%% +\newcommand{\ladderLine}[0]{ + % Updating variables + \setcounter{currentX}{0} + \setcounter{nextX}{0} + \setcounter{currentY}{\value{nextY}} +} + + +%%% TEXT %%% +\newcommand{\ladderText}[3][]{ + \draw[text centered](\value{currentX}+1,\value{currentY}+1) node {\textbf{#2}}; + \draw[text centered](\value{currentX}+1,\value{currentY}+0.5) node {\textit{#3}}; + \draw[text centered](\value{currentX}+1,\value{currentY}) node {\texttt{\LARGE{#1}}}; +} + + +%%% NO CONTACT %%% +\newcommand{\ladderNO}[3][]{ + % Updating variables + \setcounter{currentX}{\value{nextX}} + \setcounter{tempCurrentY}{\value{currentY}-2} + \ifthenelse{\value{nextY}>\value{tempCurrentY}}{\setcounter{nextY}{\value{tempCurrentY}}}{} + \ifthenelse{\value{nextYPar}>\value{tempCurrentY}}{\setcounter{nextYPar}{\value{tempCurrentY}}}{} + \addtocounter{nextX}{2} + + % Drawing + \draw(\value{currentX}+0.75,\value{currentY}+0.25) -- (\value{currentX}+0.75,\value{currentY}-0.25); % First bar of NO contact + \draw(\value{currentX}+1.25,\value{currentY}+0.25) -- (\value{currentX}+1.25,\value{currentY}-0.25); % Second bar of NO contact + \draw(\value{currentX},\value{currentY}) -- (\value{currentX}+0.75,\value{currentY}); % Connection + \draw(\value{currentX}+1.25,\value{currentY}) -- (\value{nextX},\value{currentY}); % Connection + \ladderText[#1]{#2}{#3} +} + + +%%% NC CONTACT %%% +\newcommand{\ladderNC}[3][]{ + % Updating variables + \setcounter{currentX}{\value{nextX}} + \setcounter{tempCurrentY}{\value{currentY}-2} + \ifthenelse{\value{nextY}>\value{tempCurrentY}}{\setcounter{nextY}{\value{tempCurrentY}}}{} + \ifthenelse{\value{nextYPar}>\value{tempCurrentY}}{\setcounter{nextYPar}{\value{tempCurrentY}}}{} + \addtocounter{nextX}{2} + + % Drawing + \draw(\value{currentX}+0.75,\value{currentY}+0.25) -- (\value{currentX}+0.75,\value{currentY}-0.25) -- (\value{currentX}+1.25,\value{currentY}+0.25) -- (\value{currentX}+1.25,\value{currentY}-0.25); % NC contact + \draw(\value{currentX},\value{currentY}) -- (\value{currentX}+0.75,\value{currentY}); % Connection + \draw(\value{currentX}+1.25,\value{currentY}) -- (\value{nextX},\value{currentY}); % Connection + \ladderText[#1]{#2}{#3} +} + + +%%% COILS %%% +\newcommand{\ladderC}[3][]{ + % Updating variables + \setcounter{currentX}{\value{nextX}} + \setcounter{tempCurrentY}{\value{currentY}-2} + \ifthenelse{\value{nextY}>\value{tempCurrentY}}{\setcounter{nextY}{\value{tempCurrentY}}}{} + \ifthenelse{\value{nextYPar}>\value{tempCurrentY}}{\setcounter{nextYPar}{\value{tempCurrentY}}}{} + \addtocounter{nextX}{2} + + % Drawing + \draw (\value{currentX}+1,\value{currentY}) circle (0.3); + \draw(\value{currentX},\value{currentY}) -- (\value{currentX}+0.7,\value{currentY}); % Connection + \draw(\value{currentX}+1.3,\value{currentY}) -- (\value{nextX},\value{currentY}); % Connection + \ladderText[#1]{#2}{#3} +} + + + +%%% START OF PARALLEL SECTION %%% +\newcommand{\startParallel}[0]{ + \setcounter{startPar}{\value{nextX}} % Store the X of beginning +} + + + +%%% DEBUT PARALLELE %%% +\newcommand{\setParallel}[0]{ + \setcounter{stopPar}{\value{nextX}}% + \draw(\value{startPar},\value{currentY}) -- (\value{startPar},\value{nextYPar}); % Vertical bar + \setcounter{memCurrentX}{\value{nextX}}% + \setcounter{memCurrentY}{\value{currentY}}% + \setcounter{nextX}{\value{startPar}}% + \setcounter{currentY}{\value{nextYPar}}% +} + + +%%% END OF PARALLEL SECTION %%% +\newcommand{\unsetParallel}[0]{ + % Parallel section is more larger than "normal" section test + \ifthenelse{\value{nextX}>\value{memCurrentX}}{}{\draw(\value{nextX},\value{currentY}) -- (\value{stopPar},\value{currentY}) -- (\value{stopPar},\value{memCurrentY});} + \ifthenelse{\value{nextX}>\value{memCurrentX}}{\draw (\value{nextX},\value{currentY}) -- (\value{nextX},\value{memCurrentY}) -- (\value{memCurrentX},\value{memCurrentY});}{\setcounter{nextX}{\value{memCurrentX}}} + \setcounter{currentY}{\value{memCurrentY}} + \setcounter{nextYPar}{0} +} diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 3c96c32e6e4..6b277c2ea46 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -346,7 +346,7 @@ my @TLP_working = qw( ktv-texdata kurier l2picfaq l2tabu l2tabu-english l2tabu-french l2tabu-italian l2tabu-spanish l3build l3kernel l3packages l3experimental - labbook labels labyrinth lambda-lists langcode langsci + labbook labels labyrinth ladder lambda-lists langcode langsci lapdf lastpackage lastpage latex latex-bib-ex latex-bib2-ex latex-brochure latex-course latex-doc-ptr latex-fonts diff --git a/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc b/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc index 32f0e2b0710..9117ccf9c67 100644 --- a/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc @@ -63,6 +63,7 @@ depend hobby depend hvfloat depend knitting depend knittingpattern +depend ladder depend lapdf depend latex-make depend lpic diff --git a/Master/tlpkg/tlpsrc/ladder.tlpsrc b/Master/tlpkg/tlpsrc/ladder.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/ladder.tlpsrc |