## 编译环境
操作系统
* [X] Windows 7/8/10
* [ ] macOS
* [ ] Linux
`若需勾选,请把[ ]改成[x]`
Tex发行版
* [X] TexLive `年...
## 编译环境
操作系统
* [X] Windows 7/8/10
* [ ] macOS
* [ ] Linux
`若需勾选,请把[ ]改成[x]`
Tex发行版
* [X] TexLive `年份`
* [ ] MikTeX `版本号`
* [ ] CTeX
`若需勾选,请把[ ]改成[x]`
## 我的问题
我准备自己做一个电路元件。具体说是一个电缆,circuitikz里有一个transmission line,但是没有地线我想做一个元件,现在是半成品。如果做成四端元件,画出node再连线,是可以的。但我想知道怎么在path上画node,node怎么盖住path。
\documentclass{article}
\pagestyle{empty}
\usepackage{circuitikz}
\usepackage{xeCJK}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage[T1]{fontenc}
\usepackage{calc}
\usepackage[paperwidth=10.5cm, paperheight=12.5cm,margin=1cm ]{geometry}
\definecolor{XJBlue}{RGB}{0, 78, 151}
\definecolor{XJRed}{RGB}{200, 22, 30}
\definecolor{XJGray}{RGB}{220, 220, 221}
\pgfdeclareshape{cable}
{
\anchor{center}{\pgfpointorigin} %中心点
\anchor{text} %
{\pgfpoint{-0.5\wd\pgfnodeparttextbox}{-0.5\ht\pgfnodeparttextbox}}
\savedanchor\in1{\pgfpoint{-1cm}{0cm}} % 入端信号/高压
\anchor{A1}{\in1}
\savedanchor\in0{\pgfpoint{-1cm}{-0.5cm}} % 入端地
\anchor{A0}{\in0}
\savedanchor\out1{\pgfpoint{1cm}{0cm}} % 出端信号/高压
\anchor{B1}{\out1}
\savedanchor\out0{\pgfpoint{1cm}{-0.5cm}} % 出端地
\anchor{B0}{\out0}
\foregroundpath{ % 图形在此输入
\pgfsetlinewidth{0.02cm}
\begin{pgfscope}
\pgfpathmoveto{\pgfpoint{1cm}{-0.22cm}}
\pgfpathlineto{\pgfpoint{0.45cm}{-0.22cm}}
\pgfpathlineto{\pgfpoint{0.45cm}{0.22cm}}
\pgfpathlineto{\pgfpoint{1cm}{0.22cm}}
\pgfusepath{clip}
\pgfpathellipse{\pgfpoint{0.45cm}{0cm}} {\pgfpoint{0cm}{0.2cm}} {\pgfpoint{0.1cm}{0cm}}
\pgfusepath{stroke}
\end{pgfscope}
\pgfpathmoveto{\pgfpoint{0.45cm}{-0.2cm}}
\pgfpathlineto{\pgfpoint{-0.45cm}{-0.2cm}}
\pgfpathmoveto{\pgfpoint{-0.45cm}{0.2cm}}
\pgfpathlineto{\pgfpoint{0.45cm}{0.2cm}}
\pgfusepath{stroke}
\pgfpathellipse{\pgfpoint{-0.45cm}{0cm}} {\pgfpoint{0cm}{0.2cm}} {\pgfpoint{0.1cm}{0cm}}
\pgfusepath{stroke}
}
}
\begin{document}
\begin{center}
\begin{circuitikz}
%\draw (0,0) to [transmission line] ++(2,0) coordinate(sw1) to [short, -*] ++(4,0);
\draw (0,0) to node[cable,]{111} ++(2,0);
\end{circuitikz}
\end{center}
\end{document}
一周热门 更多>