# How to normalize the coordinate without changing the object size?

The following MWE produces

\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{pst-circ}
\psset
{
unit=1cm,
dipolestyle=zigzag,
}
\begin{document}
\begin{pspicture}[showgrid=true](0,-4)(8,4)
\resistor(0,0)(4,0){$R_1$}
\resistor(4,0)(8,0){$R_2$}
\resistor(4,0)(4,4){$R_3$}
\resistor(4,0)(4,-4){$R_4$}
\end{pspicture}
\end{document}


I noticed that a resistor (among other components) needs a space of about 4 centimeter. Based on this fact, I want to normalize the coordinate from, for example, \resistor(4,0)(4,-4){$R_4$} to \resistor(1,0)(1,-1){$R_4$} by changing the unit unit=4cm as follows.

\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{pst-circ}
\psset
{
unit=4cm,
dipolestyle=zigzag,
}
\begin{document}
\begin{pspicture}[showgrid=true](0,-1)(2,1)
\resistor(0,0)(1,0){$R_1$}
\resistor(1,0)(2,0){$R_2$}
\resistor(1,0)(1,1){$R_3$}
\resistor(1,0)(1,-1){$R_4$}
\end{pspicture}
\end{document}


Unfortunately, the resistor itself also gets affected as follows.

# Question

Is there any way to normalize the grid without affecting the size of other drawn objects?

# Edit

I am also interested in other solutions (if any) with TikZ, Metapost, Asymptote, etc.

## 1 Answer

In general not possible. Only with some tricky code ...

\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{pst-circ}
\def\1{4}\def\2{8}
\psset{dipolestyle=zigzag}
\begin{document}
\begin{pspicture}[showgrid=true](0,-\1)(\2,\1)
\resistor(0,0)(\1,0){$R_1$}
\resistor(\1,0)(\2,0){$R_2$}
\resistor(\1,0)(\1,\1){$R_3$}
\resistor(\1,0)(\1,-\1){$R_4$}
\end{pspicture}
\end{document}


or

\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{pst-circ}
\let\Resistor\resistor
\def\resistor(#1,#2)(#3,#4){%
\Resistor(\numexpr4*#1,\numexpr4*#2)%
(\numexpr4*#3,\numexpr4*#4)}
\let\PSpicture\pspicture
\def\pspicture[#1](#2,#3)(#4,#5){%
\PSpicture[#1](\numexpr4*#2,\numexpr4*#3)(\numexpr4*#4,\numexpr4*#5)}

\psset{dipolestyle=zigzag}
\begin{document}
\begin{pspicture}[showgrid=true](0,-1)(2,1)
\resistor(0,0)(1,0){$R_1$}
\resistor(1,0)(2,0){$R_2$}
\resistor(1,0)(1,1){$R_3$}
\resistor(1,0)(1,-1){$R_4$}
\end{pspicture}
\end{document}

• and another tricky one added
– user2478
Sep 26, 2018 at 9:11
• Very good, could you apply the same trick for the pspicture and the grid? :-) Sep 26, 2018 at 9:13
• see edited answer. This one needs always the optional argument for pspicture which can be, of course, empty: \begin{pspicture[](...)
– user2478
Sep 26, 2018 at 9:28
• Is it possible to change something like Ox, Dx, dx, etc of the grid? Sep 26, 2018 at 9:37
• Always with \numexpr or \dimexpr but that is always overkill .... ;-)
– user2478
Sep 26, 2018 at 9:42