Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label and anchor info for advanced voltages #567

Closed
Rmano opened this issue Jul 9, 2021 · 8 comments
Closed

Label and anchor info for advanced voltages #567

Rmano opened this issue Jul 9, 2021 · 8 comments

Comments

@Rmano
Copy link
Collaborator

@Rmano Rmano commented Jul 9, 2021

As noticed by @judober (see issue #448), when using advanced voltages we can say:

  1. v, i, f : no arrows/symbols are added, and no voltage/current/flow label is generated (so we do not have label anchors/data)
  2. v=~: the arrows/symbols are generated, and a series of anchors and info (rotation, etc) are generated for the blank label.

There is no provision for

  1. not having arrow/symbols but having the information for the label placement generated (that could be useful if, for example, you want just to change the symbol but you are happy with the labels as they are).

I think that it would be nice to have an option to not draw the symbols (but generate the anchors) and placing the labels (that could be a blank one).

I am open to suggestions for a syntax; I do not want to create all the v_^ combinations, so I think that an extra key like suppress v or !v to add to suppress drawing could be ok.

@judober
Copy link

@judober judober commented Jul 13, 2021

Maybe something like suppress arrows as the v-label does not have to be blank. Then one could just use v=~ as desired.

@Rmano Rmano linked a pull request that will close this issue Jul 14, 2021
@Rmano
Copy link
Collaborator Author

@Rmano Rmano commented Jul 14, 2021

@judober you can play with it if you want with:

circuitikzgit.sty.zip

But I'll do a couple of tests and then I hope to merge (and release) soon

@Rmano
Copy link
Collaborator Author

@Rmano Rmano commented Jul 14, 2021

Maybe something like suppress arrows as the v-label does not have to be blank. Then one could just use v=~ as desired.

And yes, I did exactly that ;-)

@Rmano
Copy link
Collaborator Author

@Rmano Rmano commented Jul 14, 2021

\newcommand{\iarronly}[1]{% name
    \node [currarrow, color=red, anchor=center,
    rotate=\ctikzgetdirection{#1-Iarrow}] at (#1-Ipos) {};
}
\newcommand{\varronly}[1]{% name
    \draw [color=blue] (#1-Vfrom) .. controls (#1-Vcont1)
        and (#1-Vcont2)..  (#1-Vto) node [currarrow,
        sloped, anchor=tip, allow upside down,pos=1]{};
}
\begin{circuitikz}[]
    \ctikzset{!vi/.style={no v symbols, no i symbols}}
    \ctikzset{bipole voltage style/.style={color=blue},
        bipole current style/.style={color=red}}
    \draw (120:6) to[R, *-,  name=R, v^=$v_R$, !vi]
        (120:3) to[short, i=$i_R$, name=SR, !vi] (0,0);
    \draw (180:4) to[L, o-, l=$L$, name=L2, v=$v_L$, !vi]
        (180:2) to[V, -*, name=V2, v_=$v_2$, !vi] (0:0);
    \iarronly{SR}\varronly{R}\varronly{L2}\varronly{V2}
\end{circuitikz}

image

@Rmano
Copy link
Collaborator Author

@Rmano Rmano commented Jul 14, 2021

I am not sure if adding the !vif shorthand (and a corresponding vif!) could be useful for everybody... hmmm...

@Rmano Rmano closed this in #573 Jul 14, 2021
Rmano added a commit that referenced this issue Jul 14, 2021
Add options to have label-only voltage/current/flow

Thanks to @judober, see issues #448 and #567
@Rmano
Copy link
Collaborator Author

@Rmano Rmano commented Jul 14, 2021

I merged it because I want to release soon. Please @judober feel free to comment (others too ;-)!), I can always change things (before releasing)

@Rmano Rmano reopened this Jul 14, 2021
@judober
Copy link

@judober judober commented Jul 14, 2021

Wow, works like a charm.
It also removes the need for custom colored label printing when I accept different rotation for label and vlabel (example below).

\documentclass[class=report, 11pt,a4paper,tikz, border=4pt]{standalone}
% Version from https://github.com/circuitikz/circuitikz/issues/567
\usepackage[european, straightvoltages, americaninductors, betterproportions, nooldvoltagedirection]{circuitikzgit}[
]

\ctikzset{!vi/.style={no v symbols, no i symbols}}
\ctikzset{bipole voltage style/.style={color=blue},
	bipole current style/.style={color=red}}


\newcommand{\iarronly}[1]{% name
    \node [currarrow, color=red, anchor=center,
    rotate=\ctikzgetdirection{#1-Iarrow}] at (#1-Ipos) {};
}
\newcommand{\varronly}[1]{% name
    \draw [color=blue] (#1-Vfrom) .. controls (#1-Vcont1)
        and (#1-Vcont2)..  (#1-Vto) node [currarrow,
        sloped, anchor=tip, allow upside down,pos=1]{};
}

\begin{document}
	\begin{tikzpicture}
		\draw (120:6) to[R, *-,  name=R, v_<=$v_R$, !vi, l=R] (120:3) to[short, i=$i_R$, name=SR, !vi] (0,0);
		\draw (180:4) to[L, o-, l=$L$, name=L2, v=$v_L$, !vi] (180:2) to[V, -*, name=V2, v_=$v_2$, !vi] (0:0);
		\iarronly{SR}
		\varronly{R}
		\varronly{L2}
		\varronly{V2}
	\end{tikzpicture}
\end{document}

grafik

@Rmano
Copy link
Collaborator Author

@Rmano Rmano commented Jul 14, 2021

Thanks! ;-)

@Rmano Rmano linked a pull request that will close this issue Jul 14, 2021
@Rmano Rmano closed this in #574 Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants