Skip to content

Commit

Permalink
Fix the date parsing to cope with different separators
Browse files Browse the repository at this point in the history
  • Loading branch information
Rmano committed Jul 17, 2024
1 parent 3ea40ae commit 5aa1d7d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 19 deletions.
7 changes: 5 additions & 2 deletions doc/circuitikzmanual.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3556,17 +3556,18 @@ \subsubsection{Generic Tunable Arrows}
\subsubsection{Arrow tips}\label{sec:arrow-tips}

In addition to the pseudo-arrows, \Circuitikz{} also adds a couple of ``real'' arrow tips.
The package automatically loads the \texttt{arrows.meta} \TikZ{} library but \emph{not} the deprecated \texttt{arrows} library; in the first versions of the package it used quite a lot the \texttt{latex'} tip, which is not available anymore. To maintain the backward compatibility, the `latexslim` tip has been added, and used by default in several components. This is an old-style arrow tip, with no cusstomization possible.
The package automatically loads the \texttt{arrows.meta} \TikZ{} library but \emph{not} the deprecated \texttt{arrows} library; in the first versions of the package it used quite a lot the \texttt{latex'} tip, which is not available anymore. To maintain the backward compatibility, the `latexslim` tip has been added, and used by default in several components. This is an old-style arrow tip, with no customization possible.

The other tip is \texttt{Jack Tap}\footnote{Added after a suggestion from \href{https://github.com/circuitikz/circuitikz/issues/806}{Anisio Rogerio Braga} on GitHub}, which is mainly used to build jack connectors (see section~\ref{sec:jacks}). This is a new-style arrow tip, and accepts the parameter \texttt{length} (default \texttt{0.3 cm}), \texttt{width} (default \texttt{0.15 cm}), and the boolean \texttt{swap}.


\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
\draw (0,.25) (0,0) edge[-latexslim] ++(1,0)
++(0, -0.5) edge[-{Jack Tap[swap]}] ++(1,0)
++(0, -0.5) edge[-Jack Tap] ++(1,0)
++(0, -0.5) edge[-{Jack Tap[fill=cyan]}] ++(1,0)
++(0, -0.5) edge[-{Jack Tap[width=.3cm,filled]}]++(1,0)
++(0, -0.5) edge[-{Jack Tap[width=.3cm,fill]}]++(1,0)
++(0, -0.5) edge[-{Jack Tap[width=.3cm,line join=round,
line cap=round]}, thick] ++(1,0)
++(0, -0.5) edge[^-^f] ++(1,0)
Expand All @@ -3578,6 +3579,8 @@ \subsubsection{Arrow tips}\label{sec:arrow-tips}





\subsection{Terminal shapes}\label{sec:terminals}

These are the so-called ``bipole nodes'' shapes, or poles (see section~\ref{sec:bipole-nodes}). These nodes are always filled; the ``open'' versions (starting with an \texttt{o}) are by default filled with the color specified by the key \texttt{open nodes fill} (by default \texttt{white}), but you can override locally it with the \texttt{fill} parameter.
Expand Down
58 changes: 41 additions & 17 deletions tex/pgfcirc.defines.tex
Original file line number Diff line number Diff line change
Expand Up @@ -268,29 +268,53 @@

%% check loaded TikZ/pgf version %<<<`
%
% parse the release date, thanks to Skillmon
% https://github.com/pgf-tikz/pgf/issues/1348#issuecomment-2231681032
% date can be yyyy-mm-dd or (older TikZ) yyyy/mm/dd
\begingroup
\pgfutil@protected\def\parsedate#1%
{%
\afterassignment\parsedate@month
\pgf@circ@count@a=#1\relax
}
\pgfutil@protected\def\parsedate@month#1%
{%
\afterassignment\parsedate@day
\pgf@circ@count@b=%
}
\pgfutil@protected\def\parsedate@day#1%
{%
\afterassignment\parsedate@cleanup
\pgf@circ@count@c=%
}
\def\parsedate@cleanup#1\relax{}%
\parsedate{\pgfrevisiondate}%
\xdef\ctikz@@pgfyear{\the\pgf@circ@count@a}%
\xdef\ctikz@@pgfmonth{\the\pgf@circ@count@b}%
\xdef\ctikz@@pgfday{\the\pgf@circ@count@c}%
\endgroup
% The following code thanks to Skillmon:
% https://tex.stackexchange.com/a/722570/38080
\def\ctikz@@ifpgfatleast@auxi#1#2%
% modified by romano to check the date
\def\ctikz@@ifpgfafter@auxi#1#2%
{%
\ifnum#1
\ctikz@@ifpgfatleast@auxii{#2}%
\ctikz@@ifpgfafter@auxii{#2}%
\fi
}
\def\ctikz@@ifpgfatleast@auxii#1\fi#2\ctikz@@ifpgfatleast#3{\fi#1}
\def\ctikz@@ifpgfatleast#1.#2.#3#%
\def\ctikz@@ifpgfafter@auxii#1\fi#2\ctikz@@ifpgfafter#3{\fi#1}
\def\ctikz@@ifpgfafter#1-#2-#3#%
{%
\ctikz@@ifpgfatleast@auxi{\ctikz@@pgfmayor>#1}\pgfutil@firstoftwo
\ctikz@@ifpgfatleast@auxi{\ctikz@@pgfmayor<#1}\pgfutil@secondoftwo
\ctikz@@ifpgfatleast@auxi{\ctikz@@pgfminor>#2}\pgfutil@firstoftwo
\ctikz@@ifpgfatleast@auxi{\ctikz@@pgfminor<#2}\pgfutil@secondoftwo
\ctikz@@ifpgfatleast@auxi{\ctikz@@pgfminorminor<#3}\pgfutil@secondoftwo
\pgfutil@gobble\ctikz@@ifpgfatleast\pgfutil@firstoftwo
\ctikz@@ifpgfafter@auxi{\ctikz@@pgfyear>#1}\pgfutil@firstoftwo
\ctikz@@ifpgfafter@auxi{\ctikz@@pgfyear<#1}\pgfutil@secondoftwo
\ctikz@@ifpgfafter@auxi{\ctikz@@pgfmonth>#2}\pgfutil@firstoftwo
\ctikz@@ifpgfafter@auxi{\ctikz@@pgfmonth<#2}\pgfutil@secondoftwo
\ctikz@@ifpgfafter@auxi{\ctikz@@pgfday<#3}\pgfutil@secondoftwo
\pgfutil@gobble\ctikz@@ifpgfafter\pgfutil@firstoftwo
}
\def\ctikz@@pgfpgfversionsplit#1.#2.#3\ctikz@@pgfstop{\xdef\ctikz@@pgfmayor{#1}\xdef\ctikz@@pgfminor{#2}\xdef\ctikz@@pgfminorminor{#3}}
\expandafter\ctikz@@pgfpgfversionsplit\pgfversion\ctikz@@pgfstop
%
% usage \ctikz@@ifpgfatleast 3.1.11{true}{false}
% ^^^ no spaces here, braces needed.
% usage \ctikz@@ifpgfafter 2023-01-16{true}{false}
% ^^^ no spaces here, braces needed.
%
%>>>

Expand Down Expand Up @@ -367,14 +391,14 @@
\ifdim\pgfarrowlinewidth>0pt\pgfusepathqfillstroke\else\pgfusepathqfill\fi
\fi
},
defaults = {length = 0.3cm, width=0.15cm,open},
defaults = {length = 0.3cm, width=0.15cm, open},
% cache=false, % breaks everything
}
% the new "fill without arg" will be in TikZ 3.1.11. Apply it here if we have an
% older version
\ctikz@@ifpgfatleast 3.1.11{\relax}{%
\ctikz@@ifpgfafter 2023-01-16{\relax}{%
% thanks @muzimuzhi https://github.com/pgf-tikz/pgf/issues/1348#issuecomment-2229075269
% undo fill/.value required thingy
% undo the fill/.value required key
\expandafter\let\csname pgfk@/pgf/arrow keys/fill/.@def\endcsname\@undefined
\pgfkeys{/pgf/arrow keys/fill/.code={%
\def\pgf@temp{#1}%
Expand Down

0 comments on commit 5aa1d7d

Please sign in to comment.