From 14bc93939d2ac679019a94721b4bc5c178671f2f Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 20 Jan 2021 03:01:21 +0000 Subject: CTAN sync 202101200301 --- FILES.byname | 650 +- FILES.byname.gz | Bin 2265542 -> 2265570 bytes FILES.last07days | 628 +- graphics/pgf/contrib/circuitikz/README.md | 8 +- graphics/pgf/contrib/circuitikz/doc/changelog.tex | 15 + .../contrib/circuitikz/doc/circuitikz-context.pdf | Bin 17743 -> 17743 bytes .../contrib/circuitikz/doc/circuitikz-context.tex | 8 +- .../contrib/circuitikz/doc/circuitikzmanual.pdf | Bin 1123157 -> 1128310 bytes .../contrib/circuitikz/doc/circuitikzmanual.tex | 94 +- .../pgf/contrib/circuitikz/doc/ctikzmanutils.sty | 8 +- .../contrib/circuitikz/tex/circuitikz-1.2.7.sty | 24526 +++++++++++++++++++ graphics/pgf/contrib/circuitikz/tex/circuitikz.sty | 259 +- .../pgf/contrib/circuitikz/tex/pgfcirc.defines.tex | 1965 +- .../pgf/contrib/circuitikz/tex/pgfcircbipoles.tex | 3844 ++- .../pgf/contrib/circuitikz/tex/pgfcirccurrent.tex | 36 +- .../pgf/contrib/circuitikz/tex/pgfcircflow.tex | 34 +- .../pgf/contrib/circuitikz/tex/pgfcirclabel.tex | 32 +- .../contrib/circuitikz/tex/pgfcircmonopoles.tex | 114 +- .../contrib/circuitikz/tex/pgfcircmultipoles.tex | 1459 +- .../pgf/contrib/circuitikz/tex/pgfcircpath.tex | 803 +- .../contrib/circuitikz/tex/pgfcircquadpoles.tex | 2151 +- .../pgf/contrib/circuitikz/tex/pgfcircshapes.tex | 8 +- .../pgf/contrib/circuitikz/tex/pgfcirctripoles.tex | 2695 +- .../pgf/contrib/circuitikz/tex/pgfcircutils.tex | 8 +- .../pgf/contrib/circuitikz/tex/pgfcircvoltage.tex | 98 +- .../contrib/circuitikz/tex/t-circuitikz-1.2.7.tex | 24308 ++++++++++++++++++ .../pgf/contrib/circuitikz/tex/t-circuitikz.tex | 14 +- macros/latex/contrib/asmeconf/README.md | 5 +- macros/latex/contrib/asmeconf/asmeconf-sample.bib | 4 +- .../latex/contrib/asmeconf/asmeconf-template.pdf | Bin 637738 -> 637772 bytes .../latex/contrib/asmeconf/asmeconf-template.tex | 48 +- macros/latex/contrib/asmeconf/asmeconf.cls | 18 +- .../examples/asmeconf-authorgrid-example.pdf | Bin 610063 -> 610103 bytes .../examples/asmeconf-authorgrid-example.tex | 51 +- .../asmeconf/examples/asmeconf-fontspec.pdf | Bin 381077 -> 381051 bytes .../asmeconf/examples/asmeconf-fontspec.tex | 4 +- .../examples/asmeconf-lualatex-ode-example.pdf | Bin 275358 -> 275604 bytes .../biblatex-gb7714-2015/README.md | 2381 +- .../biblatex-gb7714-2015-preamble.tex | 862 +- .../biblatex-gb7714-2015/biblatex-gb7714-2015.pdf | Bin 1884407 -> 1886456 bytes .../biblatex-gb7714-2015/biblatex-gb7714-2015.tex | 5377 ++-- .../biblatex-gb7714-2015/biblatex-map-test.bib | 114 - .../biblatex-gb7714-2015/biblatex-map.py | 2059 -- .../biblatex-gb7714-2015/biblatex_check.py | 590 - .../biblatex-gb7714-2015/chinese-erj.bbx | 474 +- .../biblatex-gb7714-2015/chinese-erj.cbx | 302 +- .../biblatex-gb7714-2015/example.bib | 7676 +++--- .../biblatex-gb7714-2015/gb7714-2015-gbk.def | 56 +- .../biblatex-gb7714-2015/gb7714-2015.bbx | 7799 +++--- .../biblatex-gb7714-2015/gb7714-2015.cbx | 752 +- .../biblatex-gb7714-2015/gb7714-2015ay.bbx | 7689 +++--- .../biblatex-gb7714-2015/gb7714-2015ay.cbx | 774 +- .../biblatex-gb7714-2015/gb7714-2015ms.bbx | 5470 ++--- .../biblatex-gb7714-2015/gb7714-2015ms.cbx | 380 +- .../biblatex-gb7714-2015/gb7714-2015mx.bbx | 6679 ++--- .../biblatex-gb7714-2015/gb7714-2015mx.cbx | 932 +- .../biblatex-gb7714-2015/gb7714texteg.dat | 214 - .../biblatex-gb7714-2015/gb7714texttobib.pl | 1670 -- .../biblatex-gb7714-2015/gbT7714-2015.tex | 15 - .../biblatex-gb7714-2015/gbT7714-2015eg.tex | 114 - .../biblatex-gb7714-2015/gbT7714-2015fmt.tex | 13 - .../biblatex-gb7714-2015/gbT7714-2015lan.tex | 45 - .../biblatex-gb7714-2015/gbT7714-2015ms.tex | 15 - .../biblatex-gb7714-2015/gbT7714-2015thesis.tex | 68 - .../biblatex-gb7714-2015/readme-BibLatex-Check.md | 27 - .../biblatex-gb7714-2015/readme-BibLatex-map.md | 152 - .../biblatex-contrib/biblatex-oxref/Makefile | 2 +- .../biblatex-contrib/biblatex-oxref/README.md | 2 +- .../biblatex-contrib/biblatex-oxref/oxalph-doc.pdf | Bin 436849 -> 436778 bytes .../biblatex-oxref/oxnotes-doc.pdf | Bin 443126 -> 443291 bytes .../biblatex-contrib/biblatex-oxref/oxnum-doc.pdf | Bin 437069 -> 439195 bytes .../biblatex-contrib/biblatex-oxref/oxref.dtx | 569 +- .../biblatex-contrib/biblatex-oxref/oxref.pdf | Bin 533046 -> 535848 bytes .../biblatex-contrib/biblatex-oxref/oxyear-doc.pdf | Bin 440773 -> 440823 bytes .../latex/contrib/easybook/doc/easybook-demo.pdf | Bin 308553 -> 308556 bytes .../latex/contrib/easybook/doc/easybook-demo.tex | 2 +- macros/latex/contrib/easybook/doc/easybook.pdf | Bin 234522 -> 234567 bytes macros/latex/contrib/easybook/doc/easybook.tex | 4 +- macros/latex/contrib/easybook/easybook.cls | 4 +- macros/latex/contrib/everysel/README.md | 26 + macros/latex/contrib/everysel/everysel.dtx | 441 + macros/latex/contrib/everysel/everysel.ins | 49 + macros/latex/contrib/everysel/everysel.pdf | Bin 0 -> 442773 bytes macros/latex/contrib/ms/README.md | 3 +- macros/latex/contrib/ms/everysel.dtx | 418 - macros/latex/contrib/ms/everysel.ins | 108 - macros/latex/contrib/ms/everysel.pdf | Bin 439959 -> 0 bytes systems/texlive/tlnet/tlpkg/texlive.tlpdb | 228 +- systems/texlive/tlnet/tlpkg/texlive.tlpdb.md5 | 2 +- systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512 | 2 +- .../texlive/tlnet/tlpkg/texlive.tlpdb.sha512.asc | 14 +- systems/texlive/tlnet/tlpkg/texlive.tlpdb.xz | Bin 2267568 -> 2271048 bytes systems/win32/miktex/source/CHANGELOG.md | 18 + systems/win32/miktex/tm/packages/next/pr.ini | 8 +- systems/win32/miktex/tm/packages/pr.ini | 8 +- systems/win32/w32tex/ChangeLog | 6 + timestamp | 2 +- 97 files changed, 81284 insertions(+), 37226 deletions(-) create mode 100644 graphics/pgf/contrib/circuitikz/tex/circuitikz-1.2.7.sty create mode 100644 graphics/pgf/contrib/circuitikz/tex/t-circuitikz-1.2.7.tex delete mode 100644 macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-map-test.bib delete mode 100644 macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-map.py delete mode 100644 macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex_check.py delete mode 100644 macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714texteg.dat delete mode 100644 macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714texttobib.pl delete mode 100644 macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015.tex delete mode 100644 macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015eg.tex delete mode 100644 macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015fmt.tex delete mode 100644 macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015lan.tex delete mode 100644 macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015ms.tex delete mode 100644 macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015thesis.tex delete mode 100644 macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/readme-BibLatex-Check.md delete mode 100644 macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/readme-BibLatex-map.md create mode 100644 macros/latex/contrib/everysel/README.md create mode 100644 macros/latex/contrib/everysel/everysel.dtx create mode 100644 macros/latex/contrib/everysel/everysel.ins create mode 100644 macros/latex/contrib/everysel/everysel.pdf delete mode 100644 macros/latex/contrib/ms/everysel.dtx delete mode 100644 macros/latex/contrib/ms/everysel.ins delete mode 100644 macros/latex/contrib/ms/everysel.pdf diff --git a/FILES.byname b/FILES.byname index 0b5fa110fb..266f3a4f6c 100644 --- a/FILES.byname +++ b/FILES.byname @@ -5087,7 +5087,7 @@ 1990/10/02 | 5440 | dviware/vutex/vaxvms.hlp 1990/10/02 | 812 | dviware/vutex/vaxvms.ins 1990/10/02 | 127576 | dviware/vutex/vutex.web -2021/01/18 | 228720 | FILES.last07days +2021/01/19 | 188211 | FILES.last07days 2020/08/14 | 104065 | fonts/academicons/academicons.pdf 2020/08/14 | 17247 | fonts/academicons/academicons.sty 2020/08/14 | 6546 | fonts/academicons/academicons.tex @@ -141821,46 +141821,48 @@ 2019/04/14 | 24014 | graphics/pgf/contrib/chordbox/chordbox.tex 2019/04/14 | 1125 | graphics/pgf/contrib/chordbox/README.md 2019/04/15 | 567774 | graphics/pgf/contrib/chordbox.zip -2020/12/27 | 29680 | graphics/pgf/contrib/circuitikz/doc/changelog.tex -2020/12/27 | 17743 | graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf -2020/12/27 | 938 | graphics/pgf/contrib/circuitikz/doc/circuitikz-context.tex -2020/12/27 | 1123157 | graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf -2020/12/27 | 392071 | graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex -2020/12/27 | 418 | graphics/pgf/contrib/circuitikz/doc/compatibility.tex -2020/12/27 | 6106 | graphics/pgf/contrib/circuitikz/doc/ctikzmanutils.sty -2020/12/27 | 3277 | graphics/pgf/contrib/circuitikz/README.md -2020/12/27 | 364086 | graphics/pgf/contrib/circuitikz/tex/circuitikz-0.4.sty -2020/12/27 | 393856 | graphics/pgf/contrib/circuitikz/tex/circuitikz-0.6.sty -2020/12/27 | 403539 | graphics/pgf/contrib/circuitikz/tex/circuitikz-0.7.sty -2020/12/27 | 422268 | graphics/pgf/contrib/circuitikz/tex/circuitikz-0.8.3.sty -2020/12/27 | 690730 | graphics/pgf/contrib/circuitikz/tex/circuitikz-0.9.3.sty -2020/12/27 | 758990 | graphics/pgf/contrib/circuitikz/tex/circuitikz-0.9.6.sty -2020/12/27 | 841461 | graphics/pgf/contrib/circuitikz/tex/circuitikz-1.0.sty -2020/12/27 | 937253 | graphics/pgf/contrib/circuitikz/tex/circuitikz-1.1.2.sty -2020/12/27 | 11132 | graphics/pgf/contrib/circuitikz/tex/circuitikz.sty -2020/12/27 | 280 | graphics/pgf/contrib/circuitikz/tex/ctikzstyle-example.tex -2020/12/27 | 3101 | graphics/pgf/contrib/circuitikz/tex/ctikzstyle-legacy.tex -2020/12/27 | 1877 | graphics/pgf/contrib/circuitikz/tex/ctikzstyle-romano.tex -2020/12/27 | 230999 | graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex -2020/12/27 | 8754 | graphics/pgf/contrib/circuitikz/tex/pgfcirccurrent.tex -2020/12/27 | 105225 | graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex -2020/12/27 | 9107 | graphics/pgf/contrib/circuitikz/tex/pgfcircflow.tex -2020/12/27 | 14413 | graphics/pgf/contrib/circuitikz/tex/pgfcirclabel.tex -2020/12/27 | 50152 | graphics/pgf/contrib/circuitikz/tex/pgfcircmonopoles.tex -2020/12/27 | 151918 | graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex -2020/12/27 | 63892 | graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex -2020/12/27 | 51357 | graphics/pgf/contrib/circuitikz/tex/pgfcircquadpoles.tex -2020/12/27 | 30990 | graphics/pgf/contrib/circuitikz/tex/pgfcircshapes.tex -2020/12/27 | 258244 | graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex -2020/12/27 | 2678 | graphics/pgf/contrib/circuitikz/tex/pgfcircutils.tex -2020/12/27 | 31836 | graphics/pgf/contrib/circuitikz/tex/pgfcircvoltage.tex -2020/12/27 | 416850 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz-0.8.3.tex -2020/12/27 | 683433 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz-0.9.3.tex -2020/12/27 | 751663 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz-0.9.6.tex -2020/12/27 | 834142 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz-1.0.tex -2020/12/27 | 929934 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz-1.1.2.tex -2020/12/27 | 3590 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex -2020/12/27 | 2201396 | graphics/pgf/contrib/circuitikz.zip +2021/01/19 | 30068 | graphics/pgf/contrib/circuitikz/doc/changelog.tex +2021/01/19 | 17743 | graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf +2021/01/19 | 938 | graphics/pgf/contrib/circuitikz/doc/circuitikz-context.tex +2021/01/19 | 1128310 | graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf +2021/01/19 | 394355 | graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex +2021/01/19 | 418 | graphics/pgf/contrib/circuitikz/doc/compatibility.tex +2021/01/19 | 6106 | graphics/pgf/contrib/circuitikz/doc/ctikzmanutils.sty +2021/01/19 | 3277 | graphics/pgf/contrib/circuitikz/README.md +2021/01/19 | 364086 | graphics/pgf/contrib/circuitikz/tex/circuitikz-0.4.sty +2021/01/19 | 393856 | graphics/pgf/contrib/circuitikz/tex/circuitikz-0.6.sty +2021/01/19 | 403539 | graphics/pgf/contrib/circuitikz/tex/circuitikz-0.7.sty +2021/01/19 | 422268 | graphics/pgf/contrib/circuitikz/tex/circuitikz-0.8.3.sty +2021/01/19 | 690730 | graphics/pgf/contrib/circuitikz/tex/circuitikz-0.9.3.sty +2021/01/19 | 758990 | graphics/pgf/contrib/circuitikz/tex/circuitikz-0.9.6.sty +2021/01/19 | 841461 | graphics/pgf/contrib/circuitikz/tex/circuitikz-1.0.sty +2021/01/19 | 937253 | graphics/pgf/contrib/circuitikz/tex/circuitikz-1.1.2.sty +2021/01/19 | 1021921 | graphics/pgf/contrib/circuitikz/tex/circuitikz-1.2.7.sty +2021/01/19 | 12286 | graphics/pgf/contrib/circuitikz/tex/circuitikz.sty +2021/01/19 | 280 | graphics/pgf/contrib/circuitikz/tex/ctikzstyle-example.tex +2021/01/19 | 3101 | graphics/pgf/contrib/circuitikz/tex/ctikzstyle-legacy.tex +2021/01/19 | 1877 | graphics/pgf/contrib/circuitikz/tex/ctikzstyle-romano.tex +2021/01/19 | 226047 | graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex +2021/01/19 | 8757 | graphics/pgf/contrib/circuitikz/tex/pgfcirccurrent.tex +2021/01/19 | 29007 | graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex +2021/01/19 | 9109 | graphics/pgf/contrib/circuitikz/tex/pgfcircflow.tex +2021/01/19 | 14437 | graphics/pgf/contrib/circuitikz/tex/pgfcirclabel.tex +2021/01/19 | 54038 | graphics/pgf/contrib/circuitikz/tex/pgfcircmonopoles.tex +2021/01/19 | 105296 | graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex +2021/01/19 | 16580 | graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex +2021/01/19 | 114935 | graphics/pgf/contrib/circuitikz/tex/pgfcircquadpoles.tex +2021/01/19 | 30990 | graphics/pgf/contrib/circuitikz/tex/pgfcircshapes.tex +2021/01/19 | 344519 | graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex +2021/01/19 | 2678 | graphics/pgf/contrib/circuitikz/tex/pgfcircutils.tex +2021/01/19 | 34691 | graphics/pgf/contrib/circuitikz/tex/pgfcircvoltage.tex +2021/01/19 | 416850 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz-0.8.3.tex +2021/01/19 | 683433 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz-0.9.3.tex +2021/01/19 | 751663 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz-0.9.6.tex +2021/01/19 | 834142 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz-1.0.tex +2021/01/19 | 929934 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz-1.1.2.tex +2021/01/19 | 1014383 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz-1.2.7.tex +2021/01/19 | 3590 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex +2021/01/19 | 2422452 | graphics/pgf/contrib/circuitikz.zip 2019/07/12 | 14811 | graphics/pgf/contrib/codeanatomy/codeanatomy.dtx 2019/07/12 | 1475 | graphics/pgf/contrib/codeanatomy/codeanatomy.ins 2019/07/12 | 123921 | graphics/pgf/contrib/codeanatomy/codeanatomy.lstlisting.pdf @@ -171552,7 +171554,7 @@ 2020/12/27 | 13202142 | install/graphics/pgf/base/pgf.tds.zip 2013/02/23 | 92056 | install/graphics/pgf/contrib/battleship.tds.zip 2016/02/19 | 701759 | install/graphics/pgf/contrib/celtic.tds.zip -2020/12/27 | 2215851 | install/graphics/pgf/contrib/circuitikz.tds.zip +2021/01/19 | 2437163 | install/graphics/pgf/contrib/circuitikz.tds.zip 2020/06/12 | 573255 | install/graphics/pgf/contrib/commutative-diagrams.tds.zip 2017/06/01 | 1005947 | install/graphics/pgf/contrib/hobby.tds.zip 2014/06/15 | 843875 | install/graphics/pgf/contrib/logicpuzzle.tds.zip @@ -184801,7 +184803,7 @@ 2013/04/01 | 14776 | macros/context/contrib/context-visualcounter/tex/context/third/visualcounter/t-visualcounter.mkvi 2018/03/05 | 11 | macros/context/contrib/context-visualcounter/VERSION 2018/03/22 | 276789 | macros/context/contrib/context-visualcounter.zip -2021/01/11 | 119624572 | macros/context/latest/cont-tmf.zip +2021/01/18 | 119650805 | macros/context/latest/cont-tmf.zip 2016/04/21 | 32846 | macros/cstex/base/cmexb.tar.gz 2016/06/26 | 1728262 | macros/cstex/base/csfonts-t1.tar.gz 2007/03/01 | 187106 | macros/cstex/base/csfonts.tar.gz @@ -189061,23 +189063,23 @@ 2020/10/22 | 814 | macros/latex/contrib/askmaps/README 2020/10/22 | 385765 | macros/latex/contrib/askmaps.zip 2021/01/04 | 37675 | macros/latex/contrib/asmeconf/asmeconf.bst -2021/01/16 | 71644 | macros/latex/contrib/asmeconf/asmeconf.cls -2021/01/14 | 13995 | macros/latex/contrib/asmeconf/asmeconf-sample.bib -2021/01/15 | 637738 | macros/latex/contrib/asmeconf/asmeconf-template.pdf -2021/01/15 | 41372 | macros/latex/contrib/asmeconf/asmeconf-template.tex -2021/01/15 | 610063 | macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.pdf -2021/01/15 | 41302 | macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.tex -2021/01/16 | 381077 | macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.pdf -2021/01/16 | 27446 | macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.tex -2021/01/16 | 275358 | macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.pdf +2021/01/18 | 71637 | macros/latex/contrib/asmeconf/asmeconf.cls +2021/01/18 | 13996 | macros/latex/contrib/asmeconf/asmeconf-sample.bib +2021/01/18 | 637772 | macros/latex/contrib/asmeconf/asmeconf-template.pdf +2021/01/18 | 42418 | macros/latex/contrib/asmeconf/asmeconf-template.tex +2021/01/18 | 610103 | macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.pdf +2021/01/18 | 41310 | macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.tex +2021/01/18 | 381051 | macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.pdf +2021/01/18 | 27451 | macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.tex +2021/01/18 | 275604 | macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.pdf 2021/01/16 | 9886 | macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.tex 2020/11/07 | 483046 | macros/latex/contrib/asmeconf/examples/CONTRACTOR-copyright-asmeconf-template.pdf 2020/11/07 | 482459 | macros/latex/contrib/asmeconf/examples/GOVT-copyright-asmeconf-template.pdf -2021/01/16 | 7609 | macros/latex/contrib/asmeconf/README.md +2021/01/18 | 7672 | macros/latex/contrib/asmeconf/README.md 2019/03/24 | 17689 | macros/latex/contrib/asmeconf/sample-figure-1.pdf 2019/07/08 | 95556 | macros/latex/contrib/asmeconf/sample-figure-2a.pdf 2019/07/08 | 91105 | macros/latex/contrib/asmeconf/sample-figure-2b.pdf -2021/01/16 | 2834904 | macros/latex/contrib/asmeconf.zip +2021/01/19 | 2835236 | macros/latex/contrib/asmeconf.zip 2020/04/15 | 42263 | macros/latex/contrib/asmejour/asmejour.bst 2020/08/12 | 29726 | macros/latex/contrib/asmejour/asmejour.cls 2020/04/15 | 18673 | macros/latex/contrib/asmejour/asmejour-sample.bib @@ -191119,36 +191121,23 @@ 2017/11/21 | 1662 | macros/latex/contrib/biblatex-contrib/biblatex-fiwi/latex/dbx/fiwi.dbx 2017/11/21 | 2941 | macros/latex/contrib/biblatex-contrib/biblatex-fiwi/README 2017/11/21 | 793984 | macros/latex/contrib/biblatex-contrib/biblatex-fiwi.zip -2020/01/25 | 18983 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex_check.py -2020/07/20 | 1884407 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf -2020/07/04 | 17212 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015-preamble.tex -2020/07/04 | 187259 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.tex -2020/01/25 | 66208 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-map.py -2020/01/25 | 3134 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-map-test.bib -2020/01/25 | 9268 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/chinese-erj.bbx -2020/01/25 | 5181 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/chinese-erj.cbx -2020/01/25 | 131797 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/example.bib -2020/07/21 | 153891 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx -2020/07/21 | 10902 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.cbx -2020/07/21 | 158183 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.bbx -2020/07/21 | 12310 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.cbx -2020/07/21 | 924 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015-gbk.def -2020/07/21 | 113757 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx -2020/07/21 | 5557 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.cbx -2020/07/21 | 132633 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx -2020/07/21 | 15127 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.cbx -2020/01/25 | 27685 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714texteg.dat -2020/01/25 | 54657 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714texttobib.pl -2020/01/25 | 3502 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015eg.tex -2020/01/25 | 334 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015fmt.tex -2020/01/25 | 1571 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015lan.tex -2020/02/26 | 391 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015ms.tex -2020/02/26 | 387 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015.tex -2020/02/28 | 2150 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015thesis.tex -2020/01/25 | 801 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/readme-BibLatex-Check.md -2020/01/25 | 4785 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/readme-BibLatex-map.md -2020/07/21 | 50725 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/README.md -2020/07/24 | 1938715 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015.zip +2021/01/19 | 1886456 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf +2021/01/03 | 17643 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015-preamble.tex +2021/01/19 | 190596 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.tex +2021/01/03 | 9505 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/chinese-erj.bbx +2021/01/03 | 5332 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/chinese-erj.cbx +2021/01/04 | 135634 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/example.bib +2021/01/19 | 157816 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx +2021/01/19 | 14715 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.cbx +2021/01/19 | 162209 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.bbx +2021/01/19 | 12686 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.cbx +2021/01/03 | 952 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015-gbk.def +2021/01/19 | 116503 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx +2021/01/19 | 5747 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.cbx +2021/01/19 | 136053 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx +2021/01/19 | 15593 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.cbx +2021/01/19 | 53411 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/README.md +2021/01/19 | 1881620 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015.zip 2020/11/15 | 162517 | macros/latex/contrib/biblatex-contrib/biblatex-german-legal/biblatex-german-legal.pdf 2020/11/15 | 15845 | macros/latex/contrib/biblatex-contrib/biblatex-german-legal/biblatex-german-legal.tex 2020/11/15 | 8950 | macros/latex/contrib/biblatex-contrib/biblatex-german-legal/german-legal-book.bbx @@ -191422,15 +191411,15 @@ 2015/05/31 | 763 | macros/latex/contrib/biblatex-contrib/biblatex-opcit-booktitle/makefile 2015/05/31 | 345 | macros/latex/contrib/biblatex-contrib/biblatex-opcit-booktitle/README 2018/10/24 | 113539 | macros/latex/contrib/biblatex-contrib/biblatex-opcit-booktitle.zip -2020/10/19 | 3072 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/Makefile -2020/10/19 | 436849 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxalph-doc.pdf -2020/10/19 | 443126 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxnotes-doc.pdf -2020/10/19 | 437069 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxnum-doc.pdf -2020/10/19 | 470939 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxref.dtx -2020/10/19 | 533046 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxref.pdf -2020/10/19 | 440773 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxyear-doc.pdf -2020/10/19 | 5403 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/README.md -2020/10/19 | 2339357 | macros/latex/contrib/biblatex-contrib/biblatex-oxref.zip +2021/01/18 | 3073 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/Makefile +2021/01/18 | 436778 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxalph-doc.pdf +2021/01/18 | 443291 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxnotes-doc.pdf +2021/01/18 | 439195 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxnum-doc.pdf +2021/01/18 | 472235 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxref.dtx +2021/01/18 | 535848 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxref.pdf +2021/01/18 | 440823 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxyear-doc.pdf +2021/01/18 | 5403 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/README.md +2021/01/19 | 2344565 | macros/latex/contrib/biblatex-contrib/biblatex-oxref.zip 2020/09/30 | 225015 | macros/latex/contrib/biblatex-contrib/biblatex-philosophy/biblatex-philosophy.dtx 2020/09/30 | 500403 | macros/latex/contrib/biblatex-contrib/biblatex-philosophy/biblatex-philosophy.pdf 2020/09/30 | 9869 | macros/latex/contrib/biblatex-contrib/biblatex-philosophy/examples.zip @@ -195719,19 +195708,19 @@ 2008/06/22 | 373 | macros/latex/contrib/ean13isbn/README 2008/06/20 | 3175 | macros/latex/contrib/ean13isbn/tex/latex/ean13isbn/ean13isbn.sty 2008/06/22 | 316997 | macros/latex/contrib/ean13isbn.zip -2021/01/18 | 308553 | macros/latex/contrib/easybook/doc/easybook-demo.pdf -2021/01/18 | 2540 | macros/latex/contrib/easybook/doc/easybook-demo.tex -2021/01/18 | 234522 | macros/latex/contrib/easybook/doc/easybook.pdf -2021/01/18 | 25497 | macros/latex/contrib/easybook/doc/easybook.tex +2021/01/19 | 308556 | macros/latex/contrib/easybook/doc/easybook-demo.pdf +2021/01/19 | 2540 | macros/latex/contrib/easybook/doc/easybook-demo.tex +2021/01/19 | 234567 | macros/latex/contrib/easybook/doc/easybook.pdf +2021/01/19 | 25498 | macros/latex/contrib/easybook/doc/easybook.tex 2021/01/02 | 175 | macros/latex/contrib/easybook/doc/pages/appendix.tex 2021/01/05 | 4106 | macros/latex/contrib/easybook/doc/pages/chapter1.tex 2021/01/11 | 3856 | macros/latex/contrib/easybook/doc/pages/chapter2.tex 2021/01/13 | 2958 | macros/latex/contrib/easybook/doc/pages/chapter3.tex 2021/01/10 | 1108 | macros/latex/contrib/easybook/doc/pages/preface.tex 2020/12/23 | 794 | macros/latex/contrib/easybook/doc/ref/refs.bib -2021/01/18 | 42906 | macros/latex/contrib/easybook/easybook.cls +2021/01/19 | 42906 | macros/latex/contrib/easybook/easybook.cls 2021/01/14 | 3005 | macros/latex/contrib/easybook/README.md -2021/01/18 | 544092 | macros/latex/contrib/easybook.zip +2021/01/19 | 544132 | macros/latex/contrib/easybook.zip 2009/06/17 | 82589 | macros/latex/contrib/easy/doc/docbib.pdf 2009/06/17 | 78378 | macros/latex/contrib/easy/doc/docbmat.pdf 2009/06/17 | 99132 | macros/latex/contrib/easy/doc/doceqn.pdf @@ -197042,6 +197031,11 @@ 2020/10/17 | 159952 | macros/latex/contrib/everypage/everypage.pdf 2020/10/17 | 2456 | macros/latex/contrib/everypage/README.md 2020/10/18 | 168720 | macros/latex/contrib/everypage.zip +2021/01/19 | 15018 | macros/latex/contrib/everysel/everysel.dtx +2021/01/17 | 1565 | macros/latex/contrib/everysel/everysel.ins +2021/01/19 | 442773 | macros/latex/contrib/everysel/everysel.pdf +2021/01/19 | 744 | macros/latex/contrib/everysel/README.md +2021/01/19 | 447105 | macros/latex/contrib/everysel.zip 2020/11/24 | 13330 | macros/latex/contrib/everyshi/everyshi.dtx 2020/11/24 | 1561 | macros/latex/contrib/everyshi/everyshi.ins 2020/11/24 | 135907 | macros/latex/contrib/everyshi/everyshi.pdf @@ -204303,9 +204297,6 @@ 2008/06/02 | 154934 | macros/latex/contrib/msc/refman.pdf 2008/06/02 | 55546 | macros/latex/contrib/msc/refman.tex 2008/06/02 | 451349 | macros/latex/contrib/msc.zip -2020/11/24 | 13295 | macros/latex/contrib/ms/everysel.dtx -2020/11/24 | 3430 | macros/latex/contrib/ms/everysel.ins -2011/10/28 | 439959 | macros/latex/contrib/ms/everysel.pdf 2019/01/01 | 1743 | macros/latex/contrib/msg/CHANGES 2006/11/08 | 898 | macros/latex/contrib/msg/Makefile 2019/01/01 | 66015 | macros/latex/contrib/msg/msg.dtx @@ -204330,7 +204321,7 @@ 2020/11/24 | 18305 | macros/latex/contrib/ms/multitoc.dtx 2020/11/24 | 3537 | macros/latex/contrib/ms/multitoc.ins 2007/04/15 | 110362 | macros/latex/contrib/ms/multitoc.pdf -2020/11/24 | 441 | macros/latex/contrib/ms/README.md +2021/01/17 | 401 | macros/latex/contrib/ms/README.md 2017/12/20 | 25719 | macros/latex/contrib/msu-thesis/msu-thesis.cls 2017/12/20 | 226815 | macros/latex/contrib/msu-thesis/msu-thesis.pdf 2017/12/20 | 25643 | macros/latex/contrib/msu-thesis/msu-thesis.tex @@ -204342,7 +204333,7 @@ 2017/12/20 | 9363 | macros/latex/contrib/msu-thesis/samples/MSU-thesis-testfile.tex 2017/12/20 | 28876 | macros/latex/contrib/msu-thesis/samples/unified.bst 2017/12/20 | 442794 | macros/latex/contrib/msu-thesis.zip -2020/11/24 | 1037176 | macros/latex/contrib/ms.zip +2021/01/19 | 594454 | macros/latex/contrib/ms.zip 1999/07/29 | 5665 | macros/latex/contrib/mtgreek/mtgreek.dtx 1999/07/29 | 752 | macros/latex/contrib/mtgreek/mtgreek.ins 2010/04/21 | 169570 | macros/latex/contrib/mtgreek/mtgreek.pdf @@ -259172,6 +259163,9 @@ 2019/02/28 | 91652 | systems/texlive/tlnet/archive/a5comb.doc.r17020.tar.xz 2019/02/28 | 968 | systems/texlive/tlnet/archive/a5comb.r17020.tar.xz 2019/10/22 | 5172 | systems/texlive/tlnet/archive/aaai-named.r52470.tar.xz +2021/01/19 | 185656 | systems/texlive/tlnet/archive/aalok.doc.r57462.tar.xz +2021/01/19 | 6220 | systems/texlive/tlnet/archive/aalok.r57462.tar.xz +2021/01/19 | 18036 | systems/texlive/tlnet/archive/aalok.source.r57462.tar.xz 2019/08/08 | 1248512 | systems/texlive/tlnet/archive/aastex.doc.r51836.tar.xz 2019/08/08 | 48496 | systems/texlive/tlnet/archive/aastex.r51836.tar.xz 2019/02/28 | 852 | systems/texlive/tlnet/archive/abbr.doc.r15878.tar.xz @@ -261303,20 +261297,20 @@ 2020/03/04 | 372 | systems/texlive/tlnet/archive/collection-langczechslovak.r54074.tar.xz 2021/01/03 | 832 | systems/texlive/tlnet/archive/collection-langenglish.r57292.tar.xz 2020/11/10 | 704 | systems/texlive/tlnet/archive/collection-langeuropean.r56895.tar.xz -2020/08/06 | 584 | systems/texlive/tlnet/archive/collection-langfrench.r56051.tar.xz +2021/01/19 | 592 | systems/texlive/tlnet/archive/collection-langfrench.r57456.tar.xz 2020/07/01 | 628 | systems/texlive/tlnet/archive/collection-langgerman.r55706.tar.xz 2020/03/07 | 428 | systems/texlive/tlnet/archive/collection-langgreek.r54139.tar.xz 2020/05/14 | 432 | systems/texlive/tlnet/archive/collection-langitalian.r55129.tar.xz 2020/04/27 | 620 | systems/texlive/tlnet/archive/collection-langjapanese.r54894.tar.xz 2020/03/04 | 396 | systems/texlive/tlnet/archive/collection-langkorean.r54074.tar.xz -2020/07/25 | 788 | systems/texlive/tlnet/archive/collection-langother.r55932.tar.xz +2021/01/19 | 792 | systems/texlive/tlnet/archive/collection-langother.r57462.tar.xz 2020/03/04 | 408 | systems/texlive/tlnet/archive/collection-langpolish.r54074.tar.xz 2020/03/04 | 392 | systems/texlive/tlnet/archive/collection-langportuguese.r54074.tar.xz 2020/03/07 | 380 | systems/texlive/tlnet/archive/collection-langspanish.r54141.tar.xz 2021/01/12 | 6240 | systems/texlive/tlnet/archive/collection-latexextra.r57390.tar.xz 2020/12/03 | 696 | systems/texlive/tlnet/archive/collection-latex.r57048.tar.xz 2020/12/03 | 756 | systems/texlive/tlnet/archive/collection-latexrecommended.r57048.tar.xz -2020/12/30 | 700 | systems/texlive/tlnet/archive/collection-luatex.r57257.tar.xz +2021/01/19 | 704 | systems/texlive/tlnet/archive/collection-luatex.r57463.tar.xz 2020/11/08 | 1476 | systems/texlive/tlnet/archive/collection-mathscience.r56872.tar.xz 2019/03/09 | 540 | systems/texlive/tlnet/archive/collection-metapost.r50293.tar.xz 2020/04/12 | 472 | systems/texlive/tlnet/archive/collection-music.r54666.tar.xz @@ -262636,8 +262630,8 @@ 2019/02/28 | 1788 | systems/texlive/tlnet/archive/ean13isbn.r15878.tar.xz 2019/02/28 | 948 | systems/texlive/tlnet/archive/ean.doc.r20851.tar.xz 2019/02/28 | 3148 | systems/texlive/tlnet/archive/ean.r20851.tar.xz -2021/01/16 | 527376 | systems/texlive/tlnet/archive/easybook.doc.r57431.tar.xz -2021/01/16 | 9824 | systems/texlive/tlnet/archive/easybook.r57431.tar.xz +2021/01/19 | 530348 | systems/texlive/tlnet/archive/easybook.doc.r57460.tar.xz +2021/01/19 | 9856 | systems/texlive/tlnet/archive/easybook.r57460.tar.xz 2019/02/28 | 4540 | systems/texlive/tlnet/archive/easy.doc.r19440.tar.xz 2020/09/08 | 175976 | systems/texlive/tlnet/archive/easyfig.doc.r56291.tar.xz 2020/09/08 | 1936 | systems/texlive/tlnet/archive/easyfig.r56291.tar.xz @@ -265648,8 +265642,8 @@ 2019/02/28 | 7728 | systems/texlive/tlnet/archive/logicproof.source.r33254.tar.xz 2019/02/28 | 810144 | systems/texlive/tlnet/archive/logicpuzzle.doc.r34491.tar.xz 2019/02/28 | 15228 | systems/texlive/tlnet/archive/logicpuzzle.r34491.tar.xz -2020/09/24 | 1519580 | systems/texlive/tlnet/archive/logix.doc.r56414.tar.xz -2020/09/24 | 1469476 | systems/texlive/tlnet/archive/logix.r56414.tar.xz +2021/01/19 | 1211856 | systems/texlive/tlnet/archive/logix.doc.r57457.tar.xz +2021/01/19 | 2090608 | systems/texlive/tlnet/archive/logix.r57457.tar.xz 2019/02/28 | 67724 | systems/texlive/tlnet/archive/logpap.doc.r15878.tar.xz 2019/02/28 | 5880 | systems/texlive/tlnet/archive/logpap.r15878.tar.xz 2019/02/28 | 22100 | systems/texlive/tlnet/archive/logpap.source.r15878.tar.xz @@ -265877,6 +265871,8 @@ 2020/03/29 | 2620656 | systems/texlive/tlnet/archive/luajittex.x86_64-darwin.r54608.tar.xz 2020/03/13 | 3879900 | systems/texlive/tlnet/archive/luajittex.x86_64-linuxmusl.r54264.tar.xz 2020/03/13 | 2650640 | systems/texlive/tlnet/archive/luajittex.x86_64-linux.r54264.tar.xz +2021/01/19 | 140576 | systems/texlive/tlnet/archive/luakeys.doc.r57463.tar.xz +2021/01/19 | 4904 | systems/texlive/tlnet/archive/luakeys.r57463.tar.xz 2019/02/28 | 137620 | systems/texlive/tlnet/archive/lualatex-doc-de.doc.r30474.tar.xz 2019/02/28 | 536 | systems/texlive/tlnet/archive/lualatex-doc-de.r30474.tar.xz 2019/02/28 | 112928 | systems/texlive/tlnet/archive/lualatex-doc.doc.r30473.tar.xz @@ -266610,8 +266606,8 @@ 2019/02/28 | 186980 | systems/texlive/tlnet/archive/mlist.doc.r15878.tar.xz 2019/02/28 | 3068 | systems/texlive/tlnet/archive/mlist.r15878.tar.xz 2019/02/28 | 15480 | systems/texlive/tlnet/archive/mlist.source.r15878.tar.xz -2021/01/14 | 33756 | systems/texlive/tlnet/archive/mlmodern.doc.r57411.tar.xz -2021/01/14 | 7019984 | systems/texlive/tlnet/archive/mlmodern.r57411.tar.xz +2021/01/19 | 46740 | systems/texlive/tlnet/archive/mlmodern.doc.r57458.tar.xz +2021/01/19 | 7595924 | systems/texlive/tlnet/archive/mlmodern.r57458.tar.xz 2019/02/28 | 340 | systems/texlive/tlnet/archive/mltex.aarch64-linux.r46208.tar.xz 2019/02/28 | 340 | systems/texlive/tlnet/archive/mltex.amd64-freebsd.r16472.tar.xz 2019/02/28 | 336 | systems/texlive/tlnet/archive/mltex.amd64-netbsd.r30191.tar.xz @@ -266978,8 +266974,8 @@ 2019/02/28 | 4000 | systems/texlive/tlnet/archive/nevelok.source.r39029.tar.xz 2019/02/28 | 407624 | systems/texlive/tlnet/archive/newcommand.doc.r18704.tar.xz 2019/02/28 | 496 | systems/texlive/tlnet/archive/newcommand.r18704.tar.xz -2021/01/04 | 1662632 | systems/texlive/tlnet/archive/newcomputermodern.doc.r57309.tar.xz -2021/01/04 | 4535988 | systems/texlive/tlnet/archive/newcomputermodern.r57309.tar.xz +2021/01/19 | 1662972 | systems/texlive/tlnet/archive/newcomputermodern.doc.r57459.tar.xz +2021/01/19 | 4708832 | systems/texlive/tlnet/archive/newcomputermodern.r57459.tar.xz 2019/02/28 | 1632 | systems/texlive/tlnet/archive/newenviron.doc.r29331.tar.xz 2019/02/28 | 2488 | systems/texlive/tlnet/archive/newenviron.r29331.tar.xz 2019/02/28 | 147644 | systems/texlive/tlnet/archive/newfile.doc.r15878.tar.xz @@ -268112,6 +268108,8 @@ 2019/02/28 | 378272 | systems/texlive/tlnet/archive/productbox.doc.r20886.tar.xz 2019/02/28 | 4944 | systems/texlive/tlnet/archive/productbox.r20886.tar.xz 2019/02/28 | 15512 | systems/texlive/tlnet/archive/productbox.source.r20886.tar.xz +2021/01/19 | 2330552 | systems/texlive/tlnet/archive/profcollege.doc.r57456.tar.xz +2021/01/19 | 59492 | systems/texlive/tlnet/archive/profcollege.r57456.tar.xz 2019/02/28 | 49880 | systems/texlive/tlnet/archive/program.doc.r44214.tar.xz 2019/02/28 | 11780 | systems/texlive/tlnet/archive/program.r44214.tar.xz 2019/02/28 | 86236 | systems/texlive/tlnet/archive/progressbar.doc.r33822.tar.xz @@ -270083,8 +270081,8 @@ 2020/03/24 | 280 | systems/texlive/tlnet/archive/texlive-cz.r54496.tar.xz 2020/12/26 | 1338744 | systems/texlive/tlnet/archive/texlive-de.doc.r57223.tar.xz 2020/12/26 | 272 | systems/texlive/tlnet/archive/texlive-de.r57223.tar.xz -2021/01/18 | 171292 | systems/texlive/tlnet/archive/texlive-docindex.doc.r57450.tar.xz -2021/01/18 | 388 | systems/texlive/tlnet/archive/texlive-docindex.r57450.tar.xz +2021/01/19 | 171448 | systems/texlive/tlnet/archive/texlive-docindex.doc.r57454.tar.xz +2021/01/19 | 388 | systems/texlive/tlnet/archive/texlive-docindex.r57454.tar.xz 2020/04/16 | 1891392 | systems/texlive/tlnet/archive/texlive-en.doc.r54755.tar.xz 2020/04/16 | 272 | systems/texlive/tlnet/archive/texlive-en.r54755.tar.xz 2020/03/22 | 3090144 | systems/texlive/tlnet/archive/texlive-es.doc.r54465.tar.xz @@ -270140,7 +270138,7 @@ 2020/05/17 | 592 | systems/texlive/tlnet/archive/texlive-scripts.amd64-freebsd.r55172.tar.xz 2020/05/17 | 588 | systems/texlive/tlnet/archive/texlive-scripts.amd64-netbsd.r55172.tar.xz 2020/05/17 | 592 | systems/texlive/tlnet/archive/texlive-scripts.armhf-linux.r55172.tar.xz -2021/01/18 | 218820 | systems/texlive/tlnet/archive/texlive-scripts.doc.r57450.tar.xz +2021/01/19 | 218816 | systems/texlive/tlnet/archive/texlive-scripts.doc.r57455.tar.xz 2020/01/27 | 916 | systems/texlive/tlnet/archive/texlive-scripts-extra.aarch64-linux.r53577.tar.xz 2020/01/27 | 924 | systems/texlive/tlnet/archive/texlive-scripts-extra.amd64-freebsd.r53577.tar.xz 2020/01/27 | 916 | systems/texlive/tlnet/archive/texlive-scripts-extra.amd64-netbsd.r53577.tar.xz @@ -270164,7 +270162,7 @@ 2020/05/17 | 588 | systems/texlive/tlnet/archive/texlive-scripts.i386-linux.r55172.tar.xz 2020/05/17 | 592 | systems/texlive/tlnet/archive/texlive-scripts.i386-netbsd.r55172.tar.xz 2020/05/17 | 588 | systems/texlive/tlnet/archive/texlive-scripts.i386-solaris.r55172.tar.xz -2021/01/18 | 132176 | systems/texlive/tlnet/archive/texlive-scripts.r57450.tar.xz +2021/01/19 | 132176 | systems/texlive/tlnet/archive/texlive-scripts.r57455.tar.xz 2020/08/24 | 36336 | systems/texlive/tlnet/archive/texlive-scripts.win32.r56157.tar.xz 2020/05/17 | 588 | systems/texlive/tlnet/archive/texlive-scripts.x86_64-cygwin.r55172.tar.xz 2020/05/12 | 592 | systems/texlive/tlnet/archive/texlive-scripts.x86_64-darwinlegacy.r55117.tar.xz @@ -270749,8 +270747,8 @@ 2019/02/28 | 396 | systems/texlive/tlnet/archive/translation-moreverb-de.r23957.tar.xz 2019/02/28 | 687888 | systems/texlive/tlnet/archive/translation-natbib-fr.doc.r25105.tar.xz 2019/02/28 | 384 | systems/texlive/tlnet/archive/translation-natbib-fr.r25105.tar.xz -2021/01/17 | 503620 | systems/texlive/tlnet/archive/translations.doc.r57446.tar.xz -2021/01/17 | 12776 | systems/texlive/tlnet/archive/translations.r57446.tar.xz +2021/01/19 | 503624 | systems/texlive/tlnet/archive/translations.doc.r57461.tar.xz +2021/01/19 | 12820 | systems/texlive/tlnet/archive/translations.r57461.tar.xz 2019/02/28 | 355420 | systems/texlive/tlnet/archive/translation-tabbing-fr.doc.r24228.tar.xz 2019/02/28 | 404 | systems/texlive/tlnet/archive/translation-tabbing-fr.r24228.tar.xz 2020/08/06 | 215600 | systems/texlive/tlnet/archive/translator.doc.r56052.tar.xz @@ -271828,16 +271826,16 @@ 2020/07/18 | 47816 | systems/texlive/tlnet/archive/zztex.doc.r55862.tar.xz 2020/07/18 | 101724 | systems/texlive/tlnet/archive/zztex.r55862.tar.xz 2021/01/06 | 106039 | systems/texlive/tlnet/install-tl -2021/01/18 | 5521395 | systems/texlive/tlnet/install-tl-unx.tar.gz -2021/01/18 | 152 | systems/texlive/tlnet/install-tl-unx.tar.gz.sha512 -2021/01/18 | 455 | systems/texlive/tlnet/install-tl-unx.tar.gz.sha512.asc +2021/01/19 | 5521375 | systems/texlive/tlnet/install-tl-unx.tar.gz +2021/01/19 | 152 | systems/texlive/tlnet/install-tl-unx.tar.gz.sha512 +2021/01/19 | 455 | systems/texlive/tlnet/install-tl-unx.tar.gz.sha512.asc 2020/08/23 | 4889 | systems/texlive/tlnet/install-tl-windows.bat -2021/01/18 | 19416424 | systems/texlive/tlnet/install-tl-windows.exe -2021/01/18 | 153 | systems/texlive/tlnet/install-tl-windows.exe.sha512 -2021/01/18 | 455 | systems/texlive/tlnet/install-tl-windows.exe.sha512.asc -2021/01/18 | 24288850 | systems/texlive/tlnet/install-tl.zip -2021/01/18 | 145 | systems/texlive/tlnet/install-tl.zip.sha512 -2021/01/18 | 455 | systems/texlive/tlnet/install-tl.zip.sha512.asc +2021/01/19 | 19416405 | systems/texlive/tlnet/install-tl-windows.exe +2021/01/19 | 153 | systems/texlive/tlnet/install-tl-windows.exe.sha512 +2021/01/19 | 455 | systems/texlive/tlnet/install-tl-windows.exe.sha512.asc +2021/01/19 | 24288850 | systems/texlive/tlnet/install-tl.zip +2021/01/19 | 145 | systems/texlive/tlnet/install-tl.zip.sha512 +2021/01/19 | 455 | systems/texlive/tlnet/install-tl.zip.sha512.asc 2020/03/05 | 1215 | systems/texlive/tlnet/README.md 2020/04/06 | 5961 | systems/texlive/tlnet/tlpkg/gpg/pubring.gpg 2016/04/12 | 600 | systems/texlive/tlnet/tlpkg/gpg/random_seed @@ -271893,12 +271891,12 @@ 2020/05/17 | 20322 | systems/texlive/tlnet/tlpkg/TeXLive/TLCrypto.pm 2020/05/03 | 4786 | systems/texlive/tlnet/tlpkg/TeXLive/TLDownload.pm 2020/09/22 | 27563 | systems/texlive/tlnet/tlpkg/TeXLive/TLPaper.pm -2021/01/18 | 16966659 | systems/texlive/tlnet/tlpkg/texlive.tlpdb -2021/01/18 | 48 | systems/texlive/tlnet/tlpkg/texlive.tlpdb.md5 +2021/01/19 | 16971896 | systems/texlive/tlnet/tlpkg/texlive.tlpdb +2021/01/19 | 48 | systems/texlive/tlnet/tlpkg/texlive.tlpdb.md5 2020/05/13 | 86417 | systems/texlive/tlnet/tlpkg/TeXLive/TLPDB.pm -2021/01/18 | 144 | systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512 -2021/01/18 | 455 | systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512.asc -2021/01/18 | 2267568 | systems/texlive/tlnet/tlpkg/texlive.tlpdb.xz +2021/01/19 | 144 | systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512 +2021/01/19 | 455 | systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512.asc +2021/01/19 | 2271048 | systems/texlive/tlnet/tlpkg/texlive.tlpdb.xz 2020/04/15 | 58761 | systems/texlive/tlnet/tlpkg/TeXLive/TLPOBJ.pm 2020/03/20 | 41736 | systems/texlive/tlnet/tlpkg/TeXLive/TLPSRC.pm 2020/05/11 | 15010 | systems/texlive/tlnet/tlpkg/TeXLive/TLTREE.pm @@ -275164,7 +275162,7 @@ 2021/01/17 | 2323948 | systems/win32/miktex/setup/windows-x86/miktexsetup-4.1.zip 2020/10/10 | 20308232 | systems/win32/miktex/setup/windows-x86/setup-4.1.1.exe 2021/01/17 | 20529416 | systems/win32/miktex/setup/windows-x86/setup-4.2.exe -2020/12/11 | 27069 | systems/win32/miktex/source/CHANGELOG.md +2021/01/16 | 27458 | systems/win32/miktex/source/CHANGELOG.md 2020/10/11 | 26421700 | systems/win32/miktex/source/miktex-20.10.tar.xz 2020/10/11 | 499 | systems/win32/miktex/source/miktex-20.10.tar.xz.asc 2020/11/01 | 26848532 | systems/win32/miktex/source/miktex-20.11.tar.xz @@ -275177,6 +275175,8 @@ 2020/06/28 | 499 | systems/win32/miktex/source/miktex-20.6.tar.xz.asc 2020/08/02 | 26418152 | systems/win32/miktex/source/miktex-20.7.tar.xz 2020/08/02 | 499 | systems/win32/miktex/source/miktex-20.7.tar.xz.asc +2021/01/19 | 26902024 | systems/win32/miktex/source/miktex-21.1.tar.xz +2021/01/19 | 499 | systems/win32/miktex/source/miktex-21.1.tar.xz.asc 2019/05/29 | 25598304 | systems/win32/miktex/source/miktex-2.9.7050.tar.xz 2019/05/29 | 499 | systems/win32/miktex/source/miktex-2.9.7050.tar.xz.asc 2019/08/01 | 26862852 | systems/win32/miktex/source/miktex-2.9.7140.tar.xz @@ -276474,7 +276474,7 @@ 2020/10/03 | 318630 | systems/win32/miktex/tm/packages/filehook.tar.lzma 2012/12/04 | 924573 | systems/win32/miktex/tm/packages/fileinfo.tar.lzma 2011/09/21 | 281409 | systems/win32/miktex/tm/packages/filemod.tar.lzma -2021/01/18 | 559494 | systems/win32/miktex/tm/packages/files.csv.lzma +2021/01/19 | 559494 | systems/win32/miktex/tm/packages/files.csv.lzma 2001/05/14 | 5617 | systems/win32/miktex/tm/packages/finbib.tar.lzma 2015/10/20 | 44379 | systems/win32/miktex/tm/packages/findhyph.tar.lzma 2011/10/21 | 89323 | systems/win32/miktex/tm/packages/fink.tar.lzma @@ -277656,9 +277656,9 @@ 2018/01/12 | 157226 | systems/win32/miktex/tm/packages/miktex-zip-bin-x64.tar.lzma 2021/01/16 | 39515 | systems/win32/miktex/tm/packages/miktex-zlib-bin-2.9.tar.lzma 2021/01/16 | 43377 | systems/win32/miktex/tm/packages/miktex-zlib-bin-x64-2.9.tar.lzma -2021/01/18 | 206220 | systems/win32/miktex/tm/packages/miktex-zzdb1-2.9.tar.lzma -2021/01/18 | 1243365 | systems/win32/miktex/tm/packages/miktex-zzdb2-2.9.tar.lzma -2021/01/18 | 1160996 | systems/win32/miktex/tm/packages/miktex-zzdb3-2.9.tar.lzma +2021/01/19 | 206252 | systems/win32/miktex/tm/packages/miktex-zzdb1-2.9.tar.lzma +2021/01/19 | 1243863 | systems/win32/miktex/tm/packages/miktex-zzdb2-2.9.tar.lzma +2021/01/19 | 1160954 | systems/win32/miktex/tm/packages/miktex-zzdb3-2.9.tar.lzma 2021/01/16 | 13454 | systems/win32/miktex/tm/packages/miktex-zzip-bin-2.9.tar.lzma 2021/01/16 | 14322 | systems/win32/miktex/tm/packages/miktex-zzip-bin-x64-2.9.tar.lzma 2016/07/15 | 35914 | systems/win32/miktex/tm/packages/mil3.tar.lzma @@ -277816,187 +277816,187 @@ 2018/04/09 | 400132 | systems/win32/miktex/tm/packages/newunicodechar.tar.lzma 2011/09/19 | 101312 | systems/win32/miktex/tm/packages/newvbtm.tar.lzma 2020/09/06 | 231669 | systems/win32/miktex/tm/packages/newverbs.tar.lzma -2021/01/18 | 559283 | systems/win32/miktex/tm/packages/next/files.csv.lzma -2021/01/18 | 50703 | systems/win32/miktex/tm/packages/next/miktex-arctrl-bin-2.9.tar.lzma -2021/01/18 | 56455 | systems/win32/miktex/tm/packages/next/miktex-arctrl-bin-x64-2.9.tar.lzma -2021/01/18 | 969228 | systems/win32/miktex/tm/packages/next/miktex-asymptote-bin-2.9.tar.lzma -2021/01/18 | 1078966 | systems/win32/miktex/tm/packages/next/miktex-asymptote-bin-x64-2.9.tar.lzma -2021/01/18 | 29024 | systems/win32/miktex/tm/packages/next/miktex-autosp-bin-2.9.tar.lzma -2021/01/18 | 31346 | systems/win32/miktex/tm/packages/next/miktex-autosp-bin-x64-2.9.tar.lzma -2021/01/18 | 29512 | systems/win32/miktex/tm/packages/next/miktex-axohelp-bin-2.9.tar.lzma -2021/01/18 | 34306 | systems/win32/miktex/tm/packages/next/miktex-axohelp-bin-x64-2.9.tar.lzma -2021/01/18 | 50031 | systems/win32/miktex/tm/packages/next/miktex-bibarts-bin-2.9.tar.lzma -2021/01/18 | 57609 | systems/win32/miktex/tm/packages/next/miktex-bibarts-bin-x64-2.9.tar.lzma -2021/01/18 | 85304 | systems/win32/miktex/tm/packages/next/miktex-bibtex8bit-bin-2.9.tar.lzma -2021/01/18 | 94599 | systems/win32/miktex/tm/packages/next/miktex-bibtex8bit-bin-x64-2.9.tar.lzma -2021/01/18 | 67496 | systems/win32/miktex/tm/packages/next/miktex-bibtex-bin-2.9.tar.lzma -2021/01/18 | 75340 | systems/win32/miktex/tm/packages/next/miktex-bibtex-bin-x64-2.9.tar.lzma -2021/01/18 | 27203 | systems/win32/miktex/tm/packages/next/miktex-bzip2-bin-2.9.tar.lzma -2021/01/18 | 30873 | systems/win32/miktex/tm/packages/next/miktex-bzip2-bin-x64-2.9.tar.lzma -2021/01/18 | 329919 | systems/win32/miktex/tm/packages/next/miktex-cairo-bin-2.9.tar.lzma -2021/01/18 | 392682 | systems/win32/miktex/tm/packages/next/miktex-cairo-bin-x64-2.9.tar.lzma -2021/01/18 | 32544 | systems/win32/miktex/tm/packages/next/miktex-chktex-bin-2.9.tar.lzma -2021/01/18 | 36678 | systems/win32/miktex/tm/packages/next/miktex-chktex-bin-x64-2.9.tar.lzma -2021/01/18 | 51409 | systems/win32/miktex/tm/packages/next/miktex-cjkutils-bin-2.9.tar.lzma -2021/01/18 | 56600 | systems/win32/miktex/tm/packages/next/miktex-cjkutils-bin-x64-2.9.tar.lzma -2021/01/18 | 231667 | systems/win32/miktex/tm/packages/next/miktex-console-bin-2.9.tar.lzma -2021/01/18 | 254183 | systems/win32/miktex/tm/packages/next/miktex-console-bin-x64-2.9.tar.lzma -2021/01/18 | 179467 | systems/win32/miktex/tm/packages/next/miktex-curl-bin-2.9.tar.lzma -2021/01/18 | 195675 | systems/win32/miktex/tm/packages/next/miktex-curl-bin-x64-2.9.tar.lzma -2021/01/18 | 52497 | systems/win32/miktex/tm/packages/next/miktex-cweb-bin-2.9.tar.lzma -2021/01/18 | 59144 | systems/win32/miktex/tm/packages/next/miktex-cweb-bin-x64-2.9.tar.lzma -2021/01/18 | 21130 | systems/win32/miktex/tm/packages/next/miktex-devnag-bin-2.9.tar.lzma -2021/01/18 | 23313 | systems/win32/miktex/tm/packages/next/miktex-devnag-bin-x64-2.9.tar.lzma -2021/01/18 | 461387 | systems/win32/miktex/tm/packages/next/miktex-doc.tar.lzma -2021/01/18 | 45635 | systems/win32/miktex/tm/packages/next/miktex-dvicopy-bin-2.9.tar.lzma -2021/01/18 | 51184 | systems/win32/miktex/tm/packages/next/miktex-dvicopy-bin-x64-2.9.tar.lzma -2021/01/18 | 281360 | systems/win32/miktex/tm/packages/next/miktex-dvipdfmx-bin-2.9.tar.lzma -2021/01/18 | 320795 | systems/win32/miktex/tm/packages/next/miktex-dvipdfmx-bin-x64-2.9.tar.lzma -2021/01/18 | 40963 | systems/win32/miktex/tm/packages/next/miktex-dvipng-bin-2.9.tar.lzma -2021/01/18 | 45271 | systems/win32/miktex/tm/packages/next/miktex-dvipng-bin-x64-2.9.tar.lzma -2021/01/18 | 116935 | systems/win32/miktex/tm/packages/next/miktex-dvips-bin-2.9.tar.lzma -2021/01/18 | 131490 | systems/win32/miktex/tm/packages/next/miktex-dvips-bin-x64-2.9.tar.lzma -2021/01/18 | 1281719 | systems/win32/miktex/tm/packages/next/miktex-dvisvgm-bin-2.9.tar.lzma -2021/01/18 | 1417675 | systems/win32/miktex/tm/packages/next/miktex-dvisvgm-bin-x64-2.9.tar.lzma -2021/01/18 | 87637 | systems/win32/miktex/tm/packages/next/miktex-epstopdf-bin-2.9.tar.lzma -2021/01/18 | 99483 | systems/win32/miktex/tm/packages/next/miktex-epstopdf-bin-x64-2.9.tar.lzma -2021/01/18 | 43071 | systems/win32/miktex/tm/packages/next/miktex-expat-bin-2.9.tar.lzma -2021/01/18 | 47903 | systems/win32/miktex/tm/packages/next/miktex-expat-bin-x64-2.9.tar.lzma -2021/01/18 | 25129 | systems/win32/miktex/tm/packages/next/miktex-findtexmf-bin-2.9.tar.lzma -2021/01/18 | 28006 | systems/win32/miktex/tm/packages/next/miktex-findtexmf-bin-x64-2.9.tar.lzma -2021/01/18 | 55852 | systems/win32/miktex/tm/packages/next/miktex-fmt-bin-2.9.tar.lzma -2021/01/18 | 62741 | systems/win32/miktex/tm/packages/next/miktex-fmt-bin-x64-2.9.tar.lzma -2021/01/18 | 135011 | systems/win32/miktex/tm/packages/next/miktex-fontconfig-bin-2.9.tar.lzma -2021/01/18 | 152746 | systems/win32/miktex/tm/packages/next/miktex-fontconfig-bin-x64-2.9.tar.lzma -2021/01/18 | 73322 | systems/win32/miktex/tm/packages/next/miktex-fonts-bin-2.9.tar.lzma -2021/01/18 | 77840 | systems/win32/miktex/tm/packages/next/miktex-fonts-bin-x64-2.9.tar.lzma -2021/01/18 | 71574 | systems/win32/miktex/tm/packages/next/miktex-freeglut-bin-2.9.tar.lzma -2021/01/18 | 80639 | systems/win32/miktex/tm/packages/next/miktex-freeglut-bin-x64-2.9.tar.lzma -2021/01/18 | 258632 | systems/win32/miktex/tm/packages/next/miktex-freetype2-bin-2.9.tar.lzma -2021/01/18 | 295620 | systems/win32/miktex/tm/packages/next/miktex-freetype2-bin-x64-2.9.tar.lzma -2021/01/18 | 22044 | systems/win32/miktex/tm/packages/next/miktex-fribidixetex-bin-2.9.tar.lzma -2021/01/18 | 25039 | systems/win32/miktex/tm/packages/next/miktex-fribidixetex-bin-x64-2.9.tar.lzma -2021/01/18 | 97403 | systems/win32/miktex/tm/packages/next/miktex-gd-bin-2.9.tar.lzma -2021/01/18 | 112280 | systems/win32/miktex/tm/packages/next/miktex-gd-bin-x64-2.9.tar.lzma -2021/01/18 | 63831 | systems/win32/miktex/tm/packages/next/miktex-graphite2-bin-2.9.tar.lzma -2021/01/18 | 72842 | systems/win32/miktex/tm/packages/next/miktex-graphite2-bin-x64-2.9.tar.lzma -2021/01/18 | 94788 | systems/win32/miktex/tm/packages/next/miktex-gregorio-bin-2.9.tar.lzma -2021/01/18 | 113935 | systems/win32/miktex/tm/packages/next/miktex-gregorio-bin-x64-2.9.tar.lzma -2021/01/18 | 38058 | systems/win32/miktex/tm/packages/next/miktex-gsf2pk-bin-2.9.tar.lzma -2021/01/18 | 42663 | systems/win32/miktex/tm/packages/next/miktex-gsf2pk-bin-x64-2.9.tar.lzma -2021/01/18 | 484327 | systems/win32/miktex/tm/packages/next/miktex-harfbuzz-bin-2.9.tar.lzma -2021/01/18 | 568173 | systems/win32/miktex/tm/packages/next/miktex-harfbuzz-bin-x64-2.9.tar.lzma -2021/01/18 | 147188 | systems/win32/miktex/tm/packages/next/miktex-hunspell-bin-2.9.tar.lzma -2021/01/18 | 159864 | systems/win32/miktex/tm/packages/next/miktex-hunspell-bin-x64-2.9.tar.lzma -2021/01/18 | 94803 | systems/win32/miktex/tm/packages/next/miktex-jpeg-bin-2.9.tar.lzma -2021/01/18 | 109150 | systems/win32/miktex/tm/packages/next/miktex-jpeg-bin-x64-2.9.tar.lzma -2021/01/18 | 16339 | systems/win32/miktex/tm/packages/next/miktex-kpathsea-bin-2.9.tar.lzma -2021/01/18 | 17958 | systems/win32/miktex/tm/packages/next/miktex-kpathsea-bin-x64-2.9.tar.lzma -2021/01/18 | 28228 | systems/win32/miktex/tm/packages/next/miktex-lacheck-bin-2.9.tar.lzma -2021/01/18 | 30031 | systems/win32/miktex/tm/packages/next/miktex-lacheck-bin-x64-2.9.tar.lzma -2021/01/18 | 624929 | systems/win32/miktex/tm/packages/next/miktex-lcdf-typetools-bin-2.9.tar.lzma -2021/01/18 | 680060 | systems/win32/miktex/tm/packages/next/miktex-lcdf-typetools-bin-x64-2.9.tar.lzma -2021/01/18 | 531714 | systems/win32/miktex/tm/packages/next/miktex-libressl-bin-2.9.tar.lzma -2021/01/18 | 596720 | systems/win32/miktex/tm/packages/next/miktex-libressl-bin-x64-2.9.tar.lzma -2021/01/18 | 475817 | systems/win32/miktex/tm/packages/next/miktex-log4cxx-bin-2.9.tar.lzma -2021/01/18 | 514087 | systems/win32/miktex/tm/packages/next/miktex-log4cxx-bin-x64-2.9.tar.lzma -2021/01/18 | 94374 | systems/win32/miktex/tm/packages/next/miktex-lua53-bin-2.9.tar.lzma -2021/01/18 | 103331 | systems/win32/miktex/tm/packages/next/miktex-lua53-bin-x64-2.9.tar.lzma -2021/01/18 | 1685634 | systems/win32/miktex/tm/packages/next/miktex-luatex-bin-2.9.tar.lzma -2021/01/18 | 2002728 | systems/win32/miktex/tm/packages/next/miktex-luatex-bin-x64-2.9.tar.lzma -2021/01/18 | 67684 | systems/win32/miktex/tm/packages/next/miktex-lzma-bin-2.9.tar.lzma -2021/01/18 | 74156 | systems/win32/miktex/tm/packages/next/miktex-lzma-bin-x64-2.9.tar.lzma -2021/01/18 | 27463 | systems/win32/miktex/tm/packages/next/miktex-makeindex-bin-2.9.tar.lzma -2021/01/18 | 31542 | systems/win32/miktex/tm/packages/next/miktex-makeindex-bin-x64-2.9.tar.lzma -2021/01/18 | 7747 | systems/win32/miktex/tm/packages/next/miktex-md5-bin-2.9.tar.lzma -2021/01/18 | 8772 | systems/win32/miktex/tm/packages/next/miktex-md5-bin-x64-2.9.tar.lzma -2021/01/18 | 195624 | systems/win32/miktex/tm/packages/next/miktex-metafont-bin-2.9.tar.lzma -2021/01/18 | 213738 | systems/win32/miktex/tm/packages/next/miktex-metafont-bin-x64-2.9.tar.lzma -2021/01/18 | 250203 | systems/win32/miktex/tm/packages/next/miktex-metapost-bin-2.9.tar.lzma -2021/01/18 | 283981 | systems/win32/miktex/tm/packages/next/miktex-metapost-bin-x64-2.9.tar.lzma -2021/01/18 | 97120 | systems/win32/miktex/tm/packages/next/miktex-mfware-bin-2.9.tar.lzma -2021/01/18 | 101860 | systems/win32/miktex/tm/packages/next/miktex-mfware-bin-x64-2.9.tar.lzma -2021/01/18 | 60606 | systems/win32/miktex/tm/packages/next/miktex-mkfntmap-bin-2.9.tar.lzma -2021/01/18 | 67915 | systems/win32/miktex/tm/packages/next/miktex-mkfntmap-bin-x64-2.9.tar.lzma -2021/01/18 | 124939 | systems/win32/miktex/tm/packages/next/miktex-mktex-bin-2.9.tar.lzma -2021/01/18 | 136346 | systems/win32/miktex/tm/packages/next/miktex-mktex-bin-x64-2.9.tar.lzma -2021/01/18 | 147085 | systems/win32/miktex/tm/packages/next/miktex-mo-bin-2.9.tar.lzma -2021/01/18 | 163796 | systems/win32/miktex/tm/packages/next/miktex-mo-bin-x64-2.9.tar.lzma -2021/01/18 | 199586 | systems/win32/miktex/tm/packages/next/miktex-mpfr-bin-2.9.tar.lzma -2021/01/18 | 180159 | systems/win32/miktex/tm/packages/next/miktex-mpfr-bin-x64-2.9.tar.lzma -2021/01/18 | 67355 | systems/win32/miktex/tm/packages/next/miktex-mpmcli-bin-2.9.tar.lzma -2021/01/18 | 77430 | systems/win32/miktex/tm/packages/next/miktex-mpmcli-bin-x64-2.9.tar.lzma -2021/01/18 | 31227 | systems/win32/miktex/tm/packages/next/miktex-mspack-bin-2.9.tar.lzma -2021/01/18 | 35064 | systems/win32/miktex/tm/packages/next/miktex-mspack-bin-x64-2.9.tar.lzma -2021/01/18 | 38072 | systems/win32/miktex/tm/packages/next/miktex-mthelp-bin-2.9.tar.lzma -2021/01/18 | 42551 | systems/win32/miktex/tm/packages/next/miktex-mthelp-bin-x64-2.9.tar.lzma -2021/01/18 | 42871 | systems/win32/miktex/tm/packages/next/miktex-mtprint-bin-2.9.tar.lzma -2021/01/18 | 46959 | systems/win32/miktex/tm/packages/next/miktex-mtprint-bin-x64-2.9.tar.lzma -2021/01/18 | 45898 | systems/win32/miktex/tm/packages/next/miktex-m-tx-bin-2.9.tar.lzma -2021/01/18 | 52404 | systems/win32/miktex/tm/packages/next/miktex-m-tx-bin-x64-2.9.tar.lzma -2021/01/18 | 193756 | systems/win32/miktex/tm/packages/next/miktex-omegaware-bin-2.9.tar.lzma -2021/01/18 | 210930 | systems/win32/miktex/tm/packages/next/miktex-omegaware-bin-x64-2.9.tar.lzma -2021/01/18 | 35424 | systems/win32/miktex/tm/packages/next/miktex-patgen-bin.tar.lzma -2021/01/18 | 40230 | systems/win32/miktex/tm/packages/next/miktex-patgen-bin-x64.tar.lzma -2021/01/18 | 740141 | systems/win32/miktex/tm/packages/next/miktex-pdftex-bin-2.9.tar.lzma -2021/01/18 | 813998 | systems/win32/miktex/tm/packages/next/miktex-pdftex-bin-x64-2.9.tar.lzma -2021/01/18 | 198081 | systems/win32/miktex/tm/packages/next/miktex-pixman-bin-2.9.tar.lzma -2021/01/18 | 202648 | systems/win32/miktex/tm/packages/next/miktex-pixman-bin-x64-2.9.tar.lzma -2021/01/18 | 208089 | systems/win32/miktex/tm/packages/next/miktex-pmx-bin-2.9.tar.lzma -2021/01/18 | 243509 | systems/win32/miktex/tm/packages/next/miktex-pmx-bin-x64-2.9.tar.lzma -2021/01/18 | 78748 | systems/win32/miktex/tm/packages/next/miktex-png-bin-2.9.tar.lzma -2021/01/18 | 87770 | systems/win32/miktex/tm/packages/next/miktex-png-bin-x64-2.9.tar.lzma -2021/01/18 | 1171816 | systems/win32/miktex/tm/packages/next/miktex-poppler-bin-2.9.tar.lzma -2021/01/18 | 1307386 | systems/win32/miktex/tm/packages/next/miktex-poppler-bin-x64-2.9.tar.lzma -2021/01/18 | 20121 | systems/win32/miktex/tm/packages/next/miktex-popt-bin-2.9.tar.lzma -2021/01/18 | 23881 | systems/win32/miktex/tm/packages/next/miktex-popt-bin-x64-2.9.tar.lzma -2021/01/18 | 31550 | systems/win32/miktex/tm/packages/next/miktex-posix-bin-2.9.tar.lzma -2021/01/18 | 37251 | systems/win32/miktex/tm/packages/next/miktex-posix-bin-x64-2.9.tar.lzma -2021/01/18 | 63927 | systems/win32/miktex/tm/packages/next/miktex-ps2pk-bin-2.9.tar.lzma -2021/01/18 | 71966 | systems/win32/miktex/tm/packages/next/miktex-ps2pk-bin-x64-2.9.tar.lzma -2021/01/18 | 43563 | systems/win32/miktex/tm/packages/next/miktex-psutils-bin-2.9.tar.lzma -2021/01/18 | 52054 | systems/win32/miktex/tm/packages/next/miktex-psutils-bin-x64-2.9.tar.lzma -2021/01/18 | 1291600 | systems/win32/miktex/tm/packages/next/miktex-runtime-bin-2.9.tar.lzma -2021/01/18 | 1421910 | systems/win32/miktex/tm/packages/next/miktex-runtime-bin-x64-2.9.tar.lzma -2021/01/18 | 42397 | systems/win32/miktex/tm/packages/next/miktex-synctex-bin-2.9.tar.lzma -2021/01/18 | 51863 | systems/win32/miktex/tm/packages/next/miktex-synctex-bin-x64-2.9.tar.lzma -2021/01/18 | 56324 | systems/win32/miktex/tm/packages/next/miktex-tdsutil-bin.tar.lzma -2021/01/18 | 59808 | systems/win32/miktex/tm/packages/next/miktex-tdsutil-bin-x64.tar.lzma -2021/01/18 | 25332 | systems/win32/miktex/tm/packages/next/miktex-teckit-bin-2.9.tar.lzma -2021/01/18 | 27442 | systems/win32/miktex/tm/packages/next/miktex-teckit-bin-x64-2.9.tar.lzma -2021/01/18 | 16111 | systems/win32/miktex/tm/packages/next/miktex-tex2xindy-bin-2.9.tar.lzma -2021/01/18 | 18106 | systems/win32/miktex/tm/packages/next/miktex-tex2xindy-bin-x64-2.9.tar.lzma -2021/01/18 | 63764 | systems/win32/miktex/tm/packages/next/miktex-tex4ht-bin-2.9.tar.lzma -2021/01/18 | 70202 | systems/win32/miktex/tm/packages/next/miktex-tex4ht-bin-x64-2.9.tar.lzma -2021/01/18 | 153805 | systems/win32/miktex/tm/packages/next/miktex-tex-bin-2.9.tar.lzma -2021/01/18 | 167736 | systems/win32/miktex/tm/packages/next/miktex-tex-bin-x64-2.9.tar.lzma -2021/01/18 | 56976 | systems/win32/miktex/tm/packages/next/miktex-texify-bin-2.9.tar.lzma -2021/01/18 | 65322 | systems/win32/miktex/tm/packages/next/miktex-texify-bin-x64-2.9.tar.lzma -2021/01/18 | 99605 | systems/win32/miktex/tm/packages/next/miktex-texware-bin-2.9.tar.lzma -2021/01/18 | 104759 | systems/win32/miktex/tm/packages/next/miktex-texware-bin-x64-2.9.tar.lzma -2021/01/18 | 2495611 | systems/win32/miktex/tm/packages/next/miktex-texworks-bin-2.9.tar.lzma -2021/01/18 | 2617420 | systems/win32/miktex/tm/packages/next/miktex-texworks-bin-x64-2.9.tar.lzma -2021/01/18 | 55374 | systems/win32/miktex/tm/packages/next/miktex-ttf2pk2-bin-2.9.tar.lzma -2021/01/18 | 62081 | systems/win32/miktex/tm/packages/next/miktex-ttf2pk2-bin-x64-2.9.tar.lzma -2021/01/18 | 33532 | systems/win32/miktex/tm/packages/next/miktex-upmendex-bin.tar.lzma -2021/01/18 | 37311 | systems/win32/miktex/tm/packages/next/miktex-upmendex-bin-x64.tar.lzma -2021/01/18 | 27216 | systems/win32/miktex/tm/packages/next/miktex-uriparser-bin-2.9.tar.lzma -2021/01/18 | 33143 | systems/win32/miktex/tm/packages/next/miktex-uriparser-bin-x64-2.9.tar.lzma -2021/01/18 | 65815 | systems/win32/miktex/tm/packages/next/miktex-web-bin-2.9.tar.lzma -2021/01/18 | 70425 | systems/win32/miktex/tm/packages/next/miktex-web-bin-x64-2.9.tar.lzma -2021/01/18 | 310964 | systems/win32/miktex/tm/packages/next/miktex-xetex-bin-2.9.tar.lzma -2021/01/18 | 345230 | systems/win32/miktex/tm/packages/next/miktex-xetex-bin-x64-2.9.tar.lzma -2021/01/18 | 583741 | systems/win32/miktex/tm/packages/next/miktex-yap-bin-2.9.tar.lzma -2021/01/18 | 619143 | systems/win32/miktex/tm/packages/next/miktex-yap-bin-x64-2.9.tar.lzma -2021/01/18 | 39535 | systems/win32/miktex/tm/packages/next/miktex-zlib-bin-2.9.tar.lzma -2021/01/18 | 43383 | systems/win32/miktex/tm/packages/next/miktex-zlib-bin-x64-2.9.tar.lzma -2021/01/18 | 206258 | systems/win32/miktex/tm/packages/next/miktex-zzdb1-2.9.tar.lzma -2021/01/18 | 1243994 | systems/win32/miktex/tm/packages/next/miktex-zzdb2-2.9.tar.lzma -2021/01/18 | 1160953 | systems/win32/miktex/tm/packages/next/miktex-zzdb3-2.9.tar.lzma -2021/01/18 | 13466 | systems/win32/miktex/tm/packages/next/miktex-zzip-bin-2.9.tar.lzma -2021/01/18 | 14343 | systems/win32/miktex/tm/packages/next/miktex-zzip-bin-x64-2.9.tar.lzma +2021/01/19 | 559283 | systems/win32/miktex/tm/packages/next/files.csv.lzma +2021/01/19 | 50704 | systems/win32/miktex/tm/packages/next/miktex-arctrl-bin-2.9.tar.lzma +2021/01/19 | 56455 | systems/win32/miktex/tm/packages/next/miktex-arctrl-bin-x64-2.9.tar.lzma +2021/01/19 | 969226 | systems/win32/miktex/tm/packages/next/miktex-asymptote-bin-2.9.tar.lzma +2021/01/19 | 1078966 | systems/win32/miktex/tm/packages/next/miktex-asymptote-bin-x64-2.9.tar.lzma +2021/01/19 | 29022 | systems/win32/miktex/tm/packages/next/miktex-autosp-bin-2.9.tar.lzma +2021/01/19 | 31345 | systems/win32/miktex/tm/packages/next/miktex-autosp-bin-x64-2.9.tar.lzma +2021/01/19 | 29511 | systems/win32/miktex/tm/packages/next/miktex-axohelp-bin-2.9.tar.lzma +2021/01/19 | 34305 | systems/win32/miktex/tm/packages/next/miktex-axohelp-bin-x64-2.9.tar.lzma +2021/01/19 | 50031 | systems/win32/miktex/tm/packages/next/miktex-bibarts-bin-2.9.tar.lzma +2021/01/19 | 57610 | systems/win32/miktex/tm/packages/next/miktex-bibarts-bin-x64-2.9.tar.lzma +2021/01/19 | 85305 | systems/win32/miktex/tm/packages/next/miktex-bibtex8bit-bin-2.9.tar.lzma +2021/01/19 | 94597 | systems/win32/miktex/tm/packages/next/miktex-bibtex8bit-bin-x64-2.9.tar.lzma +2021/01/19 | 67497 | systems/win32/miktex/tm/packages/next/miktex-bibtex-bin-2.9.tar.lzma +2021/01/19 | 75341 | systems/win32/miktex/tm/packages/next/miktex-bibtex-bin-x64-2.9.tar.lzma +2021/01/19 | 27203 | systems/win32/miktex/tm/packages/next/miktex-bzip2-bin-2.9.tar.lzma +2021/01/19 | 30873 | systems/win32/miktex/tm/packages/next/miktex-bzip2-bin-x64-2.9.tar.lzma +2021/01/19 | 329919 | systems/win32/miktex/tm/packages/next/miktex-cairo-bin-2.9.tar.lzma +2021/01/19 | 392682 | systems/win32/miktex/tm/packages/next/miktex-cairo-bin-x64-2.9.tar.lzma +2021/01/19 | 32544 | systems/win32/miktex/tm/packages/next/miktex-chktex-bin-2.9.tar.lzma +2021/01/19 | 36678 | systems/win32/miktex/tm/packages/next/miktex-chktex-bin-x64-2.9.tar.lzma +2021/01/19 | 51409 | systems/win32/miktex/tm/packages/next/miktex-cjkutils-bin-2.9.tar.lzma +2021/01/19 | 56599 | systems/win32/miktex/tm/packages/next/miktex-cjkutils-bin-x64-2.9.tar.lzma +2021/01/19 | 231665 | systems/win32/miktex/tm/packages/next/miktex-console-bin-2.9.tar.lzma +2021/01/19 | 254184 | systems/win32/miktex/tm/packages/next/miktex-console-bin-x64-2.9.tar.lzma +2021/01/19 | 179467 | systems/win32/miktex/tm/packages/next/miktex-curl-bin-2.9.tar.lzma +2021/01/19 | 195675 | systems/win32/miktex/tm/packages/next/miktex-curl-bin-x64-2.9.tar.lzma +2021/01/19 | 52498 | systems/win32/miktex/tm/packages/next/miktex-cweb-bin-2.9.tar.lzma +2021/01/19 | 59144 | systems/win32/miktex/tm/packages/next/miktex-cweb-bin-x64-2.9.tar.lzma +2021/01/19 | 21130 | systems/win32/miktex/tm/packages/next/miktex-devnag-bin-2.9.tar.lzma +2021/01/19 | 23313 | systems/win32/miktex/tm/packages/next/miktex-devnag-bin-x64-2.9.tar.lzma +2021/01/19 | 461387 | systems/win32/miktex/tm/packages/next/miktex-doc.tar.lzma +2021/01/19 | 45636 | systems/win32/miktex/tm/packages/next/miktex-dvicopy-bin-2.9.tar.lzma +2021/01/19 | 51183 | systems/win32/miktex/tm/packages/next/miktex-dvicopy-bin-x64-2.9.tar.lzma +2021/01/19 | 281357 | systems/win32/miktex/tm/packages/next/miktex-dvipdfmx-bin-2.9.tar.lzma +2021/01/19 | 320797 | systems/win32/miktex/tm/packages/next/miktex-dvipdfmx-bin-x64-2.9.tar.lzma +2021/01/19 | 40963 | systems/win32/miktex/tm/packages/next/miktex-dvipng-bin-2.9.tar.lzma +2021/01/19 | 45271 | systems/win32/miktex/tm/packages/next/miktex-dvipng-bin-x64-2.9.tar.lzma +2021/01/19 | 116936 | systems/win32/miktex/tm/packages/next/miktex-dvips-bin-2.9.tar.lzma +2021/01/19 | 131488 | systems/win32/miktex/tm/packages/next/miktex-dvips-bin-x64-2.9.tar.lzma +2021/01/19 | 1281720 | systems/win32/miktex/tm/packages/next/miktex-dvisvgm-bin-2.9.tar.lzma +2021/01/19 | 1417676 | systems/win32/miktex/tm/packages/next/miktex-dvisvgm-bin-x64-2.9.tar.lzma +2021/01/19 | 87637 | systems/win32/miktex/tm/packages/next/miktex-epstopdf-bin-2.9.tar.lzma +2021/01/19 | 99483 | systems/win32/miktex/tm/packages/next/miktex-epstopdf-bin-x64-2.9.tar.lzma +2021/01/19 | 43071 | systems/win32/miktex/tm/packages/next/miktex-expat-bin-2.9.tar.lzma +2021/01/19 | 47903 | systems/win32/miktex/tm/packages/next/miktex-expat-bin-x64-2.9.tar.lzma +2021/01/19 | 25129 | systems/win32/miktex/tm/packages/next/miktex-findtexmf-bin-2.9.tar.lzma +2021/01/19 | 28006 | systems/win32/miktex/tm/packages/next/miktex-findtexmf-bin-x64-2.9.tar.lzma +2021/01/19 | 55852 | systems/win32/miktex/tm/packages/next/miktex-fmt-bin-2.9.tar.lzma +2021/01/19 | 62740 | systems/win32/miktex/tm/packages/next/miktex-fmt-bin-x64-2.9.tar.lzma +2021/01/19 | 135012 | systems/win32/miktex/tm/packages/next/miktex-fontconfig-bin-2.9.tar.lzma +2021/01/19 | 152746 | systems/win32/miktex/tm/packages/next/miktex-fontconfig-bin-x64-2.9.tar.lzma +2021/01/19 | 73322 | systems/win32/miktex/tm/packages/next/miktex-fonts-bin-2.9.tar.lzma +2021/01/19 | 77840 | systems/win32/miktex/tm/packages/next/miktex-fonts-bin-x64-2.9.tar.lzma +2021/01/19 | 71574 | systems/win32/miktex/tm/packages/next/miktex-freeglut-bin-2.9.tar.lzma +2021/01/19 | 80639 | systems/win32/miktex/tm/packages/next/miktex-freeglut-bin-x64-2.9.tar.lzma +2021/01/19 | 258631 | systems/win32/miktex/tm/packages/next/miktex-freetype2-bin-2.9.tar.lzma +2021/01/19 | 295622 | systems/win32/miktex/tm/packages/next/miktex-freetype2-bin-x64-2.9.tar.lzma +2021/01/19 | 22044 | systems/win32/miktex/tm/packages/next/miktex-fribidixetex-bin-2.9.tar.lzma +2021/01/19 | 25039 | systems/win32/miktex/tm/packages/next/miktex-fribidixetex-bin-x64-2.9.tar.lzma +2021/01/19 | 97402 | systems/win32/miktex/tm/packages/next/miktex-gd-bin-2.9.tar.lzma +2021/01/19 | 112279 | systems/win32/miktex/tm/packages/next/miktex-gd-bin-x64-2.9.tar.lzma +2021/01/19 | 63832 | systems/win32/miktex/tm/packages/next/miktex-graphite2-bin-2.9.tar.lzma +2021/01/19 | 72841 | systems/win32/miktex/tm/packages/next/miktex-graphite2-bin-x64-2.9.tar.lzma +2021/01/19 | 94787 | systems/win32/miktex/tm/packages/next/miktex-gregorio-bin-2.9.tar.lzma +2021/01/19 | 113934 | systems/win32/miktex/tm/packages/next/miktex-gregorio-bin-x64-2.9.tar.lzma +2021/01/19 | 38057 | systems/win32/miktex/tm/packages/next/miktex-gsf2pk-bin-2.9.tar.lzma +2021/01/19 | 42661 | systems/win32/miktex/tm/packages/next/miktex-gsf2pk-bin-x64-2.9.tar.lzma +2021/01/19 | 484326 | systems/win32/miktex/tm/packages/next/miktex-harfbuzz-bin-2.9.tar.lzma +2021/01/19 | 568175 | systems/win32/miktex/tm/packages/next/miktex-harfbuzz-bin-x64-2.9.tar.lzma +2021/01/19 | 147187 | systems/win32/miktex/tm/packages/next/miktex-hunspell-bin-2.9.tar.lzma +2021/01/19 | 159864 | systems/win32/miktex/tm/packages/next/miktex-hunspell-bin-x64-2.9.tar.lzma +2021/01/19 | 94803 | systems/win32/miktex/tm/packages/next/miktex-jpeg-bin-2.9.tar.lzma +2021/01/19 | 109150 | systems/win32/miktex/tm/packages/next/miktex-jpeg-bin-x64-2.9.tar.lzma +2021/01/19 | 16340 | systems/win32/miktex/tm/packages/next/miktex-kpathsea-bin-2.9.tar.lzma +2021/01/19 | 17958 | systems/win32/miktex/tm/packages/next/miktex-kpathsea-bin-x64-2.9.tar.lzma +2021/01/19 | 28230 | systems/win32/miktex/tm/packages/next/miktex-lacheck-bin-2.9.tar.lzma +2021/01/19 | 30031 | systems/win32/miktex/tm/packages/next/miktex-lacheck-bin-x64-2.9.tar.lzma +2021/01/19 | 624931 | systems/win32/miktex/tm/packages/next/miktex-lcdf-typetools-bin-2.9.tar.lzma +2021/01/19 | 680059 | systems/win32/miktex/tm/packages/next/miktex-lcdf-typetools-bin-x64-2.9.tar.lzma +2021/01/19 | 531716 | systems/win32/miktex/tm/packages/next/miktex-libressl-bin-2.9.tar.lzma +2021/01/19 | 596723 | systems/win32/miktex/tm/packages/next/miktex-libressl-bin-x64-2.9.tar.lzma +2021/01/19 | 475816 | systems/win32/miktex/tm/packages/next/miktex-log4cxx-bin-2.9.tar.lzma +2021/01/19 | 514085 | systems/win32/miktex/tm/packages/next/miktex-log4cxx-bin-x64-2.9.tar.lzma +2021/01/19 | 94375 | systems/win32/miktex/tm/packages/next/miktex-lua53-bin-2.9.tar.lzma +2021/01/19 | 103331 | systems/win32/miktex/tm/packages/next/miktex-lua53-bin-x64-2.9.tar.lzma +2021/01/19 | 1685635 | systems/win32/miktex/tm/packages/next/miktex-luatex-bin-2.9.tar.lzma +2021/01/19 | 2002728 | systems/win32/miktex/tm/packages/next/miktex-luatex-bin-x64-2.9.tar.lzma +2021/01/19 | 67684 | systems/win32/miktex/tm/packages/next/miktex-lzma-bin-2.9.tar.lzma +2021/01/19 | 74157 | systems/win32/miktex/tm/packages/next/miktex-lzma-bin-x64-2.9.tar.lzma +2021/01/19 | 27463 | systems/win32/miktex/tm/packages/next/miktex-makeindex-bin-2.9.tar.lzma +2021/01/19 | 31543 | systems/win32/miktex/tm/packages/next/miktex-makeindex-bin-x64-2.9.tar.lzma +2021/01/19 | 7747 | systems/win32/miktex/tm/packages/next/miktex-md5-bin-2.9.tar.lzma +2021/01/19 | 8773 | systems/win32/miktex/tm/packages/next/miktex-md5-bin-x64-2.9.tar.lzma +2021/01/19 | 195627 | systems/win32/miktex/tm/packages/next/miktex-metafont-bin-2.9.tar.lzma +2021/01/19 | 213738 | systems/win32/miktex/tm/packages/next/miktex-metafont-bin-x64-2.9.tar.lzma +2021/01/19 | 250203 | systems/win32/miktex/tm/packages/next/miktex-metapost-bin-2.9.tar.lzma +2021/01/19 | 283982 | systems/win32/miktex/tm/packages/next/miktex-metapost-bin-x64-2.9.tar.lzma +2021/01/19 | 97120 | systems/win32/miktex/tm/packages/next/miktex-mfware-bin-2.9.tar.lzma +2021/01/19 | 101858 | systems/win32/miktex/tm/packages/next/miktex-mfware-bin-x64-2.9.tar.lzma +2021/01/19 | 60606 | systems/win32/miktex/tm/packages/next/miktex-mkfntmap-bin-2.9.tar.lzma +2021/01/19 | 67915 | systems/win32/miktex/tm/packages/next/miktex-mkfntmap-bin-x64-2.9.tar.lzma +2021/01/19 | 124938 | systems/win32/miktex/tm/packages/next/miktex-mktex-bin-2.9.tar.lzma +2021/01/19 | 136345 | systems/win32/miktex/tm/packages/next/miktex-mktex-bin-x64-2.9.tar.lzma +2021/01/19 | 147086 | systems/win32/miktex/tm/packages/next/miktex-mo-bin-2.9.tar.lzma +2021/01/19 | 163793 | systems/win32/miktex/tm/packages/next/miktex-mo-bin-x64-2.9.tar.lzma +2021/01/19 | 199586 | systems/win32/miktex/tm/packages/next/miktex-mpfr-bin-2.9.tar.lzma +2021/01/19 | 180160 | systems/win32/miktex/tm/packages/next/miktex-mpfr-bin-x64-2.9.tar.lzma +2021/01/19 | 67356 | systems/win32/miktex/tm/packages/next/miktex-mpmcli-bin-2.9.tar.lzma +2021/01/19 | 77429 | systems/win32/miktex/tm/packages/next/miktex-mpmcli-bin-x64-2.9.tar.lzma +2021/01/19 | 31226 | systems/win32/miktex/tm/packages/next/miktex-mspack-bin-2.9.tar.lzma +2021/01/19 | 35066 | systems/win32/miktex/tm/packages/next/miktex-mspack-bin-x64-2.9.tar.lzma +2021/01/19 | 38068 | systems/win32/miktex/tm/packages/next/miktex-mthelp-bin-2.9.tar.lzma +2021/01/19 | 42551 | systems/win32/miktex/tm/packages/next/miktex-mthelp-bin-x64-2.9.tar.lzma +2021/01/19 | 42872 | systems/win32/miktex/tm/packages/next/miktex-mtprint-bin-2.9.tar.lzma +2021/01/19 | 46959 | systems/win32/miktex/tm/packages/next/miktex-mtprint-bin-x64-2.9.tar.lzma +2021/01/19 | 45898 | systems/win32/miktex/tm/packages/next/miktex-m-tx-bin-2.9.tar.lzma +2021/01/19 | 52402 | systems/win32/miktex/tm/packages/next/miktex-m-tx-bin-x64-2.9.tar.lzma +2021/01/19 | 193760 | systems/win32/miktex/tm/packages/next/miktex-omegaware-bin-2.9.tar.lzma +2021/01/19 | 210930 | systems/win32/miktex/tm/packages/next/miktex-omegaware-bin-x64-2.9.tar.lzma +2021/01/19 | 35425 | systems/win32/miktex/tm/packages/next/miktex-patgen-bin.tar.lzma +2021/01/19 | 40229 | systems/win32/miktex/tm/packages/next/miktex-patgen-bin-x64.tar.lzma +2021/01/19 | 740141 | systems/win32/miktex/tm/packages/next/miktex-pdftex-bin-2.9.tar.lzma +2021/01/19 | 813999 | systems/win32/miktex/tm/packages/next/miktex-pdftex-bin-x64-2.9.tar.lzma +2021/01/19 | 198081 | systems/win32/miktex/tm/packages/next/miktex-pixman-bin-2.9.tar.lzma +2021/01/19 | 202648 | systems/win32/miktex/tm/packages/next/miktex-pixman-bin-x64-2.9.tar.lzma +2021/01/19 | 208089 | systems/win32/miktex/tm/packages/next/miktex-pmx-bin-2.9.tar.lzma +2021/01/19 | 243510 | systems/win32/miktex/tm/packages/next/miktex-pmx-bin-x64-2.9.tar.lzma +2021/01/19 | 78748 | systems/win32/miktex/tm/packages/next/miktex-png-bin-2.9.tar.lzma +2021/01/19 | 87770 | systems/win32/miktex/tm/packages/next/miktex-png-bin-x64-2.9.tar.lzma +2021/01/19 | 1171816 | systems/win32/miktex/tm/packages/next/miktex-poppler-bin-2.9.tar.lzma +2021/01/19 | 1307388 | systems/win32/miktex/tm/packages/next/miktex-poppler-bin-x64-2.9.tar.lzma +2021/01/19 | 20119 | systems/win32/miktex/tm/packages/next/miktex-popt-bin-2.9.tar.lzma +2021/01/19 | 23881 | systems/win32/miktex/tm/packages/next/miktex-popt-bin-x64-2.9.tar.lzma +2021/01/19 | 31549 | systems/win32/miktex/tm/packages/next/miktex-posix-bin-2.9.tar.lzma +2021/01/19 | 37250 | systems/win32/miktex/tm/packages/next/miktex-posix-bin-x64-2.9.tar.lzma +2021/01/19 | 63927 | systems/win32/miktex/tm/packages/next/miktex-ps2pk-bin-2.9.tar.lzma +2021/01/19 | 71966 | systems/win32/miktex/tm/packages/next/miktex-ps2pk-bin-x64-2.9.tar.lzma +2021/01/19 | 43564 | systems/win32/miktex/tm/packages/next/miktex-psutils-bin-2.9.tar.lzma +2021/01/19 | 52055 | systems/win32/miktex/tm/packages/next/miktex-psutils-bin-x64-2.9.tar.lzma +2021/01/19 | 1291601 | systems/win32/miktex/tm/packages/next/miktex-runtime-bin-2.9.tar.lzma +2021/01/19 | 1421909 | systems/win32/miktex/tm/packages/next/miktex-runtime-bin-x64-2.9.tar.lzma +2021/01/19 | 42398 | systems/win32/miktex/tm/packages/next/miktex-synctex-bin-2.9.tar.lzma +2021/01/19 | 51863 | systems/win32/miktex/tm/packages/next/miktex-synctex-bin-x64-2.9.tar.lzma +2021/01/19 | 56327 | systems/win32/miktex/tm/packages/next/miktex-tdsutil-bin.tar.lzma +2021/01/19 | 59809 | systems/win32/miktex/tm/packages/next/miktex-tdsutil-bin-x64.tar.lzma +2021/01/19 | 25331 | systems/win32/miktex/tm/packages/next/miktex-teckit-bin-2.9.tar.lzma +2021/01/19 | 27442 | systems/win32/miktex/tm/packages/next/miktex-teckit-bin-x64-2.9.tar.lzma +2021/01/19 | 16112 | systems/win32/miktex/tm/packages/next/miktex-tex2xindy-bin-2.9.tar.lzma +2021/01/19 | 18106 | systems/win32/miktex/tm/packages/next/miktex-tex2xindy-bin-x64-2.9.tar.lzma +2021/01/19 | 63763 | systems/win32/miktex/tm/packages/next/miktex-tex4ht-bin-2.9.tar.lzma +2021/01/19 | 70202 | systems/win32/miktex/tm/packages/next/miktex-tex4ht-bin-x64-2.9.tar.lzma +2021/01/19 | 153807 | systems/win32/miktex/tm/packages/next/miktex-tex-bin-2.9.tar.lzma +2021/01/19 | 167737 | systems/win32/miktex/tm/packages/next/miktex-tex-bin-x64-2.9.tar.lzma +2021/01/19 | 56978 | systems/win32/miktex/tm/packages/next/miktex-texify-bin-2.9.tar.lzma +2021/01/19 | 65322 | systems/win32/miktex/tm/packages/next/miktex-texify-bin-x64-2.9.tar.lzma +2021/01/19 | 99606 | systems/win32/miktex/tm/packages/next/miktex-texware-bin-2.9.tar.lzma +2021/01/19 | 104759 | systems/win32/miktex/tm/packages/next/miktex-texware-bin-x64-2.9.tar.lzma +2021/01/19 | 2495615 | systems/win32/miktex/tm/packages/next/miktex-texworks-bin-2.9.tar.lzma +2021/01/19 | 2617420 | systems/win32/miktex/tm/packages/next/miktex-texworks-bin-x64-2.9.tar.lzma +2021/01/19 | 55374 | systems/win32/miktex/tm/packages/next/miktex-ttf2pk2-bin-2.9.tar.lzma +2021/01/19 | 62081 | systems/win32/miktex/tm/packages/next/miktex-ttf2pk2-bin-x64-2.9.tar.lzma +2021/01/19 | 33533 | systems/win32/miktex/tm/packages/next/miktex-upmendex-bin.tar.lzma +2021/01/19 | 37310 | systems/win32/miktex/tm/packages/next/miktex-upmendex-bin-x64.tar.lzma +2021/01/19 | 27217 | systems/win32/miktex/tm/packages/next/miktex-uriparser-bin-2.9.tar.lzma +2021/01/19 | 33142 | systems/win32/miktex/tm/packages/next/miktex-uriparser-bin-x64-2.9.tar.lzma +2021/01/19 | 65816 | systems/win32/miktex/tm/packages/next/miktex-web-bin-2.9.tar.lzma +2021/01/19 | 70425 | systems/win32/miktex/tm/packages/next/miktex-web-bin-x64-2.9.tar.lzma +2021/01/19 | 310964 | systems/win32/miktex/tm/packages/next/miktex-xetex-bin-2.9.tar.lzma +2021/01/19 | 345231 | systems/win32/miktex/tm/packages/next/miktex-xetex-bin-x64-2.9.tar.lzma +2021/01/19 | 583739 | systems/win32/miktex/tm/packages/next/miktex-yap-bin-2.9.tar.lzma +2021/01/19 | 619146 | systems/win32/miktex/tm/packages/next/miktex-yap-bin-x64-2.9.tar.lzma +2021/01/19 | 39536 | systems/win32/miktex/tm/packages/next/miktex-zlib-bin-2.9.tar.lzma +2021/01/19 | 43385 | systems/win32/miktex/tm/packages/next/miktex-zlib-bin-x64-2.9.tar.lzma +2021/01/19 | 206257 | systems/win32/miktex/tm/packages/next/miktex-zzdb1-2.9.tar.lzma +2021/01/19 | 1243664 | systems/win32/miktex/tm/packages/next/miktex-zzdb2-2.9.tar.lzma +2021/01/19 | 1160853 | systems/win32/miktex/tm/packages/next/miktex-zzdb3-2.9.tar.lzma +2021/01/19 | 13466 | systems/win32/miktex/tm/packages/next/miktex-zzip-bin-2.9.tar.lzma +2021/01/19 | 14343 | systems/win32/miktex/tm/packages/next/miktex-zzip-bin-x64-2.9.tar.lzma 2019/03/12 | 1412 | systems/win32/miktex/tm/packages/nextpage.tar.lzma -2021/01/18 | 1153 | systems/win32/miktex/tm/packages/next/pr.ini +2021/01/19 | 1153 | systems/win32/miktex/tm/packages/next/pr.ini 2018/07/06 | 145915 | systems/win32/miktex/tm/packages/nexus-otf.tar.lzma 2017/03/30 | 191149 | systems/win32/miktex/tm/packages/nfssext-cfr.tar.lzma 2012/12/20 | 612251 | systems/win32/miktex/tm/packages/nicefilelist.tar.lzma @@ -278326,7 +278326,7 @@ 2020/10/20 | 342254 | systems/win32/miktex/tm/packages/preview.tar.lzma 2019/06/20 | 375963 | systems/win32/miktex/tm/packages/prftree.tar.lzma 2020/10/27 | 357822 | systems/win32/miktex/tm/packages/principia.tar.lzma -2021/01/18 | 974 | systems/win32/miktex/tm/packages/pr.ini +2021/01/19 | 974 | systems/win32/miktex/tm/packages/pr.ini 2010/09/27 | 248469 | systems/win32/miktex/tm/packages/printlen.tar.lzma 2008/06/17 | 77313 | systems/win32/miktex/tm/packages/proba.tar.lzma 2017/07/12 | 988486 | systems/win32/miktex/tm/packages/probsoln.tar.lzma @@ -279500,7 +279500,7 @@ 2021/01/13 | 5177516 | systems/win32/w32tex/aleph-w32.tar.xz 2021/01/10 | 66729544 | systems/win32/w32tex/biblatex-biber.tar.xz 2016/12/13 | 65971452 | systems/win32/w32tex/cbfonts.tar.xz -2021/01/17 | 770311 | systems/win32/w32tex/ChangeLog +2021/01/18 | 770450 | systems/win32/w32tex/ChangeLog 2009/08/03 | 141221 | systems/win32/w32tex/ChangeLog.0 2009/08/03 | 221890 | systems/win32/w32tex/ChangeLog.1 2009/08/03 | 116462 | systems/win32/w32tex/ChangeLog.2 @@ -279508,7 +279508,7 @@ 2017/06/24 | 644754 | systems/win32/w32tex/ChangeLog.4 2020/10/20 | 23448752 | systems/win32/w32tex/cjkzr.tar.xz 2013/04/27 | 15858676 | systems/win32/w32tex/context-doc.tar.xz -2021/01/13 | 141702768 | systems/win32/w32tex/context.tar.xz +2021/01/18 | 141721444 | systems/win32/w32tex/context.tar.xz 2021/01/13 | 911488 | systems/win32/w32tex/cweb-w32.tar.xz 2020/09/21 | 6434128 | systems/win32/w32tex/datetime2.tar.xz 2021/01/13 | 844644 | systems/win32/w32tex/dvi2ps-w32.tar.xz @@ -279557,7 +279557,7 @@ 2020/10/31 | 142032 | systems/win32/w32tex/t1utils-w32.tar.xz 2021/01/13 | 2604708 | systems/win32/w32tex/tex4htk-w32.tar.xz 2018/06/20 | 15940044 | systems/win32/w32tex/tex-gyre.tar.xz -2021/01/13 | 4485516 | systems/win32/w32tex/texinfo-w32.tar.xz +2021/01/18 | 4485396 | systems/win32/w32tex/texinfo-w32.tar.xz 2021/01/03 | 2050496 | systems/win32/w32tex/texinstwin.zip 2020/01/19 | 97168 | systems/win32/w32tex/tiff2png-w32.tar.xz 2013/04/08 | 308444 | systems/win32/w32tex/timesnew.tar.xz @@ -279721,7 +279721,7 @@ 2004/06/04 | 404 | tds/tds.sed 2004/06/23 | 65418 | tds/tds.tex 2019/05/29 | 304264 | tds.zip -2021/01/19 | 186 | timestamp +2021/01/20 | 186 | timestamp 2002/08/26 | 61898 | usergrps/dante/antrag.pdf 2002/08/26 | 118217 | usergrps/dante/antrag.ps 2017/06/30 | 917 | usergrps/dante/dtk/doc/beispiel.bib diff --git a/FILES.byname.gz b/FILES.byname.gz index f247ff06bf..5eee0179f4 100644 Binary files a/FILES.byname.gz and b/FILES.byname.gz differ diff --git a/FILES.last07days b/FILES.last07days index efede62d2a..58ac04b670 100644 --- a/FILES.last07days +++ b/FILES.last07days @@ -1,5 +1,296 @@ -2021/01/18 | 99605 | systems/win32/miktex/tm/packages/next/miktex-texware-bin-2.9.tar.lzma -2021/01/18 | 99483 | systems/win32/miktex/tm/packages/next/miktex-epstopdf-bin-x64-2.9.tar.lzma +2021/01/19 | 99606 | systems/win32/miktex/tm/packages/next/miktex-texware-bin-2.9.tar.lzma +2021/01/19 | 99483 | systems/win32/miktex/tm/packages/next/miktex-epstopdf-bin-x64-2.9.tar.lzma +2021/01/19 | 9856 | systems/texlive/tlnet/archive/easybook.r57460.tar.xz +2021/01/19 | 974 | systems/win32/miktex/tm/packages/pr.ini +2021/01/19 | 97402 | systems/win32/miktex/tm/packages/next/miktex-gd-bin-2.9.tar.lzma +2021/01/19 | 97120 | systems/win32/miktex/tm/packages/next/miktex-mfware-bin-2.9.tar.lzma +2021/01/19 | 969226 | systems/win32/miktex/tm/packages/next/miktex-asymptote-bin-2.9.tar.lzma +2021/01/19 | 94803 | systems/win32/miktex/tm/packages/next/miktex-jpeg-bin-2.9.tar.lzma +2021/01/19 | 94787 | systems/win32/miktex/tm/packages/next/miktex-gregorio-bin-2.9.tar.lzma +2021/01/19 | 94597 | systems/win32/miktex/tm/packages/next/miktex-bibtex8bit-bin-x64-2.9.tar.lzma +2021/01/19 | 94375 | systems/win32/miktex/tm/packages/next/miktex-lua53-bin-2.9.tar.lzma +2021/01/19 | 938 | graphics/pgf/contrib/circuitikz/doc/circuitikz-context.tex +2021/01/19 | 937253 | graphics/pgf/contrib/circuitikz/tex/circuitikz-1.1.2.sty +2021/01/19 | 929934 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz-1.1.2.tex +2021/01/19 | 9109 | graphics/pgf/contrib/circuitikz/tex/pgfcircflow.tex +2021/01/19 | 87770 | systems/win32/miktex/tm/packages/next/miktex-png-bin-x64-2.9.tar.lzma +2021/01/19 | 8773 | systems/win32/miktex/tm/packages/next/miktex-md5-bin-x64-2.9.tar.lzma +2021/01/19 | 87637 | systems/win32/miktex/tm/packages/next/miktex-epstopdf-bin-2.9.tar.lzma +2021/01/19 | 8757 | graphics/pgf/contrib/circuitikz/tex/pgfcirccurrent.tex +2021/01/19 | 85305 | systems/win32/miktex/tm/packages/next/miktex-bibtex8bit-bin-2.9.tar.lzma +2021/01/19 | 841461 | graphics/pgf/contrib/circuitikz/tex/circuitikz-1.0.sty +2021/01/19 | 834142 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz-1.0.tex +2021/01/19 | 813999 | systems/win32/miktex/tm/packages/next/miktex-pdftex-bin-x64-2.9.tar.lzma +2021/01/19 | 80639 | systems/win32/miktex/tm/packages/next/miktex-freeglut-bin-x64-2.9.tar.lzma +2021/01/19 | 792 | systems/texlive/tlnet/archive/collection-langother.r57462.tar.xz +2021/01/19 | 78748 | systems/win32/miktex/tm/packages/next/miktex-png-bin-2.9.tar.lzma +2021/01/19 | 77840 | systems/win32/miktex/tm/packages/next/miktex-fonts-bin-x64-2.9.tar.lzma +2021/01/19 | 7747 | systems/win32/miktex/tm/packages/next/miktex-md5-bin-2.9.tar.lzma +2021/01/19 | 77429 | systems/win32/miktex/tm/packages/next/miktex-mpmcli-bin-x64-2.9.tar.lzma +2021/01/19 | 7595924 | systems/texlive/tlnet/archive/mlmodern.r57458.tar.xz +2021/01/19 | 758990 | graphics/pgf/contrib/circuitikz/tex/circuitikz-0.9.6.sty +2021/01/19 | 75341 | systems/win32/miktex/tm/packages/next/miktex-bibtex-bin-x64-2.9.tar.lzma +2021/01/19 | 751663 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz-0.9.6.tex +2021/01/19 | 744 | macros/latex/contrib/everysel/README.md +2021/01/19 | 74157 | systems/win32/miktex/tm/packages/next/miktex-lzma-bin-x64-2.9.tar.lzma +2021/01/19 | 740141 | systems/win32/miktex/tm/packages/next/miktex-pdftex-bin-2.9.tar.lzma +2021/01/19 | 73322 | systems/win32/miktex/tm/packages/next/miktex-fonts-bin-2.9.tar.lzma +2021/01/19 | 72841 | systems/win32/miktex/tm/packages/next/miktex-graphite2-bin-x64-2.9.tar.lzma +2021/01/19 | 71966 | systems/win32/miktex/tm/packages/next/miktex-ps2pk-bin-x64-2.9.tar.lzma +2021/01/19 | 71574 | systems/win32/miktex/tm/packages/next/miktex-freeglut-bin-2.9.tar.lzma +2021/01/19 | 704 | systems/texlive/tlnet/archive/collection-luatex.r57463.tar.xz +2021/01/19 | 70425 | systems/win32/miktex/tm/packages/next/miktex-web-bin-x64-2.9.tar.lzma +2021/01/19 | 70202 | systems/win32/miktex/tm/packages/next/miktex-tex4ht-bin-x64-2.9.tar.lzma +2021/01/19 | 690730 | graphics/pgf/contrib/circuitikz/tex/circuitikz-0.9.3.sty +2021/01/19 | 683433 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz-0.9.3.tex +2021/01/19 | 680059 | systems/win32/miktex/tm/packages/next/miktex-lcdf-typetools-bin-x64-2.9.tar.lzma +2021/01/19 | 67915 | systems/win32/miktex/tm/packages/next/miktex-mkfntmap-bin-x64-2.9.tar.lzma +2021/01/19 | 67684 | systems/win32/miktex/tm/packages/next/miktex-lzma-bin-2.9.tar.lzma +2021/01/19 | 67497 | systems/win32/miktex/tm/packages/next/miktex-bibtex-bin-2.9.tar.lzma +2021/01/19 | 67356 | systems/win32/miktex/tm/packages/next/miktex-mpmcli-bin-2.9.tar.lzma +2021/01/19 | 65816 | systems/win32/miktex/tm/packages/next/miktex-web-bin-2.9.tar.lzma +2021/01/19 | 65322 | systems/win32/miktex/tm/packages/next/miktex-texify-bin-x64-2.9.tar.lzma +2021/01/19 | 63927 | systems/win32/miktex/tm/packages/next/miktex-ps2pk-bin-2.9.tar.lzma +2021/01/19 | 63832 | systems/win32/miktex/tm/packages/next/miktex-graphite2-bin-2.9.tar.lzma +2021/01/19 | 63763 | systems/win32/miktex/tm/packages/next/miktex-tex4ht-bin-2.9.tar.lzma +2021/01/19 | 62740 | systems/win32/miktex/tm/packages/next/miktex-fmt-bin-x64-2.9.tar.lzma +2021/01/19 | 624931 | systems/win32/miktex/tm/packages/next/miktex-lcdf-typetools-bin-2.9.tar.lzma +2021/01/19 | 6220 | systems/texlive/tlnet/archive/aalok.r57462.tar.xz +2021/01/19 | 62081 | systems/win32/miktex/tm/packages/next/miktex-ttf2pk2-bin-x64-2.9.tar.lzma +2021/01/19 | 619146 | systems/win32/miktex/tm/packages/next/miktex-yap-bin-x64-2.9.tar.lzma +2021/01/19 | 6106 | graphics/pgf/contrib/circuitikz/doc/ctikzmanutils.sty +2021/01/19 | 60606 | systems/win32/miktex/tm/packages/next/miktex-mkfntmap-bin-2.9.tar.lzma +2021/01/19 | 59809 | systems/win32/miktex/tm/packages/next/miktex-tdsutil-bin-x64.tar.lzma +2021/01/19 | 596723 | systems/win32/miktex/tm/packages/next/miktex-libressl-bin-x64-2.9.tar.lzma +2021/01/19 | 59492 | systems/texlive/tlnet/archive/profcollege.r57456.tar.xz +2021/01/19 | 594454 | macros/latex/contrib/ms.zip +2021/01/19 | 592 | systems/texlive/tlnet/archive/collection-langfrench.r57456.tar.xz +2021/01/19 | 59144 | systems/win32/miktex/tm/packages/next/miktex-cweb-bin-x64-2.9.tar.lzma +2021/01/19 | 583739 | systems/win32/miktex/tm/packages/next/miktex-yap-bin-2.9.tar.lzma +2021/01/19 | 57610 | systems/win32/miktex/tm/packages/next/miktex-bibarts-bin-x64-2.9.tar.lzma +2021/01/19 | 5747 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.cbx +2021/01/19 | 56978 | systems/win32/miktex/tm/packages/next/miktex-texify-bin-2.9.tar.lzma +2021/01/19 | 568175 | systems/win32/miktex/tm/packages/next/miktex-harfbuzz-bin-x64-2.9.tar.lzma +2021/01/19 | 56599 | systems/win32/miktex/tm/packages/next/miktex-cjkutils-bin-x64-2.9.tar.lzma +2021/01/19 | 56455 | systems/win32/miktex/tm/packages/next/miktex-arctrl-bin-x64-2.9.tar.lzma +2021/01/19 | 56327 | systems/win32/miktex/tm/packages/next/miktex-tdsutil-bin.tar.lzma +2021/01/19 | 559494 | systems/win32/miktex/tm/packages/files.csv.lzma +2021/01/19 | 559283 | systems/win32/miktex/tm/packages/next/files.csv.lzma +2021/01/19 | 55852 | systems/win32/miktex/tm/packages/next/miktex-fmt-bin-2.9.tar.lzma +2021/01/19 | 55374 | systems/win32/miktex/tm/packages/next/miktex-ttf2pk2-bin-2.9.tar.lzma +2021/01/19 | 5521375 | systems/texlive/tlnet/install-tl-unx.tar.gz +2021/01/19 | 544132 | macros/latex/contrib/easybook.zip +2021/01/19 | 54038 | graphics/pgf/contrib/circuitikz/tex/pgfcircmonopoles.tex +2021/01/19 | 53411 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/README.md +2021/01/19 | 531716 | systems/win32/miktex/tm/packages/next/miktex-libressl-bin-2.9.tar.lzma +2021/01/19 | 530348 | systems/texlive/tlnet/archive/easybook.doc.r57460.tar.xz +2021/01/19 | 52498 | systems/win32/miktex/tm/packages/next/miktex-cweb-bin-2.9.tar.lzma +2021/01/19 | 52402 | systems/win32/miktex/tm/packages/next/miktex-m-tx-bin-x64-2.9.tar.lzma +2021/01/19 | 52055 | systems/win32/miktex/tm/packages/next/miktex-psutils-bin-x64-2.9.tar.lzma +2021/01/19 | 51863 | systems/win32/miktex/tm/packages/next/miktex-synctex-bin-x64-2.9.tar.lzma +2021/01/19 | 51409 | systems/win32/miktex/tm/packages/next/miktex-cjkutils-bin-2.9.tar.lzma +2021/01/19 | 514085 | systems/win32/miktex/tm/packages/next/miktex-log4cxx-bin-x64-2.9.tar.lzma +2021/01/19 | 51183 | systems/win32/miktex/tm/packages/next/miktex-dvicopy-bin-x64-2.9.tar.lzma +2021/01/19 | 50704 | systems/win32/miktex/tm/packages/next/miktex-arctrl-bin-2.9.tar.lzma +2021/01/19 | 503624 | systems/texlive/tlnet/archive/translations.doc.r57461.tar.xz +2021/01/19 | 50031 | systems/win32/miktex/tm/packages/next/miktex-bibarts-bin-2.9.tar.lzma +2021/01/19 | 499 | systems/win32/miktex/source/miktex-21.1.tar.xz.asc +2021/01/19 | 4904 | systems/texlive/tlnet/archive/luakeys.r57463.tar.xz +2021/01/19 | 48 | systems/texlive/tlnet/tlpkg/texlive.tlpdb.md5 +2021/01/19 | 484326 | systems/win32/miktex/tm/packages/next/miktex-harfbuzz-bin-2.9.tar.lzma +2021/01/19 | 47903 | systems/win32/miktex/tm/packages/next/miktex-expat-bin-x64-2.9.tar.lzma +2021/01/19 | 475816 | systems/win32/miktex/tm/packages/next/miktex-log4cxx-bin-2.9.tar.lzma +2021/01/19 | 4708832 | systems/texlive/tlnet/archive/newcomputermodern.r57459.tar.xz +2021/01/19 | 46959 | systems/win32/miktex/tm/packages/next/miktex-mtprint-bin-x64-2.9.tar.lzma +2021/01/19 | 46740 | systems/texlive/tlnet/archive/mlmodern.doc.r57458.tar.xz +2021/01/19 | 461387 | systems/win32/miktex/tm/packages/next/miktex-doc.tar.lzma +2021/01/19 | 45898 | systems/win32/miktex/tm/packages/next/miktex-m-tx-bin-2.9.tar.lzma +2021/01/19 | 45636 | systems/win32/miktex/tm/packages/next/miktex-dvicopy-bin-2.9.tar.lzma +2021/01/19 | 455 | systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512.asc +2021/01/19 | 455 | systems/texlive/tlnet/install-tl.zip.sha512.asc +2021/01/19 | 455 | systems/texlive/tlnet/install-tl-windows.exe.sha512.asc +2021/01/19 | 455 | systems/texlive/tlnet/install-tl-unx.tar.gz.sha512.asc +2021/01/19 | 45271 | systems/win32/miktex/tm/packages/next/miktex-dvipng-bin-x64-2.9.tar.lzma +2021/01/19 | 447105 | macros/latex/contrib/everysel.zip +2021/01/19 | 442773 | macros/latex/contrib/everysel/everysel.pdf +2021/01/19 | 43564 | systems/win32/miktex/tm/packages/next/miktex-psutils-bin-2.9.tar.lzma +2021/01/19 | 43385 | systems/win32/miktex/tm/packages/next/miktex-zlib-bin-x64-2.9.tar.lzma +2021/01/19 | 43071 | systems/win32/miktex/tm/packages/next/miktex-expat-bin-2.9.tar.lzma +2021/01/19 | 42906 | macros/latex/contrib/easybook/easybook.cls +2021/01/19 | 42872 | systems/win32/miktex/tm/packages/next/miktex-mtprint-bin-2.9.tar.lzma +2021/01/19 | 42661 | systems/win32/miktex/tm/packages/next/miktex-gsf2pk-bin-x64-2.9.tar.lzma +2021/01/19 | 42551 | systems/win32/miktex/tm/packages/next/miktex-mthelp-bin-x64-2.9.tar.lzma +2021/01/19 | 42398 | systems/win32/miktex/tm/packages/next/miktex-synctex-bin-2.9.tar.lzma +2021/01/19 | 422268 | graphics/pgf/contrib/circuitikz/tex/circuitikz-0.8.3.sty +2021/01/19 | 418 | graphics/pgf/contrib/circuitikz/doc/compatibility.tex +2021/01/19 | 416850 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz-0.8.3.tex +2021/01/19 | 40963 | systems/win32/miktex/tm/packages/next/miktex-dvipng-bin-2.9.tar.lzma +2021/01/19 | 403539 | graphics/pgf/contrib/circuitikz/tex/circuitikz-0.7.sty +2021/01/19 | 40229 | systems/win32/miktex/tm/packages/next/miktex-patgen-bin-x64.tar.lzma +2021/01/19 | 39536 | systems/win32/miktex/tm/packages/next/miktex-zlib-bin-2.9.tar.lzma +2021/01/19 | 394355 | graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex +2021/01/19 | 393856 | graphics/pgf/contrib/circuitikz/tex/circuitikz-0.6.sty +2021/01/19 | 392682 | systems/win32/miktex/tm/packages/next/miktex-cairo-bin-x64-2.9.tar.lzma +2021/01/19 | 388 | systems/texlive/tlnet/archive/texlive-docindex.r57454.tar.xz +2021/01/19 | 38068 | systems/win32/miktex/tm/packages/next/miktex-mthelp-bin-2.9.tar.lzma +2021/01/19 | 38057 | systems/win32/miktex/tm/packages/next/miktex-gsf2pk-bin-2.9.tar.lzma +2021/01/19 | 37310 | systems/win32/miktex/tm/packages/next/miktex-upmendex-bin-x64.tar.lzma +2021/01/19 | 37250 | systems/win32/miktex/tm/packages/next/miktex-posix-bin-x64-2.9.tar.lzma +2021/01/19 | 36678 | systems/win32/miktex/tm/packages/next/miktex-chktex-bin-x64-2.9.tar.lzma +2021/01/19 | 364086 | graphics/pgf/contrib/circuitikz/tex/circuitikz-0.4.sty +2021/01/19 | 3590 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex +2021/01/19 | 35425 | systems/win32/miktex/tm/packages/next/miktex-patgen-bin.tar.lzma +2021/01/19 | 35066 | systems/win32/miktex/tm/packages/next/miktex-mspack-bin-x64-2.9.tar.lzma +2021/01/19 | 34691 | graphics/pgf/contrib/circuitikz/tex/pgfcircvoltage.tex +2021/01/19 | 345231 | systems/win32/miktex/tm/packages/next/miktex-xetex-bin-x64-2.9.tar.lzma +2021/01/19 | 344519 | graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex +2021/01/19 | 34305 | systems/win32/miktex/tm/packages/next/miktex-axohelp-bin-x64-2.9.tar.lzma +2021/01/19 | 33533 | systems/win32/miktex/tm/packages/next/miktex-upmendex-bin.tar.lzma +2021/01/19 | 33142 | systems/win32/miktex/tm/packages/next/miktex-uriparser-bin-x64-2.9.tar.lzma +2021/01/19 | 329919 | systems/win32/miktex/tm/packages/next/miktex-cairo-bin-2.9.tar.lzma +2021/01/19 | 3277 | graphics/pgf/contrib/circuitikz/README.md +2021/01/19 | 32544 | systems/win32/miktex/tm/packages/next/miktex-chktex-bin-2.9.tar.lzma +2021/01/19 | 320797 | systems/win32/miktex/tm/packages/next/miktex-dvipdfmx-bin-x64-2.9.tar.lzma +2021/01/19 | 31549 | systems/win32/miktex/tm/packages/next/miktex-posix-bin-2.9.tar.lzma +2021/01/19 | 31543 | systems/win32/miktex/tm/packages/next/miktex-makeindex-bin-x64-2.9.tar.lzma +2021/01/19 | 31345 | systems/win32/miktex/tm/packages/next/miktex-autosp-bin-x64-2.9.tar.lzma +2021/01/19 | 31226 | systems/win32/miktex/tm/packages/next/miktex-mspack-bin-2.9.tar.lzma +2021/01/19 | 310964 | systems/win32/miktex/tm/packages/next/miktex-xetex-bin-2.9.tar.lzma +2021/01/19 | 3101 | graphics/pgf/contrib/circuitikz/tex/ctikzstyle-legacy.tex +2021/01/19 | 30990 | graphics/pgf/contrib/circuitikz/tex/pgfcircshapes.tex +2021/01/19 | 30873 | systems/win32/miktex/tm/packages/next/miktex-bzip2-bin-x64-2.9.tar.lzma +2021/01/19 | 308556 | macros/latex/contrib/easybook/doc/easybook-demo.pdf +2021/01/19 | 30068 | graphics/pgf/contrib/circuitikz/doc/changelog.tex +2021/01/19 | 30031 | systems/win32/miktex/tm/packages/next/miktex-lacheck-bin-x64-2.9.tar.lzma +2021/01/19 | 295622 | systems/win32/miktex/tm/packages/next/miktex-freetype2-bin-x64-2.9.tar.lzma +2021/01/19 | 29511 | systems/win32/miktex/tm/packages/next/miktex-axohelp-bin-2.9.tar.lzma +2021/01/19 | 29022 | systems/win32/miktex/tm/packages/next/miktex-autosp-bin-2.9.tar.lzma +2021/01/19 | 29007 | graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex +2021/01/19 | 283982 | systems/win32/miktex/tm/packages/next/miktex-metapost-bin-x64-2.9.tar.lzma +2021/01/19 | 2835236 | macros/latex/contrib/asmeconf.zip +2021/01/19 | 28230 | systems/win32/miktex/tm/packages/next/miktex-lacheck-bin-2.9.tar.lzma +2021/01/19 | 281357 | systems/win32/miktex/tm/packages/next/miktex-dvipdfmx-bin-2.9.tar.lzma +2021/01/19 | 280 | graphics/pgf/contrib/circuitikz/tex/ctikzstyle-example.tex +2021/01/19 | 28006 | systems/win32/miktex/tm/packages/next/miktex-findtexmf-bin-x64-2.9.tar.lzma +2021/01/19 | 27463 | systems/win32/miktex/tm/packages/next/miktex-makeindex-bin-2.9.tar.lzma +2021/01/19 | 27442 | systems/win32/miktex/tm/packages/next/miktex-teckit-bin-x64-2.9.tar.lzma +2021/01/19 | 27217 | systems/win32/miktex/tm/packages/next/miktex-uriparser-bin-2.9.tar.lzma +2021/01/19 | 27203 | systems/win32/miktex/tm/packages/next/miktex-bzip2-bin-2.9.tar.lzma +2021/01/19 | 26902024 | systems/win32/miktex/source/miktex-21.1.tar.xz +2021/01/19 | 2678 | graphics/pgf/contrib/circuitikz/tex/pgfcircutils.tex +2021/01/19 | 2617420 | systems/win32/miktex/tm/packages/next/miktex-texworks-bin-x64-2.9.tar.lzma +2021/01/19 | 258631 | systems/win32/miktex/tm/packages/next/miktex-freetype2-bin-2.9.tar.lzma +2021/01/19 | 25498 | macros/latex/contrib/easybook/doc/easybook.tex +2021/01/19 | 254184 | systems/win32/miktex/tm/packages/next/miktex-console-bin-x64-2.9.tar.lzma +2021/01/19 | 2540 | macros/latex/contrib/easybook/doc/easybook-demo.tex +2021/01/19 | 25331 | systems/win32/miktex/tm/packages/next/miktex-teckit-bin-2.9.tar.lzma +2021/01/19 | 25129 | systems/win32/miktex/tm/packages/next/miktex-findtexmf-bin-2.9.tar.lzma +2021/01/19 | 25039 | systems/win32/miktex/tm/packages/next/miktex-fribidixetex-bin-x64-2.9.tar.lzma +2021/01/19 | 250203 | systems/win32/miktex/tm/packages/next/miktex-metapost-bin-2.9.tar.lzma +2021/01/19 | 2495615 | systems/win32/miktex/tm/packages/next/miktex-texworks-bin-2.9.tar.lzma +2021/01/19 | 2437163 | install/graphics/pgf/contrib/circuitikz.tds.zip +2021/01/19 | 243510 | systems/win32/miktex/tm/packages/next/miktex-pmx-bin-x64-2.9.tar.lzma +2021/01/19 | 24288850 | systems/texlive/tlnet/install-tl.zip +2021/01/19 | 2422452 | graphics/pgf/contrib/circuitikz.zip +2021/01/19 | 23881 | systems/win32/miktex/tm/packages/next/miktex-popt-bin-x64-2.9.tar.lzma +2021/01/19 | 234567 | macros/latex/contrib/easybook/doc/easybook.pdf +2021/01/19 | 2344565 | macros/latex/contrib/biblatex-contrib/biblatex-oxref.zip +2021/01/19 | 23313 | systems/win32/miktex/tm/packages/next/miktex-devnag-bin-x64-2.9.tar.lzma +2021/01/19 | 2330552 | systems/texlive/tlnet/archive/profcollege.doc.r57456.tar.xz +2021/01/19 | 231665 | systems/win32/miktex/tm/packages/next/miktex-console-bin-2.9.tar.lzma +2021/01/19 | 2271048 | systems/texlive/tlnet/tlpkg/texlive.tlpdb.xz +2021/01/19 | 226047 | graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex +2021/01/19 | 22044 | systems/win32/miktex/tm/packages/next/miktex-fribidixetex-bin-2.9.tar.lzma +2021/01/19 | 218816 | systems/texlive/tlnet/archive/texlive-scripts.doc.r57455.tar.xz +2021/01/19 | 213738 | systems/win32/miktex/tm/packages/next/miktex-metafont-bin-x64-2.9.tar.lzma +2021/01/19 | 21130 | systems/win32/miktex/tm/packages/next/miktex-devnag-bin-2.9.tar.lzma +2021/01/19 | 210930 | systems/win32/miktex/tm/packages/next/miktex-omegaware-bin-x64-2.9.tar.lzma +2021/01/19 | 2090608 | systems/texlive/tlnet/archive/logix.r57457.tar.xz +2021/01/19 | 208089 | systems/win32/miktex/tm/packages/next/miktex-pmx-bin-2.9.tar.lzma +2021/01/19 | 206257 | systems/win32/miktex/tm/packages/next/miktex-zzdb1-2.9.tar.lzma +2021/01/19 | 206252 | systems/win32/miktex/tm/packages/miktex-zzdb1-2.9.tar.lzma +2021/01/19 | 202648 | systems/win32/miktex/tm/packages/next/miktex-pixman-bin-x64-2.9.tar.lzma +2021/01/19 | 20119 | systems/win32/miktex/tm/packages/next/miktex-popt-bin-2.9.tar.lzma +2021/01/19 | 2002728 | systems/win32/miktex/tm/packages/next/miktex-luatex-bin-x64-2.9.tar.lzma +2021/01/19 | 199586 | systems/win32/miktex/tm/packages/next/miktex-mpfr-bin-2.9.tar.lzma +2021/01/19 | 198081 | systems/win32/miktex/tm/packages/next/miktex-pixman-bin-2.9.tar.lzma +2021/01/19 | 195675 | systems/win32/miktex/tm/packages/next/miktex-curl-bin-x64-2.9.tar.lzma +2021/01/19 | 195627 | systems/win32/miktex/tm/packages/next/miktex-metafont-bin-2.9.tar.lzma +2021/01/19 | 19416405 | systems/texlive/tlnet/install-tl-windows.exe +2021/01/19 | 193760 | systems/win32/miktex/tm/packages/next/miktex-omegaware-bin-2.9.tar.lzma +2021/01/19 | 190596 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.tex +2021/01/19 | 1886456 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf +2021/01/19 | 1881620 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015.zip +2021/01/19 | 1877 | graphics/pgf/contrib/circuitikz/tex/ctikzstyle-romano.tex +2021/01/19 | 185656 | systems/texlive/tlnet/archive/aalok.doc.r57462.tar.xz +2021/01/19 | 18106 | systems/win32/miktex/tm/packages/next/miktex-tex2xindy-bin-x64-2.9.tar.lzma +2021/01/19 | 18036 | systems/texlive/tlnet/archive/aalok.source.r57462.tar.xz +2021/01/19 | 180160 | systems/win32/miktex/tm/packages/next/miktex-mpfr-bin-x64-2.9.tar.lzma +2021/01/19 | 17958 | systems/win32/miktex/tm/packages/next/miktex-kpathsea-bin-x64-2.9.tar.lzma +2021/01/19 | 179467 | systems/win32/miktex/tm/packages/next/miktex-curl-bin-2.9.tar.lzma +2021/01/19 | 17743 | graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf +2021/01/19 | 171448 | systems/texlive/tlnet/archive/texlive-docindex.doc.r57454.tar.xz +2021/01/19 | 16971896 | systems/texlive/tlnet/tlpkg/texlive.tlpdb +2021/01/19 | 1685635 | systems/win32/miktex/tm/packages/next/miktex-luatex-bin-2.9.tar.lzma +2021/01/19 | 167737 | systems/win32/miktex/tm/packages/next/miktex-tex-bin-x64-2.9.tar.lzma +2021/01/19 | 1662972 | systems/texlive/tlnet/archive/newcomputermodern.doc.r57459.tar.xz +2021/01/19 | 16580 | graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex +2021/01/19 | 163793 | systems/win32/miktex/tm/packages/next/miktex-mo-bin-x64-2.9.tar.lzma +2021/01/19 | 16340 | systems/win32/miktex/tm/packages/next/miktex-kpathsea-bin-2.9.tar.lzma +2021/01/19 | 162209 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.bbx +2021/01/19 | 16112 | systems/win32/miktex/tm/packages/next/miktex-tex2xindy-bin-2.9.tar.lzma +2021/01/19 | 159864 | systems/win32/miktex/tm/packages/next/miktex-hunspell-bin-x64-2.9.tar.lzma +2021/01/19 | 157816 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx +2021/01/19 | 15593 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.cbx +2021/01/19 | 153 | systems/texlive/tlnet/install-tl-windows.exe.sha512 +2021/01/19 | 153807 | systems/win32/miktex/tm/packages/next/miktex-tex-bin-2.9.tar.lzma +2021/01/19 | 152 | systems/texlive/tlnet/install-tl-unx.tar.gz.sha512 +2021/01/19 | 152746 | systems/win32/miktex/tm/packages/next/miktex-fontconfig-bin-x64-2.9.tar.lzma +2021/01/19 | 15018 | macros/latex/contrib/everysel/everysel.dtx +2021/01/19 | 147187 | systems/win32/miktex/tm/packages/next/miktex-hunspell-bin-2.9.tar.lzma +2021/01/19 | 14715 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.cbx +2021/01/19 | 147086 | systems/win32/miktex/tm/packages/next/miktex-mo-bin-2.9.tar.lzma +2021/01/19 | 145 | systems/texlive/tlnet/install-tl.zip.sha512 +2021/01/19 | 144 | systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512 +2021/01/19 | 14437 | graphics/pgf/contrib/circuitikz/tex/pgfcirclabel.tex +2021/01/19 | 14343 | systems/win32/miktex/tm/packages/next/miktex-zzip-bin-x64-2.9.tar.lzma +2021/01/19 | 1421909 | systems/win32/miktex/tm/packages/next/miktex-runtime-bin-x64-2.9.tar.lzma +2021/01/19 | 1417676 | systems/win32/miktex/tm/packages/next/miktex-dvisvgm-bin-x64-2.9.tar.lzma +2021/01/19 | 140576 | systems/texlive/tlnet/archive/luakeys.doc.r57463.tar.xz +2021/01/19 | 136345 | systems/win32/miktex/tm/packages/next/miktex-mktex-bin-x64-2.9.tar.lzma +2021/01/19 | 136053 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx +2021/01/19 | 135012 | systems/win32/miktex/tm/packages/next/miktex-fontconfig-bin-2.9.tar.lzma +2021/01/19 | 13466 | systems/win32/miktex/tm/packages/next/miktex-zzip-bin-2.9.tar.lzma +2021/01/19 | 132176 | systems/texlive/tlnet/archive/texlive-scripts.r57455.tar.xz +2021/01/19 | 131488 | systems/win32/miktex/tm/packages/next/miktex-dvips-bin-x64-2.9.tar.lzma +2021/01/19 | 1307388 | systems/win32/miktex/tm/packages/next/miktex-poppler-bin-x64-2.9.tar.lzma +2021/01/19 | 1291601 | systems/win32/miktex/tm/packages/next/miktex-runtime-bin-2.9.tar.lzma +2021/01/19 | 12820 | systems/texlive/tlnet/archive/translations.r57461.tar.xz +2021/01/19 | 1281720 | systems/win32/miktex/tm/packages/next/miktex-dvisvgm-bin-2.9.tar.lzma +2021/01/19 | 12686 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.cbx +2021/01/19 | 124938 | systems/win32/miktex/tm/packages/next/miktex-mktex-bin-2.9.tar.lzma +2021/01/19 | 1243863 | systems/win32/miktex/tm/packages/miktex-zzdb2-2.9.tar.lzma +2021/01/19 | 1243664 | systems/win32/miktex/tm/packages/next/miktex-zzdb2-2.9.tar.lzma +2021/01/19 | 12286 | graphics/pgf/contrib/circuitikz/tex/circuitikz.sty +2021/01/19 | 1211856 | systems/texlive/tlnet/archive/logix.doc.r57457.tar.xz +2021/01/19 | 1171816 | systems/win32/miktex/tm/packages/next/miktex-poppler-bin-2.9.tar.lzma +2021/01/19 | 116936 | systems/win32/miktex/tm/packages/next/miktex-dvips-bin-2.9.tar.lzma +2021/01/19 | 116503 | macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx +2021/01/19 | 1160954 | systems/win32/miktex/tm/packages/miktex-zzdb3-2.9.tar.lzma +2021/01/19 | 1160853 | systems/win32/miktex/tm/packages/next/miktex-zzdb3-2.9.tar.lzma +2021/01/19 | 1153 | systems/win32/miktex/tm/packages/next/pr.ini +2021/01/19 | 114935 | graphics/pgf/contrib/circuitikz/tex/pgfcircquadpoles.tex +2021/01/19 | 113934 | systems/win32/miktex/tm/packages/next/miktex-gregorio-bin-x64-2.9.tar.lzma +2021/01/19 | 1128310 | graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf +2021/01/19 | 112279 | systems/win32/miktex/tm/packages/next/miktex-gd-bin-x64-2.9.tar.lzma +2021/01/19 | 109150 | systems/win32/miktex/tm/packages/next/miktex-jpeg-bin-x64-2.9.tar.lzma +2021/01/19 | 1078966 | systems/win32/miktex/tm/packages/next/miktex-asymptote-bin-x64-2.9.tar.lzma +2021/01/19 | 105296 | graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex +2021/01/19 | 104759 | systems/win32/miktex/tm/packages/next/miktex-texware-bin-x64-2.9.tar.lzma +2021/01/19 | 103331 | systems/win32/miktex/tm/packages/next/miktex-lua53-bin-x64-2.9.tar.lzma +2021/01/19 | 1021921 | graphics/pgf/contrib/circuitikz/tex/circuitikz-1.2.7.sty +2021/01/19 | 101858 | systems/win32/miktex/tm/packages/next/miktex-mfware-bin-x64-2.9.tar.lzma +2021/01/19 | 1014383 | graphics/pgf/contrib/circuitikz/tex/t-circuitikz-1.2.7.tex 2021/01/18 | 9900 | fonts/erewhon/tfm/Erewhon-RegularSlanted-osf-t2b.tfm 2021/01/18 | 9900 | fonts/erewhon/tfm/Erewhon-RegularSlanted-lf-t2b.tfm 2021/01/18 | 9884 | fonts/erewhon/tfm/Erewhon-RegularSlanted-tosf-t2b.tfm @@ -8,26 +299,18 @@ 2021/01/18 | 98269 | fonts/mlmodern/type1/mlmssqo8.pfb 2021/01/18 | 9788 | fonts/newcomputermodern/README 2021/01/18 | 97574 | fonts/mlmodern/type1/mlmvtlo10.pfb -2021/01/18 | 974 | systems/win32/miktex/tm/packages/pr.ini -2021/01/18 | 97403 | systems/win32/miktex/tm/packages/next/miktex-gd-bin-2.9.tar.lzma 2021/01/18 | 9720 | fonts/erewhon/tfm/Erewhon-Regular-osf-t2b.tfm 2021/01/18 | 9720 | fonts/erewhon/tfm/Erewhon-Regular-lf-t2b.tfm -2021/01/18 | 97120 | systems/win32/miktex/tm/packages/next/miktex-mfware-bin-2.9.tar.lzma 2021/01/18 | 9704 | fonts/erewhon/tfm/Erewhon-Regular-tosf-t2b.tfm 2021/01/18 | 9704 | fonts/erewhon/tfm/Erewhon-Regular-tlf-t2b.tfm -2021/01/18 | 969228 | systems/win32/miktex/tm/packages/next/miktex-asymptote-bin-2.9.tar.lzma 2021/01/18 | 96277 | fonts/mlmodern/type1/mlmvtl10.pfb 2021/01/18 | 96240 | fonts/mlmodern/type1/mlmssdo10.pfb 2021/01/18 | 95899 | fonts/mlmodern/type1/mlmvtto10.pfb 2021/01/18 | 95560 | fonts/mlmodern/type1/mlmvtko10.pfb 2021/01/18 | 9496 | fonts/erewhon/tfm/Erewhon-BoldSlanted-osf-t2a.tfm 2021/01/18 | 9480 | fonts/erewhon/tfm/Erewhon-BoldSlanted-lf-t2a.tfm -2021/01/18 | 94803 | systems/win32/miktex/tm/packages/next/miktex-jpeg-bin-2.9.tar.lzma -2021/01/18 | 94788 | systems/win32/miktex/tm/packages/next/miktex-gregorio-bin-2.9.tar.lzma 2021/01/18 | 9476 | fonts/erewhon/tfm/Erewhon-BoldSlanted-tosf-t2a.tfm 2021/01/18 | 9476 | fonts/erewhon/tfm/Erewhon-BoldSlanted-tlf-t2a.tfm -2021/01/18 | 94599 | systems/win32/miktex/tm/packages/next/miktex-bibtex8bit-bin-x64-2.9.tar.lzma -2021/01/18 | 94374 | systems/win32/miktex/tm/packages/next/miktex-lua53-bin-2.9.tar.lzma 2021/01/18 | 94015 | fonts/mlmodern/type1/mlmvtt10.pfb 2021/01/18 | 9348 | fonts/erewhon/tfm/Erewhon-Bold-osf-t2a.tfm 2021/01/18 | 9332 | fonts/erewhon/tfm/Erewhon-Bold-lf-t2a.tfm @@ -97,14 +380,11 @@ 2021/01/18 | 87858 | fonts/mlmodern/type1/mlmssqbx8.pfb 2021/01/18 | 8784 | fonts/erewhon/tfm/Erewhon-Italic-osf-t1.tfm 2021/01/18 | 8780 | fonts/erewhon/tfm/Erewhon-BoldSlanted-lf-t1.tfm -2021/01/18 | 87770 | systems/win32/miktex/tm/packages/next/miktex-png-bin-x64-2.9.tar.lzma 2021/01/18 | 8776 | fonts/erewhon/tfm/Erewhon-BoldSlanted-tosf-t1.tfm 2021/01/18 | 8776 | fonts/erewhon/tfm/Erewhon-BoldSlanted-tlf-t1.tfm 2021/01/18 | 87746 | fonts/mlmodern/type1/mlmtk10.pfb 2021/01/18 | 87737 | fonts/mlmodern/type1/mlmssq8.pfb -2021/01/18 | 8772 | systems/win32/miktex/tm/packages/next/miktex-md5-bin-x64-2.9.tar.lzma 2021/01/18 | 8764 | fonts/erewhon/tfm/Erewhon-Italic-tosf-t1.tfm -2021/01/18 | 87637 | systems/win32/miktex/tm/packages/next/miktex-epstopdf-bin-2.9.tar.lzma 2021/01/18 | 8760 | fonts/erewhon/tfm/Erewhon-Italic-tlf-t1.tfm 2021/01/18 | 87455 | fonts/mlmodern/type1/mlmtt12.pfb 2021/01/18 | 87130 | fonts/mlmodern/type1/mlmtt9.pfb @@ -129,7 +409,6 @@ 2021/01/18 | 8584 | fonts/erewhon/tfm/Erewhon-BoldSlanted-tlf-t2c.tfm 2021/01/18 | 85660 | fonts/mlmodern/type1/mlmssbx10.pfb 2021/01/18 | 85561 | fonts/mlmodern/type1/mlmtl10.pfb -2021/01/18 | 85304 | systems/win32/miktex/tm/packages/next/miktex-bibtex8bit-bin-2.9.tar.lzma 2021/01/18 | 85009 | fonts/mlmodern/type1/mlmss9.pfb 2021/01/18 | 84973 | fonts/mlmodern/type1/mlmss10.pfb 2021/01/18 | 84960 | fonts/mlmodern/type1/mlmss12.pfb @@ -150,44 +429,25 @@ 2021/01/18 | 8172 | fonts/erewhon/tfm/Erewhon-BoldItalic-lf-t2c.tfm 2021/01/18 | 8152 | fonts/erewhon/tfm/Erewhon-BoldItalic-tosf-t2c.tfm 2021/01/18 | 8152 | fonts/erewhon/tfm/Erewhon-BoldItalic-tlf-t2c.tfm -2021/01/18 | 813998 | systems/win32/miktex/tm/packages/next/miktex-pdftex-bin-x64-2.9.tar.lzma 2021/01/18 | 807 | fonts/mlmodern/README -2021/01/18 | 80639 | systems/win32/miktex/tm/packages/next/miktex-freeglut-bin-x64-2.9.tar.lzma -2021/01/18 | 78748 | systems/win32/miktex/tm/packages/next/miktex-png-bin-2.9.tar.lzma -2021/01/18 | 77840 | systems/win32/miktex/tm/packages/next/miktex-fonts-bin-x64-2.9.tar.lzma -2021/01/18 | 7747 | systems/win32/miktex/tm/packages/next/miktex-md5-bin-2.9.tar.lzma -2021/01/18 | 77430 | systems/win32/miktex/tm/packages/next/miktex-mpmcli-bin-x64-2.9.tar.lzma 2021/01/18 | 7740 | fonts/erewhon/tfm/Erewhon-BoldSlanted-osf-sc-t2c.tfm +2021/01/18 | 770450 | systems/win32/w32tex/ChangeLog +2021/01/18 | 7672 | macros/latex/contrib/asmeconf/README.md 2021/01/18 | 764 | fonts/erewhon/tfm/Erewhon-Bold-tlf-ot2.tfm -2021/01/18 | 75340 | systems/win32/miktex/tm/packages/next/miktex-bibtex-bin-x64-2.9.tar.lzma 2021/01/18 | 74446 | macros/unicodetex/latex/aalok/aalok.dtx -2021/01/18 | 74156 | systems/win32/miktex/tm/packages/next/miktex-lzma-bin-x64-2.9.tar.lzma -2021/01/18 | 740141 | systems/win32/miktex/tm/packages/next/miktex-pdftex-bin-2.9.tar.lzma -2021/01/18 | 73322 | systems/win32/miktex/tm/packages/next/miktex-fonts-bin-2.9.tar.lzma -2021/01/18 | 72842 | systems/win32/miktex/tm/packages/next/miktex-graphite2-bin-x64-2.9.tar.lzma 2021/01/18 | 720 | fonts/erewhon/vf/Erewhon-Italic-tosf-ts1.vf 2021/01/18 | 720 | fonts/erewhon/vf/Erewhon-Italic-tlf-ts1.vf 2021/01/18 | 720 | fonts/erewhon/vf/Erewhon-Italic-osf-ts1.vf 2021/01/18 | 720 | fonts/erewhon/vf/Erewhon-Italic-lf-ts1.vf -2021/01/18 | 71966 | systems/win32/miktex/tm/packages/next/miktex-ps2pk-bin-x64-2.9.tar.lzma -2021/01/18 | 71574 | systems/win32/miktex/tm/packages/next/miktex-freeglut-bin-2.9.tar.lzma -2021/01/18 | 70425 | systems/win32/miktex/tm/packages/next/miktex-web-bin-x64-2.9.tar.lzma -2021/01/18 | 70202 | systems/win32/miktex/tm/packages/next/miktex-tex4ht-bin-x64-2.9.tar.lzma +2021/01/18 | 71637 | macros/latex/contrib/asmeconf/asmeconf.cls 2021/01/18 | 69572 | fonts/logix/fonts/logixMono.ttf 2021/01/18 | 6888 | fonts/erewhon/tfm/Erewhon-BoldSlanted-lf-sc-t2a.tfm 2021/01/18 | 6884 | fonts/erewhon/tfm/Erewhon-BoldSlanted-tosf-sc-t2a.tfm 2021/01/18 | 6884 | fonts/erewhon/tfm/Erewhon-BoldSlanted-tlf-sc-t2a.tfm -2021/01/18 | 680060 | systems/win32/miktex/tm/packages/next/miktex-lcdf-typetools-bin-x64-2.9.tar.lzma -2021/01/18 | 67915 | systems/win32/miktex/tm/packages/next/miktex-mkfntmap-bin-x64-2.9.tar.lzma -2021/01/18 | 67684 | systems/win32/miktex/tm/packages/next/miktex-lzma-bin-2.9.tar.lzma -2021/01/18 | 67496 | systems/win32/miktex/tm/packages/next/miktex-bibtex-bin-2.9.tar.lzma 2021/01/18 | 6742 | fonts/erewhon/enc/erewhontlf-ot2.enc -2021/01/18 | 67355 | systems/win32/miktex/tm/packages/next/miktex-mpmcli-bin-2.9.tar.lzma 2021/01/18 | 6680 | fonts/erewhon/tfm/Erewhon-BoldSlanted-lf-sc-t2b.tfm 2021/01/18 | 6676 | fonts/erewhon/tfm/Erewhon-BoldSlanted-tosf-sc-t2b.tfm 2021/01/18 | 6676 | fonts/erewhon/tfm/Erewhon-BoldSlanted-tlf-sc-t2b.tfm -2021/01/18 | 65815 | systems/win32/miktex/tm/packages/next/miktex-web-bin-2.9.tar.lzma -2021/01/18 | 65322 | systems/win32/miktex/tm/packages/next/miktex-texify-bin-x64-2.9.tar.lzma 2021/01/18 | 648 | fonts/erewhon/vf/Erewhon-RegularSlanted-tosf-ts1.vf 2021/01/18 | 648 | fonts/erewhon/vf/Erewhon-RegularSlanted-tlf-ts1.vf 2021/01/18 | 648 | fonts/erewhon/vf/Erewhon-RegularSlanted-osf-ts1.vf @@ -204,10 +464,8 @@ 2021/01/18 | 6428 | fonts/erewhon/tfm/Erewhon-BoldItalic-lf-sc-t2a.tfm 2021/01/18 | 6412 | fonts/erewhon/tfm/Erewhon-BoldItalic-tosf-sc-t2a.tfm 2021/01/18 | 6412 | fonts/erewhon/tfm/Erewhon-BoldItalic-tlf-sc-t2a.tfm -2021/01/18 | 63927 | systems/win32/miktex/tm/packages/next/miktex-ps2pk-bin-2.9.tar.lzma -2021/01/18 | 63831 | systems/win32/miktex/tm/packages/next/miktex-graphite2-bin-2.9.tar.lzma 2021/01/18 | 63800 | fonts/logix/opentype/logixMono.otf -2021/01/18 | 63764 | systems/win32/miktex/tm/packages/next/miktex-tex4ht-bin-2.9.tar.lzma +2021/01/18 | 637772 | macros/latex/contrib/asmeconf/asmeconf-template.pdf 2021/01/18 | 6364 | fonts/erewhon/tfm/Erewhon-RegularSlanted-osf-sc-t2a.tfm 2021/01/18 | 6364 | fonts/erewhon/tfm/Erewhon-RegularSlanted-lf-sc-t2a.tfm 2021/01/18 | 6356 | fonts/erewhon/tfm/Erewhon-RegularSlanted-osf-ly1.tfm @@ -221,12 +479,10 @@ 2021/01/18 | 6308 | fonts/erewhon/tfm/Erewhon-BoldSlanted-tlf-sc-t2c.tfm 2021/01/18 | 6280 | fonts/erewhon/tfm/Erewhon-RegularSlanted-osf-sc-t2b.tfm 2021/01/18 | 6280 | fonts/erewhon/tfm/Erewhon-RegularSlanted-lf-sc-t2b.tfm -2021/01/18 | 62741 | systems/win32/miktex/tm/packages/next/miktex-fmt-bin-x64-2.9.tar.lzma 2021/01/18 | 6272 | fonts/erewhon/tfm/Erewhon-BoldItalic-osf-sc-t2b.tfm 2021/01/18 | 6264 | fonts/erewhon/tfm/Erewhon-BoldItalic-lf-sc-t2b.tfm 2021/01/18 | 6256 | fonts/erewhon/tfm/Erewhon-RegularSlanted-tosf-sc-t2b.tfm 2021/01/18 | 6256 | fonts/erewhon/tfm/Erewhon-RegularSlanted-tlf-sc-t2b.tfm -2021/01/18 | 624929 | systems/win32/miktex/tm/packages/next/miktex-lcdf-typetools-bin-2.9.tar.lzma 2021/01/18 | 6248 | fonts/erewhon/tfm/Erewhon-BoldItalic-tosf-sc-t2b.tfm 2021/01/18 | 6248 | fonts/erewhon/tfm/Erewhon-BoldItalic-tlf-sc-t2b.tfm 2021/01/18 | 6220 | fonts/erewhon/tfm/Erewhon-Regular-osf-ly1.tfm @@ -235,14 +491,13 @@ 2021/01/18 | 620 | fonts/erewhon/vf/Erewhon-Bold-tlf-ts1.vf 2021/01/18 | 620 | fonts/erewhon/vf/Erewhon-Bold-osf-ts1.vf 2021/01/18 | 620 | fonts/erewhon/vf/Erewhon-Bold-lf-ts1.vf -2021/01/18 | 62081 | systems/win32/miktex/tm/packages/next/miktex-ttf2pk2-bin-x64-2.9.tar.lzma 2021/01/18 | 6200 | fonts/erewhon/tfm/Erewhon-Regular-tosf-ly1.tfm 2021/01/18 | 6200 | fonts/erewhon/tfm/Erewhon-Regular-tlf-ly1.tfm -2021/01/18 | 619143 | systems/win32/miktex/tm/packages/next/miktex-yap-bin-x64-2.9.tar.lzma 2021/01/18 | 6116 | fonts/erewhon/tfm/Erewhon-Bold-osf-sc-t2a.tfm 2021/01/18 | 6108 | fonts/erewhon/tfm/Erewhon-Regular-osf-sc-t2a.tfm 2021/01/18 | 6108 | fonts/erewhon/tfm/Erewhon-Regular-lf-sc-t2a.tfm 2021/01/18 | 6104 | fonts/erewhon/tfm/Erewhon-Bold-lf-sc-t2a.tfm +2021/01/18 | 610103 | macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.pdf 2021/01/18 | 6100 | fonts/erewhon/tfm/Erewhon-Bold-tosf-sc-t2a.tfm 2021/01/18 | 6100 | fonts/erewhon/tfm/Erewhon-Bold-tlf-sc-t2a.tfm 2021/01/18 | 6088 | fonts/erewhon/tfm/Erewhon-Bold-osf-sc-t2b.tfm @@ -259,7 +514,6 @@ 2021/01/18 | 6064 | fonts/erewhon/tfm/Erewhon-BoldItalic-osf-ly1.tfm 2021/01/18 | 6060 | fonts/erewhon/tfm/Erewhon-RegularSlanted-lf-sc-t1.tfm 2021/01/18 | 6060 | fonts/erewhon/tfm/Erewhon-BoldItalic-lf-ly1.tfm -2021/01/18 | 60606 | systems/win32/miktex/tm/packages/next/miktex-mkfntmap-bin-2.9.tar.lzma 2021/01/18 | 6040 | fonts/erewhon/tfm/Erewhon-RegularSlanted-tosf-sc-t1.tfm 2021/01/18 | 6040 | fonts/erewhon/tfm/Erewhon-RegularSlanted-tlf-sc-t1.tfm 2021/01/18 | 6036 | fonts/erewhon/tfm/Erewhon-BoldItalic-tosf-ly1.tfm @@ -272,14 +526,10 @@ 2021/01/18 | 6000 | fonts/erewhon/tfm/Erewhon-Regular-tlf-sc-t2b.tfm 2021/01/18 | 6000 | fonts/erewhon/tfm/Erewhon-Italic-tosf-ly1.tfm 2021/01/18 | 5996 | fonts/erewhon/tfm/Erewhon-Italic-tlf-ly1.tfm -2021/01/18 | 59808 | systems/win32/miktex/tm/packages/next/miktex-tdsutil-bin-x64.tar.lzma -2021/01/18 | 596720 | systems/win32/miktex/tm/packages/next/miktex-libressl-bin-x64-2.9.tar.lzma 2021/01/18 | 5928 | fonts/erewhon/tfm/Erewhon-Bold-osf-ly1.tfm -2021/01/18 | 59144 | systems/win32/miktex/tm/packages/next/miktex-cweb-bin-x64-2.9.tar.lzma 2021/01/18 | 5912 | fonts/erewhon/tfm/Erewhon-Bold-lf-ly1.tfm 2021/01/18 | 5908 | fonts/erewhon/tfm/Erewhon-Bold-tosf-ly1.tfm 2021/01/18 | 5908 | fonts/erewhon/tfm/Erewhon-Bold-tlf-ly1.tfm -2021/01/18 | 583741 | systems/win32/miktex/tm/packages/next/miktex-yap-bin-2.9.tar.lzma 2021/01/18 | 5828 | fonts/erewhon/tfm/Erewhon-Bold-osf-sc-t2c.tfm 2021/01/18 | 5816 | fonts/erewhon/tfm/Erewhon-Bold-lf-sc-t2c.tfm 2021/01/18 | 5812 | fonts/erewhon/tfm/Erewhon-Bold-tosf-sc-t2c.tfm @@ -292,37 +542,17 @@ 2021/01/18 | 5776 | fonts/erewhon/tfm/Erewhon-RegularSlanted-tlf-sc-t2c.tfm 2021/01/18 | 5768 | fonts/erewhon/tfm/Erewhon-BoldItalic-tosf-sc-t2c.tfm 2021/01/18 | 5768 | fonts/erewhon/tfm/Erewhon-BoldItalic-tlf-sc-t2c.tfm -2021/01/18 | 57609 | systems/win32/miktex/tm/packages/next/miktex-bibarts-bin-x64-2.9.tar.lzma -2021/01/18 | 56976 | systems/win32/miktex/tm/packages/next/miktex-texify-bin-2.9.tar.lzma -2021/01/18 | 568173 | systems/win32/miktex/tm/packages/next/miktex-harfbuzz-bin-x64-2.9.tar.lzma -2021/01/18 | 56600 | systems/win32/miktex/tm/packages/next/miktex-cjkutils-bin-x64-2.9.tar.lzma -2021/01/18 | 56455 | systems/win32/miktex/tm/packages/next/miktex-arctrl-bin-x64-2.9.tar.lzma -2021/01/18 | 56324 | systems/win32/miktex/tm/packages/next/miktex-tdsutil-bin.tar.lzma -2021/01/18 | 559494 | systems/win32/miktex/tm/packages/files.csv.lzma -2021/01/18 | 559283 | systems/win32/miktex/tm/packages/next/files.csv.lzma -2021/01/18 | 55852 | systems/win32/miktex/tm/packages/next/miktex-fmt-bin-2.9.tar.lzma 2021/01/18 | 5544 | fonts/erewhon/tfm/Erewhon-Regular-osf-sc-t2c.tfm 2021/01/18 | 5544 | fonts/erewhon/tfm/Erewhon-Regular-lf-sc-t2c.tfm -2021/01/18 | 55374 | systems/win32/miktex/tm/packages/next/miktex-ttf2pk2-bin-2.9.tar.lzma -2021/01/18 | 5521395 | systems/texlive/tlnet/install-tl-unx.tar.gz 2021/01/18 | 5520 | fonts/erewhon/tfm/Erewhon-Regular-tosf-sc-t2c.tfm 2021/01/18 | 5520 | fonts/erewhon/tfm/Erewhon-Regular-tlf-sc-t2c.tfm 2021/01/18 | 550812 | fonts/logix/opentype/logix.otf -2021/01/18 | 544092 | macros/latex/contrib/easybook.zip +2021/01/18 | 5403 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/README.md +2021/01/18 | 535848 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxref.pdf 2021/01/18 | 5336 | fonts/erewhon/tfm/Erewhon-RegularSlanted-tlf-ot2.tfm -2021/01/18 | 531714 | systems/win32/miktex/tm/packages/next/miktex-libressl-bin-2.9.tar.lzma 2021/01/18 | 5296966 | fonts/erewhon.zip -2021/01/18 | 52497 | systems/win32/miktex/tm/packages/next/miktex-cweb-bin-2.9.tar.lzma -2021/01/18 | 52404 | systems/win32/miktex/tm/packages/next/miktex-m-tx-bin-x64-2.9.tar.lzma 2021/01/18 | 523701 | macros/latex/contrib/translations.zip -2021/01/18 | 52054 | systems/win32/miktex/tm/packages/next/miktex-psutils-bin-x64-2.9.tar.lzma -2021/01/18 | 51863 | systems/win32/miktex/tm/packages/next/miktex-synctex-bin-x64-2.9.tar.lzma -2021/01/18 | 51409 | systems/win32/miktex/tm/packages/next/miktex-cjkutils-bin-2.9.tar.lzma -2021/01/18 | 514087 | systems/win32/miktex/tm/packages/next/miktex-log4cxx-bin-x64-2.9.tar.lzma -2021/01/18 | 51184 | systems/win32/miktex/tm/packages/next/miktex-dvicopy-bin-x64-2.9.tar.lzma 2021/01/18 | 5116 | fonts/erewhon/tfm/Erewhon-Regular-tlf-ot2.tfm -2021/01/18 | 50703 | systems/win32/miktex/tm/packages/next/miktex-arctrl-bin-2.9.tar.lzma -2021/01/18 | 50031 | systems/win32/miktex/tm/packages/next/miktex-bibarts-bin-2.9.tar.lzma 2021/01/18 | 4996 | fonts/erewhon/tfm/Erewhon-RegularSlanted-osf-sc-ly1.tfm 2021/01/18 | 4996 | fonts/erewhon/tfm/Erewhon-RegularSlanted-lf-sc-ly1.tfm 2021/01/18 | 497756 | fonts/logix/fonts/logix.woff @@ -332,44 +562,30 @@ 2021/01/18 | 4964 | fonts/erewhon/tfm/Erewhon-Regular-lf-sc-t1.tfm 2021/01/18 | 4940 | fonts/erewhon/tfm/Erewhon-Regular-tosf-sc-t1.tfm 2021/01/18 | 4940 | fonts/erewhon/tfm/Erewhon-Regular-tlf-sc-t1.tfm -2021/01/18 | 48 | systems/texlive/tlnet/tlpkg/texlive.tlpdb.md5 2021/01/18 | 48550 | fonts/mlmodern/doc/mlmodern.pdf -2021/01/18 | 484327 | systems/win32/miktex/tm/packages/next/miktex-harfbuzz-bin-2.9.tar.lzma 2021/01/18 | 4828 | fonts/erewhon/tfm/Erewhon-Italic-tlf-ot2.tfm 2021/01/18 | 48200 | fonts/erewhon/map/erewhon.map -2021/01/18 | 47903 | systems/win32/miktex/tm/packages/next/miktex-expat-bin-x64-2.9.tar.lzma -2021/01/18 | 475817 | systems/win32/miktex/tm/packages/next/miktex-log4cxx-bin-2.9.tar.lzma -2021/01/18 | 46959 | systems/win32/miktex/tm/packages/next/miktex-mtprint-bin-x64-2.9.tar.lzma +2021/01/18 | 472235 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxref.dtx 2021/01/18 | 462783 | fonts/logix/doc/logix.pdf 2021/01/18 | 4616 | fonts/erewhon/tfm/Erewhon-Italic-lf-sc-t2a.tfm -2021/01/18 | 461387 | systems/win32/miktex/tm/packages/next/miktex-doc.tar.lzma 2021/01/18 | 4612 | fonts/erewhon/tfm/Erewhon-Italic-osf-sc-t2a.tfm 2021/01/18 | 4592 | fonts/erewhon/tfm/Erewhon-Italic-tosf-sc-t2a.tfm 2021/01/18 | 4592 | fonts/erewhon/tfm/Erewhon-Italic-tlf-sc-t2a.tfm -2021/01/18 | 45898 | systems/win32/miktex/tm/packages/next/miktex-m-tx-bin-2.9.tar.lzma 2021/01/18 | 4588 | fonts/erewhon/tfm/Erewhon-Italic-lf-sc-t2b.tfm 2021/01/18 | 4580 | fonts/erewhon/tfm/Erewhon-Italic-osf-sc-t2b.tfm -2021/01/18 | 45635 | systems/win32/miktex/tm/packages/next/miktex-dvicopy-bin-2.9.tar.lzma 2021/01/18 | 4560 | fonts/erewhon/tfm/Erewhon-Italic-tosf-sc-t2b.tfm 2021/01/18 | 4560 | fonts/erewhon/tfm/Erewhon-Italic-tlf-sc-t2b.tfm -2021/01/18 | 455 | systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512.asc -2021/01/18 | 455 | systems/texlive/tlnet/install-tl.zip.sha512.asc -2021/01/18 | 455 | systems/texlive/tlnet/install-tl-windows.exe.sha512.asc -2021/01/18 | 455 | systems/texlive/tlnet/install-tl-unx.tar.gz.sha512.asc -2021/01/18 | 45271 | systems/win32/miktex/tm/packages/next/miktex-dvipng-bin-x64-2.9.tar.lzma -2021/01/18 | 43563 | systems/win32/miktex/tm/packages/next/miktex-psutils-bin-2.9.tar.lzma -2021/01/18 | 43383 | systems/win32/miktex/tm/packages/next/miktex-zlib-bin-x64-2.9.tar.lzma +2021/01/18 | 4485396 | systems/win32/w32tex/texinfo-w32.tar.xz +2021/01/18 | 443291 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxnotes-doc.pdf +2021/01/18 | 440823 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxyear-doc.pdf +2021/01/18 | 439195 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxnum-doc.pdf +2021/01/18 | 436778 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxalph-doc.pdf 2021/01/18 | 4328 | fonts/erewhon/tfm/Erewhon-Italic-lf-sc-t2c.tfm 2021/01/18 | 4320 | fonts/erewhon/tfm/Erewhon-Italic-osf-sc-t2c.tfm -2021/01/18 | 43071 | systems/win32/miktex/tm/packages/next/miktex-expat-bin-2.9.tar.lzma 2021/01/18 | 4300 | fonts/erewhon/tfm/Erewhon-Italic-tosf-sc-t2c.tfm 2021/01/18 | 4300 | fonts/erewhon/tfm/Erewhon-Italic-tlf-sc-t2c.tfm -2021/01/18 | 42906 | macros/latex/contrib/easybook/easybook.cls -2021/01/18 | 42871 | systems/win32/miktex/tm/packages/next/miktex-mtprint-bin-2.9.tar.lzma -2021/01/18 | 42663 | systems/win32/miktex/tm/packages/next/miktex-gsf2pk-bin-x64-2.9.tar.lzma -2021/01/18 | 42551 | systems/win32/miktex/tm/packages/next/miktex-mthelp-bin-x64-2.9.tar.lzma +2021/01/18 | 42418 | macros/latex/contrib/asmeconf/asmeconf-template.tex 2021/01/18 | 4240 | fonts/erewhon/tfm/Erewhon-BoldItalic-osf-sc-t1.tfm -2021/01/18 | 42397 | systems/win32/miktex/tm/packages/next/miktex-synctex-bin-2.9.tar.lzma 2021/01/18 | 4236 | fonts/erewhon/tfm/Erewhon-BoldItalic-lf-sc-t1.tfm 2021/01/18 | 4216 | fonts/erewhon/tfm/Erewhon-BoldItalic-tosf-sc-t1.tfm 2021/01/18 | 4216 | fonts/erewhon/tfm/Erewhon-BoldItalic-tlf-sc-t1.tfm @@ -381,18 +597,15 @@ 2021/01/18 | 41524 | fonts/mlmodern/type1/mlmex10.pfb 2021/01/18 | 4132 | fonts/erewhon/tfm/Erewhon-Regular-osf-sc-ly1.tfm 2021/01/18 | 4132 | fonts/erewhon/tfm/Erewhon-Regular-lf-sc-ly1.tfm +2021/01/18 | 41310 | macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.tex 2021/01/18 | 411069 | fonts/logix/fonts/logix.eot 2021/01/18 | 4104 | fonts/erewhon/tfm/Erewhon-Regular-tosf-sc-ly1.tfm 2021/01/18 | 4104 | fonts/erewhon/tfm/Erewhon-Regular-tlf-sc-ly1.tfm -2021/01/18 | 40963 | systems/win32/miktex/tm/packages/next/miktex-dvipng-bin-2.9.tar.lzma 2021/01/18 | 4096154 | fonts/logix.zip 2021/01/18 | 406769 | macros/latex/contrib/profcollege/latex/ProfCollege.sty -2021/01/18 | 40230 | systems/win32/miktex/tm/packages/next/miktex-patgen-bin-x64.tar.lzma -2021/01/18 | 39535 | systems/win32/miktex/tm/packages/next/miktex-zlib-bin-2.9.tar.lzma 2021/01/18 | 3950 | fonts/erewhon/enc/zut1_25oktk.enc 2021/01/18 | 3943 | fonts/erewhon/enc/zut1_nlk3tk.enc 2021/01/18 | 3926 | fonts/erewhon/enc/zut1_uuvzxd.enc -2021/01/18 | 392682 | systems/win32/miktex/tm/packages/next/miktex-cairo-bin-x64-2.9.tar.lzma 2021/01/18 | 3922 | fonts/erewhon/enc/zut1_74cce3.enc 2021/01/18 | 3915 | fonts/erewhon/enc/zut1_zx32l7.enc 2021/01/18 | 3914 | fonts/erewhon/enc/zut1_ljsdwq.enc @@ -402,7 +615,6 @@ 2021/01/18 | 3905 | fonts/erewhon/enc/zut1_cmujr7.enc 2021/01/18 | 3900 | fonts/erewhon/enc/zut1_eajfvl.enc 2021/01/18 | 3895 | fonts/erewhon/enc/zut1_kdakg5.enc -2021/01/18 | 388 | systems/texlive/tlnet/archive/texlive-docindex.r57450.tar.xz 2021/01/18 | 3889 | fonts/erewhon/enc/zut1_dkbnkq.enc 2021/01/18 | 38851 | fonts/mlmodern/type1/mlmmi5.pfb 2021/01/18 | 3883 | fonts/erewhon/enc/zut1_izu75o.enc @@ -416,10 +628,9 @@ 2021/01/18 | 3840 | fonts/erewhon/enc/zut1_7lebnu.enc 2021/01/18 | 3820 | fonts/erewhon/enc/zut1_t32gte.enc 2021/01/18 | 3818 | fonts/erewhon/enc/zut1_ijhs6t.enc +2021/01/18 | 381051 | macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.pdf 2021/01/18 | 3808 | fonts/erewhon/enc/zut1_6etwti.enc -2021/01/18 | 38072 | systems/win32/miktex/tm/packages/next/miktex-mthelp-bin-2.9.tar.lzma 2021/01/18 | 3805 | fonts/erewhon/enc/zut1_cxj5nb.enc -2021/01/18 | 38058 | systems/win32/miktex/tm/packages/next/miktex-gsf2pk-bin-2.9.tar.lzma 2021/01/18 | 38009 | fonts/mlmodern/type1/mlmmi7.pfb 2021/01/18 | 3799 | fonts/erewhon/enc/zut1_4qs3ad.enc 2021/01/18 | 37975 | fonts/mlmodern/type1/mlmmi10.pfb @@ -450,9 +661,7 @@ 2021/01/18 | 3735 | fonts/erewhon/enc/zut1_mqrime.enc 2021/01/18 | 3735 | fonts/erewhon/enc/zut1_amccbu.enc 2021/01/18 | 3732 | fonts/erewhon/enc/zut1_frcrrk.enc -2021/01/18 | 37311 | systems/win32/miktex/tm/packages/next/miktex-upmendex-bin-x64.tar.lzma 2021/01/18 | 3730 | fonts/erewhon/enc/zut1_jofyrj.enc -2021/01/18 | 37251 | systems/win32/miktex/tm/packages/next/miktex-posix-bin-x64-2.9.tar.lzma 2021/01/18 | 3723 | fonts/erewhon/enc/zut1_ul5nhk.enc 2021/01/18 | 3722 | fonts/erewhon/enc/zut1_4chmhh.enc 2021/01/18 | 3716 | fonts/erewhon/enc/zut1_pj2kv6.enc @@ -465,7 +674,6 @@ 2021/01/18 | 3681 | fonts/erewhon/enc/zut1_x3yqgk.enc 2021/01/18 | 3674 | fonts/erewhon/enc/zut1_tzgz6e.enc 2021/01/18 | 3667 | fonts/erewhon/enc/zut1_e4qrg7.enc -2021/01/18 | 36678 | systems/win32/miktex/tm/packages/next/miktex-chktex-bin-x64-2.9.tar.lzma 2021/01/18 | 3663 | fonts/erewhon/enc/zut1_fec52x.enc 2021/01/18 | 3660 | fonts/erewhon/enc/zut1_elnhz2.enc 2021/01/18 | 3653 | fonts/erewhon/enc/zut1_fqlf3s.enc @@ -485,7 +693,6 @@ 2021/01/18 | 3559 | fonts/erewhon/enc/zut1_awhpzb.enc 2021/01/18 | 3554 | fonts/erewhon/enc/zut1_orscbj.enc 2021/01/18 | 3554 | fonts/erewhon/enc/zut1_6kzn42.enc -2021/01/18 | 35424 | systems/win32/miktex/tm/packages/next/miktex-patgen-bin.tar.lzma 2021/01/18 | 3528 | fonts/erewhon/enc/zut1_mxehrm.enc 2021/01/18 | 3523 | fonts/erewhon/enc/zut1_gagfjo.enc 2021/01/18 | 3523 | fonts/erewhon/enc/zut1_2jsbza.enc @@ -493,7 +700,6 @@ 2021/01/18 | 3522 | fonts/erewhon/enc/zut1_aluvmp.enc 2021/01/18 | 3522 | fonts/erewhon/enc/zut1_2objs7.enc 2021/01/18 | 3510 | fonts/erewhon/enc/zut1_etc5hm.enc -2021/01/18 | 35064 | systems/win32/miktex/tm/packages/next/miktex-mspack-bin-x64-2.9.tar.lzma 2021/01/18 | 3482 | fonts/erewhon/enc/zut1_5kulil.enc 2021/01/18 | 3476 | fonts/erewhon/tfm/Erewhon-Italic-lf-sc-ly1.tfm 2021/01/18 | 3474 | fonts/erewhon/enc/zut1_7ajsnx.enc @@ -501,13 +707,11 @@ 2021/01/18 | 3473 | fonts/erewhon/enc/zut1_m62wbz.enc 2021/01/18 | 3473 | fonts/erewhon/enc/zut1_lefook.enc 2021/01/18 | 3468 | fonts/erewhon/tfm/Erewhon-Italic-osf-sc-ly1.tfm -2021/01/18 | 345230 | systems/win32/miktex/tm/packages/next/miktex-xetex-bin-x64-2.9.tar.lzma 2021/01/18 | 3448 | fonts/erewhon/tfm/Erewhon-Italic-tosf-sc-ly1.tfm 2021/01/18 | 3448 | fonts/erewhon/enc/zut1_hl634h.enc 2021/01/18 | 3444 | fonts/erewhon/tfm/Erewhon-Italic-tlf-sc-ly1.tfm 2021/01/18 | 3436 | fonts/erewhon/tfm/Erewhon-BoldItalic-osf-sc-ly1.tfm 2021/01/18 | 3432 | fonts/erewhon/tfm/Erewhon-BoldItalic-lf-sc-ly1.tfm -2021/01/18 | 34306 | systems/win32/miktex/tm/packages/next/miktex-axohelp-bin-x64-2.9.tar.lzma 2021/01/18 | 3427 | fonts/erewhon/enc/zut1_xd5tcn.enc 2021/01/18 | 3422 | fonts/erewhon/enc/zut1_dq4c7f.enc 2021/01/18 | 3416 | fonts/erewhon/enc/zut1_azqpxw.enc @@ -525,7 +729,6 @@ 2021/01/18 | 33568 | fonts/mlmodern/type1/mlmsy10.pfb 2021/01/18 | 3355 | fonts/erewhon/enc/zut1_36pkgq.enc 2021/01/18 | 33559 | fonts/mlmodern/type1/mlmsy7.pfb -2021/01/18 | 33532 | systems/win32/miktex/tm/packages/next/miktex-upmendex-bin.tar.lzma 2021/01/18 | 33461 | fonts/mlmodern/type1/mlmsy8.pfb 2021/01/18 | 3339 | fonts/erewhon/enc/zut1_uhamxn.enc 2021/01/18 | 33339 | fonts/mlmodern/type1/mlmsy9.pfb @@ -534,7 +737,6 @@ 2021/01/18 | 3319 | fonts/erewhon/enc/zut1_azbcfh.enc 2021/01/18 | 3318 | fonts/erewhon/enc/zut1_wrgbks.enc 2021/01/18 | 3315 | fonts/erewhon/enc/zut1_a7a6j7.enc -2021/01/18 | 33143 | systems/win32/miktex/tm/packages/next/miktex-uriparser-bin-x64-2.9.tar.lzma 2021/01/18 | 3312 | fonts/erewhon/enc/zut1_wg4pgf.enc 2021/01/18 | 3312 | fonts/erewhon/enc/zut1_peef5q.enc 2021/01/18 | 3312 | fonts/erewhon/enc/zut1_ncwigg.enc @@ -543,7 +745,6 @@ 2021/01/18 | 3306 | fonts/erewhon/enc/zut1_qvbgtd.enc 2021/01/18 | 3303 | fonts/erewhon/enc/zut1_x3bhkk.enc 2021/01/18 | 3301 | fonts/erewhon/enc/zut1_jsdebf.enc -2021/01/18 | 329919 | systems/win32/miktex/tm/packages/next/miktex-cairo-bin-2.9.tar.lzma 2021/01/18 | 3287 | fonts/erewhon/enc/zut1_mkqhoa.enc 2021/01/18 | 3287 | fonts/erewhon/enc/zut1_fomwqp.enc 2021/01/18 | 3284 | fonts/erewhon/enc/zut1_irfza6.enc @@ -554,7 +755,6 @@ 2021/01/18 | 3267 | fonts/erewhon/enc/zut1_mieo7u.enc 2021/01/18 | 3260 | fonts/erewhon/enc/zut1_dnhvn3.enc 2021/01/18 | 3256 | fonts/erewhon/enc/zut1_dru2ao.enc -2021/01/18 | 32544 | systems/win32/miktex/tm/packages/next/miktex-chktex-bin-2.9.tar.lzma 2021/01/18 | 3251 | fonts/erewhon/enc/zut1_pux3en.enc 2021/01/18 | 3251 | fonts/erewhon/enc/zut1_cj3gqs.enc 2021/01/18 | 3249 | fonts/erewhon/enc/zut1_nhu5qm.enc @@ -574,7 +774,6 @@ 2021/01/18 | 3212 | fonts/erewhon/enc/zut1_knq7bi.enc 2021/01/18 | 3211 | fonts/erewhon/enc/zut1_kpjvx5.enc 2021/01/18 | 3208 | fonts/erewhon/enc/zut1_5drzr5.enc -2021/01/18 | 320795 | systems/win32/miktex/tm/packages/next/miktex-dvipdfmx-bin-x64-2.9.tar.lzma 2021/01/18 | 3197 | fonts/erewhon/enc/zut1_sim7pz.enc 2021/01/18 | 3197 | fonts/erewhon/enc/zut1_o4jtlp.enc 2021/01/18 | 3196 | fonts/erewhon/enc/zut1_nmevy6.enc @@ -591,8 +790,6 @@ 2021/01/18 | 3159 | fonts/erewhon/enc/zut1_vj42om.enc 2021/01/18 | 3159 | fonts/erewhon/enc/zut1_nrup2h.enc 2021/01/18 | 3159 | fonts/erewhon/enc/zut1_7zfl2i.enc -2021/01/18 | 31550 | systems/win32/miktex/tm/packages/next/miktex-posix-bin-2.9.tar.lzma -2021/01/18 | 31542 | systems/win32/miktex/tm/packages/next/miktex-makeindex-bin-x64-2.9.tar.lzma 2021/01/18 | 3149 | fonts/erewhon/enc/zut1_qptrxz.enc 2021/01/18 | 3149 | fonts/erewhon/enc/zut1_okacrk.enc 2021/01/18 | 3149 | fonts/erewhon/enc/zut1_igmc4g.enc @@ -601,80 +798,44 @@ 2021/01/18 | 3135 | fonts/erewhon/enc/zut1_kwgi2r.enc 2021/01/18 | 3135 | fonts/erewhon/enc/zut1_gxqdb2.enc 2021/01/18 | 3135 | fonts/erewhon/enc/zut1_adckrx.enc -2021/01/18 | 31346 | systems/win32/miktex/tm/packages/next/miktex-autosp-bin-x64-2.9.tar.lzma 2021/01/18 | 3128 | fonts/erewhon/enc/zut1_umzzxg.enc 2021/01/18 | 3128 | fonts/erewhon/enc/zut1_jdnyy6.enc 2021/01/18 | 3128 | fonts/erewhon/enc/zut1_4j4ux5.enc -2021/01/18 | 31227 | systems/win32/miktex/tm/packages/next/miktex-mspack-bin-2.9.tar.lzma -2021/01/18 | 310964 | systems/win32/miktex/tm/packages/next/miktex-xetex-bin-2.9.tar.lzma 2021/01/18 | 3104 | fonts/erewhon/enc/zut1_fojqdn.enc 2021/01/18 | 3104 | fonts/erewhon/enc/zut1_d6afaq.enc 2021/01/18 | 3104 | fonts/erewhon/enc/zut1_7zlfno.enc 2021/01/18 | 3101 | fonts/erewhon/enc/zut1_k3uyvf.enc 2021/01/18 | 3101 | fonts/erewhon/enc/zut1_hhrib2.enc 2021/01/18 | 3101 | fonts/erewhon/enc/zut1_2lssnc.enc -2021/01/18 | 30873 | systems/win32/miktex/tm/packages/next/miktex-bzip2-bin-x64-2.9.tar.lzma -2021/01/18 | 308553 | macros/latex/contrib/easybook/doc/easybook-demo.pdf -2021/01/18 | 30031 | systems/win32/miktex/tm/packages/next/miktex-lacheck-bin-x64-2.9.tar.lzma +2021/01/18 | 3073 | macros/latex/contrib/biblatex-contrib/biblatex-oxref/Makefile 2021/01/18 | 29958 | fonts/logix/fonts/logixMono.eot 2021/01/18 | 29634 | fonts/mlmodern/type1/mlmbsy5.pfb -2021/01/18 | 295620 | systems/win32/miktex/tm/packages/next/miktex-freetype2-bin-x64-2.9.tar.lzma -2021/01/18 | 29512 | systems/win32/miktex/tm/packages/next/miktex-axohelp-bin-2.9.tar.lzma 2021/01/18 | 29149 | fonts/mlmodern/type1/mlmbsy10.pfb 2021/01/18 | 29064 | fonts/mlmodern/type1/mlmbsy7.pfb -2021/01/18 | 29024 | systems/win32/miktex/tm/packages/next/miktex-autosp-bin-2.9.tar.lzma -2021/01/18 | 283981 | systems/win32/miktex/tm/packages/next/miktex-metapost-bin-x64-2.9.tar.lzma -2021/01/18 | 28228 | systems/win32/miktex/tm/packages/next/miktex-lacheck-bin-2.9.tar.lzma -2021/01/18 | 281360 | systems/win32/miktex/tm/packages/next/miktex-dvipdfmx-bin-2.9.tar.lzma 2021/01/18 | 280547 | fonts/erewhon/type1/Erewhon-Regular.pfb 2021/01/18 | 28028 | systems/texlive/tlnet/archive/alfaslabone.doc.r57452.tar.xz -2021/01/18 | 28006 | systems/win32/miktex/tm/packages/next/miktex-findtexmf-bin-x64-2.9.tar.lzma -2021/01/18 | 27463 | systems/win32/miktex/tm/packages/next/miktex-makeindex-bin-2.9.tar.lzma -2021/01/18 | 27442 | systems/win32/miktex/tm/packages/next/miktex-teckit-bin-x64-2.9.tar.lzma -2021/01/18 | 27216 | systems/win32/miktex/tm/packages/next/miktex-uriparser-bin-2.9.tar.lzma -2021/01/18 | 27203 | systems/win32/miktex/tm/packages/next/miktex-bzip2-bin-2.9.tar.lzma +2021/01/18 | 275604 | macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.pdf +2021/01/18 | 27451 | macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.tex 2021/01/18 | 267122 | fonts/erewhon/type1/Erewhon-Bold.pfb -2021/01/18 | 2617420 | systems/win32/miktex/tm/packages/next/miktex-texworks-bin-x64-2.9.tar.lzma 2021/01/18 | 258828 | fonts/erewhon/opentype/Erewhon-Regular.otf -2021/01/18 | 258632 | systems/win32/miktex/tm/packages/next/miktex-freetype2-bin-2.9.tar.lzma 2021/01/18 | 2553070 | macros/latex/contrib/profcollege.zip -2021/01/18 | 25497 | macros/latex/contrib/easybook/doc/easybook.tex -2021/01/18 | 254183 | systems/win32/miktex/tm/packages/next/miktex-console-bin-x64-2.9.tar.lzma -2021/01/18 | 2540 | macros/latex/contrib/easybook/doc/easybook-demo.tex -2021/01/18 | 25332 | systems/win32/miktex/tm/packages/next/miktex-teckit-bin-2.9.tar.lzma -2021/01/18 | 25129 | systems/win32/miktex/tm/packages/next/miktex-findtexmf-bin-2.9.tar.lzma -2021/01/18 | 25039 | systems/win32/miktex/tm/packages/next/miktex-fribidixetex-bin-x64-2.9.tar.lzma -2021/01/18 | 250203 | systems/win32/miktex/tm/packages/next/miktex-metapost-bin-2.9.tar.lzma -2021/01/18 | 2495611 | systems/win32/miktex/tm/packages/next/miktex-texworks-bin-2.9.tar.lzma -2021/01/18 | 243509 | systems/win32/miktex/tm/packages/next/miktex-pmx-bin-x64-2.9.tar.lzma 2021/01/18 | 243239 | fonts/erewhon/type1/Erewhon-BoldItalic.pfb -2021/01/18 | 24288850 | systems/texlive/tlnet/install-tl.zip 2021/01/18 | 242872 | fonts/erewhon/opentype/Erewhon-Bold.otf 2021/01/18 | 242788 | fonts/erewhon/opentype/Erewhon-RegularSlanted.otf -2021/01/18 | 23881 | systems/win32/miktex/tm/packages/next/miktex-popt-bin-x64-2.9.tar.lzma -2021/01/18 | 234522 | macros/latex/contrib/easybook/doc/easybook.pdf 2021/01/18 | 233308 | fonts/erewhon/opentype/Erewhon-BoldSlanted.otf 2021/01/18 | 233298 | fonts/erewhon/type1/Erewhon-BoldSlanted.pfb -2021/01/18 | 23313 | systems/win32/miktex/tm/packages/next/miktex-devnag-bin-x64-2.9.tar.lzma -2021/01/18 | 231667 | systems/win32/miktex/tm/packages/next/miktex-console-bin-2.9.tar.lzma 2021/01/18 | 231380 | fonts/erewhon/type1/Erewhon-Italic.pfb 2021/01/18 | 229708 | fonts/erewhon/type1/Erewhon-RegularSlanted.pfb -2021/01/18 | 2267568 | systems/texlive/tlnet/tlpkg/texlive.tlpdb.xz 2021/01/18 | 220892 | fonts/erewhon/opentype/Erewhon-BoldItalic.otf -2021/01/18 | 22044 | systems/win32/miktex/tm/packages/next/miktex-fribidixetex-bin-2.9.tar.lzma -2021/01/18 | 218820 | systems/texlive/tlnet/archive/texlive-scripts.doc.r57450.tar.xz 2021/01/18 | 217216 | fonts/erewhon/opentype/Erewhon-Italic.otf 2021/01/18 | 2160 | fonts/erewhon/tfm/Erewhon-Italic-sup-t2a.tfm 2021/01/18 | 2152 | fonts/erewhon/tfm/Erewhon-Italic-sup-t2b.tfm 2021/01/18 | 2144 | fonts/erewhon/tfm/Erewhon-Italic-sup-t2c.tfm -2021/01/18 | 213738 | systems/win32/miktex/tm/packages/next/miktex-metafont-bin-x64-2.9.tar.lzma 2021/01/18 | 2136 | fonts/erewhon/tfm/Erewhon-BoldItalic-sup-t2b.tfm 2021/01/18 | 2136 | fonts/erewhon/tfm/Erewhon-BoldItalic-sup-t2a.tfm 2021/01/18 | 2132 | fonts/erewhon/tfm/Erewhon-BoldItalic-sup-t2c.tfm 2021/01/18 | 2124 | fonts/erewhon/tfm/Erewhon-RegularSlanted-sup-t2a.tfm -2021/01/18 | 21130 | systems/win32/miktex/tm/packages/next/miktex-devnag-bin-2.9.tar.lzma 2021/01/18 | 2112 | fonts/erewhon/tfm/Erewhon-Italic-lf-sc-t2a--base.tfm -2021/01/18 | 210930 | systems/win32/miktex/tm/packages/next/miktex-omegaware-bin-x64-2.9.tar.lzma 2021/01/18 | 2108 | fonts/erewhon/tfm/Erewhon-Italic-osf-sc-t2a--base.tfm 2021/01/18 | 2104 | fonts/erewhon/tfm/Erewhon-RegularSlanted-sup-t2b.tfm 2021/01/18 | 2104 | fonts/erewhon/tfm/Erewhon-RegularSlanted-osf-sc-t2a--base.tfm @@ -695,7 +856,6 @@ 2021/01/18 | 2080 | fonts/erewhon/tfm/Erewhon-RegularSlanted-numr-t2a.tfm 2021/01/18 | 2080 | fonts/erewhon/tfm/Erewhon-RegularSlanted-dnom-t2a.tfm 2021/01/18 | 2080 | fonts/erewhon/tfm/Erewhon-Italic-osf-sc-t2c--base.tfm -2021/01/18 | 208089 | systems/win32/miktex/tm/packages/next/miktex-pmx-bin-2.9.tar.lzma 2021/01/18 | 2076 | fonts/erewhon/tfm/Erewhon-BoldSlanted-sup-t2c.tfm 2021/01/18 | 2076 | fonts/erewhon/tfm/Erewhon-BoldSlanted-osf-sc-t2b--base.tfm 2021/01/18 | 2076 | fonts/erewhon/tfm/Erewhon-BoldSlanted-lf-sc-t2a--base.tfm @@ -714,8 +874,6 @@ 2021/01/18 | 2064 | fonts/erewhon/tfm/Erewhon-BoldSlanted-osf-sc-t2c--base.tfm 2021/01/18 | 2064 | fonts/erewhon/tfm/Erewhon-BoldSlanted-lf-sc-t2b--base.tfm 2021/01/18 | 2064 | fonts/erewhon/tfm/Erewhon-BoldSlanted-dnom-t2a.tfm -2021/01/18 | 206258 | systems/win32/miktex/tm/packages/next/miktex-zzdb1-2.9.tar.lzma -2021/01/18 | 206220 | systems/win32/miktex/tm/packages/miktex-zzdb1-2.9.tar.lzma 2021/01/18 | 2060 | fonts/erewhon/tfm/Erewhon-RegularSlanted-numr-t2b.tfm 2021/01/18 | 2060 | fonts/erewhon/tfm/Erewhon-RegularSlanted-dnom-t2b.tfm 2021/01/18 | 2060 | fonts/erewhon/tfm/Erewhon-Italic-tosf-sc-t2c--base.tfm @@ -754,7 +912,6 @@ 2021/01/18 | 2028 | fonts/erewhon/tfm/Erewhon-BoldSlanted-inf-t2c.tfm 2021/01/18 | 2028 | fonts/erewhon/tfm/Erewhon-BoldItalic-tosf-sc-t2a--base.tfm 2021/01/18 | 2028 | fonts/erewhon/tfm/Erewhon-BoldItalic-tlf-sc-t2a--base.tfm -2021/01/18 | 202648 | systems/win32/miktex/tm/packages/next/miktex-pixman-bin-x64-2.9.tar.lzma 2021/01/18 | 2024 | fonts/erewhon/tfm/Erewhon-BoldItalic-tosf-sc-t2b--base.tfm 2021/01/18 | 2024 | fonts/erewhon/tfm/Erewhon-BoldItalic-tlf-sc-t2b--base.tfm 2021/01/18 | 2020 | fonts/erewhon/tfm/Erewhon-BoldItalic-sup-t1.tfm @@ -769,16 +926,12 @@ 2021/01/18 | 2012 | fonts/erewhon/tfm/Erewhon-BoldItalic-numr-t2c.tfm 2021/01/18 | 2012 | fonts/erewhon/tfm/Erewhon-BoldItalic-inf-t2b.tfm 2021/01/18 | 2012 | fonts/erewhon/tfm/Erewhon-BoldItalic-dnom-t2c.tfm -2021/01/18 | 20121 | systems/win32/miktex/tm/packages/next/miktex-popt-bin-2.9.tar.lzma 2021/01/18 | 2008 | fonts/erewhon/tfm/Erewhon-BoldItalic-inf-t2c.tfm 2021/01/18 | 2004 | fonts/erewhon/tfm/Erewhon-BoldItalic-sup-ly1.tfm -2021/01/18 | 2002728 | systems/win32/miktex/tm/packages/next/miktex-luatex-bin-x64-2.9.tar.lzma -2021/01/18 | 199586 | systems/win32/miktex/tm/packages/next/miktex-mpfr-bin-2.9.tar.lzma 2021/01/18 | 1992 | fonts/erewhon/tfm/Erewhon-Italic-sup-ly1.tfm 2021/01/18 | 1988 | fonts/erewhon/tfm/Erewhon-Italic-sup-t1.tfm 2021/01/18 | 1984 | fonts/erewhon/tfm/Erewhon-Bold-sup-t2a.tfm 2021/01/18 | 1980 | fonts/erewhon/tfm/Erewhon-Italic-sup-t1--base.tfm -2021/01/18 | 198081 | systems/win32/miktex/tm/packages/next/miktex-pixman-bin-2.9.tar.lzma 2021/01/18 | 1968 | fonts/erewhon/tfm/Erewhon-Regular-sup-t2a.tfm 2021/01/18 | 1968 | fonts/erewhon/tfm/Erewhon-RegularSlanted-osf-sc-ly1--base.tfm 2021/01/18 | 1968 | fonts/erewhon/tfm/Erewhon-RegularSlanted-lf-sc-ly1--base.tfm @@ -786,8 +939,6 @@ 2021/01/18 | 1964 | fonts/erewhon/tfm/Erewhon-RegularSlanted-sup-t1.tfm 2021/01/18 | 1960 | fonts/erewhon/tfm/Erewhon-RegularSlanted-sup-ly1.tfm 2021/01/18 | 1956 | fonts/erewhon/tfm/Erewhon-RegularSlanted-sup-t1--base.tfm -2021/01/18 | 195675 | systems/win32/miktex/tm/packages/next/miktex-curl-bin-x64-2.9.tar.lzma -2021/01/18 | 195624 | systems/win32/miktex/tm/packages/next/miktex-metafont-bin-2.9.tar.lzma 2021/01/18 | 1952 | fonts/erewhon/tfm/Erewhon-BoldSlanted-sup-t1.tfm 2021/01/18 | 1952 | fonts/erewhon/tfm/Erewhon-BoldItalic-osf-sc-ly1--base.tfm 2021/01/18 | 1948 | fonts/erewhon/tfm/Erewhon-Regular-sup-t2b.tfm @@ -796,11 +947,9 @@ 2021/01/18 | 1948 | fonts/erewhon/tfm/Erewhon-BoldItalic-lf-sc-ly1--base.tfm 2021/01/18 | 1944 | fonts/erewhon/tfm/Erewhon-Italic-lf-sc-ly1--base.tfm 2021/01/18 | 1944 | fonts/erewhon/tfm/Erewhon-Bold-sup-t2c.tfm -2021/01/18 | 19416424 | systems/texlive/tlnet/install-tl-windows.exe 2021/01/18 | 1940 | fonts/erewhon/tfm/Erewhon-RegularSlanted-tosf-sc-ly1--base.tfm 2021/01/18 | 1940 | fonts/erewhon/tfm/Erewhon-RegularSlanted-tlf-sc-ly1--base.tfm 2021/01/18 | 1940 | fonts/erewhon/tfm/Erewhon-BoldSlanted-sup-t1--base.tfm -2021/01/18 | 193756 | systems/win32/miktex/tm/packages/next/miktex-omegaware-bin-2.9.tar.lzma 2021/01/18 | 1936 | fonts/erewhon/tfm/Erewhon-Italic-osf-sc-ly1--base.tfm 2021/01/18 | 1936 | fonts/erewhon/tfm/Erewhon-BoldSlanted-lf-sc-ly1--base.tfm 2021/01/18 | 1932 | fonts/erewhon/tfm/Erewhon-RegularSlanted-osf-sc-t1--base.tfm @@ -925,12 +1074,8 @@ 2021/01/18 | 1820 | fonts/erewhon/tfm/Erewhon-Regular-tlf-sc-t2c--base.tfm 2021/01/18 | 1816 | fonts/erewhon/tfm/Erewhon-Regular-sup-t1.tfm 2021/01/18 | 1812 | fonts/erewhon/tfm/Erewhon-Bold-sup-ly1.tfm -2021/01/18 | 18106 | systems/win32/miktex/tm/packages/next/miktex-tex2xindy-bin-x64-2.9.tar.lzma 2021/01/18 | 1804 | fonts/erewhon/tfm/Erewhon-Regular-sup-t1--base.tfm 2021/01/18 | 1804 | fonts/erewhon/tfm/Erewhon-Regular-sup-ly1.tfm -2021/01/18 | 180159 | systems/win32/miktex/tm/packages/next/miktex-mpfr-bin-x64-2.9.tar.lzma -2021/01/18 | 17958 | systems/win32/miktex/tm/packages/next/miktex-kpathsea-bin-x64-2.9.tar.lzma -2021/01/18 | 179467 | systems/win32/miktex/tm/packages/next/miktex-curl-bin-2.9.tar.lzma 2021/01/18 | 177988 | systems/texlive/tlnet/archive/alfaslabone.r57452.tar.xz 2021/01/18 | 1748 | fonts/erewhon/tfm/Erewhon-Bold-osf-t1--base.tfm 2021/01/18 | 1744 | fonts/erewhon/tfm/Erewhon-Regular-osf-sc-ly1--base.tfm @@ -1019,7 +1164,6 @@ 2021/01/18 | 1712 | fonts/erewhon/vf/Erewhon-RegularSlanted-tlf-sc-ly1.vf 2021/01/18 | 1712 | fonts/erewhon/vf/Erewhon-RegularSlanted-osf-sc-ly1.vf 2021/01/18 | 1712 | fonts/erewhon/tfm/Erewhon-Bold-osf-sc-t1--base.tfm -2021/01/18 | 171292 | systems/texlive/tlnet/archive/texlive-docindex.doc.r57450.tar.xz 2021/01/18 | 1708 | fonts/erewhon/vf/Erewhon-RegularSlanted-lf-sc-ly1.vf 2021/01/18 | 1708 | fonts/erewhon/vf/Erewhon-BoldSlanted-tosf-sc-ly1.vf 2021/01/18 | 1708 | fonts/erewhon/vf/Erewhon-BoldSlanted-tlf-sc-ly1.vf @@ -1057,7 +1201,6 @@ 2021/01/18 | 1696 | fonts/erewhon/vf/Erewhon-BoldItalic-dnom-t1.vf 2021/01/18 | 1696 | fonts/erewhon/tfm/Erewhon-Bold-tosf-sc-t1--base.tfm 2021/01/18 | 1696 | fonts/erewhon/tfm/Erewhon-Bold-tlf-sc-t1--base.tfm -2021/01/18 | 16966659 | systems/texlive/tlnet/tlpkg/texlive.tlpdb 2021/01/18 | 1692 | fonts/erewhon/vf/Erewhon-Regular-sup-t1.vf 2021/01/18 | 1692 | fonts/erewhon/vf/Erewhon-Regular-numr-t1.vf 2021/01/18 | 1692 | fonts/erewhon/vf/Erewhon-Regular-inf-t1.vf @@ -1072,8 +1215,6 @@ 2021/01/18 | 1688 | fonts/erewhon/vf/Erewhon-Bold-inf-t1.vf 2021/01/18 | 1688 | fonts/erewhon/vf/Erewhon-Bold-dnom-t1.vf 2021/01/18 | 1688 | fonts/erewhon/tfm/Erewhon-Regular-lf-sc-t1--base.tfm -2021/01/18 | 1685634 | systems/win32/miktex/tm/packages/next/miktex-luatex-bin-2.9.tar.lzma -2021/01/18 | 167736 | systems/win32/miktex/tm/packages/next/miktex-tex-bin-x64-2.9.tar.lzma 2021/01/18 | 1664 | fonts/erewhon/tfm/Erewhon-Regular-tosf-sc-t1--base.tfm 2021/01/18 | 1664 | fonts/erewhon/tfm/Erewhon-Regular-tlf-sc-t1--base.tfm 2021/01/18 | 1648 | fonts/erewhon/vf/Erewhon-RegularSlanted-tosf-sc-t2a.vf @@ -1089,13 +1230,10 @@ 2021/01/18 | 1640 | fonts/erewhon/vf/Erewhon-Italic-tlf-sc-t2a.vf 2021/01/18 | 1640 | fonts/erewhon/vf/Erewhon-Italic-osf-sc-t2a.vf 2021/01/18 | 1640 | fonts/erewhon/vf/Erewhon-Italic-lf-sc-t2a.vf -2021/01/18 | 163796 | systems/win32/miktex/tm/packages/next/miktex-mo-bin-x64-2.9.tar.lzma -2021/01/18 | 16339 | systems/win32/miktex/tm/packages/next/miktex-kpathsea-bin-2.9.tar.lzma 2021/01/18 | 1632 | fonts/erewhon/tfm/Erewhon-Italic-osf-ts1--base.tfm 2021/01/18 | 1632 | fonts/erewhon/tfm/Erewhon-Italic-lf-ts1--base.tfm 2021/01/18 | 1624 | fonts/erewhon/tfm/Erewhon-Italic-osf-ts1.tfm 2021/01/18 | 1624 | fonts/erewhon/tfm/Erewhon-Italic-lf-ts1.tfm -2021/01/18 | 16111 | systems/win32/miktex/tm/packages/next/miktex-tex2xindy-bin-2.9.tar.lzma 2021/01/18 | 1608 | fonts/erewhon/tfm/Erewhon-Italic-tosf-ts1--base.tfm 2021/01/18 | 1608 | fonts/erewhon/tfm/Erewhon-Italic-tlf-ts1--base.tfm 2021/01/18 | 1604 | fonts/erewhon/tfm/Erewhon-BoldItalic-osf-ts1.tfm @@ -1104,7 +1242,6 @@ 2021/01/18 | 1600 | fonts/erewhon/tfm/Erewhon-Italic-tlf-ts1.tfm 2021/01/18 | 1600 | fonts/erewhon/tfm/Erewhon-BoldItalic-osf-ts1--base.tfm 2021/01/18 | 1600 | fonts/erewhon/tfm/Erewhon-BoldItalic-lf-ts1--base.tfm -2021/01/18 | 159864 | systems/win32/miktex/tm/packages/next/miktex-hunspell-bin-x64-2.9.tar.lzma 2021/01/18 | 1596 | fonts/erewhon/tfm/Erewhon-RegularSlanted-osf-ts1.tfm 2021/01/18 | 1596 | fonts/erewhon/tfm/Erewhon-RegularSlanted-osf-ts1--base.tfm 2021/01/18 | 1596 | fonts/erewhon/tfm/Erewhon-RegularSlanted-lf-ts1.tfm @@ -1149,74 +1286,47 @@ 2021/01/18 | 1540 | fonts/erewhon/vf/Erewhon-Italic-tlf-sc-t2c.vf 2021/01/18 | 1540 | fonts/erewhon/vf/Erewhon-Italic-osf-sc-t2c.vf 2021/01/18 | 1540 | fonts/erewhon/vf/Erewhon-Italic-lf-sc-t2c.vf -2021/01/18 | 153 | systems/texlive/tlnet/install-tl-windows.exe.sha512 -2021/01/18 | 153805 | systems/win32/miktex/tm/packages/next/miktex-tex-bin-2.9.tar.lzma 2021/01/18 | 1532 | fonts/erewhon/tfm/Erewhon-Regular-osf-ts1.tfm 2021/01/18 | 1532 | fonts/erewhon/tfm/Erewhon-Regular-lf-ts1.tfm -2021/01/18 | 152 | systems/texlive/tlnet/install-tl-unx.tar.gz.sha512 2021/01/18 | 1528 | fonts/erewhon/tfm/Erewhon-Regular-osf-ts1--base.tfm 2021/01/18 | 1528 | fonts/erewhon/tfm/Erewhon-Regular-lf-ts1--base.tfm -2021/01/18 | 152746 | systems/win32/miktex/tm/packages/next/miktex-fontconfig-bin-x64-2.9.tar.lzma 2021/01/18 | 1504 | fonts/erewhon/tfm/Erewhon-Regular-tosf-ts1.tfm 2021/01/18 | 1504 | fonts/erewhon/tfm/Erewhon-Regular-tlf-ts1.tfm 2021/01/18 | 1500 | fonts/erewhon/tfm/Erewhon-Regular-tosf-ts1--base.tfm 2021/01/18 | 1500 | fonts/erewhon/tfm/Erewhon-Regular-tlf-ts1--base.tfm -2021/01/18 | 147188 | systems/win32/miktex/tm/packages/next/miktex-hunspell-bin-2.9.tar.lzma -2021/01/18 | 147085 | systems/win32/miktex/tm/packages/next/miktex-mo-bin-2.9.tar.lzma -2021/01/18 | 145 | systems/texlive/tlnet/install-tl.zip.sha512 2021/01/18 | 145359 | macros/luatex/generic/luakeys.zip -2021/01/18 | 144 | systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512 -2021/01/18 | 14343 | systems/win32/miktex/tm/packages/next/miktex-zzip-bin-x64-2.9.tar.lzma -2021/01/18 | 1421910 | systems/win32/miktex/tm/packages/next/miktex-runtime-bin-x64-2.9.tar.lzma -2021/01/18 | 1417675 | systems/win32/miktex/tm/packages/next/miktex-dvisvgm-bin-x64-2.9.tar.lzma +2021/01/18 | 141721444 | systems/win32/w32tex/context.tar.xz 2021/01/18 | 140586 | macros/luatex/generic/luakeys/luakeys.pdf 2021/01/18 | 1404 | fonts/erewhon/tfm/Erewhon-Bold-osf-ts1.tfm 2021/01/18 | 1404 | fonts/erewhon/tfm/Erewhon-Bold-lf-ts1.tfm +2021/01/18 | 13996 | macros/latex/contrib/asmeconf/asmeconf-sample.bib 2021/01/18 | 1396 | fonts/erewhon/tfm/Erewhon-Bold-osf-ts1--base.tfm 2021/01/18 | 1396 | fonts/erewhon/tfm/Erewhon-Bold-lf-ts1--base.tfm 2021/01/18 | 1384 | fonts/erewhon/tfm/Erewhon-Bold-tosf-ts1.tfm 2021/01/18 | 1384 | fonts/erewhon/tfm/Erewhon-Bold-tlf-ts1.tfm 2021/01/18 | 1376 | fonts/erewhon/tfm/Erewhon-Bold-tosf-ts1--base.tfm 2021/01/18 | 1376 | fonts/erewhon/tfm/Erewhon-Bold-tlf-ts1--base.tfm -2021/01/18 | 136346 | systems/win32/miktex/tm/packages/next/miktex-mktex-bin-x64-2.9.tar.lzma 2021/01/18 | 13604 | macros/luatex/generic/luakeys/luakeys.lua 2021/01/18 | 13504 | fonts/erewhon/tfm/Erewhon-BoldSlanted-osf-sc-t1.tfm -2021/01/18 | 135011 | systems/win32/miktex/tm/packages/next/miktex-fontconfig-bin-2.9.tar.lzma 2021/01/18 | 13492 | fonts/erewhon/tfm/Erewhon-BoldSlanted-lf-sc-t1.tfm 2021/01/18 | 13488 | fonts/erewhon/tfm/Erewhon-BoldSlanted-tosf-sc-t1.tfm 2021/01/18 | 13488 | fonts/erewhon/tfm/Erewhon-BoldSlanted-tlf-sc-t1.tfm -2021/01/18 | 13466 | systems/win32/miktex/tm/packages/next/miktex-zzip-bin-2.9.tar.lzma 2021/01/18 | 13320 | fonts/erewhon/tfm/Erewhon-Bold-osf-sc-t1.tfm 2021/01/18 | 13308 | fonts/erewhon/tfm/Erewhon-Bold-lf-sc-t1.tfm 2021/01/18 | 13304 | fonts/erewhon/tfm/Erewhon-Bold-tosf-sc-t1.tfm 2021/01/18 | 13304 | fonts/erewhon/tfm/Erewhon-Bold-tlf-sc-t1.tfm -2021/01/18 | 132176 | systems/texlive/tlnet/archive/texlive-scripts.r57450.tar.xz -2021/01/18 | 131490 | systems/win32/miktex/tm/packages/next/miktex-dvips-bin-x64-2.9.tar.lzma -2021/01/18 | 1307386 | systems/win32/miktex/tm/packages/next/miktex-poppler-bin-x64-2.9.tar.lzma -2021/01/18 | 1291600 | systems/win32/miktex/tm/packages/next/miktex-runtime-bin-2.9.tar.lzma -2021/01/18 | 1281719 | systems/win32/miktex/tm/packages/next/miktex-dvisvgm-bin-2.9.tar.lzma 2021/01/18 | 1271 | macros/luatex/generic/luakeys/README.md -2021/01/18 | 124939 | systems/win32/miktex/tm/packages/next/miktex-mktex-bin-2.9.tar.lzma -2021/01/18 | 1243994 | systems/win32/miktex/tm/packages/next/miktex-zzdb2-2.9.tar.lzma -2021/01/18 | 1243365 | systems/win32/miktex/tm/packages/miktex-zzdb2-2.9.tar.lzma +2021/01/18 | 119650805 | macros/context/latest/cont-tmf.zip 2021/01/18 | 1174964 | fonts/logix/fonts/logix.ttf -2021/01/18 | 1171816 | systems/win32/miktex/tm/packages/next/miktex-poppler-bin-2.9.tar.lzma -2021/01/18 | 116935 | systems/win32/miktex/tm/packages/next/miktex-dvips-bin-2.9.tar.lzma -2021/01/18 | 1160996 | systems/win32/miktex/tm/packages/miktex-zzdb3-2.9.tar.lzma -2021/01/18 | 1160953 | systems/win32/miktex/tm/packages/next/miktex-zzdb3-2.9.tar.lzma 2021/01/18 | 115998 | fonts/mlmodern/type1/mlmduno10.pfb -2021/01/18 | 1153 | systems/win32/miktex/tm/packages/next/pr.ini 2021/01/18 | 115043 | fonts/mlmodern/type1/mlmro12.pfb 2021/01/18 | 114275 | fonts/mlmodern/type1/mlmro17.pfb -2021/01/18 | 113935 | systems/win32/miktex/tm/packages/next/miktex-gregorio-bin-x64-2.9.tar.lzma 2021/01/18 | 11321 | macros/luatex/generic/luakeys/luakeys.tex 2021/01/18 | 113021 | fonts/mlmodern/type1/mlmro8.pfb -2021/01/18 | 112280 | systems/win32/miktex/tm/packages/next/miktex-gd-bin-x64-2.9.tar.lzma 2021/01/18 | 112180 | fonts/mlmodern/type1/mlmro10.pfb 2021/01/18 | 111349 | fonts/mlmodern/type1/mlmu10.pfb 2021/01/18 | 111197 | fonts/mlmodern/type1/mlmro9.pfb 2021/01/18 | 109779 | fonts/mlmodern/type1/mlmcsco10.pfb -2021/01/18 | 109150 | systems/win32/miktex/tm/packages/next/miktex-jpeg-bin-x64-2.9.tar.lzma 2021/01/18 | 109120 | fonts/mlmodern/type1/mlmri10.pfb 2021/01/18 | 108970 | fonts/mlmodern/type1/mlmri7.pfb 2021/01/18 | 108179 | fonts/mlmodern/type1/mlmr12.pfb @@ -1224,7 +1334,6 @@ 2021/01/18 | 108091 | fonts/mlmodern/type1/mlmbo10.pfb 2021/01/18 | 107927 | fonts/mlmodern/type1/mlmr6.pfb 2021/01/18 | 107924 | fonts/mlmodern/type1/mlmbxo10.pfb -2021/01/18 | 1078966 | systems/win32/miktex/tm/packages/next/miktex-asymptote-bin-x64-2.9.tar.lzma 2021/01/18 | 107866 | fonts/mlmodern/type1/mlmr5.pfb 2021/01/18 | 107738 | fonts/mlmodern/type1/mlmbxi10.pfb 2021/01/18 | 1075 | macros/luatex/generic/luakeys/luakeys-debug.sty @@ -1239,7 +1348,6 @@ 2021/01/18 | 105907 | fonts/mlmodern/type1/mlmri8.pfb 2021/01/18 | 1055913 | macros/latex/contrib/profcollege/doc/ProfCollege-doc.zip 2021/01/18 | 105144 | fonts/mlmodern/type1/mlmbx6.pfb -2021/01/18 | 104759 | systems/win32/miktex/tm/packages/next/miktex-texware-bin-x64-2.9.tar.lzma 2021/01/18 | 104746 | fonts/mlmodern/type1/mlmbx12.pfb 2021/01/18 | 104408 | fonts/mlmodern/type1/mlmbx7.pfb 2021/01/18 | 104289 | fonts/mlmodern/type1/mlmbx8.pfb @@ -1247,7 +1355,6 @@ 2021/01/18 | 10404 | fonts/erewhon/tfm/Erewhon-BoldSlanted-lf-sc-ly1.tfm 2021/01/18 | 10400 | fonts/erewhon/tfm/Erewhon-BoldSlanted-tosf-sc-ly1.tfm 2021/01/18 | 10400 | fonts/erewhon/tfm/Erewhon-BoldSlanted-tlf-sc-ly1.tfm -2021/01/18 | 103331 | systems/win32/miktex/tm/packages/next/miktex-lua53-bin-x64-2.9.tar.lzma 2021/01/18 | 103329 | fonts/mlmodern/type1/mlmbx10.pfb 2021/01/18 | 103051 | fonts/mlmodern/type1/mlmbx9.pfb 2021/01/18 | 103007 | fonts/mlmodern/type1/mlmb10.pfb @@ -1258,7 +1365,6 @@ 2021/01/18 | 10196 | fonts/erewhon/tfm/Erewhon-RegularSlanted-osf-t2a.tfm 2021/01/18 | 10196 | fonts/erewhon/tfm/Erewhon-RegularSlanted-lf-t2a.tfm 2021/01/18 | 101866 | fonts/mlmodern/type1/mlmdunh10.pfb -2021/01/18 | 101860 | systems/win32/miktex/tm/packages/next/miktex-mfware-bin-x64-2.9.tar.lzma 2021/01/18 | 10180 | fonts/erewhon/tfm/Erewhon-RegularSlanted-tosf-t2a.tfm 2021/01/18 | 10180 | fonts/erewhon/tfm/Erewhon-RegularSlanted-tlf-t2a.tfm 2021/01/18 | 10087 | fonts/erewhon/README @@ -1272,7 +1378,6 @@ 2021/01/17 | 814968 | systems/win32/miktex/tm/packages/miktex-pdftex-bin-x64-2.9.tar.lzma 2021/01/17 | 807924 | systems/win32/w32tex/win64/dvipdfm-w64.tar.xz 2021/01/17 | 7984943 | systems/texlive/tlnet/update-tlmgr-r57424.sh -2021/01/17 | 770311 | systems/win32/w32tex/ChangeLog 2021/01/17 | 746079 | systems/win32/miktex/tm/packages/miktex-pdftex-bin-2.9.tar.lzma 2021/01/17 | 7292 | systems/texlive/tlnet/archive/luaotfload.source.r57443.tar.xz 2021/01/17 | 6804 | macros/latex/contrib/profcollege/metapost/PfC-Svgnames.mp @@ -1291,7 +1396,6 @@ 2021/01/17 | 546215 | fonts/logix/source/logixMono.vfc 2021/01/17 | 538980 | systems/win32/miktex/tm/packages/easybook.tar.lzma 2021/01/17 | 521048 | systems/win32/miktex/tm/packages/translations.tar.lzma -2021/01/17 | 503620 | systems/texlive/tlnet/archive/translations.doc.r57446.tar.xz 2021/01/17 | 496826 | macros/latex/contrib/translations/translations_en.pdf 2021/01/17 | 49060520 | systems/win32/w32tex/xetex-w32.tar.xz 2021/01/17 | 4893441 | fonts/logix/source/logix.vfc @@ -1304,6 +1408,7 @@ 2021/01/17 | 44057 | macros/latex/contrib/translations/translations.sty 2021/01/17 | 437 | macros/latex/contrib/profcollege/README 2021/01/17 | 43672 | systems/texlive/tlnet/archive/acro.r57447.tar.xz +2021/01/17 | 401 | macros/latex/contrib/ms/README.md 2021/01/17 | 3997576 | systems/texlive/tlnet/update-tlmgr-r57424.exe 2021/01/17 | 365584 | systems/texlive/tlnet/archive/texlive.infra.x86_64-darwin.r57336.tar.xz 2021/01/17 | 35437 | macros/latex/contrib/translations/translations_en.tex @@ -1346,6 +1451,7 @@ 2021/01/17 | 1714200 | systems/win32/w32tex/win64/ptex-ng-w64.tar.xz 2021/01/17 | 1694 | macros/latex/contrib/translations/README 2021/01/17 | 159246 | systems/win32/miktex/tm/packages/babel-ukrainian.tar.lzma +2021/01/17 | 1565 | macros/latex/contrib/everysel/everysel.ins 2021/01/17 | 154 | systems/texlive/tlnet/update-tlmgr-r57424.exe.sha512 2021/01/17 | 153 | systems/texlive/tlnet/update-tlmgr-r57424.sh.sha512 2021/01/17 | 1512 | systems/texlive/tlnet/archive/tikz-bbox.r57444.tar.xz @@ -1358,7 +1464,6 @@ 2021/01/17 | 13854 | macros/latex/contrib/profcollege/latex/PfC-EquationSymbole1.tex 2021/01/17 | 13151 | macros/latex/contrib/profcollege/metapost/PfC-Calculatrice.mp 2021/01/17 | 1294189 | systems/win32/miktex/tm/packages/miktex-runtime-bin-2.9.tar.lzma -2021/01/17 | 12776 | systems/texlive/tlnet/archive/translations.r57446.tar.xz 2021/01/17 | 1273069 | systems/win32/miktex/tm/packages/acro.tar.lzma 2021/01/17 | 1223432 | systems/texlive/tlnet/archive/acro.doc.r57447.tar.xz 2021/01/17 | 1222420 | fonts/newcomputermodern/NewCMMath-Regular.otf @@ -1371,7 +1476,6 @@ 2021/01/16 | 9875 | macros/luatex/generic/luaotfload/fontloader-fonts-gbn.lua 2021/01/16 | 98536 | systems/win32/miktex/tm/packages/miktex-texware-bin-2.9.tar.lzma 2021/01/16 | 983 | macros/latex/contrib/acro/examples/acro.example.issue-119.tex -2021/01/16 | 9824 | systems/texlive/tlnet/archive/easybook.r57431.tar.xz 2021/01/16 | 97287 | systems/win32/miktex/tm/packages/miktex-gd-bin-2.9.tar.lzma 2021/01/16 | 97099 | systems/win32/miktex/tm/packages/miktex-mfware-bin-2.9.tar.lzma 2021/01/16 | 967680 | systems/win32/miktex/tm/packages/miktex-asymptote-bin-2.9.tar.lzma @@ -1426,7 +1530,6 @@ 2021/01/16 | 77410 | systems/win32/miktex/tm/packages/miktex-mpmcli-bin-x64-2.9.tar.lzma 2021/01/16 | 7726 | systems/win32/miktex/tm/packages/miktex-md5-bin-2.9.tar.lzma 2021/01/16 | 766 | graphics/pgf/contrib/tikz-bbox/pgfmanual4bbox.tex -2021/01/16 | 7609 | macros/latex/contrib/asmeconf/README.md 2021/01/16 | 7589 | macros/luatex/generic/luaotfload/luaotfload-unicode.lua 2021/01/16 | 757 | macros/latex/contrib/acro/examples/acro.example.texsx-542461.tex 2021/01/16 | 75587 | systems/texlive/tlnet/tlpkg/translations/sl.po @@ -1442,7 +1545,6 @@ 2021/01/16 | 7260 | macros/luatex/generic/luaotfload/fontloader-fonts-ext.lua 2021/01/16 | 72105 | systems/win32/miktex/tm/packages/miktex-ps2pk-bin-x64-2.9.tar.lzma 2021/01/16 | 71731 | systems/win32/miktex/tm/packages/miktex-freeglut-bin-2.9.tar.lzma -2021/01/16 | 71644 | macros/latex/contrib/asmeconf/asmeconf.cls 2021/01/16 | 7119 | graphics/pgf/contrib/tikz-bbox/pgfmanual-en-library-bbox.tex 2021/01/16 | 706 | macros/latex/contrib/acro/examples/acro.example.issue-111.tex 2021/01/16 | 70428 | systems/win32/miktex/tm/packages/miktex-web-bin-x64-2.9.tar.lzma @@ -1496,7 +1598,6 @@ 2021/01/16 | 5388 | macros/luatex/generic/luaotfload/fontloader-data-con.lua 2021/01/16 | 531607 | systems/win32/miktex/tm/packages/miktex-libressl-bin-2.9.tar.lzma 2021/01/16 | 52 | macros/luatex/generic/luaotfload/luaotfload-blacklist.cnf -2021/01/16 | 527376 | systems/texlive/tlnet/archive/easybook.doc.r57431.tar.xz 2021/01/16 | 52446 | systems/win32/miktex/tm/packages/miktex-cweb-bin-2.9.tar.lzma 2021/01/16 | 52418 | systems/win32/miktex/tm/packages/miktex-m-tx-bin-x64-2.9.tar.lzma 2021/01/16 | 5240 | systems/texlive/tlnet/archive/marathi.r57432.tar.xz @@ -1550,7 +1651,6 @@ 2021/01/16 | 3869096 | systems/win32/w32tex/luajittex-w32.tar.xz 2021/01/16 | 3866408 | systems/win32/w32tex/luajittex-dev-w32.tar.xz 2021/01/16 | 3821 | macros/luatex/generic/luaotfload/fontloader-fonts-def.lua -2021/01/16 | 381077 | macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.pdf 2021/01/16 | 38041 | systems/win32/miktex/tm/packages/miktex-mthelp-bin-2.9.tar.lzma 2021/01/16 | 38035 | systems/win32/miktex/tm/packages/miktex-gsf2pk-bin-2.9.tar.lzma 2021/01/16 | 3784 | macros/luatex/generic/luaotfload/README.md @@ -1614,13 +1714,11 @@ 2021/01/16 | 2886 | fonts/alfaslabone/enc/a_adz5lu.enc 2021/01/16 | 286 | macros/latex/contrib/acro/examples/acro.example.issue-154.tex 2021/01/16 | 283886 | systems/win32/miktex/tm/packages/miktex-metapost-bin-x64-2.9.tar.lzma -2021/01/16 | 2834904 | macros/latex/contrib/asmeconf.zip 2021/01/16 | 2830 | fonts/alfaslabone/enc/a_5xld5w.enc 2021/01/16 | 28088 | systems/win32/miktex/tm/packages/miktex-lacheck-bin-2.9.tar.lzma 2021/01/16 | 27986 | systems/win32/miktex/tm/packages/miktex-findtexmf-bin-x64-2.9.tar.lzma 2021/01/16 | 275 | macros/luatex/generic/luaotfload/luaotfload-main.lua -2021/01/16 | 275358 | macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.pdf -2021/01/16 | 27446 | macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.tex +2021/01/16 | 27458 | systems/win32/miktex/source/CHANGELOG.md 2021/01/16 | 27391 | systems/win32/miktex/tm/packages/miktex-makeindex-bin-2.9.tar.lzma 2021/01/16 | 27380 | systems/texlive/tlnet/archive/tlshell.r57426.tar.xz 2021/01/16 | 27362 | systems/win32/miktex/tm/packages/miktex-teckit-bin-x64-2.9.tar.lzma @@ -1793,8 +1891,6 @@ 2021/01/15 | 680 | systems/texlive/tlnet/archive/albatross.win32.r57420.tar.xz 2021/01/15 | 67995 | language/marathi/marathi.dtx 2021/01/15 | 6406619 | fonts/nunito.zip -2021/01/15 | 637738 | macros/latex/contrib/asmeconf/asmeconf-template.pdf -2021/01/15 | 610063 | macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.pdf 2021/01/15 | 564 | fonts/nunito/vf/Nunito-SemiBoldItalic-tosf-ts1.vf 2021/01/15 | 564 | fonts/nunito/vf/Nunito-SemiBoldItalic-tlf-ts1.vf 2021/01/15 | 564 | fonts/nunito/vf/Nunito-ExtraLightItalic-tosf-ts1.vf @@ -1882,10 +1978,8 @@ 2021/01/15 | 41924 | fonts/nunito/tfm/Nunito-Bold-tlf-ly1.tfm 2021/01/15 | 41500 | fonts/nunito/tfm/Nunito-ExtraBoldItalic-tosf-ly1.tfm 2021/01/15 | 41500 | fonts/nunito/tfm/Nunito-ExtraBoldItalic-tlf-ly1.tfm -2021/01/15 | 41372 | macros/latex/contrib/asmeconf/asmeconf-template.tex 2021/01/15 | 41344 | fonts/nunito/tfm/Nunito-ExtraBold-tosf-ly1.tfm 2021/01/15 | 41344 | fonts/nunito/tfm/Nunito-ExtraBold-tlf-ly1.tfm -2021/01/15 | 41302 | macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.tex 2021/01/15 | 40576 | fonts/nunito/tfm/Nunito-LightItalic-tosf-ly1.tfm 2021/01/15 | 40576 | fonts/nunito/tfm/Nunito-LightItalic-tlf-ly1.tfm 2021/01/15 | 40476 | fonts/nunito/tfm/Nunito-Light-tosf-ly1.tfm @@ -2255,7 +2349,6 @@ 2021/01/14 | 838544 | fonts/stix2-otf/STIXTwoMath-Regular.otf 2021/01/14 | 819 | macros/latex/contrib/fcolumn/makefile 2021/01/14 | 7059003 | systems/win32/miktex/tm/packages/mlmodern.tar.lzma -2021/01/14 | 7019984 | systems/texlive/tlnet/archive/mlmodern.r57411.tar.xz 2021/01/14 | 68548 | macros/latex/contrib/fcolumn/fcolumn.dtx 2021/01/14 | 619243 | systems/win32/miktex/tm/packages/showexpl.tar.lzma 2021/01/14 | 604612 | systems/texlive/tlnet/archive/showexpl.doc.r57414.tar.xz @@ -2280,7 +2373,6 @@ 2021/01/14 | 3437528 | systems/win32/w32tex/win64/luajittex-exp-w64.tar.xz 2021/01/14 | 3408764 | fonts/stix2-otf.zip 2021/01/14 | 340487 | macros/latex/contrib/fcolumn.zip -2021/01/14 | 33756 | systems/texlive/tlnet/archive/mlmodern.doc.r57411.tar.xz 2021/01/14 | 325284 | fonts/stix2-otf/STIXTwoText-MediumItalic.otf 2021/01/14 | 325060 | fonts/stix2-otf/STIXTwoText-SemiBoldItalic.otf 2021/01/14 | 3204 | macros/latex/contrib/pslatex/README.txt @@ -2308,7 +2400,6 @@ 2021/01/14 | 1832 | language/marathi/namuna-beamer.tex 2021/01/14 | 16978 | macros/luatex/optex/base/unimath-codes.opm 2021/01/14 | 15182 | macros/latex/contrib/readablecv/ReadableCV.cls -2021/01/14 | 13995 | macros/latex/contrib/asmeconf/asmeconf-sample.bib 2021/01/14 | 13642 | fonts/stix2-otf/README.md 2021/01/14 | 1362584 | macros/luatex/optex/doc/optex-doc.pdf 2021/01/14 | 135615 | macros/latex/contrib/readablecv/ReadableCV.pdf @@ -2353,7 +2444,6 @@ 2021/01/13 | 484204 | systems/win32/w32tex/dvi2tty-w32.tar.xz 2021/01/13 | 46304 | systems/texlive/tlnet/archive/curve2e.source.r57402.tar.xz 2021/01/13 | 4550868 | systems/win32/w32tex/dvipsk-w32.tar.xz -2021/01/13 | 4485516 | systems/win32/w32tex/texinfo-w32.tar.xz 2021/01/13 | 448292 | systems/win32/w32tex/win64/dvi2tty-w64.tar.xz 2021/01/13 | 440824 | systems/win32/w32tex/win64/cweb-w64.tar.xz 2021/01/13 | 439196 | systems/win32/w32tex/mftools.tar.xz @@ -2387,7 +2477,6 @@ 2021/01/13 | 1634 | systems/win32/miktex/tm/packages/orientation.tar.lzma 2021/01/13 | 1609236 | systems/win32/w32tex/makeindex-w32.tar.xz 2021/01/13 | 14588 | systems/texlive/tlnet/archive/witharrows.r57401.tar.xz -2021/01/13 | 141702768 | systems/win32/w32tex/context.tar.xz 2021/01/13 | 13718 | fonts/erewhon/doc/erewhon-doc.tex 2021/01/13 | 136160 | systems/texlive/tlnet/archive/tex4ht.doc.r57404.tar.xz 2021/01/13 | 1283 | support/albatross/doc/albatross.1 @@ -2397,84 +2486,3 @@ 2021/01/13 | 1143280 | systems/win32/miktex/tm/packages/tuda-ci.tar.lzma 2021/01/13 | 1078524 | systems/win32/w32tex/win64/makeindex-w64.tar.xz 2021/01/13 | 10633792 | systems/win32/w32tex/ptex-w32.tar.xz -2021/01/12 | 99719588 | systems/win32/w32tex/web2c-lib.tar.xz -2021/01/12 | 964228 | macros/generic/witharrows.zip -2021/01/12 | 9383 | macros/latex/contrib/tuda-ci/tex/beamerouterthemeTUDa.sty -2021/01/12 | 9340 | systems/texlive/tlnet/archive/bithesis.source.r57388.tar.xz -2021/01/12 | 9300 | macros/latex/contrib/tuda-ci/tex/tudamecheng.cfg -2021/01/12 | 928 | systems/texlive/tlnet/archive/orientation.r57390.tar.xz -2021/01/12 | 900 | systems/texlive/tlnet/archive/orientation.doc.r57390.tar.xz -2021/01/12 | 8700 | systems/texlive/tlnet/archive/hyphenex.r57387.tar.xz -2021/01/12 | 8244 | systems/texlive/tlnet/archive/hu-berlin-bundle.r57391.tar.xz -2021/01/12 | 8237 | macros/latex/contrib/tuda-ci/tex/beamerinnerthemeTUDa.sty -2021/01/12 | 74065 | macros/latex/contrib/curve2e/curve2e-manual.tex -2021/01/12 | 7348 | macros/latex/contrib/tuda-ci/example/DEMO-TUDaBeamer.tex -2021/01/12 | 6893 | macros/latex/contrib/tuda-ci/example/DEMO-TUDaLeaflet.tex -2021/01/12 | 676331 | macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPub.pdf -2021/01/12 | 6647 | macros/latex/contrib/tuda-ci/tex/tudabeamer.cls -2021/01/12 | 654288 | macros/latex/contrib/curve2e/curve2e.pdf -2021/01/12 | 649849 | macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPhD.pdf -2021/01/12 | 644404 | macros/latex/contrib/tuda-ci/doc/DEMO-TUDaThesis.pdf -2021/01/12 | 6430218 | macros/latex/contrib/tuda-ci.zip -2021/01/12 | 640153 | macros/generic/witharrows/witharrows.pdf -2021/01/12 | 6331 | macros/latex/contrib/tuda-ci/tex/tudarules.sty -2021/01/12 | 6240 | systems/texlive/tlnet/archive/collection-latexextra.r57390.tar.xz -2021/01/12 | 621765 | macros/latex/contrib/tuda-ci/doc/DEMO-TUDaBeamer.pdf -2021/01/12 | 5989 | macros/latex/contrib/curve2e/README.txt -2021/01/12 | 589130 | macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLetter.pdf -2021/01/12 | 5871 | macros/latex/contrib/tuda-ci/example/DEMO-TUDaPoster.tex -2021/01/12 | 586680 | macros/latex/contrib/tuda-ci/doc/DEMO-TUDaSciPoster.pdf -2021/01/12 | 583234 | macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLeaflet.pdf -2021/01/12 | 5817 | macros/latex/contrib/tuda-ci/tex/tudacolors.sty -2021/01/12 | 5789 | macros/latex/contrib/tuda-ci/tex/tudasize9pt.clo -2021/01/12 | 578384 | macros/latex/contrib/tuda-ci/doc/DEMO-TUDaExercise.pdf -2021/01/12 | 574097 | macros/latex/contrib/tuda-ci/doc/DEMO-TUDaAnnouncement.pdf -2021/01/12 | 571431 | macros/latex/contrib/curve2e/curve2e-manual.pdf -2021/01/12 | 558963 | macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPoster.pdf -2021/01/12 | 552066 | fonts/erewhon/afm/Erewhon-Bold.afm -2021/01/12 | 550427 | macros/latex/contrib/tuda-ci/doc/DEMO-TUDaReport.pdf -2021/01/12 | 5381 | macros/latex/contrib/tuda-ci/tex/tudalettersize10pt.clo -2021/01/12 | 5143 | macros/latex/contrib/tuda-ci/example/DEMO-TUDaLetter.tex -2021/01/12 | 49451 | fonts/mlmodern/dvips/mlm.map -2021/01/12 | 4441 | macros/latex/contrib/tuda-ci/tex/tudacolors.def -2021/01/12 | 4328 | macros/latex/contrib/tuda-ci/tex/tuda-pgfplots.sty -2021/01/12 | 40689 | macros/latex/contrib/tuda-ci/tex/tudapub.cls -2021/01/12 | 3883 | macros/latex/contrib/tuda-ci/example/DEMO-TUDaFromaddress.lco -2021/01/12 | 3809 | macros/latex/contrib/tuda-ci/tex/beamercolorthemeTUDa.sty -2021/01/12 | 3572 | systems/texlive/tlnet/archive/bithesis.r57388.tar.xz -2021/01/12 | 3243 | macros/latex/contrib/tuda-ci/tex/tudafonts.sty -2021/01/12 | 3196 | macros/latex/contrib/tuda-ci/example/DEMO-TUDaAnnouncement.tex -2021/01/12 | 30071 | macros/latex/contrib/tuda-ci/tex/tudathesis.cfg -2021/01/12 | 280653 | macros/generic/witharrows/witharrows.dtx -2021/01/12 | 269 | fonts/erewhon/tex/erewhon.fontspec -2021/01/12 | 267392 | macros/generic/witharrows/witharrows-french.pdf -2021/01/12 | 2656 | macros/latex/contrib/tuda-ci/example/DEMO-TUDaBibliography.bib -2021/01/12 | 25665 | macros/latex/contrib/tuda-ci/example/DEMO-TUDaPub.tex -2021/01/12 | 25563 | macros/latex/contrib/tuda-ci/tex/tudaexercise.cls -2021/01/12 | 25405 | macros/latex/contrib/tuda-ci/example/DEMO-TUDaThesis.tex -2021/01/12 | 25134 | macros/latex/contrib/tuda-ci/example/DEMO-TUDaPhD.tex -2021/01/12 | 2362 | macros/latex/contrib/tuda-ci/example/DEMO-TUDaReport.tex -2021/01/12 | 218936 | systems/texlive/tlnet/archive/bithesis.doc.r57388.tar.xz -2021/01/12 | 2180 | macros/latex/contrib/tuda-ci/tex/beamerfontthemeTUDa.sty -2021/01/12 | 2172 | macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa.sty -2021/01/12 | 211928 | systems/texlive/tlnet/archive/hu-berlin-bundle.doc.r57391.tar.xz -2021/01/12 | 203972 | systems/texlive/tlnet/archive/hyphenex.source.r57387.tar.xz -2021/01/12 | 18335 | macros/latex/contrib/tuda-ci/tex/tudasciposter.cls -2021/01/12 | 183291 | macros/latex/contrib/curve2e/curve2e.dtx -2021/01/12 | 1808 | fonts/mlmodern/latex/mlmodern.sty -2021/01/12 | 17640 | systems/texlive/tlnet/archive/hu-berlin-bundle.source.r57391.tar.xz -2021/01/12 | 17395 | macros/latex/contrib/tuda-ci/tex/tudaposter.cls -2021/01/12 | 1686 | macros/latex/contrib/tuda-ci/tex/tuda-a5paper.clo -2021/01/12 | 1684 | macros/latex/contrib/tuda-ci/tex/tuda-a4paper.clo -2021/01/12 | 1682 | macros/latex/contrib/tuda-ci/tex/tuda-a3paper.clo -2021/01/12 | 1681 | macros/latex/contrib/tuda-ci/tex/tuda-a1paper.clo -2021/01/12 | 1680 | macros/latex/contrib/tuda-ci/tex/tuda-a2paper.clo -2021/01/12 | 1676 | macros/latex/contrib/tuda-ci/tex/tuda-a0paper.clo -2021/01/12 | 16688 | macros/latex/contrib/tuda-ci/tex/tudaletter.cls -2021/01/12 | 13710 | macros/latex/contrib/tuda-ci/tex/tudaleaflet.cls -2021/01/12 | 1297573 | macros/latex/contrib/curve2e.zip -2021/01/12 | 12637 | macros/luatex/optex/base/optex.lua -2021/01/12 | 11528 | macros/latex/contrib/tuda-ci/README.md -2021/01/12 | 10712 | macros/latex/contrib/tuda-ci/example/DEMO-TUDaSciPoster.tex -2021/01/12 | 10524 | macros/latex/contrib/tuda-ci/example/DEMO-TUDaExercise.tex -2021/01/12 | 10072 | macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa-mecheng.sty diff --git a/graphics/pgf/contrib/circuitikz/README.md b/graphics/pgf/contrib/circuitikz/README.md index 18614930e0..d92c284d5c 100644 --- a/graphics/pgf/contrib/circuitikz/README.md +++ b/graphics/pgf/contrib/circuitikz/README.md @@ -74,13 +74,13 @@ also the questions tagged `circuitikz` on https://tex.stackexchange.com/ are of * Romano Giannetti (romano.giannetti@gmail.com) ------------- -Copyright 2018-2020 by Romano Giannetti +Copyright 2018-2021 by Romano Giannetti -Copyright 2015-2020 by Stefan Lindner +Copyright 2015-2021 by Stefan Lindner -Copyright 2013-2020 by Stefan Erhardt +Copyright 2013-2021 by Stefan Erhardt -Copyright 2007-2020 by Massimo Redaelli +Copyright 2007-2021 by Massimo Redaelli This file may be distributed and/or modified diff --git a/graphics/pgf/contrib/circuitikz/doc/changelog.tex b/graphics/pgf/contrib/circuitikz/doc/changelog.tex index c03605dee9..6b78c47113 100644 --- a/graphics/pgf/contrib/circuitikz/doc/changelog.tex +++ b/graphics/pgf/contrib/circuitikz/doc/changelog.tex @@ -4,6 +4,21 @@ here. See \url{https://github.com/circuitikz/circuitikz/commits} for a full list of changes. \begin{itemize} +\item + Version 1.3.0 (2021-01-19) + + \begin{itemize} + \tightlist + \item + Fixed a long-standing problem with labels and similar decoration + with equal signs and commas + \item + Fixed a typo in the manual (thanks to @muzimuzhi on GitHub) + \item + The Mother of All Code Refactoring: no real changes (modulo errors) + \item + Added a rollback point to 1.2.7 + \end{itemize} \item Version 1.2.7 (2020-12-27) diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf b/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf index fb5257a31c..f53891b6d9 100644 Binary files a/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf and b/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf differ diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.tex b/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.tex index 766499ba0c..62552b746f 100644 --- a/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.tex +++ b/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf index a610f2da9f..10c780223c 100644 Binary files a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf and b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf differ diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex index 45de64ab48..4186402412 100644 --- a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex +++ b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex @@ -5,10 +5,10 @@ % !TeX spellcheck = en_US % !TeX encoding = utf8 -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -280,7 +280,8 @@ The \texttt{use fpu reciprocal} key seems to have no side effects, but given tha Here, we will provide a list of incompabilitys between different version of circuitikz. We will try to hold this list short, but sometimes it is easier to break with old syntax than including a lot of switches and compatibility layers. You can check the used version at your local installation using the macro \verb!\pgfcircversion{}!. \begin{itemize} - \item Due to a bug fix in \TikZ{} that revealed a problem in \Circuitikz, you \textbf{must} upgrade to v1.2.7 or newer if you use a \TikZ{} 3.1.8 or 3.1.8a (the change in \TikZ{} has been reverted later). + \item After 1.2.7 a big code reorganization (which by the way fixed some bug) has been made; no changes should be visible, but a fallback point at 1.2.7 has been added. + \item You \textbf{must} upgrade to v1.2.7 or newer if you use a \TikZ{} 3.1.8 or 3.1.8a (but better upgrade both packages to the current version). \item After v1.2.1: \textbf{Important:} the routine that implement the \texttt{to[...]} component positioning has been rewritten. That should enhance the line joins in path, and it's safer, but it can potentially change behavior. One of the changes is that the previous routine did the wrong thing if you used \texttt{(node) to[...]} (you should use an anchor or a coordinate, not a node there --- like \texttt{(node.anchor) to[...]}). @@ -307,13 +308,13 @@ You can check the used version at your local installation using the macro \verb! If you have older projects that show compatibility problems, you have two options: \begin{itemize} \item you can use an older version locally using the git-version and picking the correct commit from the repository (branch gh-pages) or the main GitHub site directly; - \item if you are using \LaTeX, the distribution has embedded several important old versions: \texttt{0.4}, \texttt{0.6}, \texttt{0.7}, \texttt{0.8.3}, \texttt{0.9.3}, \texttt{0.9.6}, \texttt{1.0} and \texttt{1.1.2}. + \item if you are using \LaTeX, the distribution has embedded several important old versions: \texttt{0.4}, \texttt{0.6}, \texttt{0.7}, \texttt{0.8.3}, \texttt{0.9.3}, \texttt{0.9.6}, \texttt{1.0}, \texttt{1.1.2} and \texttt{1.2.7}. To switch to use them, you simply change your \verb|\usepackage| invocation like \begin{lstlisting} \usepackage[]{circuitikz-0.8.3} % or circuitikz-0.4, 0.6... \end{lstlisting} You have to take care of the options that may have changed between versions; - \item if you are using \ConTeXt, only versions \texttt{0.8.3}, \texttt{0.9.3}, \texttt{0.9.6}, \texttt{1.0} and \texttt{1.1.2} are packaged; if can use it with + \item if you are using \ConTeXt, only versions \texttt{0.8.3}, \texttt{0.9.3}, \texttt{0.9.6}, \texttt{1.0}, \texttt{1.1.2} and \texttt{1.2.7} are packaged; if can use it with \begin{lstlisting} \usemodule[circuitikz-0.8.3] \end{lstlisting} @@ -1124,7 +1125,7 @@ The above diagram has been obtained with the code: As \href{https://github.com/circuitikz/circuitikz/issues/460}{noticed by user \texttt{septatrix}}, although relative coordinates after a component work as expected when using \texttt{++(x,y)}-style coordinates, that is not true for the \texttt{+(x,y)}-style coordinates (which are supposed to set a temporary relative coordinate and then going back to the starting point). -This behavior, although not optimal, was standard in \texttt{to} operation in plain \TikZ{} before version 3.1.18; it was changed by Henri Menke in later versions. Notice that the change revealed a problem in \Circuitikz{} that should hopefully fixed in \texttt{v1.2.7}. +This behavior, although not optimal, was standard in \texttt{to} operation in plain \TikZ{} before version 3.1.8; it was changed by Henri Menke in later versions. Notice that the change revealed a problem in \Circuitikz{} that should hopefully fixed in \texttt{v1.2.7}. You can see from the example below (notice the blue curve using a spline line). If all the vertical lines are at the left, the manual has been compiled with a new \Circuitikz{} and \TikZ. Otherwise, the red and/or blue curve will have the vertical line at the right (which in principle is wrong). @@ -5804,14 +5805,28 @@ The position of annotations and labels can be adjusted with \verb|_| and \verb| \end{circuitikz} \end{LTXexample} -\textbf{Caveat:} notice that the way in which \texttt{circuitikz} processes the options, there will be problems if the label (or annotation, voltage, or current) contains one of the characters $=$ (equal) or $,$ (comma), giving unexpected errors and wrong output. -These two characters must be protected from the option parser using an \verb|\mbox| command, or redefining the characters with a \TeX\ \verb|\def|: +\textbf{Caveat:} when \TikZ{} processes the options, there will be problems if the label (or annotation, voltage, or current) contains one of the characters $=$ (equal) or $,$ (comma) --- because the parser search for those two characters to delimit the arguments, giving unexpected errors and wrong output. +These two characters can be protected from the option parser using an extra set of braces. \begin{LTXexample}[varwidth=true] - \def\eq{=} \begin{circuitikz} % the following will fail: - % \draw (0,0) to[R, l={$R=3}] (3,0); + % \draw (0,0) to[R, l=$R=3$] + \draw (0,0) to[R, l={$R=3$}] (3,0); + \draw (0,0) to[R={$R=3$}] (0,3); + \draw (3,3) to[R={$R,3$}] (3,0); + % this works, but it has wrong spacing + \draw (0,3) to[R, l=$R{=}3$] (3,3); + \end{circuitikz} +\end{LTXexample} + +\textbf{(Even more) Caveat:} up to version \texttt{1.2.7}, due to the way in which \Circuitikz{} used to processes the options, even that was not sufficient, so you must protect that tokens even more, for example using an \verb|\mbox| command, or redefining the characters with a \TeX\ \verb|\def|: + +\begin{LTXexample}[varwidth=true] + \begin{circuitikz} + \def\eq{=} + % the following will fail up to 1.2.7: + % \draw (0,0) to[R, l={$R=3$}] (3,0); \draw (0,0) to[R, l=\mbox{$R=3$}] (3,0); \draw (0,0) to[R, l=$R\eq3$] (0,3); \draw (3,3) to[R, l=\mbox{$R,3$}] (3,0); @@ -5820,6 +5835,7 @@ These two characters must be protected from the option parser using an \verb|\mb \end{circuitikz} \end{LTXexample} + \noindent The default orientation of labels is controlled by the options \texttt{smartlabels}, \texttt{rotatelabels} and \texttt{straightlabels} (or the corresponding \texttt{label/align} keys). Here are examples to see the differences: \begin{LTXexample}[varwidth=true] \begin{circuitikz} @@ -7552,9 +7568,11 @@ Just substitute every occurrence of the environment \verb!circuitikz! with \verb \faqQ I cannot write \verb!to[R = $R_1=12V$]! nor \verb!to[ospst = open, 3s]!: I get errors. -\faqA It is a limitation of the parser, joined with a suboptimal processing by \Circuitikz{} of the passing of the argument of keys. +\faqA It is a limitation of the parser, joined with a suboptimal processing by \Circuitikz{} (up to \texttt{1.2.7}) of the passing of the argument of keys. -Use for example \verb|\mbox{}| or define \verb|\def{\eq}{=}| and use \verb!to[R = $R_1\eq 12V$]!, or try to protect commas and equal signs like \verb!to[ospst = open{,} 3s]! or \verb|ospst=\mbox{open, 3s}| instead; see caveat in section~\ref{sec:labels-and-annotations}. +You should protect commas and equal signs like in \verb!to[R = {$R_1=12V$}]! or \verb!to[ospst = {open, 3s}]!. + +In versions up to \texttt{1.2.7}, use for example \verb|\mbox{}| or define \verb|\def{\eq}{=}| and use \verb!to[R = $R_1\eq 12V$]!, or try to protect commas and equal signs like \verb!to[ospst = open{,} 3s]! or \verb|ospst=\mbox{open, 3s}| instead; see caveat in section~\ref{sec:labels-and-annotations}. \subsection{Global scaling and rotating}\label{faqs:scale-and-rotate} @@ -7581,15 +7599,16 @@ Use for example \verb|\mbox{}| or define \verb|\def{\eq}{=}| and use \verb!to[R \textbf{Big fat warning}: this material is reserved to \TeX-hackers; do not delve into this if you have no familiarity with (at least) a bit of core \TeX{} programming and to the basic \TikZ{} layer. You have been warned. - \subsection{Suggested setup} +Notice: the source code has been re-organized after release 1.2.7; if you are bound to use an older version check the corresponding manual. + The suggested way to start working on a new component is to use the utilities of the \Circuitikz{} manual for checking and testing your device. Basically, find (or download) the source code of the last version of \Circuitikz{} and find the file \texttt{ctikzmanutils.sty}; copy it in your directory and prepare a file like this: -\begin{lstlisting} +\begin{lstlisting}[keepspaces=true] \documentclass[a4paper, titlepage]{article} -\usepackage{a4wide} %smaller borders -\usepackage[utf8]{inputenc} +\usepackage{a4wide} %smaller borders +\usepackage[utf8]{inputenc} %not needed since LaTeX 2019 \usepackage[T1]{fontenc} \parindent=0pt \parskip=4pt plus 6pt minus 2pt @@ -7640,7 +7659,10 @@ From now on, you can add the new commands for the component between the \verb|\m Let's define for example a path style component, like the one suggested by the user \texttt{@alex} on \href{https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz}{\TeX{} stackexchange site}. The component will be a mix of the \texttt{damper} and the \texttt{spring} components already present. -The first step is to check if we can use the definition already existing for similar elements (for coherence of size) or if we need to define new ones; for this you have to check the file \texttt{pgfcirc.defines.tex}: we find +The definitions of the components are in the files \texttt{pgfcirc\emph{something}.tex}; they are more or less distributed by the number of terminals, but there are exceptions (for example, switches are in \texttt{bipoles}, even if several of them are tripoles or more\dots \texttt{grep} is your friend here. + +To define the new component we will look into (in this case) \texttt{pgfcircbipoles.tex}; at the start of the block where the components are defined you can find the relevant definitions (sometime some of the definitions are in \texttt{pgfcirc.defines.tex}, for historical or dependencies reasons). +The first step is to check if we can use the definition already existing for similar elements (for coherence of size) or if we need to define new ones; for this you have to check into the we find \begin{lstlisting} \ctikzset{bipoles/spring/height/.initial=.5} @@ -7652,9 +7674,10 @@ The first step is to check if we can use the definition already existing for sim We will use them; at this stage you can decide to add other parameters if you need them. (Notice, however, than although flexibility is good, these parameters should be described in the manual, otherwise they're as good as a fixed number in the code). -To define the new component we will look into \texttt{pgfcircbipoles.tex} and we will copy, for example, the definition of the damper into our code, just changing the name: -\begin{lstlisting} +After that we will copy, for example, the definition of the damper into our code, just changing the name: + +\begin{lstlisting}[keepspaces=true] %% mechanical resistor - damper \pgfcircdeclarebipolescaled{mechanicals} {} % extra anchors @@ -7694,21 +7717,20 @@ To define the new component we will look into \texttt{pgfcircbipoles.tex} and we } \end{lstlisting} -This command will define a shape that is named \texttt{viscoeshape}, with all the correct geographical anchors based on the depth, height and width defined in the parameters of \verb|\pgfcircdeclarebipolescaled|. Moreover, the element is assigned to the class \texttt{mechanicals} for styling. +This \verb|\pgfcircdeclarebipolescaled| command will define a shape that is named \texttt{viscoeshape}, with all the correct geographical anchors based on the depth, height and width defined in the parameters: in this case we are reusing the ones of the \texttt{damper} shape. Moreover, the element is assigned to the class \texttt{mechanicals} for styling. -To be coherent with the styling, you should use (when needed) the length \verb|\pgf@circ@scaled@Rlen| as the ``basic'' length for drawing, using the fill functions defined at the start of \texttt{pgfcirc.defines.tex} to fill and stroke --- so that the operation will follow the style parameters and, finally, use the macro \verb|\pgf@circ@setlinewidth| to set the line thickness /the first argument is the ``legacy'' class, if you do not want to assign one you can use the pseudo-legacy class \texttt{none}. +To be coherent with the styling, you should use (when needed) the length \verb|\pgf@circ@scaled@Rlen| as the ``basic'' length for drawing, using the fill functions (they are defined at the start of the file \texttt{pgfcirc.defines.tex}) to fill and stroke --- so that the operation will follow the style parameters and, finally, use the macro \verb|\pgf@circ@setlinewidth| to set the line thickness: the first argument is the ``legacy'' class, if you do not want to assign one you can use the pseudo-legacy class \texttt{none}. -The anchors for the bipole (which then set the lengths \verb|\pgf@circ@res@left|) are already scaled for your use. You can use these lenghts (which defines, normally, the geographical anchors of the element) to draw your shapes. +The anchors for the bipole (which then set the lengths \verb|\pgf@circ@res@left|) are already scaled for your use. You can use these lengths (which defines, normally, the geographical anchors of the element) to draw your shapes. -This is not sufficient for using the element in a \texttt{to[]} path command; you need to ``activate'' it with (this commands are normally in \texttt{pgfcircpath.tex}): +This is not sufficient for using the element in a \texttt{to[]} path command; you need to ``activate'' it (the definition of the commands are normally in \texttt{pgfcircpath.tex}). In this case the component is simple --- look at the definitions if you need to do more complex things. \begin{lstlisting} -\def\pgf@circ@viscoe@path#1{\pgf@circ@bipole@path{viscoe}{#1}} -\compattikzset{viscoe/.style = {\circuitikzbasekey, - /tikz/to path=\pgf@circ@dviscoe@path, l=#1}} +\pgfcirc@activate@bipole@simple{l}{viscoe} \end{lstlisting} -And now you can show it with: +In the definition above, the \texttt{\{l\}} parameter means that using the component like \texttt{to[viscoe=A]} will be equivalent to \texttt{to[viscoe, l=A]}; you can use also \texttt{v} or \texttt{i} or \texttt{f} if your component needs it. +Now you can show it with: \begin{lstlisting} \circuitdescbip*{viscoe}{Mechanical viscoelastic element}{}(left/135/0.2, right/45/0.2, center/-90/0.3) @@ -7723,13 +7745,14 @@ And now you can show it with: \end{LTXexample} \end{lstlisting} -Obviously, at first you you just have a component that is the same as the one you copied with another name. It is now just a matter of modifying it so that it has the desired shape; in the example above you can already see the new symbol after the changes. +Obviously, at first you you just have a component that is the same as the one you copied with another name. +It is now just a matter of modifying it so that it has the desired shape; in the example above you can already see the new symbol after the changes. -When doing the drawing, the \verb|\pgfcircdeclarebipole| will setup the lengths \verb|\pgf@circ@res@right| -and \verb|\pgf@circ@res@up| as the $x$-$y$ coordinates of the upper right corner, and -\verb|\pgf@circ@res@left| and \verb|\pgf@circ@res@down| as the $x$-$y$ coordinates of the lower left corner of your shape. The \texttt{center} coordinate is usually at $(0pt, 0pt)$. +When doing the drawing in the main argument of the \verb|\pgfcircdeclarebipole|, things will be setup so that the lengths \verb|\pgf@circ@res@right| +and \verb|\pgf@circ@res@up| are the $x$-$y$ coordinates of the upper right corner, and +\verb|\pgf@circ@res@left| and \verb|\pgf@circ@res@down| are the $x$-$y$ coordinates of the lower left corner of your shape. The \texttt{center} coordinate is usually at $(0pt, 0pt)$. -Looking at the implementation of the \texttt{spring} element, a possible implementation is changing the lines between lines~12 and~16 with: +Looking at the implementation of the \texttt{spring} element, one possibility is changing the lines between lines~12 and~16 with: \begin{lstlisting} % spring into the damper @@ -7780,6 +7803,7 @@ If you think they are too tight or too loose you can use a (developer-only) key Notice that by default the key \texttt{bipoles/\emph{mybipole}/voltage/additional shift} is not defined, so if you want to use it you must create it before (this is the meaning of the \texttt{.initial} here). +Now you can save all the code between the \verb|\makeatletter| and \verb|\makeatother| in a file and \verb|\input{}| it for using your special component, or submit the component to the project (see below). As a final note, notice that the \texttt{viscoe} element is already added to the standard package. @@ -7820,8 +7844,6 @@ Once you have a satisfactory element, you should The best way of contributing is forking the project, adding your component in the correct files, modifying the manual and creating a pull request for the developers to merge. Anyway, if this is a problem, just open an issue and someone (when they have time\dots) will answer. - - \section{Examples} Here a series of example, contributed by several people, is shown with their code. diff --git a/graphics/pgf/contrib/circuitikz/doc/ctikzmanutils.sty b/graphics/pgf/contrib/circuitikz/doc/ctikzmanutils.sty index f402c9fa73..11b8eb9086 100644 --- a/graphics/pgf/contrib/circuitikz/doc/ctikzmanutils.sty +++ b/graphics/pgf/contrib/circuitikz/doc/ctikzmanutils.sty @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % diff --git a/graphics/pgf/contrib/circuitikz/tex/circuitikz-1.2.7.sty b/graphics/pgf/contrib/circuitikz/tex/circuitikz-1.2.7.sty new file mode 100644 index 0000000000..0a813920a9 --- /dev/null +++ b/graphics/pgf/contrib/circuitikz/tex/circuitikz-1.2.7.sty @@ -0,0 +1,24526 @@ +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +\NeedsTeXFormat{LaTeX2e} + +\def\pgfcircversion{1.2.7} +\def\pgfcircversiondate{2020/12/27} + +\ProvidesPackage{circuitikz-1.2.7} +[\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion] + +%% Version 3.0 of pgf/TikZ is required +\RequirePackage{tikz} +\usetikzlibrary{calc} +% +% "arrows" library is deprecated, and behave badly with +% arrows on short paths. Change to the new arrows.meta +% In pfgcirc.define, we will add the old definition of +% latex' which we have lost in the transition +% +\usetikzlibrary{arrows.meta, bending} +\usetikzlibrary{fpu} % may be needed for use fpu reciprocal (v1.0.1) +% +% global of options (better use styles!) +% +\DeclareOption{european}{ + \ctikzset{voltage=european} \ctikzset{current=european} \ctikzset{inductor=european} + \ctikzset{resistor=european} \ctikzset{logic ports=european} \ctikzset{gas filled surge arrester choice = european} +} +\DeclareOption{american}{ + \ctikzset{voltage=american} \ctikzset{current=american} \ctikzset{resistor=american} \ctikzset{inductor=american} \ctikzset{gas filled surge arrester choice = american} + \ctikzset{logic ports = american} +} +\DeclareOption{siunitx}{ + \pgf@circ@siunitxtrue +} +\DeclareOption{nosiunitx}{ + \pgf@circ@siunitxfalse +} +\DeclareOption{compatibility}{ + \pgf@circuit@compattrue +} +% +% voltages +% +\DeclareOption{europeanvoltage}{ + \ctikzset{voltage=european} +} +\DeclareOption{straightvoltages}{ + \ctikzset{voltage=straight} +} +\DeclareOption{americanvoltage}{ + \ctikzset{voltage=american} +} +\DeclareOption{europeanvoltages}{ + \ctikzset{voltage=european} +} +\DeclareOption{americanvoltages}{ + \ctikzset{voltage=american} +} +% Voltage directions +\DeclareOption{oldvoltagedirection}{ + \pgf@circ@oldvoltagedirectiontrue + \pgf@circ@explicitvdirtrue + \pgf@circ@fixbatteriesfalse +} +\DeclareOption{nooldvoltagedirection}{ + \pgf@circ@oldvoltagedirectionfalse + \pgf@circ@explicitvdirtrue + \pgf@circ@fixbatteriesfalse +} +\DeclareOption{RPvoltages}{ + \pgf@circ@oldvoltagedirectiontrue + \pgf@circ@explicitvdirtrue + \pgf@circ@fixbatteriestrue +} +\DeclareOption{EFvoltages}{ + \pgf@circ@oldvoltagedirectionfalse + \pgf@circ@explicitvdirtrue + \pgf@circ@fixbatteriestrue +} +% +% currents +% +\DeclareOption{europeancurrent}{ + \ctikzset{current = european} +} +\DeclareOption{americancurrent}{ + \ctikzset{current = american} +} +\DeclareOption{europeancurrents}{ + \ctikzset{current = european} +} +\DeclareOption{americancurrents}{ + \ctikzset{current = american} +} +% +% resistors +% +\DeclareOption{americanresistor}{ + \ctikzset{resistor = american} +} +\DeclareOption{europeanresistor}{ + \ctikzset{resistor = european} +} +\DeclareOption{americanresistors}{ + \ctikzset{resistor = american} +} +\DeclareOption{europeanresistors}{ + \ctikzset{resistor = european} +} +% +% inductors +% +\DeclareOption{americaninductor}{ + \ctikzset{inductor = american} +} +\DeclareOption{europeaninductor}{ + \ctikzset{inductor = european} +} +\DeclareOption{cuteinductor}{ + \ctikzset{inductor = cute} +} +\DeclareOption{americaninductors}{ + \ctikzset{inductor = american} +} +\DeclareOption{europeaninductors}{ + \ctikzset{inductor = european} +} +\DeclareOption{cuteinductors}{ + \ctikzset{inductor = cute} +} +% +% logic ports +% +\DeclareOption{americanport}{ + \ctikzset{logic ports = american} +} +\DeclareOption{europeanport}{ + \ctikzset{logic ports = european} +} +\DeclareOption{americanports}{ + \ctikzset{logic ports = american} +} +\DeclareOption{europeanports}{ + \ctikzset{logic ports = european} +} +% +% surge arresters (really?) +% +\DeclareOption{americangfsurgearrester}{ + \ctikzset{gas filled surge arrester choice = american} +} +\DeclareOption{europeangfsurgearrester}{ + \ctikzset{gas filled surge arrester choice = european} +} +% +% diodes +% +\DeclareOption{fulldiodes}{ + \ctikzset{diode = full} +} +\DeclareOption{emptydiodes}{ + \ctikzset{diode = empty} +} +\DeclareOption{strokediodes}{ + \ctikzset{diode = stroke} +} +\DeclareOption{fulldiode}{ + \ctikzset{diode = full} +} +\DeclareOption{emptydiode}{ + \ctikzset{diode = empty} +} +\DeclareOption{strokediode}{ + \ctikzset{diode = stroke} +} +% +% MOSes and FETs +% +\DeclareOption{arrowmos}{ + \pgf@circuit@mos@arrowstrue +} +\DeclareOption{noarrowmos}{ + \pgf@circuit@mos@arrowsfalse +} +\DeclareOption{fetbodydiode}{ + \pgf@circuit@fet@bodydiodetrue +} +\DeclareOption{nofetbodydiode}{ + \pgf@circuit@fet@bodydiodefalse +} +\DeclareOption{fetsolderdot}{ + \pgf@circuit@fet@solderdottrue +} +\DeclareOption{nofetsolderdot}{ + \pgf@circuit@fet@solderdotfalse +} +\DeclareOption{emptypmoscircle}{ + \pgf@circuit@pmos@emptycircletrue +} +\DeclareOption{lazymos}{ + \ctikzset{tripoles/nmos/width=.5} + \ctikzset{tripoles/nmos/gate height=.35} + \ctikzset{tripoles/nmos/base height=.35} + \ctikzset{tripoles/nmos/height/.initial=1.2} + \ctikzset{tripoles/nmos/base width=.5} + \ctikzset{tripoles/nmos/gate width=.65} + \ctikzset{tripoles/pmos/width=.5} + \ctikzset{tripoles/pmos/gate height=.35} + \ctikzset{tripoles/pmos/base height=.35} + \ctikzset{tripoles/pmos/height/.initial=1.2} + \ctikzset{tripoles/pmos/base width=.5} + \ctikzset{tripoles/pmos/gate width=.65} + \pgf@circuit@pmos@emptycircletrue +} +% +% BJTs labels +% +\DeclareOption{legacytransistorstext}{ + \pgf@circuit@transisors@fixlabelsfalse +} +\DeclareOption{nolegacytransistorstext}{ + \pgf@circuit@transisors@fixlabelstrue +} +\DeclareOption{centertransistorstext}{ + \pgf@circuit@transisors@fixlabelstrue +} +% +% labels +% +\DeclareOption{straightlabels}{ + \ctikzset{label/align = straight} +} +\DeclareOption{rotatelabels}{ + \ctikzset{label/align = rotate} +} +\DeclareOption{smartlabels}{ + \ctikzset{label/align = smart} +} +% +% Several options (better use styles) +% +\DeclareOption{betterproportions}{ + \ctikzset{monopoles/ground/width/.initial=.15} + \ctikzset{bipoles/resistor/height/.initial=.23} + \ctikzset{bipoles/resistor/width/.initial=.6} + \ctikzset{bipoles/capacitor/height/.initial=.4} + \ctikzset{bipoles/capacitor/width/.initial=.1} + \ctikzset{bipoles/potentiometer/height/.initial=.6} + \ctikzset{bipoles/potentiometer/height 2/.initial=.23} + \ctikzset{bipoles/potentiometer/width/.initial=.6} + \ctikzset{bipoles/photoresistor/height/.initial=.6} + \ctikzset{bipoles/photoresistor/height 2/.initial=.23} + \ctikzset{bipoles/photoresistor/width/.initial=.6} + \ctikzset{bipoles/thermistor/main/.initial=.7} + \ctikzset{bipoles/thermistor/height/.initial=.328}%.23/.7 + \ctikzset{bipoles/thermistor/width/.initial=.6} + \ctikzset{bipoles/thermistorntc/width/.initial=.6} + \ctikzset{bipoles/thermistorntc/main/.initial=.7} + \ctikzset{bipoles/thermistorntc/height/.initial=.328}%.23/.7 + \ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.23/.7 + \ctikzset{bipoles/thermistorptc/width/.initial=.6} + \ctikzset{bipoles/thermistorptc/main/.initial=.7} + \ctikzset{bipoles/thermistorptc/height/.initial=.328}%.23/.7 + \ctikzset{bipoles/varistor/main/.initial=.7} + \ctikzset{bipoles/varistor/height/.initial=.328}%.23/.7 + \ctikzset{bipoles/varistor/width/.initial=.6} + \ctikzset{bipoles/vresistor/height/.initial=.45} + \ctikzset{bipoles/vresistor/width/.initial=.6} + \ctikzset{bipoles/generic/height/.initial=.23} + \ctikzset{bipoles/generic/width/.initial=.6} + \ctikzset{bipoles/generic potentiometer/height/.initial=.6} + \ctikzset{bipoles/generic potentiometer/height 2/.initial=.23} + \ctikzset{bipoles/generic potentiometer/width/.initial=.6} + \ctikzset{bipoles/ageneric/height/.initial=.23} + \ctikzset{bipoles/ageneric/width/.initial=.6} + \ctikzset{bipoles/memristor/height/.initial=.23} + \ctikzset{bipoles/memristor/wave height/.initial=.375} + \ctikzset{bipoles/memristor/width/.initial=.60} + \ctikzset{bipoles/tgeneric/height/.initial=.525} + \ctikzset{bipoles/tgeneric/width/.initial=.6} + \ctikzset{bipoles/tfullgeneric/height/.initial=.525} + \ctikzset{bipoles/tfullgeneric/width/.initial=.60} + \ctikzset{bipoles/fullgeneric/height/.initial=.23} + \ctikzset{bipoles/fullgeneric/width/.initial=.6} + \ctikzset{bipoles/diode/height/.initial=.3} + \ctikzset{bipoles/diode/width/.initial=.25} + \ctikzset{bipoles/bidirectionaldiode/height/.initial=.66} + \ctikzset{bipoles/bidirectionaldiode/width/.initial=.6} + \ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3} + \ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3} + \ctikzset{tripoles/thyristor/height/.initial=.66} + \ctikzset{tripoles/thyristor/height 2/.initial=.3} + \ctikzset{tripoles/thyristor/width/.initial=.6} + \ctikzset{tripoles/thyristor/diode height/.initial=.3} + \ctikzset{tripoles/thyristor/diode width left/.initial=.4} + \ctikzset{tripoles/thyristor/diode width right/.initial=.3} + \ctikzset{tripoles/triac/height/.initial=.66} + \ctikzset{tripoles/triac/width/.initial=.6} + \ctikzset{tripoles/triac/diode width left/.initial=.3} + \ctikzset{tripoles/triac/diode width right/.initial=.3} +} +% This is a nice hack that prints all the shapes declared +% by the package. Very useful for coverage testing and debugging. +% +% \let\origpgfdeclareshape=\pgfdeclareshape +% \def\pgfdeclareshape#1{% +% \typeout{SHAPE:\space"#1"}% +% \origpgfdeclareshape{#1} +% } +% +% +%%%%%%%%% +%%%%%%%%%%% Springe nach tex/pgfcirc.defines +%%%---------- open: tex/pgfcirc.defines.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. +% +% This file has folding marks for vim (See last line). +% +%% Key managements%<<<1 + +\long\def\pgf@circ@comment#1{} + +\def\circuitikzbasekey{/tikz/circuitikz} + +\pgfkeys{\circuitikzbasekey/.is family} + +\def\circuitikzset#1{\pgfkeys{\circuitikzbasekey,#1}} +\let\ctikzset\circuitikzset +\def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}} +\def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}} + +\pgfkeys{\circuitikzbasekey/.search also={/tikz}} +%%>>> + +%% Temporary Counters and dimensions%<<<1 +%% Temporary Counters +\newcount\pgf@circ@count@a +\newcount\pgf@circ@count@b +\newcount\pgf@circ@count@c +%%%%%%%%%%%% +%% Dimensions +% coordinate +\newdimen\pgf@circ@res@up +\newdimen\pgf@circ@res@down +\newdimen\pgf@circ@res@zero +\newdimen\pgf@circ@res@left +\newdimen\pgf@circ@res@right +\newdimen\pgf@circ@res@other +\newdimen\pgf@circ@res@step +\newdimen\pgf@circ@res@temp +% Base len for all circuitikz +\newdimen\pgf@circ@Rlen +% scaled length for internal use in scalable shapes +\newdimen\pgf@circ@scaled@Rlen +\ctikzset{bipoles/length/.code={\pgf@circ@Rlen = #1\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}} +\pgf@circ@Rlen = 1.4cm +% by default scale is 1.0 +\pgf@circ@scaled@Rlen=\pgf@circ@Rlen +% inital thickness +\newdimen \pgfstartlinewidth +%%>>> + +% arrow tips, ported over old arrows library (deprecated)%<<<1 +% see https://tex.stackexchange.com/questions/234084/latex-arrow-tip-with-arrows-meta-library +% this was the original definition of latex' tips, renamed to avoid clashes +% +\pgfarrowsdeclare{latexslim}{latexslim} +{ + \pgfutil@tempdima=0.28pt% + \advance\pgfutil@tempdima by.3\pgflinewidth% + \pgfarrowsleftextend{+-4\pgfutil@tempdima} + \pgfarrowsrightextend{+6\pgfutil@tempdima} +} +{ + \pgfutil@tempdima=0.28pt% + \advance\pgfutil@tempdima by.3\pgflinewidth% + \pgfpathmoveto{\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}} + \pgfpathcurveto + {\pgfqpoint{3.5\pgfutil@tempdima}{.5\pgfutil@tempdima}} + {\pgfqpoint{-1\pgfutil@tempdima}{1.5\pgfutil@tempdima}} + {\pgfqpoint{-4\pgfutil@tempdima}{3.75\pgfutil@tempdima}} + \pgfpathcurveto + {\pgfqpoint{-1.5\pgfutil@tempdima}{1\pgfutil@tempdima}} + {\pgfqpoint{-1.5\pgfutil@tempdima}{-1\pgfutil@tempdima}} + {\pgfqpoint{-4\pgfutil@tempdima}{-3.75\pgfutil@tempdima}} + \pgfpathcurveto + {\pgfqpoint{-1\pgfutil@tempdima}{-1.5\pgfutil@tempdima}} + {\pgfqpoint{3.5\pgfutil@tempdima}{-.5\pgfutil@tempdima}} + {\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}} + \pgfpathclose + \pgfusepathqfill +} + +\pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim} +%%>>> + +%% Macros to do things depending on the class%<<<1 + +\def\pgf@circ@setifdefinedfill#1#2{% + % if \ctikzclass is defined and \ctikzclass/fill is defined and is not none: + % set the fill color and execute \pgfusepath{#1}, else execute \pgfusepath{#2} + \ifdefined\ctikzclass + \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/fill}% + {% yes, it's defined + \edef\@@tmp{\ctikzvalof{\ctikzclass/fill}}\edef\@@none{none}% + \ifx\@@tmp\@@none % but it's none + \pgfusepath{#2}% + \else + \pgfsetfillcolor{\@@tmp}% + \pgfusepath{#1}% + \fi + }{% the class is defined but the fill key not; use #2 + \pgfusepath{#2}% + } + \else + \pgfusepath{#2}% + \fi +} + +%% Macro to fill or draw + +\def\pgf@circ@draworfill{% + \ifx\tikz@fillcolor\pgfutil@empty + \pgf@circ@setifdefinedfill{draw,fill}{draw} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \pgfusepath{draw, fill} + \fi +} + +\def\pgf@circ@draworfillandclip{% + \ifx\tikz@fillcolor\pgfutil@empty + \pgf@circ@setifdefinedfill{draw, clip, fill}{draw, clip} + \pgfusepath{draw, clip} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \pgfusepath{draw, clip, fill} + \fi +} + +\def\pgf@circ@maybefill{% + \ifx\tikz@fillcolor\pgfutil@empty + \pgf@circ@setifdefinedfill{fill}{discard} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \pgfusepath{fill} + \fi +} + +%% Macros for setting linewidth +% #1 is the legacy class (bipoles, tripoles) etc +% #2 is the reference linewidth +\def\pgf@circ@setlinewidth#1#2{% + \ifdefined\ctikzclass + \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/thickness}% + {% yes, it's defined + \edef\@@tmp{\ctikzvalof{\ctikzclass/thickness}}\edef\@@none{none}% + \ifx\@@tmp\@@none % but it's none + \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% passthrough legacy class + \else + \pgfsetlinewidth{\@@tmp #2}% + \fi + }{ % key not defined, do the legacy thing + \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% + }% Ok, do nothing + \else % no class + \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% + \fi +} +% use \pgf@circ@setlinewidth{none}{\pgflinewidth} if there is no legacy case +\ctikzset{none/thickness/.initial=1.0} % do not touch +%%>>> + +%% font changes compatible with plain/LaTeX/ConTeXt%<<<1 +%% thanks to Henri Menke https://github.com/circuitikz/circuitikz/issues/285#issuecomment-537224605 + +\ifpgfutil@format@is@latex + \long\def\pgf@circ@font@tiny{\tiny} + \long\def\pgf@circ@font@small{\small} + \long\def\pgf@circ@font@bold{\textbf} + \long\def\pgf@circ@font@boldmath{\boldmath} + \long\def\pgf@circ@font@sixbm{\fontsize{6}{7}\selectfont\boldmath} + \long\def\pgf@circ@font@tenbm{\fontsize{10}{12}\selectfont\boldmath} + \long\def\pgf@circ@font@twelve{\fontsize{12}{14}\selectfont} +\else\ifpgfutil@format@is@plain + \long\def\pgf@circ@font@tiny{\fiverm} + \long\def\pgf@circ@font@small{\sevenrm} + \long\def\pgf@circ@font@bold#1{{\bf#1}} + \long\def\pgf@circ@font@boldmath{\bf} % to be tested + \long\def\pgf@circ@font@sixbm{\sevenrm\bf} % + \long\def\pgf@circ@font@tenbm{\tenrm\bf} % + \long\def\pgf@circ@font@twelve{\twelverm} % +\else\ifpgfutil@format@is@context + \long\def\pgf@circ@font@tiny{\tfxx} + \long\def\pgf@circ@font@small{\tfx} + \long\def\pgf@circ@font@bold{\bold} + \long\def\pgf@circ@font@boldmath{\bold} % to be tested + \long\def\pgf@circ@font@sixbm{\tfx\bold} % + \long\def\pgf@circ@font@tenbm{\normal\bold}% + \long\def\pgf@circ@font@twelve{\tfa} % +\fi\fi\fi + + +% +% Thanks to Phelype Oleinik https://tex.stackexchange.com/a/520806/38080 +% +% this is needed to avoid problems with \ConTeXt +\ifcsname normalunexpanded\endcsname + \let\pgfcircutil@unexpanded\normalunexpanded +\else + \let\pgfcircutil@unexpanded\unexpanded +\fi +% minimally expand a pgfkey to check if it's {}/undefined or filled. +\def\unexpandedvalueof#1{% + \pgfcircutil@unexpanded\expandafter\expandafter + \expandafter\pgf@circ@valueof@chk\pgfkeysvalueof{#1}} +\def\pgf@circ@valueof@chk#1{% + \ifx\relax#1% + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {{}}% #1 is \relax, so consider empty + {\expandafter{#1}}% otherwise, leave the key after one more expansion +}% +%>>> + +% text position in some component.%<<<1 +% (added with ieeestd logic ports. Maybe to be extended to other components, +% like amplifiers) +% +\newif\ifpgf@circ@center@text\pgf@circ@center@texttrue +\tikzset{component text/.is choice}% +\tikzset{component text/center/.code={\pgf@circ@center@texttrue}}% +\tikzset{component text/left/.code={\pgf@circ@center@textfalse}}% +\ctikzset{component text/.is choice}% +\ctikzset{component text/center/.code={\pgf@circ@center@texttrue}}% +\ctikzset{component text/left/.code={\pgf@circ@center@textfalse}}% +\ctikzset{left text distance/.initial=0.3em}% +%>>> + +% voltage direction options%<<<1 + +\newif\ifpgf@circ@siunitx +\newif\ifpgf@circuit@compat +\newif\ifpgf@circ@oldvoltagedirection % default false +\newif\ifpgf@circ@explicitvdir +\newif\ifpgf@circ@fixbatteries + +\ctikzset{voltage dir/.is choice} +\ctikzset{voltage dir/old/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriesfalse}} +\ctikzset{voltage dir/noold/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriesfalse}} +\ctikzset{voltage dir/RP/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriestrue}} +\ctikzset{voltage dir/EF/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriestrue}} +\tikzset{voltage dir/.style={circuitikz/voltage dir=#1}}% +%>>> + +% bipole definitions for path component and text decorations%%<<<1 +% +% Option "t=*" for nodes +\pgfkeys{/tikz/t/.add code={}{\ctikzset{text=#1}}} +% +\ctikzset{bipole/.is family} +\ctikzset{bipole/kind/.initial=} +\ctikzset{bipole/name/.initial=} +\newif\ifpgf@circuit@bipole@isvoltage +\ctikzset{bipole/is voltage/.is if=pgf@circuit@bipole@isvoltage} +\newif\ifpgf@circuit@bipole@voltageoutsideofsymbol +\ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf@circuit@bipole@voltageoutsideofsymbol} +\newif\ifpgf@circuit@bipole@strokedsymbol +\ctikzset{bipole/is strokedsymbol/.is if=pgf@circuit@bipole@strokedsymbol} +\newif\ifpgf@circuit@bipole@iscurrent +\ctikzset{bipole/is current/.is if=pgf@circuit@bipole@iscurrent} + +\ctikzset{bipole/voltage/.is family} +\newif\ifpgf@circuit@bipole@voltage@backward +\ctikzset{bipole/voltage/direction/.is choice} +\ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}} +\ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}} +\newif\ifpgf@circuit@bipole@voltage@below +\ctikzset{bipole/voltage/position/.is choice} +\ctikzset{bipole/voltage/position/above/.code={\pgf@circuit@bipole@voltage@belowfalse}} +\ctikzset{bipole/voltage/position/below/.code={\pgf@circuit@bipole@voltage@belowtrue}} + +\ctikzset{bipole/voltage/label/unit/.initial=} +\ctikzset{bipole/voltage/label/name/.initial=} + +\ctikzset{bipole/current/.is family} +\newif\ifpgf@circuit@bipole@current@backward +\ctikzset{bipole/current/direction/.is choice} +\ctikzset{bipole/current/direction/forward/.code={\pgf@circuit@bipole@current@backwardfalse}} +\ctikzset{bipole/current/direction/backward/.code={\pgf@circuit@bipole@current@backwardtrue}} +\newif\ifpgf@circuit@bipole@current@before +\ctikzset{bipole/current/x position/.is choice} +\ctikzset{bipole/current/x position/after/.code={\pgf@circuit@bipole@current@beforefalse}} +\ctikzset{bipole/current/x position/before/.code={\pgf@circuit@bipole@current@beforetrue}} +\newif\ifpgf@circuit@bipole@current@below +\ctikzset{bipole/current/y position/.is choice} +\ctikzset{bipole/current/y position/above/.code={\pgf@circuit@bipole@current@belowfalse}} +\ctikzset{bipole/current/y position/below/.code={\pgf@circuit@bipole@current@belowtrue}} +\ctikzset{bipole/current/label/unit/.initial=} +\ctikzset{bipole/current/label/name/.initial=} + +\ctikzset{bipole/flow/.is family} +\newif\ifpgf@circuit@bipole@flow@backward +\ctikzset{bipole/flow/direction/.is choice} +\ctikzset{bipole/flow/direction/forward/.code={\pgf@circuit@bipole@flow@backwardfalse}} +\ctikzset{bipole/flow/direction/backward/.code={\pgf@circuit@bipole@flow@backwardtrue}} +\newif\ifpgf@circuit@bipole@flow@before +\ctikzset{bipole/flow/x position/.is choice} +\ctikzset{bipole/flow/x position/after/.code={\pgf@circuit@bipole@flow@beforefalse}} +\ctikzset{bipole/flow/x position/before/.code={\pgf@circuit@bipole@flow@beforetrue}} +\newif\ifpgf@circuit@bipole@flow@below +\ctikzset{bipole/flow/y position/.is choice} +\ctikzset{bipole/flow/y position/above/.code={\pgf@circuit@bipole@flow@belowfalse}} +\ctikzset{bipole/flow/y position/below/.code={\pgf@circuit@bipole@flow@belowtrue}} +\ctikzset{bipole/flow/label/unit/.initial=} +\ctikzset{bipole/flow/label/name/.initial=} +\ctikzset{flow/distance/.initial = .5} +\ctikzset{flow/offset/.initial = .2}%distance between flow-arrow and conductor + +\ctikzset{bipole/label/.is family} +\ctikzset{bipole/label/position/.initial=90} +\ctikzset{bipole/label/unit/.initial=} +\ctikzset{bipole/label/name/.initial=} +\ctikzset{bipole/annotation/.is family} +\ctikzset{bipole/annotation/position/.initial=-90} +\ctikzset{bipole/annotation/unit/.initial=} +\ctikzset{bipole/annotation/name/.initial=} + +\newif\ifpgf@circ@siunitx +\newif\ifpgf@circ@siunitx@res + +\ctikzset{label/align/.is choice} +\ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}} +\ctikzset{label/align/rotate/.code={\ctikzsetvalof{label/align}{rotate}}} +\ctikzset{label/align/smart/.code={\ctikzsetvalof{label/align}{smart}}} +%%>>> + +% traditional styles %<<<1 +% +\ctikzset{thickness/.initial=2} +\ctikzset{color/.initial=black} +\pgfkeys{/tikz/color/.add code={}{\ctikzset{color={#1}}}} +\ctikzset{bipoles/border margin/.initial=1.1} +\ctikzset{bipoles/thickness/.initial=2} +\ctikzset{tripoles/thickness/.initial=2} +\ctikzset{quadpoles/thickness/.initial=2} +\ctikzset{nodes width/.initial=.04} +%%>>> + +% Styles definitions and macros%<<<1 + +%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% main style definitions +%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% load a style file: search ctikzstyle-NAME.tex in path +\def\ctikzloadstyle#1{% + \pgfutil@InputIfFileExists{ctikzstyle-#1}{}{% + \tikzerror{I did not find the circuitikz style #1}}% +} + +% load and enact a style +\def\ctikzsetstyle#1{% + \ctikzloadstyle{#1}% + \tikzset{#1 circuit style}% +} + +% global style parameters +\ctikzset{default/scale/.initial=1.0} % do not touch +\ctikzset{default/fill/.initial=none} % do not touch +\ctikzset{default/thickness/.initial=none} % do not touch +% default is use as the generic default style for bipoles + +% mostly bipoles: + +\ctikzset{resistors/scale/.initial=1.0} +\ctikzset{resistors/fill/.initial=none} +\ctikzset{resistors/thickness/.initial=none} + +\ctikzset{capacitors/scale/.initial=1.0} +\ctikzset{capacitors/fill/.initial=none} +\ctikzset{capacitors/thickness/.initial=none} + +\ctikzset{inductors/scale/.initial=1.0} +\ctikzset{inductors/fill/.initial=none} +\ctikzset{inductors/thickness/.initial=none} + +\ctikzset{diodes/scale/.initial=1.0} +\ctikzset{diodes/fill/.initial=none} +\ctikzset{diodes/thickness/.initial=none} + +\ctikzset{batteries/scale/.initial=1.0} +\ctikzset{batteries/fill/.initial=none} +\ctikzset{batteries/thickness/.initial=none} + +\ctikzset{sources/scale/.initial=1.0} +\ctikzset{sources/fill/.initial=none} +\ctikzset{sources/thickness/.initial=none} + +\ctikzset{csources/scale/.initial=1.0} +\ctikzset{csources/fill/.initial=none} +\ctikzset{csources/thickness/.initial=none} + +\ctikzset{instruments/scale/.initial=1.0} +\ctikzset{instruments/fill/.initial=none} +\ctikzset{instruments/thickness/.initial=none} + +\ctikzset{mechanicals/scale/.initial=1.0} +\ctikzset{mechanicals/fill/.initial=none} +\ctikzset{mechanicals/thickness/.initial=none} + +\ctikzset{misc/scale/.initial=1.0} +\ctikzset{misc/fill/.initial=none} +\ctikzset{misc/thickness/.initial=none} + +\ctikzset{blocks/scale/.initial=1.0} +\ctikzset{blocks/fill/.initial=none} +\ctikzset{blocks/thickness/.initial=none} + +% mostly nodes + +\ctikzset{grounds/scale/.initial=1.0} +\ctikzset{grounds/fill/.initial=none} +\ctikzset{grounds/thickness/.initial=none} + +\ctikzset{power supplies/scale/.initial=1.0} +\ctikzset{power supplies/fill/.initial=none} +\ctikzset{power supplies/thickness/.initial=none} + +\ctikzset{transistors/scale/.initial=1.0} +\ctikzset{transistors/fill/.initial=none} +\ctikzset{transistors/thickness/.initial=none} + +\ctikzset{tubes/scale/.initial=1.0} +\ctikzset{tubes/fill/.initial=none} +\ctikzset{tubes/thickness/.initial=none} + +\ctikzset{RF/scale/.initial=1.0} +\ctikzset{RF/fill/.initial=none} +\ctikzset{RF/thickness/.initial=none} + +\ctikzset{electromechanicals/scale/.initial=1.0} +\ctikzset{electromechanicals/fill/.initial=none} +\ctikzset{electromechanicals/thickness/.initial=none} + +% transformers go with inductors +\ctikzset{amplifiers/scale/.initial=1.0} +\ctikzset{amplifiers/fill/.initial=none} +\ctikzset{amplifiers/thickness/.initial=none} + +\ctikzset{switches/scale/.initial=1.0} +\ctikzset{switches/fill/.initial=none} +\ctikzset{switches/thickness/.initial=none} + +\ctikzset{logic ports/scale/.initial=1.0} +\ctikzset{logic ports/fill/.initial=none} +\ctikzset{logic ports/thickness/.initial=none} + +\ctikzset{flipflops/scale/.initial=1.0} +\ctikzset{flipflops/fill/.initial=none} +\ctikzset{flipflops/thickness/.initial=none} + +\ctikzset{muxdemuxes/scale/.initial=1.0} +\ctikzset{muxdemuxes/fill/.initial=none} +\ctikzset{muxdemuxes/thickness/.initial=none} + +\ctikzset{chips/scale/.initial=1.0} +\ctikzset{chips/fill/.initial=none} +\ctikzset{chips/thickness/.initial=none} + +\ctikzset{displays/scale/.initial=1.0} +\ctikzset{displays/fill/.initial=none} +\ctikzset{displays/thickness/.initial=none} +% +% general styles +% +\tikzset{european/.style = {european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set}} +\tikzset{american/.style = {american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set}} +\tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}} +%%>>> + +% grounds and power supplies%<<<1 + +\ctikzset{monopoles/.is family} +\ctikzset{monopoles/ground/width/.initial=.25} +\ctikzset{monopoles/ground/connectionthickness/.initial=1} +\ctikzset{monopoles/ground/thickness/.initial=2} +\ctikzset{monopoles/rground/thickness/.initial=2} +\ctikzset{monopoles/tground/thickness/.initial=3} +\ctikzset{monopoles/vcc/width/.initial=.2} +\ctikzset{monopoles/vcc/arrow/.initial=legacy} +\ctikzset{monopoles/vee/arrow/.initial=legacy} +\ctikzset{monopoles/match/width/.initial=.4} +\ctikzset{monopoles/chassis/width/.initial=.25} +\ctikzset{monopoles/alternative chassis/width/.initial=.25} +\ctikzset{monopoles/equipotentiality/width/.initial=.25} +\ctikzset{monopoles/antenna/width/.initial=.25} +\ctikzset{monopoles/antenna/label/xanchor/.initial=.4} +\ctikzset{monopoles/antenna/label/yanchor/.initial=.75} +\ctikzset{monopoles/txantenna/label/xanchor/.initial=.4} +\ctikzset{monopoles/txantenna/label/yanchor/.initial=.75} +\ctikzset{monopoles/txantenna/width/.initial=.25} +\ctikzset{monopoles/rxantenna/label/xanchor/.initial=.4} +\ctikzset{monopoles/rxantenna/label/yanchor/.initial=.75} +\ctikzset{monopoles/rxantenna/width/.initial=.25} +\ctikzset{monopoles/bareantenna/width/.initial=.25} +\ctikzset{monopoles/bareantenna/label/xanchor/.initial=1} +\ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5} +\ctikzset{monopoles/waves/width/.initial=0.5}% +%>>> + +% microstrips %<<<1 +\ctikzset{bipoles/mstline/height/.initial=0.3} +\ctikzset{bipoles/mstline/width/.initial=1.2} +\pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}} +\ctikzset{monopoles/msport/width/.initial=.5} +\ctikzset{monopoles/msrstub/height/.initial=1.0} +\ctikzset{monopoles/msrstub/width/.initial=0.6}% +%>>> + +% microphone and loudspeaker%<<<1 +\ctikzset{bipoles/loudspeaker/height/.initial=.8} +\ctikzset{bipoles/loudspeaker/depth/.initial=.3} +\ctikzset{bipoles/loudspeaker/width/.initial=.8} +\ctikzset{bipoles/mic/height/.initial=1.2} +\ctikzset{bipoles/mic/depth/.initial=.1} +\ctikzset{bipoles/mic/width/.initial=.8}% +%>>> + +% resistors%<<<1 +% Zig Zag resistors +\ctikzset{resistors/zigs/.initial=3} +\ctikzset{resistors/width/.code={% + \ctikzset{bipoles/resistor/width=#1}% + \ctikzset{bipoles/vresistor/width=#1}% + \ctikzset{bipoles/potentiometer/width=#1}% + \ctikzset{bipoles/resistivesens/width=#1}% + \ctikzset{bipoles/photoresistor/width=#1}% + \ctikzset{bipoles/thermistor/width=#1}% + \ctikzset{bipoles/thermistorntc/width=#1}% + \ctikzset{bipoles/thermistorptc/width=#1}% + \ctikzset{bipoles/varistor/width=#1}% + \ctikzset{bipoles/generic/width=#1}% + \ctikzset{bipoles/generic potentiometer/width=#1}% + \ctikzset{bipoles/ageneric/width=#1}% + \ctikzset{bipoles/tgeneric/width=#1}% +}} +\ctikzset{wiper pos/.code={% + \ctikzset{bipoles/potentiometer/wiper pos=#1}% + \ctikzset{bipoles/generic potentiometer/wiper pos=#1}% +}} +% zigzag resistor +\ctikzset{bipoles/resistor/height/.initial=.3} +\ctikzset{bipoles/resistor/width/.initial=.8} +\ctikzset{bipoles/potentiometer/height/.initial=.8} +\ctikzset{bipoles/potentiometer/height 2/.initial=.3} +\ctikzset{bipoles/potentiometer/width/.initial=.8} +\ctikzset{bipoles/potentiometer/wiper pos/.initial=.5} +\ctikzset{bipoles/vresistor/height/.initial=.6} +\ctikzset{bipoles/vresistor/width/.initial=.8} +\ctikzset{bipoles/resistivesens/height/.initial=.6} +\ctikzset{bipoles/resistivesens/width/.initial=.8} +% square resistors +\ctikzset{bipoles/photoresistor/height/.initial=.6} +\ctikzset{bipoles/photoresistor/height 2/.initial=.3} +\ctikzset{bipoles/photoresistor/width/.initial=.8} +\ctikzset{bipoles/thermistor/main/.initial=.7} +\ctikzset{bipoles/thermistor/height/.initial=.428}%.3/.7 +\ctikzset{bipoles/thermistorntc/width/.initial=.8} +\ctikzset{bipoles/thermistorntc/main/.initial=.7} +\ctikzset{bipoles/thermistorntc/height/.initial=.428}%.3/.7 +\ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.3/.7 +\ctikzset{bipoles/thermistorptc/width/.initial=.8} +\ctikzset{bipoles/thermistorptc/main/.initial=.7} +\ctikzset{bipoles/thermistorptc/height/.initial=.428}%.3/.7 +\ctikzset{bipoles/thermistorptc/height 2/.initial=.75}%.3/.7 +\ctikzset{bipoles/thermistor/width/.initial=.8} +\ctikzset{bipoles/varistor/main/.initial=.7} +\ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7 +\ctikzset{bipoles/varistor/width/.initial=.8} +\ctikzset{bipoles/generic/height/.initial=.30} +\ctikzset{bipoles/generic/width/.initial=.80} +\ctikzset{bipoles/generic potentiometer/height/.initial=.80} +\ctikzset{bipoles/generic potentiometer/height 2/.initial=.30} +\ctikzset{bipoles/generic potentiometer/width/.initial=.80} +\ctikzset{bipoles/generic potentiometer/wiper pos/.initial=.5} +\ctikzset{bipoles/ageneric/height/.initial=.30} +\ctikzset{bipoles/tgeneric/height/.initial=.70} +\ctikzset{bipoles/tgeneric/width/.initial=.80} +\ctikzset{bipoles/ageneric/width/.initial=.80} +\ctikzset{bipoles/memristor/height/.initial=.30} +\ctikzset{bipoles/memristor/wave height/.initial=.5} +\ctikzset{bipoles/memristor/width/.initial=.80} + +\newif\ifpgf@circuit@europeanresistor +\ctikzset{resistor/.is choice} +\ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse } +\ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue } +\tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}} +\tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}} +%%>>> + +%% Capacitors%<<<1 +\ctikzset{bipoles/capacitor/height/.initial=.6} +\ctikzset{bipoles/capacitor/width/.initial=.2} +\ctikzset{bipoles/ecapacitor/height/.initial=.5} +\ctikzset{bipoles/ecapacitor/width/.initial=.2} +\ctikzset{bipoles/ecapacitor/font/.initial=\pgf@circ@font@sixbm} +%%% pcapacitor is deprecated +\ctikzset{bipoles/pcapacitor/height/.initial=.6} +\ctikzset{bipoles/pcapacitor/width/.initial=.2} +\ctikzset{bipoles/pcapacitor/bend width/.initial=1.1} +\ctikzset{bipoles/ccapacitor/height/.initial=.6} +\ctikzset{bipoles/ccapacitor/width/.initial=.12} +\ctikzset{bipoles/ccapacitor/bend width/.initial=1.1} +\ctikzset{bipoles/vcapacitor/height/.initial=.6} +\ctikzset{bipoles/vcapacitor/width/.initial=.5} +\ctikzset{bipoles/vcapacitor/capacitor width/.initial=.4} +\ctikzset{bipoles/piezoelectric/height/.initial=.7} +\ctikzset{bipoles/piezoelectric/width/.initial=.5}% +%>>> + +% Inductors%<<<1 +\ctikzset{inductors/coils/.code={% + \ctikzset{bipoles/cuteinductor/coils=#1}% + \ctikzset{bipoles/cutechoke/coils=#1}% + \ctikzset{bipoles/americaninductor/coils=#1}% + \ctikzset{bipoles/vcuteinductor/coils=#1}% + \ctikzset{bipoles/vamericaninductor/coils=#1}% +}} +\ctikzset{inductors/width/.code={% + \ctikzset{bipoles/cuteinductor/width=#1}% + \ctikzset{bipoles/cutechoke/width=#1}% + \ctikzset{bipoles/americaninductor/width=#1}% + \ctikzset{bipoles/vcuteinductor/width=#1}% + \ctikzset{bipoles/vamericaninductor/width=#1}% + \ctikzset{bipoles/fullgeneric/width=#1}% + \ctikzset{bipoles/tfullgeneric/width=#1}% +}} +\ctikzset{bipoles/cuteinductor/height/.initial=.3} +\ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15} +\ctikzset{bipoles/cuteinductor/width/.initial=.6} +\ctikzset{bipoles/cuteinductor/coils/.initial=5} +\ctikzset{bipoles/cuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil +%% Cute choke settings +\ctikzset{bipoles/cutechoke/height/.initial=.3} +\ctikzset{bipoles/cutechoke/lower coil height/.initial=.15} +\ctikzset{bipoles/cutechoke/width/.initial=.6} +\ctikzset{bipoles/cutechoke/coils/.initial=5} +\ctikzset{bipoles/cutechoke/coil aspect/.initial=.5}%percentage of choke width, which is covered by lower coil +\ctikzset{bipoles/cutechoke/cstep/.initial=.3} +\ctikzset{bipoles/cutechoke/cdist/.initial=1.3} +\ctikzset{bipoles/cutechoke/cthick/.initial=1} +\newif\ifpgf@circuit@bipole@twolineschoke +\pgf@circuit@bipole@twolineschokefalse +\pgfkeys{/tikz/onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}} +\ctikzset{onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}} +\pgfkeys{/tikz/twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}} +\ctikzset{twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}} +% +\ctikzset{bipoles/americaninductor/height/.initial=.3} +\ctikzset{bipoles/americaninductor/height 2/.initial=.1} +\ctikzset{bipoles/americaninductor/width/.initial=.8} +\ctikzset{bipoles/americaninductor/coils/.initial=4} +\ctikzset{bipoles/americaninductor/coil height/.initial=.15} +\ctikzset{bipoles/vcuteinductor/height/.initial=.6} +\ctikzset{bipoles/vcuteinductor/lower coil height/.initial=.3} +\ctikzset{bipoles/vcuteinductor/width/.initial=.6} +\ctikzset{bipoles/vcuteinductor/coils/.initial=5} +\ctikzset{bipoles/vcuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil +\ctikzset{bipoles/vamericaninductor/height/.initial=.6} +\ctikzset{bipoles/vamericaninductor/height 2/.initial=.2} +\ctikzset{bipoles/vamericaninductor/width/.initial=.8} +\ctikzset{bipoles/vamericaninductor/coils/.initial=4} +\ctikzset{bipoles/vamericaninductor/coil height/.initial=.15} +\ctikzset{bipoles/tfullgeneric/height/.initial=.70} +\ctikzset{bipoles/tfullgeneric/width/.initial=.80} +\ctikzset{bipoles/fullgeneric/height/.initial=.30} +\ctikzset{bipoles/fullgeneric/width/.initial=.80} +\ctikzset{inductor/.is choice} +\ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}} +\ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}} +\ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}} + +\tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}} +\tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}} +\tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}} +\tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}} +\tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}} + +%%>>> + +% Sources%<<<1 + +\ctikzset{bipoles/esource/height/.initial=.60} +\ctikzset{bipoles/esource/width/.initial=.60} +\ctikzset{bipoles/pvsource/height/.initial=.60} +\ctikzset{bipoles/pvsource/width/.initial=.60} +\ctikzset{bipoles/isource/height/.initial=.60} +\ctikzset{bipoles/isource/width/.initial=.60} +\ctikzset{bipoles/oosource/height/.initial=.60} +\ctikzset{bipoles/oosource/width/.initial=.60} +\ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/dcisource/angle/.initial=80} +\ctikzset{bipoles/dcisource/height/.initial=.60} +\ctikzset{bipoles/dcisource/width/.initial=.60} +\ctikzset{bipoles/dcvsource/height/.initial=.60} +\ctikzset{bipoles/dcvsource/width/.initial=.60} +\ctikzset{bipoles/vsourcetri/height/.initial=.60} +\ctikzset{bipoles/vsourcetri/width/.initial=.60} +\ctikzset{bipoles/isourceam/height/.initial=.60} +\ctikzset{bipoles/isourceam/width/.initial=.60} +\ctikzset{bipoles/vsource/height/.initial=.60} +\ctikzset{bipoles/vsource/width/.initial=.60} +\ctikzset{bipoles/vsourceam/height/.initial=.60} +\ctikzset{bipoles/vsourceam/width/.initial=.60} +\ctikzset{bipoles/vsourceam/margin/.initial=.7} +\ctikzset{bipoles/isourcesin/height/.initial=.60} +\ctikzset{bipoles/isourcesin/width/.initial=.60} +\ctikzset{bipoles/vsourcesin/height/.initial=.60} +\ctikzset{bipoles/vsourcesin/width/.initial=.60} +\ctikzset{bipoles/vsourcesquare/height/.initial=.60} +\ctikzset{bipoles/vsourcesquare/width/.initial=.60} +\ctikzset{bipoles/cisource/height/.initial=.7} +\ctikzset{bipoles/cisource/width/.initial=.7} +\ctikzset{bipoles/cisourceam/height/.initial=.7} +\ctikzset{bipoles/cisourceam/width/.initial=.7} +\ctikzset{bipoles/ecsource/height/.initial=.7} +\ctikzset{bipoles/ecsource/width/.initial=.7} +\ctikzset{bipoles/cvsource/height/.initial=.7} +\ctikzset{bipoles/cvsource/width/.initial=.7} +\ctikzset{bipoles/cvsourceam/height/.initial=.7} +\ctikzset{bipoles/cvsourceam/width/.initial=.7} +\ctikzset{bipoles/cvsourceam/margin/.initial=.7} +\ctikzset{bipoles/cvsourceam/text scale/.initial=1} +\ctikzset{bipoles/cisourcesin/width/.initial=.7} +\ctikzset{bipoles/cvsourcesin/height/.initial=.7} +\ctikzset{bipoles/cvsourcesin/width/.initial=.7} +\ctikzset{bipoles/battery/height/.initial=.6} +\ctikzset{bipoles/battery/width/.initial=.3} +\ctikzset{bipoles/battery1/height/.initial=.6} +\ctikzset{bipoles/battery1/width/.initial=.3} +\ctikzset{bipoles/battery2/height/.initial=.6} +\ctikzset{bipoles/battery2/width/.initial=.3} +% noise sources +\ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50} + +%%>>> + +% "oo" style transformers and power grid diagrams%<<<1 +% % % ootransformer +\ctikzset{bipoles/oosourcetrans/height/.initial=.6} +\ctikzset{bipoles/oosourcetrans/width/.initial=.6} +\ctikzset{bipoles/oosourcetrans/circlesize/.initial=.6}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/oosourcetrans/circleoffset/.initial=.4}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/oosourcetrans/vectorgroupscale/.initial=1} + +% % % oootransformer +\ctikzset{bipoles/ooosource/height/.initial=.6} +\ctikzset{bipoles/ooosource/circlesize/.initial=.55}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/ooosource/circleoffset/.initial=.45}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/ooosource/vectorgroupscale/.initial=1} + +% % % primary windings +\newif\ifpgf@circ@prim@delta +\newif\ifpgf@circ@prim@wye +\newif\ifpgf@circ@prim@zig +\pgfkeys{tikz/prim/.is choice} +\pgfkeys{tikz/prim/delta/.add code={}{\pgf@circ@prim@deltatrue}} +\pgfkeys{tikz/prim/wye/.add code={}{\pgf@circ@prim@wyetrue}} +\pgfkeys{tikz/prim/zig/.add code={}{\pgf@circ@prim@zigtrue}} + +% % % secondary windings +\newif\ifpgf@circ@sec@delta +\newif\ifpgf@circ@sec@wye +\newif\ifpgf@circ@sec@zig +\pgfkeys{tikz/sec/.is choice} +\pgfkeys{tikz/sec/delta/.add code={}{\pgf@circ@sec@deltatrue}} +\pgfkeys{tikz/sec/wye/.add code={}{\pgf@circ@sec@wyetrue}} +\pgfkeys{tikz/sec/zig/.add code={}{\pgf@circ@sec@zigtrue}} + +% % % tertiary windings (ooosource) +\newif\ifpgf@circ@tert@delta +\newif\ifpgf@circ@tert@wye +\newif\ifpgf@circ@tert@zig +\pgfkeys{tikz/tert/.is choice} +\pgfkeys{tikz/tert/delta/.add code={}{\pgf@circ@tert@deltatrue}} +\pgfkeys{tikz/tert/wye/.add code={}{\pgf@circ@tert@wyetrue}} +\pgfkeys{tikz/tert/zig/.add code={}{\pgf@circ@tert@zigtrue}}% +%>>> + +% diodes%<<<1 + +\ctikzset{bipoles/diode/height/.initial=.50} +\ctikzset{bipoles/diode/width/.initial=.40} +\ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1} +\ctikzset{bipoles/bidirectionaldiode/width/.initial=1} +\ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3} +\ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3} +\ctikzset{bipoles/varcap/height/.initial=.50} +\ctikzset{bipoles/varcap/width/.initial=.45} +\ctikzset{tripoles/thyristor/height/.initial=1.10} +\ctikzset{tripoles/thyristor/height 2/.initial=.5} +\ctikzset{tripoles/thyristor/width/.initial=1.0} +\ctikzset{tripoles/thyristor/diode height/.initial=.5} +\ctikzset{tripoles/thyristor/diode width left/.initial=.4} +\ctikzset{tripoles/thyristor/diode width right/.initial=.3} + +\ctikzset{tripoles/triac/height/.initial=1.1} +\ctikzset{tripoles/triac/width/.initial=1} +\ctikzset{tripoles/triac/diode width left/.initial=.3} +\ctikzset{tripoles/triac/diode width right/.initial=.3} +% +% Flipping arrows in LED and photodiodes +% +\newif\ifpgf@led@fliparrows +\newif\ifpgf@pd@fliparrows +\pgf@led@fliparrowsfalse +\pgf@pd@fliparrowsfalse +% +% by default the arrows start (LED) and go (PD) to the anode. +% +\ctikzset{led arrows from anode/.code=\pgf@led@fliparrowsfalse} +\ctikzset{pd arrows to anode/.code=\pgf@pd@fliparrowsfalse} +% +% but they can start form the cathode (LED) or go to it (PD) +% +\ctikzset{led arrows from cathode/.code=\pgf@led@fliparrowstrue} +\ctikzset{pd arrows to cathode/.code=\pgf@pd@fliparrowstrue} + +\newif\ifpgf@circuit@strokediode +\newif\ifpgf@circuit@fulldiode +\pgf@circuit@strokediodefalse +\pgf@circuit@fulldiodefalse + +\ctikzset{diode/.is choice} +\ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default +\ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue } +\ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue} + +\tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}} +\tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}} +\tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}} + +%%>>> + +% switches%<<<1 + +\ctikzset{bipoles/spst/height/.initial=.35} +\ctikzset{bipoles/spst/width/.initial=.35} +\ctikzset{bipoles/spst/depth/.initial=.2} +\ctikzset{bipoles/nos/height/.initial=.3} +\ctikzset{bipoles/nos/width/.initial=.35} +\ctikzset{bipoles/nos/depth/.initial=.2} +\ctikzset{bipoles/ncs/height/.initial=.35} +\ctikzset{bipoles/ncs/width/.initial=.35} +\ctikzset{bipoles/ncs/depth/.initial=.2} +\ctikzset{bipoles/pushbutton/height/.initial=.5} +\ctikzset{bipoles/pushbutton/height 2/.initial=.2} +\ctikzset{bipoles/pushbutton/width/.initial=.50} +%%% reed switch +\ctikzset{bipoles/reed/height/.initial=.4} +\ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos +\ctikzset{bipoles/reed/depth/.initial=.4} +%% Cute switches +\ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}} +\ctikzset{bipoles/cuteswitch/height/.initial=.6} +\ctikzset{bipoles/cuteswitch/height 2/.initial=.2} +\ctikzset{bipoles/cuteswitch/width/.initial=.50} +\ctikzset{bipoles/cuteswitch/thickness/.initial=1} + +\ctikzset{tripoles/spdt/width/.initial=.85} +\ctikzset{tripoles/spdt/height/.initial=.45} +\ctikzset{tripoles/spdt/margin/.initial=.45} + +\ctikzset{tripoles/toggleswitch/height/.initial=.8} +\ctikzset{tripoles/toggleswitch/height 2/.initial=.0} +\ctikzset{tripoles/toggleswitch/width/.initial=.80} +%%>>> + +% arresters, fuses, lamps, etc%<<<1 + +\ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30} +\ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80} +\ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30} +\ctikzset{bipoles/american gas filled surge arrester/height/.initial=.60} +\ctikzset{bipoles/american gas filled surge arrester/width/.initial=.60} +\ctikzset{bipoles/american gas filled surge arrester/inside/.initial=.15} +\ctikzset{bipoles/american gas filled surge arrester/dot x/.initial=.25} +\ctikzset{bipoles/american gas filled surge arrester/dot y/.initial=.45} +\ctikzset{bipoles/american gas filled surge arrester/size/.initial=.1} +\ctikzset{bipoles/fuse/height/.initial=.20} +\ctikzset{bipoles/fuse/width/.initial=.50} +\ctikzset{bipoles/afuse/height/.initial=.20} +\ctikzset{bipoles/afuse/width/.initial=.50} +\ctikzset{bipoles/lamp/height/.initial=.60} +\ctikzset{bipoles/lamp/width/.initial=.60} +\ctikzset{bipoles/bulb/height/.initial=.8} +\ctikzset{bipoles/bulb/width/.initial=.8} +\ctikzset{bipoles/tline/height/.initial=.3} +\ctikzset{bipoles/tline/width/.initial=.6} +\ctikzset{bipoles/squid/height/.initial=.60} +\ctikzset{bipoles/squid/width/.initial=.60} +\ctikzset{bipoles/barrier/height/.initial=.60} +\ctikzset{bipoles/barrier/width/.initial=.60} +\ctikzset{bipoles/openbarrier/gap/.initial=0.5} +\ctikzset{bipoles/thermocouple/height/.initial=.250} +\ctikzset{bipoles/thermocouple/height 2/.initial=.60} +\ctikzset{bipoles/thermocouple/width/.initial=.140} +\newif\ifpgf@circuit@europeangfsurgearrester +\ctikzset{gas filled surge arrester choice/.is choice} +\ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue}} +\ctikzset{gas filled surge arrester choice/american/.code= {\pgf@circuit@europeangfsurgearresterfalse}} + +\tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}} +\tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}} +%%>>> + +% wires (open, shorts, ...)%<<<1 + +\ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages +\ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages +\ctikzset{bipoles/open/voltage/straight label distance/.initial=0} +\ctikzset{bipoles/open/voltage/distance from node/.initial=.2} +\ctikzset{bipoles/short/height/.initial=.1} %dummy height for voltage positioning +\ctikzset{bipoles/short/width/.initial=.1} %dummy width for voltage positioning +% multiwire +\ctikzset{bipoles/multiwire/height/.initial=0.4} +\ctikzset{bipoles/multiwire/width/.initial=0.2} +\ctikzset{bipoles/multiwire/spacing/.initial=0.05} +% crossing wires +\ctikzset{bipoles/crossing/size/.initial=.2} +%%>>> + +% Instruments %<<<1 +\ctikzset{bipoles/ammeter/height/.initial=.60} +\ctikzset{bipoles/ammeter/width/.initial=.60} +\ctikzset{bipoles/ohmmeter/height/.initial=.60} +\ctikzset{bipoles/ohmmeter/width/.initial=.60} +\ctikzset{bipoles/voltmeter/height/.initial=.60} +\ctikzset{bipoles/voltmeter/width/.initial=.60} +\ctikzset{bipoles/smeter/height/.initial=.60} +\ctikzset{bipoles/smeter/width/.initial=.60} +\ctikzset{bipoles/smeter/voltage/additional shift/.initial=1} +\ctikzset{bipoles/qmeter/depth/.initial=.40} +\ctikzset{bipoles/qmeter/height/.initial=.80} +\ctikzset{bipoles/qmeter/width/.initial=.60} +% this must be specified for each one +\ctikzset{bipoles/qvprobe/voltage/additional shift/.initial=.5} +\ctikzset{bipoles/qiprobe/voltage/additional shift/.initial=.5} +\ctikzset{bipoles/qpprobe/voltage/additional shift/.initial=.5} +\ctikzset{bipoles/iloop/width/.initial=.40} +\ctikzset{bipoles/iloop/height/.initial=.60} + +\ctikzset{bipoles/oscope/height/.initial=.60} +\ctikzset{bipoles/oscope/width/.initial=.60} +\ctikzset{bipoles/oscope/voltage/additional shift/.initial=1} + + +% option to not rotate the new (Romano's) instruments +\newif\ifpgf@circuit@straightinstruments\pgf@circuit@straightinstrumentstrue +\pgfkeys{/tikz/straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}} +\ctikzset{straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}} +\pgfkeys{/tikz/rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}} +\ctikzset{rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}} +%%>>> + +% blocks (twoports and so)%<<<1 + +\ctikzset{bipoles/twoport/width/.initial=.7} +\ctikzset{bipoles/twoport/height/.initial=.7} +\ctikzset{bipoles/twoport/text/.initial=} +\ctikzset{bipoles/twoportsplit/width/.initial=.7} +\ctikzset{bipoles/twoport/text in/.initial=} +\ctikzset{bipoles/twoport/text out/.initial=} +\ctikzset{text/.style={t=#1}} +\ctikzset{t/.code={% + \ctikzsetvalof{bipoles/twoport/text}{#1}% +}} +\ctikzset{text in/.style={t1=#1}} +\ctikzset{t1/.code={% + \ctikzsetvalof{bipoles/twoport/text in}{#1}% +}} +\ctikzset{text out/.style={t2=#1}} +\ctikzset{t2/.code={% + \ctikzsetvalof{bipoles/twoport/text out}{#1}% +}} +\ctikzset{bipoles/vco/width/.initial=.7} +\ctikzset{bipoles/bandpass/width/.initial=.7} +\ctikzset{bipoles/bandstop/width/.initial=.7} +\ctikzset{bipoles/highpass/width/.initial=.7} +\ctikzset{bipoles/lowpass/width/.initial=.7} +\ctikzset{bipoles/allpass/width/.initial=.7} +\ctikzset{bipoles/adc/width/.initial=.7} +\ctikzset{bipoles/dac/width/.initial=.7} +\ctikzset{bipoles/dsp/width/.initial=.7} +\ctikzset{bipoles/fft/width/.initial=.7} +\ctikzset{bipoles/amp/width/.initial=.7} +\ctikzset{bipoles/vamp/width/.initial=.7} +\ctikzset{bipoles/piattenuator/width/.initial=.7} +\ctikzset{bipoles/vpiattenuator/width/.initial=.7} +\ctikzset{bipoles/tattenuator/width/.initial=.7} +\ctikzset{bipoles/vtattenuator/width/.initial=.7} +\ctikzset{bipoles/phaseshifter/width/.initial=.7} +\ctikzset{bipoles/vphaseshifter/width/.initial=.7} +\ctikzset{bipoles/detector/width/.initial=.7} +\ctikzset{tripoles/mixer/width/.initial=0.7} +\ctikzset{tripoles/adder/width/.initial=0.7} +\ctikzset{tripoles/circulator/width/.initial=.7} +\ctikzset{tripoles/oscillator/width/.initial=.7} + +\ctikzset{tripoles/wilkinson/height/.initial=1.3} +\ctikzset{tripoles/wilkinson/width/.initial=1.3} + +\ctikzset{tripoles/splitter/height/.initial=1.3} +\ctikzset{tripoles/splitter/width/.initial=1.3} + +\ctikzset{tripoles/mzm/height/.initial=1.3} +\ctikzset{tripoles/mzm/width/.initial=1.3} +%%>>> + +% Transistors %<<<1 + +\newif\ifpgf@circuit@trans@depletiontype +\pgf@circuit@trans@depletiontypefalse + +\newif\ifpgf@circuit@mos@arrows +\ctikzset{tripoles/mos style/.is choice} +\ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}} +\ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}} +\pgfkeys{/tikz/arrowmos/.add code={}{\pgf@circuit@mos@arrowstrue}} +\pgfkeys{/tikz/noarrowmos/.add code={}{\pgf@circuit@mos@arrowsfalse}} + +% Fixed label positions +\newif\ifpgf@circuit@transisors@fixlabels +\pgf@circuit@transisors@fixlabelstrue +\pgfkeys{/tikz/center transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}} +\ctikzset{fix transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}} +\pgfkeys{/tikz/legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}} +\ctikzset{legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}} + +% Option solderdot for fet +\newif\ifpgf@circuit@fet@solderdot +\pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}} +\ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}} +\pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}} +\ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}} + +% Option bodydiode for fet +\newif\ifpgf@circuit@fet@bodydiode +\pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}} +\ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}} +\pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}} +\ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}} + +% Option draw fet without gate connection +\newif\ifpgf@circuit@bpt@drawgate +\pgf@circuit@bpt@drawgatetrue +\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}} +\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}} +\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}} +\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}} + +% Option draw bpt with schottky base +\newif\ifpgf@circuit@bpt@schottky +\pgf@circuit@bpt@schottkyfalse +\pgfkeys{/tikz/schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}} +\ctikzset{schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}} +\pgfkeys{/tikz/no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}} +\ctikzset{no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}} +\ctikzset{tripoles/schottky base size/.initial=0.05} + +% Option draw bpt without base connection +\newif\ifpgf@circuit@bpt@drawbase +\pgf@circuit@bpt@drawbasetrue +\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}} +\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}} +\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}} +\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}} + +% Option draw bpt with optical input +\newif\ifpgf@circuit@bpt@drawphoto +\pgf@circuit@bpt@drawphotofalse +\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} +\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} +\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} +\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} + +% Option draw fet without bulk connection -- Added by Burak Kelleci +\newif\ifpgf@circuit@bpt@drawbulk +\pgfkeys{/tikz/bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}} +\ctikzset{bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}} +\pgfkeys{/tikz/nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}} +\ctikzset{nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}} + +% Option draw pmos with empty circle +\newif\ifpgf@circuit@pmos@emptycircle +\pgf@circuit@pmos@emptycirclefalse +\ctikzset{tripoles/pmos style/.is choice} +\pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} +\ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} +% Option draw pmos with no circle +\newif\ifpgf@circuit@pmos@nocircle +\pgf@circuit@pmos@nocirclefalse +\pgfkeys{/tikz/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}} +\ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}} +% back to normal +\pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} +\ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} +% arrows at the end, the correct way +\newif\ifpgf@circuit@trans@arrowatend +\pgf@circuit@trans@arrowatendfalse +\ctikzset{transistors/arrow pos/.is choice} +\ctikzset{transistors/arrow pos/legacy/.code={\pgf@circuit@trans@arrowatendfalse}} +\ctikzset{transistors/arrow pos/end/.code={\pgf@circuit@trans@arrowatendtrue}} + +\newif\ifpgf@circuit@trans@ntype +\pgf@circuit@trans@ntypetrue %default true +%\newif\ifpgf@circuit@trans@ptype +%\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@ntypetrue}} +\ctikzset{tripoles/nmos/width/.initial=.7} +\ctikzset{tripoles/nmos/gate height/.initial=.35} +\ctikzset{tripoles/nmos/base height/.initial=.5} +\ctikzset{tripoles/nmos/conn height/.initial=0} +\ctikzset{tripoles/nmos/height/.initial=1.1} +\ctikzset{tripoles/nmos/base width/.initial=.5} +\ctikzset{tripoles/nmos/gate width/.initial=.62} +\ctikzset{tripoles/nmos/arrow pos/.initial=.6} +\ctikzset{tripoles/nmos/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nmos/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nmos/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nmos/curr direction/.initial=1} + +\ctikzset{tripoles/pmos/width/.initial=.7} +\ctikzset{tripoles/pmos/gate height/.initial=.35} +\ctikzset{tripoles/pmos/base height/.initial=.5} +\ctikzset{tripoles/pmos/conn height/.initial=0} +\ctikzset{tripoles/pmos/height/.initial=1.1} +\ctikzset{tripoles/pmos/base width/.initial=.5} +\ctikzset{tripoles/pmos/gate width/.initial=.62} +\ctikzset{tripoles/pmos/arrow pos/.initial=.4} +\ctikzset{tripoles/pmos/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pmos/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pmos/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pmos/curr direction/.initial=-1} + +\ctikzset{tripoles/nmosd/width/.initial=.7} +\ctikzset{tripoles/nmosd/gate height/.initial=.35} +\ctikzset{tripoles/nmosd/base height/.initial=.5} +\ctikzset{tripoles/nmosd/conn height/.initial=0} +\ctikzset{tripoles/nmosd/height/.initial=1.1} +\ctikzset{tripoles/nmosd/base width/.initial=.5} +\ctikzset{tripoles/nmosd/gate width/.initial=.62} +\ctikzset{tripoles/nmosd/arrow pos/.initial=.6} +\ctikzset{tripoles/nmosd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nmosd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nmosd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nmosd/curr direction/.initial=1} +\ctikzset{tripoles/nmosd/depletion width/.initial=.1} +\ctikzset{tripoles/nmosd/depletion color/.initial=default} + +\ctikzset{tripoles/pmosd/width/.initial=.7} +\ctikzset{tripoles/pmosd/gate height/.initial=.35} +\ctikzset{tripoles/pmosd/base height/.initial=.5} +\ctikzset{tripoles/pmosd/conn height/.initial=0} +\ctikzset{tripoles/pmosd/height/.initial=1.1} +\ctikzset{tripoles/pmosd/base width/.initial=.5} +\ctikzset{tripoles/pmosd/gate width/.initial=.62} +\ctikzset{tripoles/pmosd/arrow pos/.initial=.4} +\ctikzset{tripoles/pmosd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pmosd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pmosd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pmosd/curr direction/.initial=-1} +\ctikzset{tripoles/pmosd/depletion width/.initial=.1} +\ctikzset{tripoles/pmosd/depletion color/.initial=default} +\ctikzset{tripoles/hemt/width/.initial=.7} +\ctikzset{tripoles/hemt/gate height/.initial=.35} +\ctikzset{tripoles/hemt/base height/.initial=.5} +\ctikzset{tripoles/hemt/conn height/.initial=0} +\ctikzset{tripoles/hemt/height/.initial=1.1} +\ctikzset{tripoles/hemt/base width/.initial=.5} +\ctikzset{tripoles/hemt/gate width/.initial=.62} +\ctikzset{tripoles/hemt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/hemt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/hemt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/hemt/curr direction/.initial=1} + +\ctikzset{tripoles/nfet/width/.initial=.7} +\ctikzset{tripoles/nfet/gate height/.initial=.35} +\ctikzset{tripoles/nfet/base height/.initial=.5} +\ctikzset{tripoles/nfet/conn height/.initial=0} +\ctikzset{tripoles/nfet/height/.initial=1.1} +\ctikzset{tripoles/nfet/base width/.initial=.5} +\ctikzset{tripoles/nfet/gate width/.initial=.62} +\ctikzset{tripoles/nfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nfet/curr direction/.initial=1} + +\ctikzset{tripoles/pfet/width/.initial=.7} +\ctikzset{tripoles/pfet/gate height/.initial=.35} +\ctikzset{tripoles/pfet/base height/.initial=.5} +\ctikzset{tripoles/pfet/conn height/.initial=0} +\ctikzset{tripoles/pfet/height/.initial=1.1} +\ctikzset{tripoles/pfet/base width/.initial=.5} +\ctikzset{tripoles/pfet/gate width/.initial=.62} +\ctikzset{tripoles/pfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pfet/curr direction/.initial=-1} + +\ctikzset{tripoles/nfetd/width/.initial=.7} +\ctikzset{tripoles/nfetd/gate height/.initial=.35} +\ctikzset{tripoles/nfetd/base height/.initial=.5} +\ctikzset{tripoles/nfetd/conn height/.initial=0} +\ctikzset{tripoles/nfetd/height/.initial=1.1} +\ctikzset{tripoles/nfetd/base width/.initial=.5} +\ctikzset{tripoles/nfetd/gate width/.initial=.62} +\ctikzset{tripoles/nfetd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nfetd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nfetd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nfetd/curr direction/.initial=1} + +\ctikzset{tripoles/pfetd/width/.initial=.7} +\ctikzset{tripoles/pfetd/gate height/.initial=.35} +\ctikzset{tripoles/pfetd/base height/.initial=.5} +\ctikzset{tripoles/pfetd/conn height/.initial=0} +\ctikzset{tripoles/pfetd/height/.initial=1.1} +\ctikzset{tripoles/pfetd/base width/.initial=.5} +\ctikzset{tripoles/pfetd/gate width/.initial=.62} +\ctikzset{tripoles/pfetd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pfetd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pfetd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pfetd/curr direction/.initial=-1} + +\ctikzset{tripoles/nigfete/width/.initial=.7} +\ctikzset{tripoles/nigfete/gate height/.initial=.35} +\ctikzset{tripoles/nigfete/base height/.initial=.5} +\ctikzset{tripoles/nigfete/conn height/.initial=.35} +\ctikzset{tripoles/nigfete/height/.initial=1.1} +\ctikzset{tripoles/nigfete/base width/.initial=.5} +\ctikzset{tripoles/nigfete/gate width/.initial=.62} +\ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nigfete/curr direction/.initial=1} + +\ctikzset{tripoles/nigfetd/width/.initial=.7} +\ctikzset{tripoles/nigfetd/gate height/.initial=.35} +\ctikzset{tripoles/nigfetd/base height/.initial=.5} +\ctikzset{tripoles/nigfetd/conn height/.initial=.35} +\ctikzset{tripoles/nigfetd/height/.initial=1.1} +\ctikzset{tripoles/nigfetd/base width/.initial=.5} +\ctikzset{tripoles/nigfetd/gate width/.initial=.62} +\ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nigfetd/curr direction/.initial=1} + +\ctikzset{tripoles/nigfetebulk/width/.initial=.7} +\ctikzset{tripoles/nigfetebulk/gate height/.initial=.35} +\ctikzset{tripoles/nigfetebulk/base height/.initial=.5} +\ctikzset{tripoles/nigfetebulk/conn height/.initial=.35} +\ctikzset{tripoles/nigfetebulk/height/.initial=1.1} +\ctikzset{tripoles/nigfetebulk/base width/.initial=.5} +\ctikzset{tripoles/nigfetebulk/gate width/.initial=.62} +\ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nigfetebulk/curr direction/.initial=1} + +\ctikzset{tripoles/pigfete/width/.initial=.7} +\ctikzset{tripoles/pigfete/gate height/.initial=.35} +\ctikzset{tripoles/pigfete/base height/.initial=.5} +\ctikzset{tripoles/pigfete/conn height/.initial=.35} +\ctikzset{tripoles/pigfete/height/.initial=1.1} +\ctikzset{tripoles/pigfete/base width/.initial=.5} +\ctikzset{tripoles/pigfete/gate width/.initial=.62} +\ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pigfete/curr direction/.initial=-1} + +\ctikzset{tripoles/pigfetd/width/.initial=.7} +\ctikzset{tripoles/pigfetd/gate height/.initial=.35} +\ctikzset{tripoles/pigfetd/base height/.initial=.5} +\ctikzset{tripoles/pigfetd/conn height/.initial=.35} +\ctikzset{tripoles/pigfetd/height/.initial=1.1} +\ctikzset{tripoles/pigfetd/base width/.initial=.5} +\ctikzset{tripoles/pigfetd/gate width/.initial=.62} +\ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pigfetd/curr direction/.initial=-1} + +\ctikzset{tripoles/pigfetebulk/width/.initial=.7} +\ctikzset{tripoles/pigfetebulk/gate height/.initial=.35} +\ctikzset{tripoles/pigfetebulk/conn height/.initial=.35} +\ctikzset{tripoles/pigfetebulk/base height/.initial=.5} +\ctikzset{tripoles/pigfetebulk/height/.initial=1.1} +\ctikzset{tripoles/pigfetebulk/base width/.initial=.5} +\ctikzset{tripoles/pigfetebulk/gate width/.initial=.62} +\ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1} + +\ctikzset{tripoles/npn/width/.initial=.6} +\ctikzset{tripoles/npn/base height/.initial=.45} +\ctikzset{tripoles/npn/base height 2/.initial=.15} +\ctikzset{tripoles/npn/base height/.initial=.4} +\ctikzset{tripoles/npn/conn height/.initial=0} +\ctikzset{tripoles/npn/height/.initial=1.1} +\ctikzset{tripoles/npn/base width/.initial=.5} +\ctikzset{tripoles/npn/arrow pos/.initial=.5} +\ctikzset{tripoles/npn/bodydiode scale/.initial=.3} +\ctikzset{tripoles/npn/bodydiode distance/.initial=.3} +\ctikzset{tripoles/npn/bodydiode conn/.initial=.6} +\ctikzset{tripoles/npn/curr direction/.initial=1} + +\ctikzset{tripoles/pnp/width/.initial=.6} +\ctikzset{tripoles/pnp/base height/.initial=.45} +\ctikzset{tripoles/pnp/base height 2/.initial=.15} +\ctikzset{tripoles/pnp/base height/.initial=.4} +\ctikzset{tripoles/pnp/conn height/.initial=0} +\ctikzset{tripoles/pnp/height/.initial=1.1} +\ctikzset{tripoles/pnp/base width/.initial=.5} +\ctikzset{tripoles/pnp/arrow pos/.initial=.5} +\ctikzset{tripoles/pnp/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pnp/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pnp/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pnp/curr direction/.initial=-1} + +\ctikzset{tripoles/pigbt/width/.initial=.6} +\ctikzset{tripoles/pigbt/gate height/.initial=.45} +\ctikzset{tripoles/pigbt/gate height 2/.initial=.15} +\ctikzset{tripoles/pigbt/base height/.initial=.4} +\ctikzset{tripoles/pigbt/outer base height/.initial=.4} +\ctikzset{tripoles/pigbt/outer base thickness/.initial=1} +\ctikzset{tripoles/pigbt/conn height/.initial=0} +\ctikzset{tripoles/pigbt/height/.initial=1.1} +\ctikzset{tripoles/pigbt/gate width/.initial=.62} +\ctikzset{tripoles/pigbt/base width/.initial=.5} +\ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pigbt/curr direction/.initial=-1} + +\ctikzset{tripoles/nigbt/width/.initial=.6} +\ctikzset{tripoles/nigbt/gate height/.initial=.45} +\ctikzset{tripoles/nigbt/gate height 2/.initial=.15} +\ctikzset{tripoles/nigbt/base height/.initial=.4} +\ctikzset{tripoles/nigbt/outer base height/.initial=.4} +\ctikzset{tripoles/nigbt/outer base thickness/.initial=1} +\ctikzset{tripoles/nigbt/conn height/.initial=0} +\ctikzset{tripoles/nigbt/height/.initial=1.1} +\ctikzset{tripoles/nigbt/gate width/.initial=.62} +\ctikzset{tripoles/nigbt/base width/.initial=.5} +\ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nigbt/curr direction/.initial=1} + +\ctikzset{tripoles/Lpigbt/width/.initial=.6} +\ctikzset{tripoles/Lpigbt/gate height/.initial=.45} +\ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15} +\ctikzset{tripoles/Lpigbt/base height/.initial=.4} +\ctikzset{tripoles/Lpigbt/outer base height/.initial=.4} +\ctikzset{tripoles/Lpigbt/outer base thickness/.initial=1} +\ctikzset{tripoles/Lpigbt/conn height/.initial=.4} +\ctikzset{tripoles/Lpigbt/height/.initial=1.1} +\ctikzset{tripoles/Lpigbt/gate width/.initial=.62} +\ctikzset{tripoles/Lpigbt/base width/.initial=.5} +\ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/Lpigbt/curr direction/.initial=-1} + +\ctikzset{tripoles/Lnigbt/width/.initial=.6} +\ctikzset{tripoles/Lnigbt/gate height/.initial=.45} +\ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15} +\ctikzset{tripoles/Lnigbt/base height/.initial=.4} +\ctikzset{tripoles/Lnigbt/outer base height/.initial=.4} +\ctikzset{tripoles/Lnigbt/outer base thickness/.initial=1} +\ctikzset{tripoles/Lnigbt/conn height/.initial=.4} +\ctikzset{tripoles/Lnigbt/height/.initial=1.1} +\ctikzset{tripoles/Lnigbt/gate width/.initial=.62} +\ctikzset{tripoles/Lnigbt/base width/.initial=.5} +\ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/Lnigbt/curr direction/.initial=1} + +\ctikzset{tripoles/igbt/outer base height/.code={ + \ctikzset{tripoles/nigbt/outer base height/.initial=#1} + \ctikzset{tripoles/pigbt/outer base height/.initial=#1} + \ctikzset{tripoles/Lnigbt/outer base height/.initial=#1} + \ctikzset{tripoles/Lpigbt/outer base height/.initial=#1} + \ctikzset{tripoles/Lnigbt/conn height/.initial=#1} + \ctikzset{tripoles/Lpigbt/conn height/.initial=#1} +}} +\ctikzset{tripoles/igbt/outer base thickness/.code={ + \ctikzset{tripoles/nigbt/outer base thickness=#1} + \ctikzset{tripoles/pigbt/outer base thickness=#1} + \ctikzset{tripoles/Lnigbt/outer base thickness=#1} + \ctikzset{tripoles/Lpigbt/outer base thickness=#1} +}} + +\ctikzset{tripoles/njfet/width/.initial=.7} +\ctikzset{tripoles/njfet/gate height/.initial=.5} +\ctikzset{tripoles/njfet/gate height 2/.initial=.35} +\ctikzset{tripoles/njfet/gate width/.initial=.5} +\ctikzset{tripoles/njfet/conn height/.initial=.35} +\ctikzset{tripoles/njfet/height/.initial=1.1} +\ctikzset{tripoles/njfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/njfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/njfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/njfet/curr direction/.initial=1} + +\ctikzset{tripoles/pjfet/width/.initial=.7} +\ctikzset{tripoles/pjfet/gate height/.initial=.5} +\ctikzset{tripoles/pjfet/gate height 2/.initial=.35} +\ctikzset{tripoles/pjfet/gate width/.initial=.5} +\ctikzset{tripoles/pjfet/conn height/.initial=.35} +\ctikzset{tripoles/pjfet/height/.initial=1.1} +\ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pjfet/curr direction/.initial=-1} + +\ctikzset{tripoles/isfet/width/.initial=1} +\ctikzset{tripoles/isfet/gate height/.initial=.35} +\ctikzset{tripoles/isfet/base height/.initial=.5} +\ctikzset{tripoles/isfet/height/.initial=1.1} +\ctikzset{tripoles/isfet/base width/.initial=.3} +\ctikzset{tripoles/isfet/gate width/.initial=.5} +\ctikzset{tripoles/isfet/conn height/.initial=0} +\ctikzset{tripoles/isfet/wave width/.initial=.16} +\ctikzset{tripoles/isfet/wave amp/.initial=.06} +\ctikzset{tripoles/isfet/waves y sep/.initial=.22} +\ctikzset{tripoles/isfet/waves x sep/.initial=.8} +\ctikzset{tripoles/isfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/isfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/isfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/isfet/curr direction/.initial=1} +% +% multi-emitter and multi-collector BJTs by Romano Giannetti +% +\ctikzset{tripoles/bjt/emitters/.initial=1} +\ctikzset{tripoles/bjt/collectors/.initial=1} +\pgfkeys{/tikz/emitters/.add code={}{\ctikzset{tripoles/bjt/emitters=#1}}} +\pgfkeys{/tikz/collectors/.add code={}{\ctikzset{tripoles/bjt/collectors=#1}}} +\ctikzset{tripoles/bjt/pins width/.initial=0.3} +\pgfkeys{/tikz/bjt pins width/.add code={}{\ctikzset{tripoles/bjt/pins width=#1}}} +\ctikzset{tripoles/bjt/multi height/.initial=.5} +\pgfkeys{/tikz/bjt multi height/.add code={}{\ctikzset{tripoles/bjt/multi height/.initial=#1}}} +% +\ctikzset{tripoles/bjt/width/.initial=.3} +\ctikzset{tripoles/bjt/base height 2/.initial=.4} +\ctikzset{tripoles/bjt/base height/.initial=1.1} +\ctikzset{tripoles/bjt/height/.initial=.4} +\ctikzset{tripoles/bjt/base width/.initial=1} +\ctikzset{tripoles/bjt/arrow pos/.initial=.5} +% do NOT touch these two! +\ctikzset{tripoles/bjt/npn/curr direction/.initial=1} +\ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1} + +%% transistors stop here +%%>>> + +% Electronic tubes: diodetube, triode, tetrode and pentode%<<<1 +\ctikzset{tubes/width/.initial=1} % relative width +\ctikzset{tubes/height/.initial=1.4} % relative height +\ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle +\ctikzset{tubes/anode distance/.initial=0.40} % distance from center +\ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate +\ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center +\ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes +\ctikzset{tubes/grid separation/.initial=0.2} % separation between grids +\ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center +\ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid +\ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode +\ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire +\ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side +\ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode +\ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint + +\newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse +\pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} +\ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} +\newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse +\pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} +\ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} +\newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse +\pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}} +\ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}% +%>>> + +%% Logic ports%<<<1 +%% beware that the third option is in IEEE ports in pgfcircmultipoles.tex + +% switches for logic gates +% +\pgfkeys{/tikz/number inputs/.initial=0} +\pgfkeys{/tikz/number inputs/.default=0} + +\newif\ifpgf@circuit@europeanlogicport +\ctikzset{logic ports/.is choice} +\ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue + \tikzset{and port/.style={shape=european and port}}% + \tikzset{or port/.style={shape=european or port}}% + \tikzset{xor port/.style={shape=european xor port}}% + \tikzset{buffer port/.style={shape=european buffer port}}% + \tikzset{not port/.style={shape=european not port}}% + \tikzset{nand port/.style={shape=european nand port}}% + \tikzset{nor port/.style={shape=european nor port}}% + \tikzset{xnor port/.style={shape=european xnor port}}% + % there is no Schmitt ports in european style (yet) + \tikzset{schmitt port/.style={shape=schmitt}}% + \tikzset{invschmitt port/.style={shape=invschmitt}}% +}} +\ctikzset{logic ports/american/.code= {\pgf@circuit@europeanlogicportfalse + \tikzset{and port/.style={shape=american and port}}% + \tikzset{or port/.style={shape=american or port}}% + \tikzset{xor port/.style={shape=american xor port}}% + \tikzset{buffer port/.style={shape=american buffer port}}% + \tikzset{not port/.style={shape=american not port}}% + \tikzset{nand port/.style={shape=american nand port}}% + \tikzset{nor port/.style={shape=american nor port}}% + \tikzset{xnor port/.style={shape=american xnor port}}% + \tikzset{schmitt port/.style={shape=schmitt}}% + \tikzset{invschmitt port/.style={shape=invschmitt}}% +}} + +\ctikzset{logic ports origin/.is choice} +\ctikzset{logic ports origin/legacy/.code={ + \ctikzset{tripoles/american and port/origin/.initial=0.8}% + \ctikzset{tripoles/american nand port/origin/.initial=0.8}% + \ctikzset{tripoles/american nor port/origin/.initial=0.8}% + \ctikzset{tripoles/american or port/origin/.initial=0.8}% + \ctikzset{tripoles/american xor port/origin/.initial=0.8}% + \ctikzset{tripoles/american xnor port/origin/.initial=0.8}% + \ctikzset{tripoles/european and port/origin/.initial=0.8}% + \ctikzset{tripoles/european nand port/origin/.initial=0.8}% + \ctikzset{tripoles/european or port/origin/.initial=0.8}% + \ctikzset{tripoles/european nor port/origin/.initial=0.8}% + \ctikzset{tripoles/european xor port/origin/.initial=0.8}% + \ctikzset{tripoles/european xnor port/origin/.initial=0.8}% + \ctikzset{tripoles/european buffer port/origin/.initial=0.8}% + \ctikzset{tripoles/european not port/origin/.initial=0.8}% + }% +} +\ctikzset{logic ports origin/center/.code={% + \ctikzset{tripoles/american and port/origin/.initial=0}% + \ctikzset{tripoles/american nand port/origin/.initial=0}% + \ctikzset{tripoles/american nor port/origin/.initial=0}% + \ctikzset{tripoles/american or port/origin/.initial=0}% + \ctikzset{tripoles/american xor port/origin/.initial=0}% + \ctikzset{tripoles/american xnor port/origin/.initial=0}% + \ctikzset{tripoles/european and port/origin/.initial=0}% + \ctikzset{tripoles/european nand port/origin/.initial=0}% + \ctikzset{tripoles/european or port/origin/.initial=0}% + \ctikzset{tripoles/european nor port/origin/.initial=0}% + \ctikzset{tripoles/european xor port/origin/.initial=0}% + \ctikzset{tripoles/european xnor port/origin/.initial=0}% + \ctikzset{tripoles/european buffer port/origin/.initial=0}% + \ctikzset{tripoles/european not port/origin/.initial=0}% + }% +} + +\newif\ifpgfcirc@roundy@or@shapes\pgfcirc@roundy@or@shapesfalse +\ctikzset{american or shape/.is choice} +\ctikzset{american or shape/roundy/.code={\pgfcirc@roundy@or@shapestrue}} +\ctikzset{american or shape/pointy/.code={\pgfcirc@roundy@or@shapesfalse}} + +\newif\ifpgfcirc@draw@input@leads\pgfcirc@draw@input@leadstrue +\ctikzset{logic ports draw input leads/.is choice} +\ctikzset{logic ports draw input leads/true/.code={\pgfcirc@draw@input@leadstrue}} +\ctikzset{logic ports draw input leads/false/.code={\pgfcirc@draw@input@leadsfalse}} +\tikzset{input leads/.code={\pgfcirc@draw@input@leadstrue}} +\tikzset{no input leads/.code={\pgfcirc@draw@input@leadsfalse}} + +\newif\ifpgfcirc@draw@output@leads\pgfcirc@draw@output@leadstrue +\ctikzset{logic ports draw output leads/.is choice} +\ctikzset{logic ports draw output leads/true/.code={\pgfcirc@draw@output@leadstrue}} +\ctikzset{logic ports draw output leads/false/.code={\pgfcirc@draw@output@leadsfalse}} +\tikzset{output leads/.code={\pgfcirc@draw@output@leadstrue}} +\tikzset{no output leads/.code={\pgfcirc@draw@output@leadsfalse}} + +\ctikzset{logic ports draw leads/.is choice} +\ctikzset{logic ports draw leads/true/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}} +\ctikzset{logic ports draw leads/false/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}} +\tikzset{all leads/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}} +\tikzset{no leads/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}} + +% adding a different style of xnor port +% see https://github.com/circuitikz/circuitikz/issues/467 +\ctikzset{european xnor style/.is choice} +\ctikzset{european xnor style/default/.code={% + \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}}% +} +\ctikzset{european xnor style/direct/.code={% + \pgfcircdeclareeurologicport{xnor}{$=$}{\pgf@circ@res@count}{}}% +} + + +% old, legacy keys that should be killed over +\ctikzset{bipoles/buffer/height/.initial=1} +\ctikzset{bipoles/buffer/width/.initial=1} +\ctikzset{bipoles/not port/width/.initial=1} +\ctikzset{bipoles/not port/height/.initial=.8} +\ctikzset{bipoles/not port/circle width/.initial=.15} + +\ctikzset{tripoles/american and port/width/.initial=1.1} +\ctikzset{tripoles/american and port/height/.initial=.8} +\ctikzset{tripoles/american and port/port width/.initial=.7} +\ctikzset{tripoles/american and port/input height/.initial=.5} +\ctikzset{tripoles/american nand port/width/.initial=1.1} +\ctikzset{tripoles/american nand port/height/.initial=.8} +\ctikzset{tripoles/american nand port/port width/.initial=.7} +\ctikzset{tripoles/american nand port/circle width/.initial=.15} +\ctikzset{tripoles/american nand port/input height/.initial=.5} +\ctikzset{tripoles/american or port/width/.initial=1.1} +\ctikzset{tripoles/american or port/height/.initial=.8} +\ctikzset{tripoles/american or port/port width/.initial=.7} +\ctikzset{tripoles/american or port/input height/.initial=.5} +\ctikzset{tripoles/american or port/input skip/.initial=.25} +\ctikzset{tripoles/american or port/aaa/.initial=.6} +\ctikzset{tripoles/american or port/bbb/.initial=.4} +\ctikzset{tripoles/american or port/ccc/.initial=.5} +\ctikzset{tripoles/american or port/ddd/.initial=.0} +\ctikzset{tripoles/american nor port/width/.initial=1.1} +\ctikzset{tripoles/american nor port/height/.initial=.8} +\ctikzset{tripoles/american nor port/port width/.initial=.7} +\ctikzset{tripoles/american nor port/input height/.initial=.5} +\ctikzset{tripoles/american nor port/input skip/.initial=.25} +\ctikzset{tripoles/american nor port/circle width/.initial=.15} +\ctikzset{tripoles/american nor port/aaa/.initial=.6} +\ctikzset{tripoles/american nor port/bbb/.initial=.4} +\ctikzset{tripoles/american nor port/ccc/.initial=.5} +\ctikzset{tripoles/american nor port/ddd/.initial=.0} +\ctikzset{tripoles/american xor port/width/.initial=1.1} +\ctikzset{tripoles/american xor port/height/.initial=.8} +\ctikzset{tripoles/american xor port/port width/.initial=.7} +\ctikzset{tripoles/american xor port/input height/.initial=.5} +\ctikzset{tripoles/american xor port/input skip/.initial=.15} +\ctikzset{tripoles/american xor port/distance/.initial=.1} +\ctikzset{tripoles/american xnor port/width/.initial=1.1} +\ctikzset{tripoles/american xnor port/height/.initial=.8} +\ctikzset{tripoles/american xnor port/port width/.initial=.7} +\ctikzset{tripoles/american xnor port/input height/.initial=.5} +\ctikzset{tripoles/american xnor port/input skip/.initial=.15} +\ctikzset{tripoles/american xnor port/distance/.initial=.1} +\ctikzset{tripoles/american xnor port/circle width/.initial=.15} +\ctikzset{tripoles/american and port/origin/.initial=0.8} +\ctikzset{tripoles/american and port/inputs/.initial=2} +% variable number of inputs +\ctikzset{tripoles/american nand port/origin/.initial=0.8} +\ctikzset{tripoles/american nand port/inputs/.initial=2} +\ctikzset{tripoles/american nor port/origin/.initial=0.8} +\ctikzset{tripoles/american nor port/inputs/.initial=2} +\ctikzset{tripoles/american nor port/angle/.initial=70} +\ctikzset{tripoles/american nor port/inner/.initial=0.3} +\ctikzset{tripoles/american or port/origin/.initial=0.8} +\ctikzset{tripoles/american or port/inputs/.initial=2} +\ctikzset{tripoles/american or port/angle/.initial=70} +\ctikzset{tripoles/american or port/inner/.initial=0.3} +\ctikzset{tripoles/american xor port/origin/.initial=0.8} +\ctikzset{tripoles/american xor port/inputs/.initial=2} +\ctikzset{tripoles/american xor port/angle/.initial=70} +\ctikzset{tripoles/american xor port/inner/.initial=0.3} +\ctikzset{tripoles/american xnor port/origin/.initial=0.8} +\ctikzset{tripoles/american xnor port/inputs/.initial=2} +\ctikzset{tripoles/american xnor port/angle/.initial=70} +\ctikzset{tripoles/american xnor port/inner/.initial=0.3} + +\ctikzset{tripoles/european and port/width/.initial=1.4} +\ctikzset{tripoles/european and port/height/.initial=.65} +\ctikzset{tripoles/european and port/reserved/.initial=.6} +\ctikzset{tripoles/european and port/input height/.initial=.6} +\ctikzset{tripoles/european or port/width/.initial=1.4} +\ctikzset{tripoles/european or port/height/.initial=.65} +\ctikzset{tripoles/european or port/reserved/.initial=.6} +\ctikzset{tripoles/european or port/input height/.initial=.6} +\ctikzset{tripoles/european xor port/width/.initial=1.4} +\ctikzset{tripoles/european xor port/height/.initial=.65} +\ctikzset{tripoles/european xor port/reserved/.initial=.6} +\ctikzset{tripoles/european xor port/input height/.initial=.6} +\ctikzset{tripoles/european nand port/width/.initial=1.4} +\ctikzset{tripoles/european nand port/not height/.initial=.3} +\ctikzset{tripoles/european nand port/not width/.initial=.8} +\ctikzset{tripoles/european nand port/height/.initial=.65} +\ctikzset{tripoles/european nand port/reserved/.initial=.6} +\ctikzset{tripoles/european nand port/input height/.initial=.6} +\ctikzset{tripoles/european buffer port/width/.initial=1.4} +\ctikzset{tripoles/european buffer port/not height/.initial=.3} +\ctikzset{tripoles/european buffer port/not width/.initial=.8} +\ctikzset{tripoles/european buffer port/height/.initial=.65} +\ctikzset{tripoles/european buffer port/reserved/.initial=.6} +\ctikzset{tripoles/european buffer port/input height/.initial=0} +\ctikzset{tripoles/european not port/width/.initial=1.4} +\ctikzset{tripoles/european not port/not height/.initial=.3} +\ctikzset{tripoles/european not port/not width/.initial=.8} +\ctikzset{tripoles/european not port/height/.initial=.65} +\ctikzset{tripoles/european not port/reserved/.initial=.6} +\ctikzset{tripoles/european not port/input height/.initial=0} +\ctikzset{tripoles/european xnor port/width/.initial=1.4} +\ctikzset{tripoles/european xnor port/not height/.initial=.3} +\ctikzset{tripoles/european xnor port/not width/.initial=.8} +\ctikzset{tripoles/european xnor port/height/.initial=.65} +\ctikzset{tripoles/european xnor port/reserved/.initial=.6} +\ctikzset{tripoles/european xnor port/input height/.initial=.6} +\ctikzset{tripoles/european nor port/width/.initial=1.4} +\ctikzset{tripoles/european nor port/not height/.initial=.3} +\ctikzset{tripoles/european nor port/not width/.initial=.8} +\ctikzset{tripoles/european nor port/height/.initial=.65} +\ctikzset{tripoles/european nor port/reserved/.initial=.6} +\ctikzset{tripoles/european nor port/input height/.initial=.6} +% variable number of inputs +\ctikzset{tripoles/european and port/origin/.initial=0.8} +\ctikzset{tripoles/european and port/inputs/.initial=2} +\ctikzset{tripoles/european nand port/origin/.initial=0.8} +\ctikzset{tripoles/european nand port/inputs/.initial=2} +\ctikzset{tripoles/european or port/origin/.initial=0.8} +\ctikzset{tripoles/european or port/inputs/.initial=2} +\ctikzset{tripoles/european nor port/origin/.initial=0.8} +\ctikzset{tripoles/european nor port/inputs/.initial=2} +\ctikzset{tripoles/european xor port/origin/.initial=0.8} +\ctikzset{tripoles/european xor port/inputs/.initial=2} +\ctikzset{tripoles/european xnor port/origin/.initial=0.8} +\ctikzset{tripoles/european xnor port/inputs/.initial=2} +\ctikzset{tripoles/european buffer port/origin/.initial=0.8} +\ctikzset{tripoles/european buffer port/inputs/.initial=1}% +\ctikzset{tripoles/european not port/origin/.initial=0.8} +\ctikzset{tripoles/european not port/inputs/.initial=1}% +%%% parameters that are not used anymore after multi-input +%%% gates --- left for compatibility of source code. +\ctikzset{tripoles/american xor port/aaa/.initial=.6} +\ctikzset{tripoles/american xor port/bbb/.initial=.4} +\ctikzset{tripoles/american xor port/ccc/.initial=.5} +\ctikzset{tripoles/american xor port/ddd/.initial=.0} +\ctikzset{tripoles/american xnor port/aaa/.initial=.6} +\ctikzset{tripoles/american xnor port/bbb/.initial=.4} +\ctikzset{tripoles/american xnor port/ccc/.initial=.5} +\ctikzset{tripoles/american xnor port/ddd/.initial=.0} +%%>>> + +% flip flops and muxdemxes%<<<1 + +%% flip-flop specific keys (most others are the same as chips) + +\ctikzset{multipoles/flipflop/font/.initial=\pgf@circ@font@small} +\ctikzset{multipoles/flipflop/fontud/.initial=\pgf@circ@font@tiny} +\ctikzset{multipoles/flipflop/width/.initial=1.2} +\ctikzset{multipoles/flipflop/pin spacing/.initial=0.6} +\ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2} + +%% muxdemuxes keys + +\ctikzset{multipoles/muxdemux/base len/.initial=0.4} +\ctikzset{multipoles/muxdemux/Lh/.initial=8.0} +\ctikzset{multipoles/muxdemux/Rh/.initial=6.0} +\ctikzset{multipoles/muxdemux/w/.initial=3.0} +\ctikzset{multipoles/muxdemux/inset w/.initial=0.0} +\ctikzset{multipoles/muxdemux/inset Lh/.initial=0.0} +\ctikzset{multipoles/muxdemux/inset Rh/.initial=0.0} +\ctikzset{multipoles/muxdemux/NL/.initial=8} +\ctikzset{multipoles/muxdemux/NR/.initial=1} +\ctikzset{multipoles/muxdemux/NB/.initial=3} +\ctikzset{multipoles/muxdemux/NT/.initial=0} +\ctikzset{multipoles/muxdemux/square pins/.initial=0}% +%>>> + +% Amplifiers%<<<1 +% +% switches for op amps +% changing input polarity +% +\newif\ifpgf@circuit@oa@iplusup\pgf@circuit@oa@iplusupfalse +\pgfkeys{/tikz/noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}} +\ctikzset{noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}} +\pgfkeys{/tikz/noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}} +\ctikzset{noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}} +% +% changing output polarity (for fully diff objects) +% +\newif\ifpgf@circuit@oa@oplusup\pgf@circuit@oa@oplusuptrue +\pgfkeys{/tikz/noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} +\ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} +\pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} +\ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} + +% Operational amplifier +\ctikzset{tripoles/op amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/op amp/height/.initial=1.4} % Total height +\ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation +\ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position +\ctikzset{tripoles/op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +% Fully differential operational amplifier +\ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height +\ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation +\ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation +\ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position +\ctikzset{tripoles/fd op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +\ctikzset{tripoles/en amp/width/.initial=1.7} +\ctikzset{tripoles/en amp/port width/.initial=.7} +\ctikzset{tripoles/en amp/height/.initial=1.6} +\ctikzset{tripoles/en amp/input height/.initial=.3} +\ctikzset{tripoles/en amp/up pos/.initial=.45} +\ctikzset{tripoles/en amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! +\ctikzset{tripoles/en amp/font2/.initial=\pgf@circ@font@twelve} % Absolute font size needed! +\ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}} +\tikzset{ + en amp text/.code = {% + \ctikzsetvalof{tripoles/en amp/text}{#1}% + }, + en amp text A/.code = {% + \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}% + }, +} + +% Transconductance amplifier +\ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid +\ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid +\ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation +\ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position +\ctikzset{tripoles/gm amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +% Instrumentation amplifier +\ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid +\ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid +\ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation +\ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position +\ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position +\ctikzset{tripoles/inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +% Instrumentation amplifier with differential output +\ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid +\ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid +\ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation +\ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation +\ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position +\ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position +\ctikzset{tripoles/fd inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +% Instrumentation amplifier with gain resistor terminals +\ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width +\ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid +\ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid +\ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation +\ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position +\ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position +\ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation +\ctikzset{tripoles/inst amp ra/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +% Plain amplifier +\ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height +\ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation +\ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position + +% changing fonts and symbols of amplifiers +\ctikzset{amplifiers/symbol font/.code={% + \ctikzset{tripoles/inst amp ra/font=#1}% + \ctikzset{tripoles/fd inst amp/font=#1}% + \ctikzset{tripoles/inst amp/font=#1}% + \ctikzset{tripoles/gm amp/font=#1}% + \ctikzset{tripoles/en amp/font=#1}% + \ctikzset{tripoles/fd op amp/font=#1}% + \ctikzset{tripoles/op amp/font=#1}% +}} +\ctikzset{amplifiers/plus/.initial={$+$}} +\ctikzset{amplifiers/minus/.initial={$-$}} +\tikzset{amp symbol font/.code={% + \ctikzset{amplifiers/symbol font={#1}}% + } +} +\tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}} +\tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}} +\def\pgf@circ@ampli@plus{\ctikzvalof{amplifiers/plus}} +\def\pgf@circ@ampli@minus{\ctikzvalof{amplifiers/minus}} +%%>>> + +% Transformers%<<<1 + +\ctikzset{quadpoles/transformer/inner/.initial=0.4} +\ctikzset{quadpoles/transformer/width/.initial=1.5} +\ctikzset{quadpoles/transformer/width1/.initial=.4} +\ctikzset{quadpoles/transformer/height/.initial=1.5} +\ctikzset{quadpoles/transformer/height1/.initial=.8} +\ctikzset{quadpoles/transformer core/inner/.initial=0.4} +\ctikzset{quadpoles/transformer core/width/.initial=1.5} +\ctikzset{quadpoles/transformer core/height/.initial=1.5} +\ctikzset{quadpoles/transformer core/core height/.initial=.5} +\ctikzset{quadpoles/transformer core/core width/.initial=.05} +\ctikzset{quadpoles/gyrator/inner/.initial=0.4} +\ctikzset{quadpoles/gyrator/width/.initial=1.5} +\ctikzset{quadpoles/gyrator/height/.initial=1.5} +\ctikzset{quadpoles/fourport/width/.initial=1.3} +\ctikzset{quadpoles/fourport/height/.initial=1.3} +\ctikzset{quadpoles/coupler/width/.initial=1.3} +\ctikzset{quadpoles/coupler/height/.initial=1.3} +\ctikzset{quadpoles/coupler2/width/.initial=1.3} +\ctikzset{quadpoles/coupler2/height/.initial=1.3} + +\ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1} + +\ctikzset{quadpoles style/.is choice} +\ctikzset{quadpoles style/inward/.code={% default value + \ctikzset{quadpoles/transformer/inner=0.4}% + \ctikzset{quadpoles/transformer/width=1.5}% + \ctikzset{quadpoles/transformer core/inner=0.4}% + \ctikzset{quadpoles/transformer core/width=1.5}% + \ctikzset{quadpoles/gyrator/inner=0.4}% + \ctikzset{quadpoles/gyrator/width=1.5}% + }% +} +\ctikzset{quadpoles style/inline/.code={% now horizontal baffle + \ctikzset{quadpoles/transformer/inner=1}% + \ctikzset{quadpoles/transformer/width=0.6}% + \ctikzset{quadpoles/transformer core/inner=1}% + \ctikzset{quadpoles/transformer core/width=0.6}% + \ctikzset{quadpoles/gyrator/inner=1} % FIXME + \ctikzset{quadpoles/gyrator/width=0.6}% + }% +} +%%>>> + +% seven segment displays by RGtti%<<<1 + +\newif\ifpgf@circ@sevenseg@dot +\newif\ifpgf@circ@sevenseg@box +\def\pgf@circ@sevenseg@dotstate{empty} +\ctikzset{seven seg/.is family} +\ctikzset{seven seg/dot/.is choice} +% none means no dot, not space for it. Empty means no dot, but space +\ctikzset{seven seg/dot/none/.code={\pgf@circ@sevenseg@dotfalse}} +\ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}} +\ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}} +\ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}} +% +\ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen +\ctikzset{seven seg/thickness/.initial=4pt}% segment thickness +\ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments +\ctikzset{seven seg/box sep/.initial=1pt}% external box gap +\ctikzset{seven seg/color on/.initial=red}% color for segment "on" +\ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off" +\ctikzset{seven seg/box/.is choice} +\ctikzset{seven seg/box/off/.code={\pgf@circ@sevenseg@boxfalse}} +\ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@boxtrue}} + +\ctikzset{seven seg/bits/.initial=0000000} + +\ctikzset{seven seg/value/.code={% + \edef\@@tmp{#1}% + \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi + \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi + \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi + \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi + \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi + \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi + \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi + \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi + \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi + \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi + \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi + \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi + \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi + \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi + \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi + \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi + \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi + \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi + \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi + \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi + \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi + \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi + \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi + \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi + \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi + \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi + \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi + \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi + \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi +}} + +\tikzset{% + seven segment val/.style args={#1dot#2box#3}{% + shape=bare7seg, + /tikz/circuitikz/seven seg/value=#1, + /tikz/circuitikz/seven seg/dot=#2, + /tikz/circuitikz/seven seg/box=#3, + }, + seven segment bits/.style args={#1dot#2box#3}{% + shape=bare7seg, + /tikz/circuitikz/seven seg/bits=#1, + /tikz/circuitikz/seven seg/dot=#2, + /tikz/circuitikz/seven seg/box=#3, + }, +} +%%>>> + +% Options for twoports and blocks%<<<1 + +% Option ">" for twoports +\newif\ifpgf@circuit@inputarrow +\ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}} +\ctikzset{inputarrow/.is choice} +\ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}} +\ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}} + +% Option "boxed" for nodes and twoports +\newif\ifpgf@circuit@boxed +\pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue}} +\ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue}} +\pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue}} +\ctikzset{box/.add code={}{\pgf@circuit@boxedtrue}} + +% Option "dashed" for nodes and twoports +\newif\ifpgf@circuit@dashed +\pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}} +\ctikzset{dashed/.add code={}{\pgf@circuit@dashedtrue}}% +%>>> + +% Chips and Rotary switches (multipoles) %<<<1 +% +\ctikzset{multipoles/thickness/.initial=2} +\ctikzset{multipoles/font/.initial=\pgf@circ@font@tiny} +% DIP (dual in line package) chips +\ctikzset{multipoles/dipchip/width/.initial=1.2} +\ctikzset{multipoles/dipchip/num pins/.initial=8} +\ctikzset{multipoles/dipchip/pin spacing/.initial=0.4} +\pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/dipchip/num pins=#1}}} +% QFP (quad flat package) chips +\ctikzset{multipoles/qfpchip/num pins/.initial=8} +\ctikzset{multipoles/qfpchip/pin spacing/.initial=0.4} +\pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/qfpchip/num pins=#1}}} +% chip numbers +\newif\ifpgf@circuit@chip@shownumbers\pgf@circuit@chip@shownumberstrue +\pgfkeys{/tikz/show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}} +\ctikzset{show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}} +\pgfkeys{/tikz/hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}} +\ctikzset{hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}} +\newif\ifpgf@circuit@chip@straightnumbers\pgf@circuit@chip@straightnumberstrue +\pgfkeys{/tikz/straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}} +\ctikzset{straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}} +\pgfkeys{/tikz/rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}} +\ctikzset{rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}} +% external chip pins +\ctikzset{multipoles/external pins thickness/.initial=1} +\ctikzset{multipoles/external pins width/.initial=0.2} +\ctikzset{multipoles/external pad fraction/.initial=0} +\pgfkeys{/tikz/external pins width/.add code={}{\ctikzset{multipoles/external pins width=#1}}} +\pgfkeys{/tikz/external pad fraction/.add code={}{\ctikzset{multipoles/external pad fraction=#1}}} +% topmarks +\newif\ifpgf@circuit@chip@topmark\pgf@circuit@chip@topmarktrue +\pgfkeys{/tikz/topmark/.add code={}{\pgf@circuit@chip@topmarktrue}} +\ctikzset{topmark/.add code={}{\pgf@circuit@chip@topmarktrue}} +\pgfkeys{/tikz/no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}} +\ctikzset{no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}} + +% rotary switch by Romano +\ctikzset{multipoles/rotary/thickness/.initial=1} +\ctikzset{multipoles/rotary/shape/.initial=ocirc} +\ctikzset{multipoles/rotary/channels/.initial=5} +\ctikzset{multipoles/rotary/angle/.initial=60} +\ctikzset{multipoles/rotary/wiper/.initial=20} +\ctikzset{multipoles/rotary/arrow/.is choice} +\newif\ifpgf@circ@rotaryarrow\pgf@circ@rotaryarrowfalse +\newif\ifpgf@circ@rotaryarrow@cw\pgf@circ@rotaryarrow@cwfalse +\newif\ifpgf@circ@rotaryarrow@ccw\pgf@circ@rotaryarrow@ccwfalse +\ctikzset{multipoles/rotary/arrow/none/.code={\pgf@circ@rotaryarrowfalse\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwfalse}} +\ctikzset{multipoles/rotary/arrow/both/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwtrue}} +\ctikzset{multipoles/rotary/arrow/cw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwfalse}} +\ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwtrue}} + +\tikzset{% + rotary switch/.style args={#1in#2wiper#3}{% + shape=rotaryswitch, + /tikz/circuitikz/multipoles/rotary/channels=#1, + /tikz/circuitikz/multipoles/rotary/angle=#2, + /tikz/circuitikz/multipoles/rotary/wiper=#3, + }, + rotary switch -/.style args={#1in#2wiper#3}{ + rotary switch=#1 in #2 wiper #3, + /tikz/circuitikz/multipoles/rotary/arrow=none, + }, + rotary switch <-/.style args={#1in#2wiper#3}{ + rotary switch=#1 in #2 wiper #3, + /tikz/circuitikz/multipoles/rotary/arrow=ccw, + }, + rotary switch ->/.style args={#1in#2wiper#3}{ + rotary switch=#1 in #2 wiper #3, + /tikz/circuitikz/multipoles/rotary/arrow=cw, + }, + rotary switch <->/.style args={#1in#2wiper#3}{ + rotary switch=#1 in #2 wiper #3, + /tikz/circuitikz/multipoles/rotary/arrow=both, + }, + % Notice that these should be the same as the initial values of the keys + rotary switch/.default={5 in 60 wiper 20}, + rotary switch -/.default={5 in 60 wiper 20}, + rotary switch <-/.default={5 in 60 wiper 20}, + rotary switch ->/.default={5 in 60 wiper 20}, + rotary switch <->/.default={5 in 60 wiper 20}, +} +%%>>> + +% %Mechanical section%<<<1 +\ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8} +\ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6} +\ctikzset{bipoles/spring/height/.initial=.5} +\ctikzset{bipoles/spring/width/.initial=.5} +\ctikzset{bipoles/inerter/height/.initial=.7} +\ctikzset{bipoles/inerter/width/.initial=.175} +\ctikzset{bipoles/mass/height/.initial=.55} +\ctikzset{bipoles/mass/box height/.initial=.4} +\ctikzset{bipoles/mass/width/.initial=.5} + +\ctikzset{bipoles/damper/height/.initial=.35} +\ctikzset{bipoles/damper/length/.initial=.3} +\ctikzset{bipoles/damper/width/.initial=.4} +%%>>> + +% powerelectronic blocks%<<<1 +\ctikzset{bipoles/sacdc/width/.initial=.7} +\ctikzset{bipoles/sdcac/width/.initial=.7} +\ctikzset{bipoles/tacdc/width/.initial=.7} +\ctikzset{bipoles/tdcac/width/.initial=.7} +\ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole? +%>>> + +% voltage and current options%<<<1 +% +\ctikzset{current arrow scale/.initial=16} +\ctikzset{current/distance/.initial = .5} + +\newif\ifpgf@circuit@europeancurrent +\newif\ifpgf@circuit@europeanvoltage +\newif\ifpgf@circuit@bipole@voltage@straight +\newif\ifpgf@circuit@bipole@voltage@raised + +\ctikzset{voltage/.is choice} +% +% straight is expected to be a subset of european, so disable it in american style +% +\ctikzset{voltage/american/.code = {% + \pgf@circuit@europeanvoltagefalse + \pgf@circuit@bipole@voltage@straightfalse + \pgf@circuit@bipole@voltage@raisedfalse +}} +\ctikzset{voltage/raised/.code = {% + \pgf@circuit@europeanvoltagefalse + \pgf@circuit@bipole@voltage@straightfalse + \pgf@circuit@bipole@voltage@raisedtrue +}} +\ctikzset{voltage/european/.code = {% + \pgf@circuit@europeanvoltagetrue + \pgf@circuit@bipole@voltage@straightfalse + \pgf@circuit@bipole@voltage@raisedfalse +}} +\ctikzset{voltage/straight/.code = {% + \pgf@circuit@europeanvoltagetrue + \pgf@circuit@bipole@voltage@straighttrue + \pgf@circuit@bipole@voltage@raisedfalse +}} +\ctikzset{voltage/curved/.code = {% + \pgf@circuit@europeanvoltagetrue + \pgf@circuit@bipole@voltage@straightfalse + \pgf@circuit@bipole@voltage@raisedfalse +}} +% are these used? +\ctikzset{current/.is choice} +\ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse} +\ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue} + +% this is left for backward compatibility... +\ctikzset{straight/.is choice} +\ctikzset{straight/true/.code = {\pgf@circuit@bipole@voltage@straighttrue}} +\ctikzset{straight/false/.code = {\pgf@circuit@bipole@voltage@straightfalse}} +\ctikzset{bipole/straight/.is if=pgf@circuit@bipole@voltage@straight} +% +% voltage is used also to set parameters, apart for the /.is choice +% above. I hope it is ok --- would be a mess otherwise +% +\ctikzset{voltage/shift/.initial=0.0} % shift form the cable of voltage symbols +\ctikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}} +\tikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}} +% +% keys for exporting voltage, current, flow anchors +% +\newif\ifpgfcirc@has@v\pgfcirc@has@vfalse +\newif\ifpgfcirc@has@f\pgfcirc@has@ffalse +\newif\ifpgfcirc@has@i\pgfcirc@has@ifalse +\def\ctikzgetanchor#1#2{\csname pgfcirc@#1-#2-anchor\endcsname} +\def\ctikzgetdirection#1{\csname pgfcirc@#1-direction\endcsname} +% +% shaping the +/- sign, see pgfcircvoltage.tex +\ctikzset{voltage/american font/.initial={}} +\ctikzset{voltage/american plus/.initial={$+$}} +\ctikzset{voltage/american minus/.initial={$-$}} +% here we start the voltage adjustments for special components. +% default values: +% +% this is the distance of the "point" marking the voltage along the line +% 0.0 is on the external nodes of the to path +% 1.0 is cramped on the object +% this can be overriden component by component +\ctikzset{voltage/distance from node/.initial=.5}% pos, 0->1 +% +% this is the distance from the line (perpendicular to) where the voltage is drawn. +% It is global, and not adjustable by component (use the "label distance" or locally +% if you need it) +\ctikzset{voltage/distance from line/.initial=.08}% in \pgf@circ@scaled@Rlen units +% +% bend paramenters for european arc. You can override them component-based +\ctikzset{voltage/bump b/.initial=1.5} +% +% generator voltages symbols or arrows (always straight) are put along the +% 60 ... 120 angles of the symbol (don't ask why). The distance here is on the +% center..angle line. It's called bump a because I don't know... +% +\ctikzset{voltage/bump a/.initial=1.2} +% +% these are the label distances FROM the drawings. +% You can override them component by component. +\ctikzset{voltage/european label distance/.initial=1.4} +\ctikzset{voltage/straight label distance/.initial=1.4} +\ctikzset{voltage/american label distance/.initial=1.4} +% american open voltage adjusting +% +\newif\ifpgf@adjust@open@voltage\pgf@adjust@open@voltagetrue +\ctikzset{open voltage position/.is choice} +\ctikzset{open voltage position/center/.code={\pgf@adjust@open@voltagetrue}} +\ctikzset{open voltage position/legacy/.code={\pgf@adjust@open@voltagefalse}} +% bad names, kept for compatibility, don't use +\ctikzset{american open voltage/.is choice} +\ctikzset{american open voltage/center/.code={\pgf@adjust@open@voltagetrue}} +\ctikzset{american open voltage/legacy/.code={\pgf@adjust@open@voltagefalse}} +% +% voltage and current styles +% +\tikzset{american currents/.style = {\circuitikzbasekey/current = american}} +\tikzset{european currents/.style = {\circuitikzbasekey/current = european}} +\tikzset{american voltages/.style = {\circuitikzbasekey/voltage = american}} +\tikzset{european voltages/.style = {\circuitikzbasekey/voltage = european}} +\tikzset{straight voltages/.style = {\circuitikzbasekey/voltage = straight}} +\tikzset{raised voltages/.style = {\circuitikzbasekey/voltage = raised}} +%%>>> + +% special cases for voltage positions%<<<1 +% the KIND is the node name without SHAPE +% See the definition above for meaning +% if bipoles/KIND/voltage/straight label distance is not defined, it uses the height +% if bipoles/KIND/voltage/additional shift is not defined, it is 0 (extra distance) +% +\ctikzset{bipoles/generic/voltage/distance from node/.initial=0.4} +\ctikzset{bipoles/generic/voltage/bump b/.initial=2} +% +\ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4} +\ctikzset{bipoles/ageneric/voltage/bump b/.initial=2} +% +\ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4} +\ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2} +% +\ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4} +\ctikzset{bipoles/memristor/voltage/bump b/.initial=2} +% +\ctikzset{bipoles/tline/voltage/bump b/.initial=2.4} +% +\ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4} +\ctikzset{bipoles/varistor/voltage/american label distance/.initial=1.8} +% +\ctikzset{bipoles/photoresistor/voltage/bump b/.initial=1.6} +% +\ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4} +\ctikzset{bipoles/thermistor/voltage/european label distance/.initial=0.8} +\ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6} +\ctikzset{bipoles/thermistorntc/voltage/european label distance/.initial=0.8} +\ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6} +\ctikzset{bipoles/thermistorptc/voltage/european label distance/.initial=0.8} +% +\ctikzset{bipoles/ccapacitor/voltage/bump b/.initial=2.2} +% +\ctikzset{bipoles/emptyzzdiode/voltage/bump b/.initial=2.5} +\ctikzset{bipoles/emptyzzdiode/voltage/european label distance/.initial=1.0} +\ctikzset{bipoles/fullzzdiode/voltage/bump b/.initial=2.5} +\ctikzset{bipoles/fullzzdiode/voltage/european label distance/.initial=1.0} +\ctikzset{bipoles/emptythyristor/voltage/bump b/.initial=2.0} +\ctikzset{bipoles/emptythyristor/voltage/european label distance/.initial=1.2} +\ctikzset{bipoles/fullthyristor/voltage/bump b/.initial=2.0} +\ctikzset{bipoles/fullthyristor/voltage/european label distance/.initial=1.2} +\ctikzset{bipoles/emptytriac/voltage/bump b/.initial=1.8} +\ctikzset{bipoles/emptytriac/voltage/european label distance/.initial=0.8} +\ctikzset{bipoles/fulltriac/voltage/bump b/.initial=1.8} +\ctikzset{bipoles/fulltriac/voltage/european label distance/.initial=0.8} +% +\ctikzset{bipoles/short/voltage/american label distance/.initial=2.8} +\ctikzset{bipoles/open/voltage/distance from node/.initial=0.3} +% +\ctikzset{bipoles/battery/voltage/bump a/.initial=1.4} +\ctikzset{bipoles/vsourceAM/voltage/american label distance/.initial=1.2} +\ctikzset{bipoles/cvsourceAM/voltage/american label distance/.initial=1.2} +%%>>> + +% vim: set fdm=marker fmr=%<<<,%>>>: +%%%---------- close: tex/pgfcirc.defines +%%%%%%%%%%% Springe nach tex/pgfcircutils +%%%---------- open: tex/pgfcircutils.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +\def\pgf@circ@handleSI#1{ + \noexpandarg + \def\pgf@temp{} + \StrBetween{#1}{<}{>}[\pgf@circ@handleSI@unit] + \StrLen{\pgf@circ@handleSI@unit}[\pgf@circ@handleSI@unit@len] + + \ifnum\pgf@circ@handleSI@unit@len=0 + \pgf@circ@siunitx@resfalse + \else + \IfEndWith{#1}{>}{ + \pgf@circ@siunitx@restrue + \noexpandarg + \StrBefore{#1}{<}[\pgf@circ@handleSI@val] + %\typeout{si |#1|} + }{ + \pgf@circ@siunitx@resfalse + %\typeout{no si |#1|} + } +\fi +} + +\def\pgf@circ@ifkeyempty#1{ + \pgfextra{ + \ctikzset{#1/.get=\pgf@circ@temp} + \edef\pgf@temp{} + } + \ifx\pgf@circ@temp\pgf@temp + } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Math routines + +\def\pgf@circ@stripdecimals#1.#2\pgf@nil{#1} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% useful commands + +\ifpgfutil@format@is@latex + %% flipping text + \def\ctikzflipx#1{\scalebox{-1}[1]{#1}} + \def\ctikzflipy#1{\scalebox{1}[-1]{#1}} + \def\ctikzflipxy#1{\scalebox{-1}[-1]{#1}} + % text mode overbar + % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080 + \def\ctikztextnot#1{$\overline{\hbox{#1}}\m@th$} +\else\ifpgfutil@format@is@plain + % text mode overbar + % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080 + \def\ctikztextnot#1{$\overline{\hbox{#1}}$} +\else\ifpgfutil@format@is@context + % text mode overbar + % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080 + \def\ctikztextnot#1{$\overline{\hbox{#1}}$} +\fi\fi\fi + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% switch to use fpu in reciprocal scale transformations +%% +%% this code has been contributed by Schrödinger's cat +%% https://tex.stackexchange.com/a/529159/38080 +%% +%% Use the official key to use the fpu if installed, see +%% https://github.com/pgf-tikz/pgf/issues/861 +%% +%% Thanks to "muzimuzhi Z" https://tex.stackexchange.com/a/547085/38080 +%% +\pgfkeysifdefined{/pgf/fpu/install only/.@cmd}{% + \pgfqkeys{/pgf}{use fpu reciprocal/.code={\pgfkeys{/pgf/fpu/install only={reciprocal}}}}% + }{% + \pgfqkeys{/pgf}{use fpu reciprocal/.code={% + \def\pgfmathreciprocal@##1{% + \begingroup + \pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}% + \pgfmathparse{1/##1}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + }}}% +} + +%%%---------- close: tex/pgfcircutils + +%%%%%%%%%%% Springe nach tex/pgfcircshapes +%%%---------- open: tex/pgfcircshapes.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Other shapes + +%% Nothing + +\pgfdeclareshape{emptyshape}{ + \savedanchor{\northeast}{% + \pgf@x=.5\wd\pgfnodeparttextbox% + \pgf@y=.5\ht\pgfnodeparttextbox% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + \anchor{center}{ + \pgfpointorigin + } +} +% +% Provision for changing opacity. Only expert use, see the manual. +% +\ctikzset{poles/open fill opacity/.initial=1.0}% better not touch it +\tikzset{open poles opacity/.code={% + \ctikzset{poles/open fill opacity=#1}% +}} +\ctikzset{poles/full fill opacity/.initial=1.0}% better not touch it +\tikzset{full poles opacity/.code={% + \ctikzset{poles/full fill opacity=#1}% +}} + +% +% Provision for changing default background +% + +\ctikzset{open poles fill/.initial={white}} + +%% Full terminal + +\pgfdeclareshape{circ}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}} + } + \behindforegroundpath{ + + \pgfscope + \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgfsetcolor{\ctikzvalof{color}} + \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0 + \pgfusepath{draw,fill} + \endpgfscope + + } +} + +%% Empty round terminal + +\pgfdeclareshape{ocirc}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}} + } + + \behindforegroundpath{ + + \pgfscope + \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgfsetcolor{\ctikzvalof{color}} + \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white + \pgfsetfillcolor{\ctikzvalof{open poles fill}} + % ...but override it if the class is defined! + % note that this element has no class, but will inherit it when used + % into another component + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \fi + \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0 + \pgfusepath{draw,fill} + \endpgfscope + + } +} + +%% Diamond terminal + +\pgfdeclareshape{diamondpole}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y} + \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)} + \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)} + \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)} + \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)} + \pgfextracty{\pgf@circ@res@up}{\northwest} + % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up} + % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy} + \pgfpointintersectionoflines + {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}} + {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}} + % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y} + \pgf@x=\@@switchx\pgf@x + \pgf@y=\@@switchy\pgf@y + } + \behindforegroundpath{ + \pgfscope + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgftransformrotate{45} + \pgfpathrectanglecorners + {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + \pgfsetcolor{\ctikzvalof{color}} + \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0 + \pgfusepath{draw,fill} + \endpgfscope + } +} + +%% Diamond terminal, unfilled + +\pgfdeclareshape{odiamondpole}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y} + \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)} + \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)} + \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)} + \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)} + \pgfextracty{\pgf@circ@res@up}{\northwest} + % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up} + % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy} + \pgfpointintersectionoflines + {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}} + {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}} + % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y} + \pgf@x=\@@switchx\pgf@x + \pgf@y=\@@switchy\pgf@y + } + \behindforegroundpath{ + \pgfscope + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgftransformrotate{45} + \pgfpathrectanglecorners + {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + \pgfsetcolor{\ctikzvalof{color}} + \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white + \pgfsetfillcolor{\ctikzvalof{open poles fill}} + % ...but override it if the class is defined! + % note that this element has no class, but will inherit it when used + % into another component + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \fi + \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0 + \pgfusepath{draw,fill} + \endpgfscope + } +} + +%% square terminal, filled + +\pgfdeclareshape{squarepole}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpointborderrectangle + {\pgfqpoint{\pgf@xa}{\pgf@ya}} + {\pgfqpoint{\pgf@circ@res@up}{\pgf@circ@res@up}} + } + \behindforegroundpath{ + \pgfscope + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgfpathrectanglecorners + {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + \pgfsetcolor{\ctikzvalof{color}} + \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0 + \pgfusepath{draw,fill} + \endpgfscope + } +} +%% square terminal, unfilled + +\pgfdeclareshape{osquarepole}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpointborderrectangle + {\pgfqpoint{\pgf@xa}{\pgf@ya}} + {\pgfqpoint{\pgf@circ@res@up}{\pgf@circ@res@up}} + } + \behindforegroundpath{ + \pgfscope + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgfpathrectanglecorners + {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + \pgfsetcolor{\ctikzvalof{color}} + \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white + \pgfsetfillcolor{\ctikzvalof{open poles fill}} + % ...but override it if the class is defined! + % note that this element has no class, but will inherit it when used + % into another component + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \fi + \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0 + \pgfusepath{draw,fill} + \endpgfscope + } +} +% BNC connector + +\pgfdeclareshape{bnc}{ + \anchor{center}{ + \pgfpointorigin + } + % BNC size is 2.5 times the size of the internal "ocirc" + \savedanchor\northwest{% + \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen + \pgf@y=2.5\pgf@y + \pgf@x=-\pgf@y + } + % center is on the opening + \anchor{center}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{zero}{ \pgfpointorigin } + \anchor{hot}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{shield}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + % geo-anchors + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{right}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{left}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}} + } + \behindforegroundpath{ + \pgfextracty{\pgf@circ@res@other}{\northwest} + \pgf@circ@res@step=\ctikzvalof{nodes width}\pgf@circ@Rlen + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgfsetcolor{\ctikzvalof{color}} + % external circle + \pgfscope + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{-2\pgf@circ@res@other}{-2\pgf@circ@res@other}} + {\pgfpoint{2\pgf@circ@res@other}{2\pgf@circ@res@other}} + % next the opening to the right + \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{-\pgf@circ@res@step}} + {\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@step}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@other} + \pgfusepath{draw} + \endpgfscope + % internal circle + \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@step} + \pgf@circ@draworfill + % and the contact line to the right + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \endpgfscope + } +} + +%% Fill for correct rectangular joins + +\pgfdeclareshape{rectjoinfill}{ + \savedanchor{\northeast}{% + \pgf@x=.5\pgflinewidth% + \pgf@y=.5\pgflinewidth% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{center}{ + \pgfpointorigin + } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + } + \behindforegroundpath{ + \pgfscope + \pgfpathrectanglecorners + {\pgfpoint{0}{.5\pgflinewidth}} + {\pgfpoint{0}{-.5\pgflinewidth}} + \pgfsetcolor{\ctikzvalof{color}} + \pgfusepath{draw,fill} + \endpgfscope + } +} + +%% transistor arrow + +\def\pgf@circ@find@linescale{ + % find the scale inverse of the scale factor: line width do not scale + % with scale=..., transform shape so we have to counteract it. + \iftikz@fullytransformed % this is true if `transform shape` is active + % from @Circumscribe https://tex.stackexchange.com/a/474035/38080 + % Note that this trick is not working inside a `spy` environment... + \pgfgettransformentries{\scaleA}{\scaleB}{\scaleC}{\scaleD}{\whatevs}{\whatevs}% + \pgfmathsetmacro{\@@factor}{1.0/sqrt(abs(\scaleA*\scaleD-\scaleB*\scaleC))}% + \else + \pgfmathsetmacro{\@@factor}{1.0} + \fi +} + +\pgfdeclareshape{trarrow}{% + % this arrow is only filled but grows with the linewidth, more or less + % like currarrow do + \savedanchor{\northeast}{% + \pgf@circ@res@step = \pgf@circ@Rlen + \pgf@circ@find@linescale + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} + \pgfpoint{0.7*\pgf@circ@res@step +0.5*\@@factor*\pgflinewidth} + {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth} + } + % The arrow size should be more or less the same of a currarrow, which is + % both filled and stroke, for backward output compatibility (more or less) + % + % angle \beta W is \pgf@circ@Rlen/\ctikzvalof{current arrow scale} + % |-\__ currarrow as the tip at (W,0) + % | | and the upper tail at (-0.7*W, 0.8*W) + % | \__ it then "overshoot" do to the linew width L + % | \__ xangle \alpha + % ---0-------> + % + % \beta = atan(0.7/0.8) \alpha=atan(0.8/1.7) + % tip overshoot is (L/2)/sin(\alpha) = 1.743*L only in x direction + % tail overshoot is -(L/2) in x, and (L/2)/sin(\beta) = 0.7539*L in y + % + \savedanchor{\northwest}{% + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} + \pgf@circ@find@linescale + \pgfpoint{-0.7*\pgf@circ@res@step -0.5*\@@factor*\pgflinewidth} + {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth} + } + \savedanchor{\tip}{% + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} + \pgf@circ@find@linescale + \pgfpoint{\pgf@circ@res@step + 1.743*\@@factor*\pgflinewidth}{0pt} + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{center}{ + \pgfpointorigin + } + \anchor{tip}{ + \tip + } + \anchor{btip}{% this anchor is behind the tip of half a linewidth + \tip + \pgf@circ@find@linescale + \pgf@circ@res@temp=\@@factor\pgflinewidth + \advance\pgf@x by -.5\pgf@circ@res@temp + } + \behindforegroundpath{ + \pgfscope + \northwest + \pgf@circ@res@up=\pgf@y + \pgf@circ@res@left=\pgf@x + \tip + \pgf@circ@res@step = \pgf@x + % + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathclose + \pgfsetcolor{\ctikzvalof{color}} + \pgfusepath{fill} % just fill + \endpgfscope + } +} + +%% Current arrow + +\pgfdeclareshape{currarrow}{ + \savedanchor{\northeast}{% + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} + \pgf@x=.5\pgf@circ@res@step + \pgf@y=\pgf@x% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{center}{ + \pgfpointorigin + } + \anchor{tip}{ + \pgfpointorigin + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} + \pgf@x =\pgf@circ@res@step + } + \behindforegroundpath{ + \pgfscope + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} + + \pgfpathmoveto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}} + \pgfsetcolor{\ctikzvalof{color}} + \pgfusepath{draw,fill} + + \endpgfscope + } +} + +%% Flow arrow + +\pgfdeclareshape{flowarrow}{ + \savedanchor{\northeast}{% + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} + \pgf@y=.5\pgf@circ@res@step + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by 4 + \pgf@x=\pgf@circ@res@step% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{text}{% text centered above + \pgfpointorigin + \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox} + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{tip}{ + \pgfpointorigin + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} + \pgf@x =\pgf@circ@res@step + } + \behindforegroundpath{ + \pgfscope + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by 4 + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfsetcolor{\ctikzvalof{color}} + \pgfusepath{draw} + \pgftransformshift{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfnode{currarrow}{tip}{}{}{\pgfusepath{fill}} + \endpgfscope + } +} + +%% Input arrow + +\pgfdeclareshape{inputarrow}{ + \savedanchor{\northeast}{% this is really not northeast, really -northwest + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} + \pgf@y=.5\pgf@circ@res@step + \pgf@x=1.7\pgf@circ@res@step + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax\pgf@x=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast\pgf@x=0cm\relax} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@x=0cm\relax} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \savedanchor{\tip}{ + \pgfpointorigin + } + \anchor{center}{ + \tip + } + \anchor{tip}{ + \tip + } + \behindforegroundpath{ + + \pgfscope + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by 16 + + \pgfpathmoveto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}} + \pgfsetcolor{\ctikzvalof{color}} + \pgfusepath{fill} + + \endpgfscope + } +} + + +%% box + +\pgfdeclareshape{box}{ + \anchor{center}{ + \pgfpointorigin + } + \behindforegroundpath{ + + \pgfscope + \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen + \pgf@circ@res@step = 0.5\pgf@circ@res@step + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgf@circ@draworfill + \endpgfscope + } +} + +%% box scaled with blocks + +\pgfdeclareshape{blockbox}{ + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}} + \anchor{center}{ + \pgfpointorigin + } + \behindforegroundpath{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen} + \pgfscope + \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@step = 0.5\pgf@circ@res@step + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgf@circ@draworfill + \endpgfscope + } +} + +% full nodes for wire crossing + +\pgfdeclareshape{jump crossing} +{ + \savedanchor\northwest{% + \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \behindbackgroundpath{ + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + % horizontal jumper + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0pt}} + \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} + \pgfsetbeveljoin + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % vertical, broken path + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0pt}{0.3\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfusepath{draw} + + } +} +\pgfdeclareshape{plain crossing} +{ + \savedanchor\northwest{% + \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \behindbackgroundpath{ + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + % horizontal jumper + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % vertical, broken path + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{0.1\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0pt}{0.1\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfusepath{draw} + + } +} + +%%%---------- close: tex/pgfcircshapes +%%%%%%%%%%% Springe nach tex/pgfcircmonopoles +%%%---------- open: tex/pgfcircmonopoles.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Monopoles +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%% +%% Grounds +%%%%%%%%%%%%% + + +%% Ground symbol +% #1 -> name +% #2 -> width +% #3 -> depth +% #4 -> code +\long\def\pgf@circ@declareground#1#2#3#4{ + \pgfdeclareshape{#1}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{grounds}} % class of these components + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor{\southeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen + \pgf@x=#2\pgf@x + \pgf@y=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen + \pgf@y=-#3\pgf@y + } + \anchor{north}{\pgfpointorigin} + \anchor{north east}{\southeast\pgf@y=0pt\relax} + \anchor{east}{\southeast\pgf@y=.5\pgf@y} + \anchor{south east}{\southeast} + \anchor{south}{\southeast\pgf@x=0pt\relax} + \anchor{south west}{\southeast\pgf@x=-\pgf@x} + \anchor{west}{\southeast\pgf@y=.5\pgf@y\pgf@x=-\pgf@x} + \anchor{north west}{\southeast\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{left}{\pgfpointorigin} + \anchor{right}{\pgfpointorigin} + \anchor{center}{\pgfpointorigin} + \behindforegroundpath{ + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen + \pgfscope + \pgfstartlinewidth=\pgflinewidth + #4 + \endpgfscope + } + } +} + + +\pgf@circ@declareground{ground}{0.6}{1.6}{ + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}} + \pgfusepath{draw} + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfusepath{draw} +} + +\pgf@circ@declareground{tlground}{0.6}{0.4}{ + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}} + \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}} + \pgfusepath{draw} +} + + +\pgf@circ@declareground{rground}{0.6}{1}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{monopoles/rground}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfsetroundcap\pgfusepath{draw} +} + +\pgf@circ@declareground{tground}{0.6}{0}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}} + \pgfusepath{draw} +} + +\pgf@circ@declareground{sground}{0.6}{1.8}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0}{-1.8\pgf@circ@res@step}} + \pgfpathclose + \pgf@circ@draworfill +} + +% noiseless ground +\pgf@circ@declareground{nground}{0.9}{1.6}{ + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}} + \pgfusepath{draw} + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfpatharc{0}{180}{0.9\pgf@circ@res@step} + \pgfusepath{draw} +} + +% protective ground +\pgf@circ@declareground{pground}{0.9}{1.8}{ + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf@circ@res@step}}{0.9\pgf@circ@res@step} + \pgf@circ@draworfill + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1\pgf@circ@res@step}} + \pgfusepath{draw} + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfusepath{draw} +} + +% chassis ground +\pgf@circ@declareground{cground}{1}{2}{ + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}} + \pgfusepath{draw} + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{-2.10\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{ 0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{ 0.50\pgf@circ@res@step}{-2.10\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-1.50\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.25\pgf@circ@res@step}{-2.10\pgf@circ@res@step}} + \pgfusepath{draw} +} + +% Contributed by @fotesan https://github.com/fotesan +% european ground +\pgf@circ@declareground{eground}{1.1}{1.7}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-.1\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfusepath{draw} +} + +\pgf@circ@declareground{eground2}{1.1}{1.7}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.45\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%%%%%%%%%%%%%%%%%% +%% Power supplies +%%%%%%%%%%%%%%%%%% + +% Vcc +\pgfdeclareshape{vcc}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080 + \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}% + \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed + \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}% + } + \savedanchor{\northeast}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@circ@res@step + \pgf@y=3\pgf@x% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax} + \anchor{south}{\pgfpointorigin} + \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{center}{\pgfpointorigin} + \anchor{left}{\pgfpointorigin} + \anchor{right}{\pgfpointorigin} + \anchor{text}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}} + \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}} + \pgf@x=0pt + \pgf@y=2\pgf@circ@res@step + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \behindforegroundpath{ + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgfscope + \edef\pgf@circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf@temp{legacy} + \ifx\pgf@temp\pgf@circ@temp + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \else + \pgfsetarrowsend{\pgf@circ@temp} + \fi + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}} + \pgfusepath{draw} + \endpgfscope + } +} + +% Vee +\pgfdeclareshape{vee}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080 + \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}% + \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed + \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}% + } + \savedanchor{\northeast}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@circ@res@step + \pgf@y=-3\pgf@x% + } + \anchor{south}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax} + \anchor{north}{\pgfpointorigin} + \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x} + \anchor{south east}{\northeast} + \anchor{south west}{\northeast\pgf@x=-\pgf@x} + \anchor{north east}{\northeast\pgf@y=0pt\relax} + \anchor{north west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{center}{\pgfpointorigin} + \anchor{left}{\pgfpointorigin} + \anchor{right}{\pgfpointorigin} + \anchor{text}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}} + \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}} + \pgf@x=0pt + \pgf@y=-2\pgf@circ@res@step + \advance \pgf@y by -1.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + + \behindforegroundpath{ + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgfscope + \edef\pgf@circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf@temp{legacy} + \ifx\pgf@temp\pgf@circ@temp + + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + \else + \pgfsetarrowsend{\pgf@circ@temp} + \fi + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}} + \pgfusepath{draw} + \endpgfscope + } +} + +%%%%%%%%%%%%%%%% +%% RF elements +%%%%%%%%%%%%%%%% + +% Legacy tlinestub +% Contributed by Leonardo Azzinnari +\pgfdeclareshape{tlinestub}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor{\northeast}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen + \pgf@x=1.2\pgf@circ@res@step + \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen + \pgf@y=.2\pgf@circ@res@step% + } + % the center is on the left side of the shape for facility of usage + \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0.5\pgf@x\relax} + \anchor{west}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=0cm\relax} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@x=0cm\pgf@y=-\pgf@y} + \anchor{center}{\pgfpointorigin} + % this is not exact, but it's better than nothing + \anchor{text}{\northeast\pgf@xa=\pgf@x\pgf@ya=\pgf@y + \pgfpoint{\dimexpr-.5\wd\pgfnodeparttextbox+.8\pgf@xa} + {\dimexpr-.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@ya}} + \behindforegroundpath{ + \pgfstartlinewidth=\pgflinewidth + + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{bipoles/tline/width}\pgf@circ@scaled@Rlen + + \pgfscope\begin{pgftransparencygroup} + \pgfpathellipse{\pgfpoint{0.5\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0.125\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0\pgf@circ@res@step}{0.25\pgf@circ@res@step}} + \pgf@circ@maybefill + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{1.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}} + \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \pgfpathellipse{\pgfpoint{0.5\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0.125\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0\pgf@circ@res@step}{0.25\pgf@circ@res@step}} + \pgfusepath{draw} + \end{pgftransparencygroup} \endpgfscope + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0pt}} + \pgfusepath{draw} + } +} + +%% New antennas without tails + +% main body of antennas +\def\pgf@circ@antennabody{% + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@scaled@Rlen=\scaledRlen + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{2\pgf@circ@res@step}} + \pgfsetbeveljoin + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{2\pgf@circ@res@step}} + \pgfusepath{draw} +} + +% Waves for the antennas. +\def\pgf@circ@antennawaves{% + \pgfscope + % define a triangle for clipping the waves + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{3\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathclose + \pgfusepath{clip} + % ...and build the waves as clipped circles + \pgf@circ@count@a=8\pgf@circ@res@other=0.5\pgf@circ@res@step + \pgfmathloop% + \ifnum\pgf@circ@count@a>2 + \pgfpathcircle{\pgfpoint{0pt}{\pgf@circ@res@step}}{\the\pgf@circ@count@a*\pgf@circ@res@other} + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + \pgfusepath{draw} + \endpgfscope +} + +% additional shape with the waves +\pgfdeclareshape{waves}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen + \pgf@x=\pgf@circ@res@step + \pgf@y=\pgf@circ@res@step + } + \anchor{text}{ + \northeast + \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \anchor{top}{\northeast\pgf@x=0pt} + \anchor{right}{\northeast\pgf@y=0pt} + \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt} + \anchor{bottom}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{north east}{\northeast} + \anchor{east}{\northeast\pgf@y=0pt} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \behindforegroundpath{ + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@step=0.5\pgf@circ@res@step + \pgfsetcolor{\ctikzvalof{color}} + \pgfscope + % define a triangle for clipping the waves + \pgfpathmoveto{\pgfpoint{-2\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{-2\pgf@circ@res@step}} + \pgfpathclose + \pgfusepath{clip} + % ...and build the waves as clipped circles + \c@pgf@counta=8\pgf@circ@res@other=0.5\pgf@circ@res@step + \pgfmathloop% + \ifnum\c@pgf@counta>1 + \pgfpathcircle{\pgfpoint{-2\pgf@circ@res@step}{0pt}}{\the\c@pgf@counta*\pgf@circ@res@other} + \advance\c@pgf@counta-1\relax% + \repeatpgfmathloop + \pgfusepath{draw} + \endpgfscope + } +} + +% the three types of antennas: simple, TX, RX. Notice that you can flip them... + +\pgfdeclareshape{bareantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen + \pgf@x=\pgf@circ@res@step + \pgf@y=2\pgf@circ@res@step + } + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y + \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \anchor{top}{\northeast\pgf@x=0pt} + \anchor{right}{\northeast\pgf@y=0.5\pgf@y} + \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{bottom}{\pgfpointorigin} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y} + \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{south}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \behindforegroundpath{ + \pgf@circ@antennabody + } +} + +\pgfdeclareshape{bareTXantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen + \pgf@x=\pgf@circ@res@step + \pgf@y=2\pgf@circ@res@step + } + \savedanchor{\savedwaves}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen + \pgf@x=4.2\pgf@circ@res@step + \pgf@y=\pgf@circ@res@step + } + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y + \pgf@x=\dimexpr-\pgf@x-\wd\pgfnodeparttextbox\relax + \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \anchor{waves}{\savedwaves} + \anchor{top}{\northeast\pgf@x=0pt} + \anchor{right}{\northeast\pgf@y=0.5\pgf@y} + \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{bottom}{\pgfpointorigin} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y} + \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{south}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \behindforegroundpath{ + \pgf@circ@antennabody + \pgf@circ@antennawaves + } +} + +\pgfdeclareshape{bareRXantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen + \pgf@x=\pgf@circ@res@step + \pgf@y=2\pgf@circ@res@step + } + \savedanchor{\savedwaves}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen + \pgf@x=-4.2\pgf@circ@res@step + \pgf@y=\pgf@circ@res@step + } + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y + \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \anchor{waves}{\savedwaves} + \anchor{top}{\northeast\pgf@x=0pt} + \anchor{right}{\northeast\pgf@y=0.5\pgf@y} + \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{bottom}{\pgfpointorigin} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y} + \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{south}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \behindforegroundpath{ + \pgf@circ@antennabody + \pgftransformxshift{-5.2\pgf@circ@res@step} + \pgf@circ@antennawaves + } +} + +%%% dynodes (see https://github.com/circuitikz/circuitikz/issues/469) +\ctikzset{monopoles/dynode/width/.initial=0.4} +\ctikzset{monopoles/dynode/height/.initial=0.8} +\ctikzset{monopoles/dynode/arc pos/.initial=0.5} +\ctikzset{monopoles/dynode/arc angle/.initial=30} +\ctikzset{monopoles/dynode/top width/.initial=1.0} + +\pgfdeclareshape{dynode}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/dynode/width}\pgf@circ@scaled@Rlen + \pgf@x=0.5\pgf@x + \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen + } + \savedanchor{\arcpos}{% bottom part of the arc pos + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=0pt + \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen + \pgf@y=\ctikzvalof{monopoles/dynode/arc pos}\pgf@y + } + \savedanchor{\topright}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/dynode/width}\pgf@circ@scaled@Rlen + \pgf@x=\ctikzvalof{monopoles/dynode/top width}\pgf@x + \pgf@x=0.5\pgf@x + \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen + } + \anchor{arc}{\arcpos} + \anchor{top right}{\topright} + \anchor{top left}{\topright\pgf@x=-\pgf@x} + \anchor{text}{ + \northeast + \advance\pgf@x by 4pt\relax + \pgf@y=\dimexpr0.5\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \anchor{top}{\northeast\pgf@x=0pt} + \anchor{right}{\northeast\pgf@y=0.5\pgf@y} + \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{bottom}{\pgfpointorigin} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y} + \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{south}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \behindforegroundpath{ + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@scaled@Rlen=\scaledRlen + \pgfsetcolor{\ctikzvalof{color}} + \northeast + \pgf@circ@res@right=\pgf@x + \pgf@circ@res@up=\pgf@y + \arcpos + \pgf@circ@res@step=\pgf@y + % top + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{monopoles/dynode/top width}*\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{monopoles/dynode/top width}*\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + % arc + \edef\@@angle{\ctikzvalof{monopoles/dynode/arc angle}} + \ifnum90=\@@angle\else % avoid divisions by zero + % radius + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right/cos(\@@angle)} + % start angle y position + \pgfmathsetlength{\pgf@circ@res@step}{\pgf@circ@res@step+\pgf@circ@res@other*(1-sin(\@@angle))} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@step}} + \pgfpatharc{-180+\@@angle}{-\@@angle}{\pgf@circ@res@other} + \fi + % tail + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfusepath{draw} + } +} +% Microstrip monopoles + +\pgfdeclareshape{mslstub}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor{\southeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen + \pgf@y=-.5\pgf@y + } + \savedanchor{\northwest}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen + \pgf@x=-.5\pgf@x + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + } + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{east}{\southeast\pgf@y=0pt\relax} + \anchor{south east}{\southeast} + \anchor{south}{\southeast\pgf@x=0pt\relax} + \anchor{south west}{\southeast\pgf@x=-\pgf@x} + \anchor{west}{\northwest\pgf@y=0pt\relax} + \anchor{north west}{\northwest} + % + \anchor{center}{\northwest\pgf@y=0pt\relax} + \anchor{left}{\northwest\pgf@y=0pt\relax} + \anchor{right}{\southeast\pgf@y=0pt\relax} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } + \behindbackgroundpath{ + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@right}{\southeast} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfextracty{\pgf@circ@res@down}{\southeast} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfstartlinewidth=\pgflinewidth + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \endpgfscope + } +} + +\pgfdeclareshape{msrstub}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor{\southeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=0pt\relax + } + \savedanchor{\northwest}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen + \pgf@x=-.5\pgf@x + \pgf@y=\ctikzvalof{monopoles/msrstub/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + } + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{east}{\southeast\pgf@y=0pt\relax} + \anchor{south east}{\southeast} + \anchor{south}{\southeast\pgf@x=0pt\relax} + \anchor{south west}{\southeast\pgf@x=-\pgf@x} + \anchor{west}{\northwest\pgf@y=0pt\relax} + \anchor{north west}{\northwest} + % + \anchor{center}{\pgfpointorigin} + \anchor{left}{\pgfpointorigin} + \anchor{right}{\pgfpointorigin} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } + \behindbackgroundpath{ + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@right}{\southeast} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfextracty{\pgf@circ@res@down}{\southeast} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfstartlinewidth=\pgflinewidth + \pgfscope + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@step}} + \pgfusepath{draw} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointpolar{135}{\pgf@circ@res@step}} + \pgfpatharc{135}{45}{\pgf@circ@res@step} + \pgfpathlineto{\pgfpointpolar{45}{\pgf@circ@res@up}} + \pgfpatharc{45}{135}{\pgf@circ@res@up} + \pgfclosepath + \pgf@circ@draworfill + \endpgfscope + } +} + +\pgfdeclareshape{msport}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor{\southeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen + \pgf@y=-.5\pgf@y + } + \savedanchor{\northwest}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen + \pgf@x=-.5\pgf@x + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + } + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{east}{\southeast\pgf@y=0pt\relax} + \anchor{south east}{\southeast} + \anchor{south}{\southeast\pgf@x=0pt\relax} + \anchor{south west}{\southeast\pgf@x=-\pgf@x} + \anchor{west}{\northwest\pgf@y=0pt\relax} + \anchor{north west}{\northwest} + % + \anchor{center}{\northwest\pgf@y=0pt\relax} + \anchor{left}{\northwest\pgf@y=0pt\relax} + \anchor{right}{\southeast\pgf@y=0pt\relax} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr-.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + } + \behindbackgroundpath{ + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@right}{\southeast} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfextracty{\pgf@circ@res@down}{\southeast} + \pgfmathsetlength{\pgf@circ@res@step}{0.5*\pgf@circ@res@up} + \pgfstartlinewidth=\pgflinewidth + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + } +} + +% Legacy antennas (with tails) +\def\pgf@circ@shift@antenna@xy#1#2{% + \pgf@y=\dimexpr\pgf@y+#2\pgf@circ@res@step + \pgf@x=\dimexpr\pgf@x+#1\pgf@circ@res@step +\relax} + +% Legacy antenna +\pgfdeclareshape{antenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen + \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth + \pgf@y=4\pgf@circ@res@step + } + \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{2}} + \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{0}{3}\relax} + \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{4}\relax} + \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{3}} + \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{0}{2}} + \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{2}} + \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{0}{4}} + \anchor{south west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{4}} + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/antenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/antenna/label/yanchor}\pgf@y + } + \behindforegroundpath{ + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen + + \pgftransformxshift{ -4\pgf@circ@res@step } + + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{0pt}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{5\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{3\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfusepath{draw} + \endpgfscope + \pgfsetlinewidth{\pgfstartlinewidth} + + } +} + +% Legacy TX antenna +\pgfdeclareshape{txantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen + \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth + \pgf@y=4\pgf@circ@res@step + } + \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}} + \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax} + \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax} + \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}} + \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}} + \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}} + \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}} + \anchor{south west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}} + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/txantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/txantenna/label/yanchor}\pgf@y + } + \behindforegroundpath{ + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/txantenna/width}\pgf@circ@scaled@Rlen + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}} + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{0pt}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{5\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{3\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfusepath{draw} + \endpgfscope + \pgfpathmoveto{\pgfpoint{5.5\pgf@circ@res@step}{6\pgf@circ@res@step}} + % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step} + \pgfpatharc{30}{-30}{2\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{6.25\pgf@circ@res@step}} + \pgfpatharc{30}{-30}{2.5\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.5\pgf@circ@res@step}} + \pgfpatharc{30}{-30}{3\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.75\pgf@circ@res@step}} + \pgfpatharc{30}{-30}{3.5\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{7\pgf@circ@res@step}} + \pgfpatharc{30}{-30}{4\pgf@circ@res@step} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + + } +} + +% Legacy RX antenna +\pgfdeclareshape{rxantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen + \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth + \pgf@y=4\pgf@circ@res@step + } + \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}} + \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax} + \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax} + \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}} + \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}} + \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}} + \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}} + \anchor{south west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}} + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/rxantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/rxantenna/label/yanchor}\pgf@y + } + \behindforegroundpath{ + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/rxantenna/width}\pgf@circ@scaled@Rlen + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}} + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{0pt}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{5\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{3\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{7\pgf@circ@res@step}} + % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step} + \pgfpatharc{150}{210}{4\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.75\pgf@circ@res@step}} + \pgfpatharc{150}{210}{3.5\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.5\pgf@circ@res@step}} + \pgfpatharc{150}{210}{3\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{6.25\pgf@circ@res@step}} + \pgfpatharc{150}{210}{2.5\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{8\pgf@circ@res@step}{6\pgf@circ@res@step}} + \pgfpatharc{150}{210}{2\pgf@circ@res@step} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + } +} + +% Legacy match +\pgfdeclareshape{match}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor{\northeast}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen + \pgf@x=2\pgf@circ@res@step + \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@circ@res@step% + } + % the center is on the left side of the shape for facility of usage + \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x\relax} + \anchor{west}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=0cm\relax} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\pgfpointorigin} + \anchor{center}{ + \pgfpointorigin + } + \anchor{text}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen + \pgf@x=1.5\pgf@x + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \pgf@y=-1.5\ht\pgfnodeparttextbox + } + \behindforegroundpath{ + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen + + \pgfscope + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0pt}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0}} + \pgfusepath{fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + \endpgfscope + } +} + +%%%---------- close: tex/pgfcircmonopoles +%%%%%%%%%%% Springe nach tex/pgfcircbipoles +%%%---------- open: tex/pgfcircbipoles.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%% Generic macro for defining a bipole shape +% #1 - additional anchors +% #2 - lower y-size of the bipole (from the center). +% #3 - #shape is the name of the shape +% #4 - upper y-size of the bipole (from the center) +% #5 - width of the bipole +% #6 - macros drawing the bipole +% +\long\def\pgfcircdeclarebipole{% + \pgfcircdeclarebipolescaled{default}} + +%% Generic macro for defining a bipole shape +% #1 - scale factor +% #2 - additional anchors +% #3 - lower y-size of the bipole (from the center). +% #4 - #shape is the name of the shape +% #5 - upper y-size of the bipole (from the center) +% #6 - width of the bipole +% #7 - macros drawing the bipole +% +\long\def\pgfcircdeclarebipolescaled#1#2#3#4#5#6#7{ + \pgfdeclareshape{#4shape}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{#1}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor{\northeast}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=#5\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=#6\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor{\northeastborder}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=#5\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y + \pgf@x=#6\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x + } + \savedanchor{\southwestborder}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=-#3\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y + \pgf@x=-#6\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x + } + \savedanchor{\southwest}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=-#3\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-#6\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor{\centerpoint}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@circ@res@down=-#3\pgf@circ@scaled@Rlen + \pgf@circ@res@up=#5\pgf@circ@scaled@Rlen + \pgfpointorigin + \pgf@y=\pgf@circ@res@up + \advance\pgf@y by\pgf@circ@res@down + \pgf@y=.5\pgf@y + } + \anchor{center}{\pgfpointorigin} + \anchor{n}{ + \northeast + \pgf@x=0cm + } + \anchor{north east}{ + \northeast + } + \anchor{north west}{ + \northeast + \pgf@x=-\pgf@x + } + \anchor{ne}{ + \northeast + } + \anchor{nw}{ + \northeast + \pgf@x=-\pgf@x + } + \anchor{e}{ + \northeast + \pgf@y=0cm + } + \anchor{s}{ + \southwest + \pgf@x=0cm + } + \anchor{south east}{ + \southwest + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \southwest + } + \anchor{se}{ + \southwest + \pgf@x=-\pgf@x + } + \anchor{sw}{ + \southwest + } + \anchor{w}{ + \southwest + \pgf@y=0cm + } + \anchor{north}{ + \northeast + \pgf@x=0cm + } + \anchor{east}{ + \northeast + \pgf@y=0cm + } + \anchor{south}{ + \southwest + \pgf@x=0cm + } + \anchor{west}{ + \southwest + \pgf@y=0cm + } + \anchor{right}{ + \northeast + \pgf@y=0cm + } + \anchor{above}{ + \northeast + \pgf@x=0cm + } + \anchor{left}{ + \southwest + \pgf@y=0cm + } + \anchor{below}{ + \southwest + \pgf@x=0cm + } + \anchor{a}{ + \northeast + \pgf@y=0cm + } + \anchor{b}{ + \southwest + \pgf@y=0cm + } + \savedanchor{\textanchor}{% + \pgf@y=\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \anchor{text}{ + \textanchor + } + \anchorborder{% + \ifpgf@circuit@bipole@inverted + \pgf@circ@res@left=-\pgf@x + \pgf@circ@res@up=-\pgf@y + \else + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \fi + \ifdim\pgf@circ@res@up>0cm + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\northeastborder} + \else + \southwestborder + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-\pgf@x}{-\pgf@y}} + \fi + } + + #2 + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northeast + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@zero = 0cm + \pgf@circ@res@left = -\pgf@x + \pgf@circ@res@right = \pgf@x + \southwest + \pgf@circ@res@down = \pgf@y + \pgf@circ@scaled@Rlen=\scaledRlen + \pgfstartlinewidth=\pgflinewidth + \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners! + #7 + + \pgfsetlinewidth{\pgfstartlinewidth} + } + } +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% anchor adjustment macros +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Extend the border anchor position by the specified factors on the right-top (north east corner) +% and the left-down (southwest border). Argument must be number (possibly decimal) without sign + +\def\pgfcirc@border@extend@full#1#2#3#4{% right, top, left, down + \anchorborder{% + \ifpgf@circuit@bipole@inverted + \pgf@circ@res@left=-\pgf@x + \pgf@circ@res@up=-\pgf@y + \else + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \fi + \ifdim\pgf@circ@res@up>0cm + \northeastborder + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{#1\pgf@x}{#2\pgf@y}} + \else + \southwestborder + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-#3\pgf@x}{-#4\pgf@y}} + \fi + } +} + +% Just up and down (very common) +\def\pgfcirc@border@extend@updown#1#2{\pgfcirc@border@extend@full{1}{#1}{1}{#2}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Standard bipole shapes declarations +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%% +% Resistive components +%%%%%%%%%%%%%%%%%%%%%%%% + +%% Short circuit + +%%% NOTICE that the short is really NOT drawn; we trust the fact that its +%%% natural length is zero. +\pgfcircdeclarebipole +{% fix the anchor border to add a bit of space for voltage and labels + % it uses the dummy width and height + \anchorborder{% + \ifpgf@circuit@bipole@inverted + \pgf@circ@res@left=-\pgf@x + \pgf@circ@res@up=-\pgf@y + \else + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \fi + \ifdim\pgf@circ@res@up>0cm + \pgf@x=\ctikzvalof{bipoles/short/width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{bipoles/short/height}\pgf@circ@Rlen + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{\pgf@x}{\pgf@y}} + \else + \pgf@x=-\ctikzvalof{bipoles/short/width}\pgf@circ@Rlen + \pgf@y=-\ctikzvalof{bipoles/short/height}\pgf@circ@Rlen + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{-\pgf@x}{-\pgf@y}} + \fi + } +} +{0} +{short} +{0} +{0} +{} + +%% Open circuit +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/open/height}} +{open} +{\ctikzvalof{bipoles/open/height}} +{\ctikzvalof{bipoles/open/width}} +{} + +% multiwire(s) +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/multiwire/height}} +{multiwire} +{\ctikzvalof{bipoles/multiwire/height}} +{\ctikzvalof{bipoles/multiwire/width}} +{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} +} + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/multiwire/height}} +{bmultiwire} +{\ctikzvalof{bipoles/multiwire/height}} +{\ctikzvalof{bipoles/multiwire/width}} +{ + \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} +} + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/multiwire/height}} +{tmultiwire} +{\ctikzvalof{bipoles/multiwire/height}} +{\ctikzvalof{bipoles/multiwire/width}} +{ + \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+2\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} +} + +% +% +%% Generic bipole - used as resistor by some (bleah) +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/generic/height}} +{generic} +{\ctikzvalof{bipoles/generic/height}} +{\ctikzvalof{bipoles/generic/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill +} + +% +% generic crossed, suggested by Radványi Patrik Tamás +% inherit "generic" properties +% +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/generic/height}} +{xgeneric} +{\ctikzvalof{bipoles/generic/height}} +{\ctikzvalof{bipoles/generic/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + % cross it + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} +} +%% Generic empty tunable +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/tgeneric/height}} +{tgeneric} +{\ctikzvalof{bipoles/tgeneric/height}} +{\ctikzvalof{bipoles/tgeneric/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Generic asymmetric bipole +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/ageneric/height}} +{ageneric} +{\ctikzvalof{bipoles/ageneric/height}} +{\ctikzvalof{bipoles/ageneric/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{stroke,fill} +} + +%% Memristor +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/memristor/height}} +{memristor} +{\ctikzvalof{bipoles/memristor/height}} +{\ctikzvalof{bipoles/memristor/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.8*\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{stroke,fill} +} + +%% Photoresistor +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/photoresistor/height 2}} +{photoresistor} +{\ctikzvalof{bipoles/photoresistor/height}} +{\ctikzvalof{bipoles/photoresistor/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{-1.2\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@right}{-1.2\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Thermistor +\pgfcircdeclarebipolescaled{resistors} +{% anchor for labelling the type of dependency + \anchor{label}{% + \southwest + \pgf@x=0.4\pgf@x + \pgf@y=1.2\pgf@y + }% + \pgfcirc@border@extend@updown{1}{1.2} +} +{\ctikzvalof{bipoles/thermistor/height}} +{thermistor} +{\ctikzvalof{bipoles/thermistor/height}} +{\ctikzvalof{bipoles/thermistor/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/thermistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/thermistor/main}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + %\pgfscope + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{1.2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.2\pgf@circ@res@down}} + \pgfusepath{draw} + %\endpgfscope +} + +%% Thermistor PTC +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/thermistorptc/height 2}} +{thermistorptc} +{\ctikzvalof{bipoles/thermistorptc/height}} +{\ctikzvalof{bipoles/thermistorptc/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/thermistorptc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/thermistorptc/main}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfusepath{draw} +} + +%% Thermistor NTC +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/thermistorntc/height 2}} +{thermistorntc} +{\ctikzvalof{bipoles/thermistorntc/height}} +{\ctikzvalof{bipoles/thermistorntc/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/thermistorntc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/thermistorntc/main}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} +} + +%% Generic tunable +\pgfcircdeclarebipolescaled{resistors} +{ + \savedanchor{\wiper}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@ya=\ctikzvalof{bipoles/generic potentiometer/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@ya + \pgf@xa=\ctikzvalof{bipoles/generic potentiometer/width}\pgf@circ@scaled@Rlen + \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/generic potentiometer/wiper pos}-0.5)*\pgf@xa} + } + \anchor{wiper}{\wiper} + \anchor{W}{\wiper} +} +{\ctikzvalof{bipoles/generic potentiometer/height 2}} +{genericpotentiometer} +{\ctikzvalof{bipoles/generic potentiometer/height}} +{\ctikzvalof{bipoles/generic potentiometer/width}} +{ + + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfscope + %\pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \pgfextractx{\pgf@circ@res@other}{\wiper} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Zig zag resistores +\def\pgf@circ@zigzag#1{% + \divide \pgf@circ@res@step by \numexpr4*\zigs\relax + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \pgf@circ@count@a=\zigs\relax + % first half zig + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}} + \pgfmathloop% + \advance\pgf@circ@count@a by -1\relax% Loop zigs -1 times + \ifnum\pgf@circ@count@a>0 + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}} + \repeatpgfmathloop% + % last zig and a half + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfsetbeveljoin + \pgfusepath{draw} +} + +%% Resistor +\pgfcircdeclarebipolescaled{resistors} +{ +\savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}} +} +{\ctikzvalof{bipoles/resistor/height}} +{resistor} +{\ctikzvalof{bipoles/resistor/height}} +{\ctikzvalof{bipoles/resistor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgf@circ@zigzag{1} +} + + +%% Variable resistor +\pgfcircdeclarebipolescaled{resistors} +{ +\savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}} +} +{\ctikzvalof{bipoles/vresistor/height}} +{vresistor} +{\ctikzvalof{bipoles/vresistor/height}} +{\ctikzvalof{bipoles/vresistor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/vresistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgf@circ@zigzag{.5} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Potentiometer +\pgfcircdeclarebipolescaled{resistors} +{ + \savedanchor{\wiper}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@ya=\ctikzvalof{bipoles/potentiometer/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@ya + \pgf@xa=\ctikzvalof{bipoles/potentiometer/width}\pgf@circ@scaled@Rlen + \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/potentiometer/wiper pos}-0.5)*\pgf@xa} + } + \anchor{wiper}{\wiper} + \anchor{W}{\wiper} + \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}} +} +{\ctikzvalof{bipoles/potentiometer/height 2}} +{potentiometer} +{\ctikzvalof{bipoles/potentiometer/height}} +{\ctikzvalof{bipoles/potentiometer/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/potentiometer/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgf@circ@zigzag{1} + + \pgfscope + %\pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \pgfextractx{\pgf@circ@res@other}{\wiper} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Resistive sensor +\pgfcircdeclarebipolescaled{resistors} +{% anchor for labelling the type of dependency + \anchor{label}{\southwest\pgf@x=0.4\pgf@x}% + \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}} +} +{\ctikzvalof{bipoles/resistivesens/height}} +{resistivesens} +{\ctikzvalof{bipoles/resistivesens/height}} +{\ctikzvalof{bipoles/resistivesens/width}} +{% + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistivesens/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgf@circ@zigzag{.5} + + \pgfscope + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%%%%%%%%%%%%%% +%% Capacitors +%%%%%%%%%%%%% + +%% Plain Capacitor +\pgfcircdeclarebipolescaled{capacitors} +{} +{\ctikzvalof{bipoles/capacitor/height}} +{capacitor} +{\ctikzvalof{bipoles/capacitor/height}} +{\ctikzvalof{bipoles/capacitor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + +} + +%% Capacitive sensor +\pgfcircdeclarebipolescaled{capacitors} +{ + \anchor{label}{\southwest\pgf@x=2.6\pgf@x\pgf@y=1.2\pgf@y}% + \pgfcirc@border@extend@full{2.6}{1}{4.4}{1.2} +} +{\ctikzvalof{bipoles/capacitor/height}} +{capacitivesens} +{\ctikzvalof{bipoles/capacitor/height}} +{\ctikzvalof{bipoles/capacitor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfscope + \pgfpathmoveto{\pgfpoint{2.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-2.6\pgf@circ@res@right}{1.2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-4.4\pgf@circ@res@right}{1.2\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Polar Capacitor (DEPRECATED) +\pgfcircdeclarebipolescaled{capacitors} +{} +{\ctikzvalof{bipoles/pcapacitor/height}} +{polarcapacitor} +{\ctikzvalof{bipoles/pcapacitor/height}} +{\ctikzvalof{bipoles/pcapacitor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+ \ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgftransformrotate{-90} + \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}} + \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} +} + + +%% Curved capacitor +% see https://tex.stackexchange.com/questions/509594/polar-capacitor-orientation-in-circuitikz-seems-wrong +% for a rationale +% +\pgfcircdeclarebipolescaled{capacitors} +{} +{\ctikzvalof{bipoles/ccapacitor/height}} +{ccapacitor} +{\ctikzvalof{bipoles/ccapacitor/height}} +{\ctikzvalof{bipoles/ccapacitor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+ \ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgftransformrotate{-90} + \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}} + \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} +} + + + + +%% Electrolytic Capacitor +\pgfcircdeclarebipolescaled{capacitors} +{} +{\ctikzvalof{bipoles/ecapacitor/height}} +{ecapacitor} +{\ctikzvalof{bipoles/ecapacitor/height}} +{\ctikzvalof{bipoles/ecapacitor/width}} +{ + \pgfsetrectcap + % % % Draw plus pole + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgf@circ@draworfill + % % Draw minus pole + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfsetfillcolor{\ctikzvalof{color}} + \pgfusepath{draw,fill} + \pgfsetfillcolor{\ctikzvalof{color}} + % % plus pole annotation + \pgftext[right,at=\pgfpoint{1.2\pgf@circ@res@left}{.6\pgf@circ@res@up}] + {\ctikzvalof{bipoles/ecapacitor/font} $+$} +} + +%% Variable Capacitor +\pgfcircdeclarebipolescaled{capacitors} +{} +{\ctikzvalof{bipoles/vcapacitor/height}} +{vcapacitor} +{\ctikzvalof{bipoles/vcapacitor/height}} +{\ctikzvalof{bipoles/vcapacitor/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/capacitor width} \pgf@circ@res@right + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfusepath{draw} +} + + +%% Piezoelectric Element + +\pgfcircdeclarebipolescaled{capacitors} +{} +{\ctikzvalof{bipoles/piezoelectric/height}} +{piezoelectric} +{\ctikzvalof{bipoles/piezoelectric/height}} +{\ctikzvalof{bipoles/piezoelectric/width}} +{ + % \pgf@circ@res@step = \ctikzvalof{bipoles/piezoelectric/width}\pgf@circ@Rlen + % \divide \pgf@circ@res@step by 5 + + %% Outer markings + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + %% Inner Box + \pgf@circ@res@step = \pgf@circ@res@right \divide \pgf@circ@res@step by 10 + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners + {\pgfpoint{\pgf@circ@res@left+4*\pgf@circ@res@step}{\pgf@circ@res@up-\pgf@circ@res@step}} + {\pgfpoint{\pgf@circ@res@right-4*\pgf@circ@res@step}{\pgf@circ@res@down+\pgf@circ@res@step}} + \pgf@circ@draworfill + \endpgfscope +} + +%%%%%%%%%%%%%%% +%% Inductors +%%%%%%%%%%%%%%% + +%% cute inductor +\pgfcircdeclarebipolescaled{inductors} +{ + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?% + \ctikzvalof{bipoles/cuteinductor/height} :% even + -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} +} +{\ctikzvalof{bipoles/cuteinductor/lower coil height}} +{cuteinductor} +{\ctikzvalof{bipoles/cuteinductor/height}} +{\ctikzvalof{bipoles/cuteinductor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@other}%width of small coil + {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)} + + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down} + } + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} +} + +%% cute inductive sensor +\pgfcircdeclarebipolescaled{inductors} +{% anchor for labelling the type of dependency + \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}% + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?% + \ctikzvalof{bipoles/cuteinductor/height} :% even + -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} + \pgfcirc@border@extend@full{1}{2}{1.6}{2.6} +} +{\ctikzvalof{bipoles/cuteinductor/lower coil height}} +{scuteinductor} +{\ctikzvalof{bipoles/cuteinductor/height}} +{\ctikzvalof{bipoles/cuteinductor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@other}%width of small coil + {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)} + + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down} + } + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} + \pgfscope + \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% cute choke +\pgfcircdeclarebipolescaled{inductors} +{ + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?% + \ctikzvalof{bipoles/cuteinductor/height} :% even + -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} +} +{\ctikzvalof{bipoles/cutechoke/lower coil height}} +{cutechoke} +{\ctikzvalof{bipoles/cutechoke/height}} +{\ctikzvalof{bipoles/cutechoke/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@other}%width of small coil + {0.5*\ctikzvalof{bipoles/cutechoke/coil aspect}*\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen/(\ctikzvalof{bipoles/cutechoke/coils}-1)} + + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cutechoke/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cutechoke/coils}/2} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {2,...,\ctikzvalof{bipoles/cutechoke/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down} + } + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth} + \pgfusepath{stroke} + + \ifpgf@circuit@bipole@twolineschoke + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up+\ctikzvalof{bipoles/cutechoke/cstep}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up+\ctikzvalof{bipoles/cutechoke/cstep}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth} + \pgfusepath{stroke} + \fi +} + +%% variable cute inductor +\pgfcircdeclarebipolescaled{inductors} +{ + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?% + \ctikzvalof{bipoles/cuteinductor/height} :% even + -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} +} +{\ctikzvalof{bipoles/vcuteinductor/lower coil height}} +{vcuteinductor} +{\ctikzvalof{bipoles/vcuteinductor/height}} +{\ctikzvalof{bipoles/vcuteinductor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@other}%width of small coil + {0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)} + + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {2,...,\ctikzvalof{bipoles/vcuteinductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up} + \pgfpatharc{0}{-180}{\pgf@circ@res@other and -.5\pgf@circ@res@down} + } + \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} +} + +%% american inductor +\pgfcircdeclarebipolescaled{inductors} +{ + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?% + 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even + 0) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} +} +{\ctikzvalof{bipoles/americaninductor/height 2}} +{americaninductor} +{\ctikzvalof{bipoles/americaninductor/height}} +{\ctikzvalof{bipoles/americaninductor/width}} +{ + \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth + \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils} + \divide \pgf@circ@res@step by 2 + \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} + } + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} +} + + +%% american inductive sensor +\pgfcircdeclarebipolescaled{inductors} +{% anchor for labelling the type of dependency + \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}% + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?% + 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even + 0) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} + \pgfcirc@border@extend@full{1}{2}{1.6}{2.6} +} +{\ctikzvalof{bipoles/americaninductor/height 2}} +{samericaninductor} +{\ctikzvalof{bipoles/americaninductor/height}} +{\ctikzvalof{bipoles/americaninductor/width}} +{ + \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth + \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils} + \divide \pgf@circ@res@step by 2 + \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} + } + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} + \pgfscope + \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% variable american inductor +\pgfcircdeclarebipolescaled{inductors} +{ + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/vamericaninductor/coils},2) ?% + 2*\ctikzvalof{bipoles/vamericaninductor/coil height} :% even + 0) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} +} +{\ctikzvalof{bipoles/vamericaninductor/height 2}} +{vamericaninductor} +{\ctikzvalof{bipoles/vamericaninductor/height}} +{\ctikzvalof{bipoles/vamericaninductor/width}} +{ + \pgf@circ@res@step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf@circ@scaled@Rlen + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth + \divide \pgf@circ@res@step by \ctikzvalof{bipoles/vamericaninductor/coils} + \divide \pgf@circ@res@step by 2 + \pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@scaled@Rlen + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {1,...,\ctikzvalof{bipoles/vamericaninductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} + } + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Generic bipole, filled - used as inductor by some +\pgfcircdeclarebipolescaled{inductors} +{ + \anchor{midtap}{\northeast\pgf@x=0pt\relax} +} +{\ctikzvalof{bipoles/fullgeneric/height}} +{fullgeneric} +{\ctikzvalof{bipoles/fullgeneric/height}} +{\ctikzvalof{bipoles/fullgeneric/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfusepath{draw,fill} +} + +%% Generic sensor, filled - used as inductive sensor by some +\pgfcircdeclarebipolescaled{inductors} +{% anchor for labelling the type of dependency + \anchor{label}{\southwest\pgf@x=0.4\pgf@x\pgf@y=2\pgf@y}% + \anchor{midtap}{\northeast\pgf@x=0pt\relax} + \pgfcirc@border@extend@full{1}{2}{1}{2} +} +{\ctikzvalof{bipoles/fullgeneric/height}} +{sfullgeneric} +{\ctikzvalof{bipoles/fullgeneric/height}} +{\ctikzvalof{bipoles/fullgeneric/width}} +{ + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfusepath{draw,fill} + %\pgfscope + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{2\pgf@circ@res@down}} + \pgfusepath{draw} + %\endpgfscope +} + +%% Generic full tunable +\pgfcircdeclarebipolescaled{inductors} +{ + \anchor{midtap}{\northeast\pgf@x=0pt\relax} +} +{\ctikzvalof{bipoles/tfullgeneric/height}} +{tfullgeneric} +{\ctikzvalof{bipoles/tfullgeneric/height}} +{\ctikzvalof{bipoles/tfullgeneric/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfusepath{draw,fill} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%%%%%%%%%%% +%% Battery +%%%%%%%%%%% + +%% Battery +\pgfcircdeclarebipolescaled{batteries} +{} +{\ctikzvalof{bipoles/battery/height}} +{battery} +{\ctikzvalof{bipoles/battery/height}} +{\ctikzvalof{bipoles/battery/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 6 + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \ifpgf@circ@fixbatteries + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +} + + +%% Battery 1 % poles with equl thickness + +\pgfcircdeclarebipolescaled{batteries} +{} +{\ctikzvalof{bipoles/battery1/height}} +{battery1} +{\ctikzvalof{bipoles/battery1/height}} +{\ctikzvalof{bipoles/battery1/width}} +{ + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \ifpgf@circ@fixbatteries + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +} + +%% Battery 2 % negative pole thicker + +\pgfcircdeclarebipolescaled{batteries} +{} +{\ctikzvalof{bipoles/battery2/height}} +{battery2} +{\ctikzvalof{bipoles/battery2/height}} +{\ctikzvalof{bipoles/battery2/width}} +{ + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \ifpgf@circ@fixbatteries + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfsetlinewidth{3\pgflinewidth} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfsetlinewidth{3\pgflinewidth} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +} + +%%%%%%%%%%% +%% Round and diamond sources +%%%%%%%%%%% + +%% Independent voltage source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/vsource/height}} +{vsource} +{\ctikzvalof{bipoles/vsource/height}} +{\ctikzvalof{bipoles/vsource/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} +} + +%% To change the internal symbols of the voltage source american style +\ctikzset{bipoles/vsourceam/inner plus/.initial={$+$}} +\ctikzset{bipoles/vsourceam/inner minus/.initial={$-$}} +%% Independent voltage source - American style +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/vsourceam/height}} +{vsourceAM} +{\ctikzvalof{bipoles/vsourceam/height}} +{\ctikzvalof{bipoles/vsourceam/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfsetcolor{\ctikzvalof{color}} + \ifpgf@circ@oldvoltagedirection + \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner plus}} + \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner minus}} + \else + \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner minus}} + \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner plus}} + \fi +} + +%% Independent sinusoidal voltage source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/vsourcesin/height}} +{vsourcesin} +{\ctikzvalof{bipoles/vsourcesin/height}} +{\ctikzvalof{bipoles/vsourcesin/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +% Square Voltage source - contributed by Alistair Kwan +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/vsourcesquare/height}} +{vsourcesquare} +{\ctikzvalof{bipoles/vsourcesquare/height}} +{\ctikzvalof{bipoles/vsourcesquare/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}} + \pgfpathlineto{\pgfpoint{-1\pgf@circ@res@up}{1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{-1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{-1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +% Triangle Voltage source - contributed by Ralf Farkas +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/vsourcetri/height}} +{vsourcetri} +{\ctikzvalof{bipoles/vsourcetri/height}} +{\ctikzvalof{bipoles/vsourcetri/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}} + \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@up}{0.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@up}{-0.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + + +%% PV Source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/pvsource/height}} +{pvsource} +{\ctikzvalof{bipoles/pvsource/height}} +{\ctikzvalof{bipoles/pvsource/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@down}} + \pgfusepath{draw} + + %Arrow Part + \pgfscope + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}} + \pgfusepath{draw} + \endpgfscope + +} + +%% Empty Source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/esource/height}} +{esource} +{\ctikzvalof{bipoles/esource/height}} +{\ctikzvalof{bipoles/esource/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill +} + +%% DC Current Source with open shape +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/dcisource/height}} +{dcisource} +{\ctikzvalof{bipoles/dcisource/height}} +{\ctikzvalof{bipoles/dcisource/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@maybefill + \edef\@@angle{\ctikzvalof{bipoles/dcisource/angle}} + \pgfpathmoveto{\pgfpointpolar{\@@angle}{\pgf@circ@res@up}} + \pgfpatharc{\@@angle}{-\@@angle}{\pgf@circ@res@up} + \pgfpathmoveto{\pgfpointpolar{180-\@@angle}{\pgf@circ@res@up}} + \pgfpatharc{180-\@@angle}{180+\@@angle}{\pgf@circ@res@up} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope +} + +%% DC-Voltage source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/dcvsource/height}} +{dcvsource} +{\ctikzvalof{bipoles/dcvsource/height}} +{\ctikzvalof{bipoles/dcvsource/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@left}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@right}} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@left}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@right}} + \pgfusepath{draw} +} + +%% Independent current source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/isource/height}} +{isource} +{\ctikzvalof{bipoles/isource/height}} +{\ctikzvalof{bipoles/isource/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgf@circ@draworfill +} + +%% Independent double oo source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/oosource/height}} +{oosource} +{\ctikzvalof{bipoles/oosource/height}} +{\ctikzvalof{bipoles/oosource/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}} + {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left} + \pgf@circ@maybefill + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@right}{0}} + {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@right} + \pgf@circ@draworfill + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}} + {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left} + \pgfusepath{draw} +} + +% % % winding symbols +% triangle +\def\pgf@circ@delta#1{ + \pgfscope + \pgftransformscale{-.01\pgf@circ@res@left*#1} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \pgftransformrotate{-\pgfcircmathresult} + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0}{.866\pgf@circ@res@up}} + \pgfpathclose + \pgfusepath{stroke} + \endpgfscope +} + +% star +\def\pgf@circ@wye#1{ + \pgfscope + \pgftransformscale{-.015\pgf@circ@res@left*#1} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \pgftransformrotate{-\pgfcircmathresult} + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpointorigin} + \pgfpathlineto{\pgfpointpolar{-30}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpointpolar{-150}{\pgf@circ@res@down}} + \pgfusepath{stroke} + \endpgfscope +} + +% zigzag +\def\pgf@circ@zig#1{ + \pgfscope + \pgftransformscale{-.015\pgf@circ@res@left*#1} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \pgftransformrotate{-\pgfcircmathresult} + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpointpolar{90}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointpolar{60}{\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpointpolar{210}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointpolar{0}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpointpolar{330}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointpolar{-60}{\pgf@circ@res@up}} + \pgfusepath{stroke} + \endpgfscope +} + +% % % % round three-phase transformer +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/oosourcetrans/height}} +{oosourcetrans} +{\ctikzvalof{bipoles/oosourcetrans/height}} +{\ctikzvalof{bipoles/oosourcetrans/width}} +{ + + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}} + {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left} + \pgf@circ@maybefill + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@right}{0}} + {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right} + \pgf@circ@draworfill + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}} + {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left} + \pgfusepath{draw} + + +% % % % draw inner symbols + + %%primary winding + \ifpgf@circ@prim@delta + \pgfscope + \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left} + \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@prim@wye + \pgfscope + \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left} + \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@prim@zig + \pgfscope + \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left} + \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}} + \endpgfscope + \fi\fi\fi + + %%secondary winding + \ifpgf@circ@sec@delta + \pgfscope + \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right} + \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@sec@wye + \pgfscope + \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right} + \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@sec@zig + \pgfscope + \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right} + \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}} + \endpgfscope + \fi\fi\fi +} + + +% % % % ooosource for three phase transformer +\pgfcircdeclarebipolescaled{sources} +{ + \anchor{right}{ + \northeast + \pgf@y=0pt + \pgfmathparse{ + \ctikzvalof{bipoles/ooosource/circleoffset}* sin(30) + + %%the sqrt must be > 0, the circles have to intersect + sqrt( + pow(\ctikzvalof{bipoles/ooosource/circlesize},2) - + pow(\ctikzvalof{bipoles/ooosource/circleoffset}*cos(30),2) + ) + } + \pgf@x=\pgfmathresult\pgf@x + } + \anchor{east}{ + \northeast + \pgf@y=0pt + } + \savedanchor{\centerprim}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@scaled@Rlen + \pgf@y=0pt + \pgf@x=.5\pgf@circ@scaled@Rlen + } + \anchor{centerprim}{ + \centerprim + } + \savedanchor{\centersec}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@scaled@Rlen + \pgfpointpolar{60}{.5\pgf@circ@scaled@Rlen} + \pgf@y=-\pgf@y + \pgf@x=-\pgf@x + } + \anchor{centersec}{ + \centersec + } + \savedanchor{\centertert}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@scaled@Rlen + \pgfpointpolar{60}{.5\pgf@circ@scaled@Rlen} + \pgf@y=\pgf@y + \pgf@x=-\pgf@x + } + \anchor{centertert}{ + \centertert + } + + % add some anchors in case the are needed :) + \anchor{prim1}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen + \pgfpointadd{\centerprim}{\pgfpointpolar{135}{.5\pgf@circ@scaled@Rlen}} + } + \anchor{prim2}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen + \pgfpointadd{\centerprim}{\pgfpointpolar{-135}{.5\pgf@circ@scaled@Rlen}} + } + \anchor{sec1}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen + \pgfpointadd{\centersec}{\pgfpointpolar{0}{.5\pgf@circ@scaled@Rlen}} + } + \anchor{sec2}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen + \pgfpointadd{\centersec}{\pgfpointpolar{45}{.5\pgf@circ@scaled@Rlen}} + } + \anchor{sec3}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen + \pgfpointadd{\centersec}{\pgfpointpolar{90}{.5\pgf@circ@scaled@Rlen}} + } + \anchor{tert1}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen + \pgfpointadd{\centertert}{\pgfpointpolar{0}{.5\pgf@circ@scaled@Rlen}} + } + \anchor{tert2}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen + \pgfpointadd{\centertert}{\pgfpointpolar{-45}{.5\pgf@circ@scaled@Rlen}} + } + \anchor{tert3}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen + \pgfpointadd{\centertert}{\pgfpointpolar{-90}{.5\pgf@circ@scaled@Rlen}} + } +} +{\ctikzvalof{bipoles/ooosource/height}} +{ooosource} +{\ctikzvalof{bipoles/ooosource/height}} +{\ctikzvalof{bipoles/ooosource/height}} +{ +% \pgf@circ@res@other = \ctikzvalof{bipoles/ooosource/vectorgroup} \pgf@circ@scaled@Rlen + +% % filling +% left + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left} + \pgf@circ@maybefill + + % up + \pgfscope + \pgfpointorigin + \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right} + \pgf@circ@maybefill + \endpgfscope +% down + \pgfscope + \pgfpointorigin + \pgfpathcircle{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right} + \pgf@circ@draworfill + \endpgfscope + +% drawing + % left + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left} + \pgfusepath{draw} + + % up + \pgfscope + \pgfpointorigin + \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right} + \pgfusepath{draw} + \endpgfscope + +% % % draw inner symbols + +% % primary winding + \ifpgf@circ@prim@delta + \pgfscope + \pgftransformxshift{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left} + \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@prim@wye + \pgfscope + \pgftransformxshift{.6\pgf@circ@res@left} + \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@prim@zig + \pgfscope + \pgftransformxshift{.6\pgf@circ@res@left} + \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}} + \endpgfscope + \fi\fi\fi + +% % secondary winding + \ifpgf@circ@sec@delta + \pgfscope + \pgfpointorigin + \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}} + \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@sec@wye + \pgfscope + \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}} + \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@sec@zig + \pgfscope + \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}} + \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}} + \endpgfscope + \fi\fi\fi + +% % tertiary winding + \ifpgf@circ@tert@delta + \pgfscope + \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}} + \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@tert@wye + \pgfscope + \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}} + \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@tert@zig + \pgfscope + \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}} + \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}} + \endpgfscope + \fi\fi\fi +} + +%% Independent current source - American +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/isourceam/height}} +{isourceAM} +{\ctikzvalof{bipoles/isourceam/height}} +{\ctikzvalof{bipoles/isourceam/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope +} + +%% Independent sinusoidal current source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/isource/height}} +{isourcesin} +{\ctikzvalof{bipoles/isource/height}} +{\ctikzvalof{bipoles/isource/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Empty controlled source +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/ecsource/height}} +{ecsource} +{\ctikzvalof{bipoles/ecsource/height}} +{\ctikzvalof{bipoles/ecsource/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill +} + +%% Controlled voltage source +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/cvsource/height}} +{cvsource} +{\ctikzvalof{bipoles/cvsource/height}} +{\ctikzvalof{bipoles/cvsource/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} +} + +%% To change the internal symbols of the controlled voltage source american style +\ctikzset{bipoles/cvsourceam/inner plus/.initial={$+$}} +\ctikzset{bipoles/cvsourceam/inner minus/.initial={$-$}} +%% Controlled voltage source - American +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/cvsourceam/height}} +{cvsourceAM} +{\ctikzvalof{bipoles/cvsourceam/height}} +{\ctikzvalof{bipoles/cvsourceam/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + + \pgfsetcolor{\ctikzvalof{color}} + \ifpgf@circ@oldvoltagedirection + \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{\ctikzvalof{bipoles/cvsourceam/inner plus}} + \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{\ctikzvalof{bipoles/cvsourceam/inner minus}} + \else + \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{\ctikzvalof{bipoles/cvsourceam/inner minus}} + \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{\ctikzvalof{bipoles/cvsourceam/inner plus}} + \fi +} + +%% Controlled sinusoidal voltage source +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/cvsourcesin/height}} +{cvsourcesin} +{\ctikzvalof{bipoles/cvsourcesin/height}} +{\ctikzvalof{bipoles/cvsourcesin/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Controlled sinusoidal current source +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/cvsourcesin/height}} +{cisourcesin} +{\ctikzvalof{bipoles/cvsourcesin/height}} +{\ctikzvalof{bipoles/cvsourcesin/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Controlled current source +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/cisource/height}} +{cisource} +{\ctikzvalof{bipoles/cisource/height}} +{\ctikzvalof{bipoles/cisource/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfusepath{draw} +} + +%% Controlled current source - American +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/cisourceam/height}} +{cisourceAM} +{\ctikzvalof{bipoles/cisourceam/height}} +{\ctikzvalof{bipoles/cisourceam/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope +} + +%% Cute Independent voltage source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/vsource/height}} +{vsourceC} +{\ctikzvalof{bipoles/vsource/height}} +{\ctikzvalof{bipoles/vsource/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfsetroundcap\pgfusepath{draw} +} + +%% Cute Independent current source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/isource/height}} +{isourceC} +{\ctikzvalof{bipoles/isource/height}} +{\ctikzvalof{bipoles/isource/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}} + \pgfsetroundcap\pgfusepath{draw} +} + +%% Cute Controlled voltage source +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/cvsource/height}} +{cvsourceC} +{\ctikzvalof{bipoles/cvsource/height}} +{\ctikzvalof{bipoles/cvsource/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@draworfill + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfsetroundcap\pgfusepath{draw} +} + +%% Cute Controlled current source +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/cisource/height}} +{cisourceC} +{\ctikzvalof{bipoles/cisource/height}} +{\ctikzvalof{bipoles/cisource/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@draworfill + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@down}} + \pgfsetroundcap\pgfusepath{draw} +} + +%% Noise voltage source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/vsource/height}} +{vsourceN} +{\ctikzvalof{bipoles/vsource/height}} +{\ctikzvalof{bipoles/vsource/width}} +{ + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + % + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax + \edef\pgf@noise@temp{dashed} + \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}} + \ifx\pgf@noise@temp\pgf@noise@fill + % fillable in this case + \pgf@circ@draworfillandclip + \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thinner\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + % + \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \else + \pgfsetfillcolor{\pgf@noise@fill} + \pgfusepath{draw,fill} + \fi + \endpgfscope + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfsetroundcap\pgfusepath{draw} +} +%% Noise current source + +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/isource/height}} +{isourceN} +{\ctikzvalof{bipoles/isource/height}} +{\ctikzvalof{bipoles/isource/width}} +{ + \pgfpointorigin + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + % + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax + \edef\pgf@noise@temp{dashed} + \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}} + \ifx\pgf@noise@temp\pgf@noise@fill + % fillable in this case + \pgf@circ@draworfillandclip + \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thinner\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + % + \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \else + \pgfsetfillcolor{\pgf@noise@fill} + \pgfusepath{draw,fill} + \fi + \endpgfscope + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}} + \pgfsetroundcap\pgfusepath{draw} +} + +%%%%%%%%%%%%%% +%% Diodes +%%%%%%%%%%%%%% + +%% Black generic diode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/diode/height}} +{fulldiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Black Zener diode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/diode/height}} +{fullzdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Black alternative zigzag Zener diode +\pgfcircdeclarebipolescaled{diodes} +{% fix the anchor border + \pgfcirc@border@extend@updown{1.3}{1.3} +} +{\ctikzvalof{bipoles/diode/height}} +{fullzzdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-1.8\pgf@circ@res@left}{\pgf@circ@res@down-0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-0.2\pgf@circ@res@left}{\pgf@circ@res@up-0.5\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Black Schottky diode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/diode/height}} +{fullsdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{.6\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{.6\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + +} + +%% Black tunnel diode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/diode/height}} +{fulltdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +% +% draw LED arrows +% +\def\pgf@circ@draw@ledarrows{% + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \ifpgf@led@fliparrows + \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}} + \pgfusepath{draw} + \else + \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} + \fi +} +% +% ---and photodiode arrows +% +\def\pgf@circ@draw@pdarrows{% + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsstart{latexslim} + \ifpgf@pd@fliparrows + \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}} + \pgfusepath{draw} + \else + \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} + \fi +} +%% Black light emitting diode +\pgfcircdeclarebipolescaled{diodes} +{% fix the anchor border + \pgfcirc@border@extend@updown{1.8}{1} +} +{\ctikzvalof{bipoles/diode/height}} +{fulllediode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgf@circ@draw@ledarrows +} + +%% Black photodiode +\pgfcircdeclarebipolescaled{diodes} +{% fix the anchor border + \pgfcirc@border@extend@updown{1.8}{1} +} +{\ctikzvalof{bipoles/diode/height}} +{fullpdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgf@circ@draw@pdarrows +} + +%% Black varcap +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/varcap/height}} +{fullvarcap} +{\ctikzvalof{bipoles/varcap/height}} +{\ctikzvalof{bipoles/varcap/width}} +{ + \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgfsetlinewidth{\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfusepath{draw,fill} + % + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Code for the diode triangle +\def\pgf@circ@basicdiodeshape{ + % \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \pgfscope + % to allow filling, we need to draw explicitly the stroke here. + \pgfsetlinewidth{\pgfstartlinewidth} + \ifpgf@circuit@bipole@strokedsymbol + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfusepath{draw} + \fi + \endpgfscope + % \endpgfscope +} + +%% Empty generic diode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/diode/height}} +{emptydiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Empty Zener diode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/diode/height}} +{emptyzdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgf@circ@basicdiodeshape + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-0.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Empty alternative zigzag Zener diode +\pgfcircdeclarebipolescaled{diodes} +{% fix the anchor border + \pgfcirc@border@extend@updown{1.3}{1.3} +} +{\ctikzvalof{bipoles/diode/height}} +{emptyzzdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgf@circ@basicdiodeshape + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-1.8\pgf@circ@res@left}{\pgf@circ@res@down-0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-0.2\pgf@circ@res@left}{\pgf@circ@res@up-0.5\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} +%% Empty Schottky diode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/diode/height}} +{emptysdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{.6\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{.6\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + +} + +%% Empty tunnel diode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/diode/height}} +{emptytdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Empty light emitting diode +\pgfcircdeclarebipolescaled{diodes} +{% fix the anchor border + \pgfcirc@border@extend@updown{1.8}{1} +} +{\ctikzvalof{bipoles/diode/height}} +{emptylediode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgf@circ@draw@ledarrows +} + +%% Empty photodiode +\pgfcircdeclarebipolescaled{diodes} +{% fix the anchor border + \pgfcirc@border@extend@updown{1.8}{1} +} +{\ctikzvalof{bipoles/diode/height}} +{emptypdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgf@circ@draw@pdarrows +} + +%% Empty varcap +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/varcap/height}} +{emptyvarcap} +{\ctikzvalof{bipoles/varcap/height}} +{\ctikzvalof{bipoles/varcap/width}} +{ + \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgfsetlinewidth{\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + % \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + \pgfscope + % to allow filling, we need to draw explicitily the stroke here. + \pgfsetlinewidth{\pgfstartlinewidth} + \ifpgf@circuit@bipole@strokedsymbol + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfusepath{draw} + \fi + \endpgfscope + % + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Empty bidirectionaldiode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/bidirectionaldiode/height}} +{emptybidirectionaldiode} +{\ctikzvalof{bipoles/bidirectionaldiode/height}} +{\ctikzvalof{bipoles/bidirectionaldiode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgf@circ@draworfill + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} +} + +%% Full bidirectionaldiode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/bidirectionaldiode/height}} +{fullbidirectionaldiode} +{\ctikzvalof{bipoles/bidirectionaldiode/height}} +{\ctikzvalof{bipoles/bidirectionaldiode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfusepath{draw, fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} +} + +%% Black thyristor +\pgfcircdeclarebipolescaled{diodes} +{ + \anchor{gate}{\northeast} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{G}{\northeast} + \anchor{cathode}{\northeast\pgf@y=0cm } +} +{\ctikzvalof{tripoles/thyristor/height 2}} +{fullthyristor} +{\ctikzvalof{tripoles/thyristor/height}} +{\ctikzvalof{tripoles/thyristor/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right + + \pgfscope + \pgftransformxshift{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfusepath{draw,fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + +} + +%% Empty thyristor + +\pgfcircdeclarebipolescaled{diodes} +{ + \anchor{gate}{\northeast} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{G}{\northeast} + \anchor{cathode}{\northeast\pgf@y=0cm } +} +{\ctikzvalof{tripoles/thyristor/height 2}} +{emptythyristor} +{\ctikzvalof{tripoles/thyristor/height}} +{\ctikzvalof{tripoles/thyristor/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right + + \pgfscope + \pgftransformxshift{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \pgfscope + % to allow filling, we need to draw explicitily the stroke here. + \pgfsetlinewidth{\pgfstartlinewidth} + \ifpgf@circuit@bipole@strokedsymbol + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfusepath{draw} + \fi + \endpgfscope + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} +} + +%% Empty triac +\pgfcircdeclarebipolescaled{diodes} +{ + \anchor{gate}{\northeast} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{G}{\northeast} + \anchor{cathode}{\northeast\pgf@y=0cm } +} +{\ctikzvalof{tripoles/triac/height}} +{emptytriac} +{\ctikzvalof{tripoles/triac/height}} +{\ctikzvalof{tripoles/triac/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgf@circ@draworfill + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} +} + +%% Full triac +\pgfcircdeclarebipolescaled{diodes} +{ + \anchor{gate}{\northeast} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{G}{\northeast} + \anchor{cathode}{\northeast\pgf@y=0cm } +} +{\ctikzvalof{tripoles/triac/height}} +{fulltriac} +{\ctikzvalof{tripoles/triac/height}} +{\ctikzvalof{tripoles/triac/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfusepath{draw,fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} +} + +%%%%%%%%%%%%% +%% switches +%%%%%%%%%%%%% + +%% (Closing) SPST +\pgfcircdeclarebipolescaled{switches} +{} +{\ctikzvalof{bipoles/spst/depth}} +{cspst} +{\ctikzvalof{bipoles/spst/height}} +{\ctikzvalof{bipoles/spst/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpointpolar{90}{1.2\pgf@circ@res@right}} + \pgfpatharc{90}{-20}{1.2\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfsetbeveljoin + \pgfusepath{draw} + \endpgfscope +} + +%% Opening SPST +\pgfcircdeclarebipolescaled{switches} +{} +{\ctikzvalof{bipoles/spst/depth}} +{ospst} +{\ctikzvalof{bipoles/spst/height}} +{\ctikzvalof{bipoles/spst/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}} + \pgfpatharc{-10}{90}{1.2\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfsetbeveljoin + \pgfusepath{draw} + \endpgfscope +} + +%% Normal open Switch +\pgfcircdeclarebipolescaled{switches} +{} +{\ctikzvalof{bipoles/nos/depth}} +{nos} +{\ctikzvalof{bipoles/nos/height}} +{\ctikzvalof{bipoles/nos/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfusepath{draw} +} + +%% Normal closed Switch +\pgfcircdeclarebipolescaled{switches} +{} +{\ctikzvalof{bipoles/ncs/depth}} +{ncs} +{\ctikzvalof{bipoles/ncs/height}} +{\ctikzvalof{bipoles/ncs/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Push Button +\pgfcircdeclarebipolescaled{switches} +{ + \anchor{tip}{\northeast\pgf@x=0pt\relax} +} +{\ctikzvalof{bipoles/pushbutton/height 2}} +{pushbutton} +{\ctikzvalof{bipoles/pushbutton/height}} +{\ctikzvalof{bipoles/pushbutton/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} + \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} +} + +%% Normally closed Push Button +\pgfcircdeclarebipolescaled{switches} +{ + \anchor{tip}{\northeast\pgf@x=0pt\relax} +} +{\ctikzvalof{bipoles/pushbutton/height 2}} +{ncpushbutton} +{\ctikzvalof{bipoles/pushbutton/height}} +{\ctikzvalof{bipoles/pushbutton/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + % Warning, if the nodes will have a class, we have to touch this. + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp}} + \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}} + \pgfusepath{draw} + % + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} + \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} +} +%% Push Button (normally closed but now open :-) see +%% https://github.com/circuitikz/circuitikz/issues/128#issuecomment-731771299 +\pgfcircdeclarebipolescaled{switches} +{ + \anchor{tip}{ + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen + \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp + \pgf@x=0pt\relax + } +} +{\ctikzvalof{bipoles/pushbutton/height 2}} +{pushbuttonc} +{\ctikzvalof{bipoles/pushbutton/height}} +{\ctikzvalof{bipoles/pushbutton/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}} + \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up/2+\pgf@circ@res@temp}} + \pgfusepath{draw} + + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} + \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} +} + +%% Normally closed Push Button now open +\pgfcircdeclarebipolescaled{switches} +{ + \anchor{tip}{ + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen + \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp + \pgf@x=0pt\relax + } +} +{\ctikzvalof{bipoles/pushbutton/height 2}} +{ncpushbuttono} +{\ctikzvalof{bipoles/pushbutton/height}} +{\ctikzvalof{bipoles/pushbutton/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + % Warning, if the nodes will have a class, we have to touch this. + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up/2}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up/2}} + \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@up/2}} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up/2+\pgf@circ@res@temp}} + \pgfusepath{draw} + % + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} + \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} +} +%%% reed switches +\pgfcircdeclarebipolescaled{switches} +{} +{\ctikzvalof{bipoles/reed/depth}} +{reed} +{\ctikzvalof{bipoles/reed/height}} +{\ctikzvalof{bipoles/reed/width}} +{ + % this is designed to be the same as a "nos". + \pgfmathsetmacro{\@@tmpx}{0.9*\ctikzvalof{bipoles/nos/width}/\ctikzvalof{bipoles/reed/width}} + \pgfmathsetmacro{\@@tmpy}{\ctikzvalof{bipoles/nos/height}/\ctikzvalof{bipoles/reed/height}} + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + % eclosure + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@up}{\pgf@circ@res@up}} + \pgfpatharc{90}{-90}{\pgf@circ@res@up} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@up}{-\pgf@circ@res@up}} + \pgfpatharc{270}{90}{\pgf@circ@res@up} + \pgfpathclose + \pgf@circ@draworfill + % switch + \pgfpathmoveto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{\@@tmpy\pgf@circ@res@up}} + % connection lines + \pgfsetbuttcap + \pgfusepath{draw} + \endpgfscope + % connection lines + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} +} + +% cute switch "to" shapes help function +% #1 -> name +% #2 -> barposition +% #3 -> arrowcode +\long\def\pgfcircdeclarecutesw#1#2#3{ + \pgfcircdeclarebipolescaled{switches} + { + \savedanchor\midlever{ + % these values are calculated when we create the definition of the shape. + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgf@circ@res@down = -.5\pgf@y + \pgf@circ@res@up = .5\pgf@y + \pgfextracty{\pgf@circ@res@other}{#2} + \pgf@x=0pt + \pgf@y=.5\pgf@circ@res@other + } + % radius of the connector + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + % If cnnecting nodes are scaled, we have to modify this + \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} + % shapename + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + % shape type + \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}} + % mid of the lever, to stack switches + \anchor{mid}{\midlever} + \anchor{cout}{\northeast \pgf@y=0cm} + \anchor{cin}{\southwest\pgf@y=0cm} + \anchor{out}{\northeast \pgf@y=0cm\advance\pgf@x by \radius} + \anchor{in}{\southwest\pgf@y=0cm\advance\pgf@x by -\radius} + } + {\ctikzvalof{bipoles/cuteswitch/height 2}} + {#1} + {\ctikzvalof{bipoles/cuteswitch/height}} + {\ctikzvalof{bipoles/cuteswitch/width}}{ + \pgfscope + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + % If cnnecting nodes are scaled, we have to modify this + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgfsetlinewidth{2\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{#2} + \pgfsetroundcap\pgfusepath{draw} + \endpgfscope + \pgfscope % arrow + #3 + \endpgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}} + \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}} + \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}} + } +} + +%% closed cute switch +\pgfcircdeclarecutesw{cuteclosedswitch} + {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}} + {} + +%% open cute switch +\pgfcircdeclarecutesw{cuteopenswitch} + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + {} + +%% closing cute switch +\pgfcircdeclarecutesw{cuteclosingswitch} + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + { + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{70}{1.2\pgf@circ@res@right}} + \pgfpatharc{70}{-10}{1.2\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} + } + +%% opening cute switch +\pgfcircdeclarecutesw{cuteopeningswitch} + {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}} + { + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}} + \pgfpatharc{-10}{60}{1.2\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} + } + +%%%%%%%%%%%%%%%%% +%% Instruments +%%%%%%%%%%%%%%%%% + +% % METERINGSHAPE +\long\def\drawmeteringcircle{ + \def\pgf@circ@temp{right} + \ifx\tikz@res@label@pos\pgf@circ@temp + \pgf@circ@res@step=-1.2\pgf@circ@res@up + \else + \def\pgf@circ@temp{below} + \ifx\tikz@res@label@pos\pgf@circ@temp + \pgf@circ@res@step=-1.2\pgf@circ@res@up + \else + \pgf@circ@res@step=1.2\pgf@circ@res@up + \fi + \fi + %draw connections to circle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + %draw circle + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up} + \pgf@circ@draworfill + \endpgfscope + %draw arrow + \pgfscope + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%AMPEREMETER +\pgfcircdeclarebipolescaled{instruments} +{} +{\ctikzvalof{bipoles/ammeter/height}} +{ammeter} +{\ctikzvalof{bipoles/ammeter/height}} +{\ctikzvalof{bipoles/ammeter/width}} +{ + \drawmeteringcircle + \pgfnode{circle}{center}{\pgf@circ@font@bold{A}}{}{} +} +%OHMMETER +\pgfcircdeclarebipolescaled{instruments} +{} +{\ctikzvalof{bipoles/ohmmeter/height}} +{ohmmeter} +{\ctikzvalof{bipoles/ohmmeter/height}} +{\ctikzvalof{bipoles/ohmmeter/width}} +{ + \drawmeteringcircle + \pgfnode{circle}{center}{\boldmath$\Omega$}{}{} +} +%VOLTMETER +\pgfcircdeclarebipolescaled{instruments} +{} +{\ctikzvalof{bipoles/voltmeter/height}} +{voltmeter} +{\ctikzvalof{bipoles/voltmeter/height}} +{\ctikzvalof{bipoles/voltmeter/width}} +{ + \drawmeteringcircle + \pgfnode{circle}{center}{\pgf@circ@font@bold{V}}{}{} + +} + +% oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176 +\pgfcircdeclarebipolescaled{instruments} +{ + \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x} + \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/oscope/height}} +{oscope} +{\ctikzvalof{bipoles/oscope/height}} +{\ctikzvalof{bipoles/oscope/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\southwest} + \pgfextracty{\pgf@circ@res@down}{\southwest} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfscope + \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + % this would create a round (analog?) scope... + % \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \endpgfscope + % get the rotation + \ifpgf@circuit@straightinstruments + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \else + \edef\rot{0} + \fi + % and unrotate the scope + \pgfscope + \pgftransformrotate{\rot} + % grid + \pgfscope + \pgfsetlinewidth{0.5\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}} + \pgfpathgrid[stepx=\pgf@circ@res@step, stepy=\pgf@circ@res@step]% + {\pgfpoint{0.75\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + {\pgfpoint{0.75\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfsetstrokeopacity{0.5} + \pgfusepath{draw} + \endpgfscope + % function displayed, thanks to + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +% generic round meter with always horizontal text, no arrow +\pgfcircdeclarebipolescaled{instruments} +{} +{\ctikzvalof{bipoles/esource/height}} +{rmeter} +{\ctikzvalof{bipoles/esource/height}} +{\ctikzvalof{bipoles/esource/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + % draw the text label + % get the rotation + \ifpgf@circuit@straightinstruments + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \else + \edef\rot{0} + \fi + % and unrotate the scope + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + \pgftransformrotate{\rot} + \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}} + \endpgfscope +} + +% generic round meter with always horizontal text, with arrow +\pgfcircdeclarebipolescaled{instruments} +{} +{\ctikzvalof{bipoles/esource/height}} +{rmeterwa} +{\ctikzvalof{bipoles/esource/height}} +{\ctikzvalof{bipoles/esource/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + % draw the text label + % get the rotation + \ifpgf@circuit@straightinstruments + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \else + \edef\rot{0} + \fi + % and unrotate the scope + \pgfscope + \pgftransformrotate{\rot} + \pgfsetcolor{\ctikzvalof{color}} + \pgfsetlinewidth{\pgfstartlinewidth} + % arrow: create a center hole to have better visual + \pgfscope + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next open a circle into it + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{.6\pgf@circ@res@up}}{\pgfpoint{.6\pgf@circ@res@left}{0}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfsetarrowsend{latexslim} + % the arrow is better if it has a bit of breath and it's not 45º + \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@left}{1.2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@right}{1.2\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + \pgftext[center]{\ctikzvalof{bipoles/twoport/text}} + \endpgfscope +} + +% generic square meter with always horizontal text +\pgfcircdeclarebipolescaled{instruments} +{ + \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x} + \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/smeter/height}} +{smeter} +{\ctikzvalof{bipoles/smeter/height}} +{\ctikzvalof{bipoles/smeter/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\southwest} + \pgfextracty{\pgf@circ@res@down}{\southwest} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfscope + \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@draworfill + \endpgfscope + % get the rotation + \ifpgf@circuit@straightinstruments + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \else + \edef\rot{0} + \fi + % and unrotate the scope + \pgfscope + \pgftransformrotate{\rot} + % the metering window + \pgfscope + \def\@starta{105}\def\@stopa{75} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgftransformshift{\pgfpoint{0pt}{-1.8\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpointpolar{\@starta}{2\pgf@circ@res@up}} + \pgfpatharc{\@starta}{\@stopa}{2\pgf@circ@res@up} + \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}} + \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up} + \pgfclosepath + \pgfpathmoveto{\pgfpointpolar{80}{2\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointpolar{80}{2.4\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + \pgftext[center, y=0.5\pgf@circ@res@down]{\ctikzvalof{bipoles/twoport/text}} + \endpgfscope +} + +% probes qucs style: +% #1 : name +% #2 : extra code +\long\def\pgfcirc@qucsprobe#1#2{ + \pgfcircdeclarebipolescaled{instruments} + { + \anchor{v+}{\southwest\pgf@x=0.6\pgf@x} + \anchor{v-}{\southwest\pgf@x=-0.6\pgf@x} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } + } + {\ctikzvalof{bipoles/qmeter/depth}} + {#1} + {\ctikzvalof{bipoles/qmeter/height}} + {\ctikzvalof{bipoles/qmeter/width}} + { + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\southwest} + \pgfextracty{\pgf@circ@res@down}{\southwest} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfscope + \pgfscope + \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@draworfill + \endpgfscope + \def\@starta{103}\def\@stopa{77} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfscope + \pgftransformshift{\pgfpoint{0pt}{-1.7\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpointpolar{\@starta}{2.1\pgf@circ@res@up}} + \pgfpatharc{\@starta}{\@stopa}{2.1\pgf@circ@res@up} + \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}} + \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up} + \pgfclosepath + \pgfpathmoveto{\pgfpointpolar{83}{2.1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointpolar{83}{2.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgf@circ@draworfill + \endpgfscope + #2 + \endpgfscope + } +} + +\pgfcirc@qucsprobe{qiprobe}{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \pgfnode{currarrow}{center}{}{}{} +} + +\pgfcirc@qucsprobe{qvprobe}{ + \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{0pt}} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other} + \pgfusepath{draw} + \pgfscope + % "+" and "-", drawn so that they scale correctly + \pgfsetlinewidth{2\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-1.5\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-3.5\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfusepath{draw} + \endpgfscope +} + +\pgfcirc@qucsprobe{qpprobe}{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \pgfnode{currarrow}{center}{}{}{} + \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left}{-3\pgf@circ@res@other}}{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{-4\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right}{-3\pgf@circ@res@other}}{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{-4\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfscope + % "+" and "-", drawn so that they scale correctly + \pgfsetlinewidth{2\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-2\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-4\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+4\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right-4\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfusepath{draw} + \endpgfscope +} + +% current loop for oscope and similar: stylized +\pgfcircdeclarebipolescaled{instruments} +{ + \anchor{i}{\northeast\pgf@x=0pt\relax} + \anchor{text}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/iloop/height}} +{iloop} +{\ctikzvalof{bipoles/iloop/height}} +{\ctikzvalof{bipoles/iloop/width}} +{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@down=-\pgf@circ@res@up + \pgf@circ@res@left=-\pgf@circ@res@right + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgfsetcolor{\ctikzvalof{color}} + % external ellipse + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next the opening to the left + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} + {\pgfpoint{0pt}{.1\pgf@circ@res@up}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfpathellipse{\pgfpointorigin}{ + \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{ + \pgfpoint{0.4\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \endpgfscope + % internal wire + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % and the contact line up + \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +% current loop for oscope and similar: real (double connection) +\pgfcircdeclarebipolescaled{instruments} +{ + \anchor{i+}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgf@y=\pgf@circ@res@up + } + \anchor{i-}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgf@y=\pgf@circ@res@up + } + \anchor{text}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/iloop/height}} +{iloop2} +{\ctikzvalof{bipoles/iloop/height}} +{\ctikzvalof{bipoles/iloop/width}} +{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@down=-\pgf@circ@res@up + \pgf@circ@res@left=-\pgf@circ@res@right + % must be the same than internal i+ and i- anchors definition + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}} + \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}} + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgfsetcolor{\ctikzvalof{color}} + % external ellipse + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next the opening to the left + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} + {\pgfpoint{0pt}{.1\pgf@circ@res@up}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfpathmoveto{\@plus} + \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgfusepath{draw} + \endpgfscope + % internal wire + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % and the contact line up + % I use ...left and ---right as temporal lengths here to avoid defining more + \pgfextractx{\pgf@circ@res@left}{\@plus} + \pgfextractx{\pgf@circ@res@right}{\@minus} + \pgfpathmoveto{\@plus} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathmoveto{\@minus} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + + +%% Varistor +\pgfcircdeclarebipolescaled{resistors} +{ + \pgfcirc@border@extend@updown{1}{1.4} +} +{\ctikzvalof{bipoles/varistor/height}} +{varistor} +{\ctikzvalof{bipoles/varistor/height}} +{\ctikzvalof{bipoles/varistor/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/varistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/varistor/main}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\pgf@circ@font@tiny\textsf{U}}} +} + +%%%%%%%%%%%%%% +%% RF bipoles +%%%%%%%%%%%%%% + +% transmission line +\pgfcircdeclarebipolescaled{RF} +{} +{\ctikzvalof{bipoles/tline/height}} +{tline} +{\ctikzvalof{bipoles/tline/height}} +{\ctikzvalof{bipoles/tline/width}} +{ + \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis + \begin{pgftransparencygroup} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \pgfpathellipse{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} + {\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{-\pgf@circ@res@up}} + \pgf@circ@draworfill + \end{pgftransparencygroup} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{stroke} +} + +% microstrip transmission line +\pgfcircdeclarebipolescaled{RF} +{} +{\ctikzvalof{bipoles/mstline/height}} +{mstline} +{\ctikzvalof{bipoles/mstline/height}} +{\ctikzvalof{bipoles/mstline/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill +} + +%%%%%%%%%%%%%%%%%%% +%% Block diagrams +%%%%%%%%%%%%%%%%%%% + +%% Draw the two-port fillable box +\def\pgf@circ@twoportbox{ + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \endpgfscope +} + +%% Generic two port box +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/twoport/height}} +{twoport} +{\ctikzvalof{bipoles/twoport/height}} +{\ctikzvalof{bipoles/twoport/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + % draw outer box + \pgf@circ@twoportbox + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}} + +} + +%% twoport split +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/twoportsplit/width}} +{twoportsplit} +{\ctikzvalof{bipoles/twoportsplit/width}} +{\ctikzvalof{bipoles/twoportsplit/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/twoportsplit/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + %get texts + \def\pgfcirc@tin{\ctikzvalof{bipoles/twoport/text in}} + \def\pgfcirc@tout{\ctikzvalof{bipoles/twoport/text out}} + + % rotate inner symbol + \def\texti{\pgfcirc@tin} + \def\textii{\pgfcirc@tout} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \def\texti{\pgfcirc@tout} + \def\textii{\pgfcirc@tin} + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \def\texti{\pgfcirc@tout} + \def\textii{\pgfcirc@tin} + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \def\texti{\pgfcirc@tin} + \def\textii{\pgfcirc@tout} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\texti} + \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textii} +} + +%% voltage controled oscillator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/vco/width}} +{vco} +{\ctikzvalof{bipoles/twoport/width}} +{\ctikzvalof{bipoles/vco/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + % draw circle + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step} + \pgf@circ@draworfill + \endpgfscope + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner sine waves + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% bandpass filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/bandpass/width}} +{bandpass} +{\ctikzvalof{bipoles/bandpass/width}} +{\ctikzvalof{bipoles/bandpass/width}} +{ + + \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% bandstop filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/bandstop/width}} +{bandstop} +{\ctikzvalof{bipoles/bandstop/width}} +{\ctikzvalof{bipoles/bandstop/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225% 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt}% always draw solid line for inner symbol + \pgfsetarrows{-}%never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% highpass filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/highpass/width}} +{highpass} +{\ctikzvalof{bipoles/highpass/width}} +{\ctikzvalof{bipoles/highpass/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% lowpass filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/lowpass/width}} +{lowpass} +{\ctikzvalof{bipoles/lowpass/width}} +{\ctikzvalof{bipoles/lowpass/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% allpass filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/allpass/width}} +{allpass} +{\ctikzvalof{bipoles/allpass/width}} +{\ctikzvalof{bipoles/allpass/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/allpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% ADC +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/adc/width}} +{adc} +{\ctikzvalof{bipoles/adc/width}} +{\ctikzvalof{bipoles/adc/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\texti{A} + \def\textii{D} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \def\texti{D} + \def\textii{A} + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \def\texti{D} + \def\textii{A} + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \def\texti{A} + \def\textii{D} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} + \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} +} + +%% DAC +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/dac/width}} +{dac} +{\ctikzvalof{bipoles/dac/width}} +{\ctikzvalof{bipoles/dac/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\texti{D} + \def\textii{A} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \def\texti{A} + \def\textii{D} + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \def\texti{A} + \def\textii{D} + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \def\texti{D} + \def\textii{A} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} + \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} +} + +%% DSP +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/dsp/width}} +{dsp} +{\ctikzvalof{bipoles/dsp/width}} +{\ctikzvalof{bipoles/dsp/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgftext[center,x=0,y=0]{\textsf{DSP}} +} + +%% FFT +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/fft/width}} +{fft} +{\ctikzvalof{bipoles/fft/width}} +{\ctikzvalof{bipoles/fft/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgftext[center,x=0,y=0]{\textsf{FFT}} +} + +%% Amplifier +\pgfcircdeclarebipolescaled{blocks} +{} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{amp} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \ifpgf@circuit@boxed + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \pgf@circ@draworfill + \fi + + % draw input arrow + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + \ifpgf@circuit@boxed + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn + \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + + \pgfsetarrows{-} %never draw arrows + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} + \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} + + \pgfpathclose + \pgf@circ@draworfill + + % draw inner text + \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} +} + + +%% variable amplifier +\pgfcircdeclarebipolescaled{blocks} +{} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{vamp} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw input arrow + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + \ifpgf@circuit@boxed + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn + \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + + + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} + \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} + + \pgfpathclose + \pgf@circ@draworfill + + % draw inner text + \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} + + % draw arrow + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% pi attenuator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/piattenuator/width}} +{piattenuator} +{\ctikzvalof{bipoles/piattenuator/width}} +{\ctikzvalof{bipoles/piattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% variable pi attenuator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{vpiattenuator} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% T attenuator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/tattenuator/width}} +{tattenuator} +{\ctikzvalof{bipoles/tattenuator/width}} +{\ctikzvalof{bipoles/tattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% variable T attenuator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/vtattenuator/width}} +{vtattenuator} +{\ctikzvalof{bipoles/vtattenuator/width}} +{\ctikzvalof{bipoles/vtattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% phase shifter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/phaseshifter/width}} +{phaseshifter} +{\ctikzvalof{bipoles/phaseshifter/width}} +{\ctikzvalof{bipoles/phaseshifter/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % inner symbol + \pgftext[center,x=0,y=0]{\Large$\varphi$} +} + +%% variable phase shifter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/phaseshifter/width}} +{vphaseshifter} +{\ctikzvalof{bipoles/vphaseshifter/width}} +{\ctikzvalof{bipoles/vphaseshifter/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % inner symbol + \pgftext[center,x=0,y=0]{\Large$\varphi$} + + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% detector +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/detector/width}} +{detector} +{\ctikzvalof{bipoles/detector/width}} +{\ctikzvalof{bipoles/detector/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{0.8\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}} + \pgfusepath{draw} + + \ifpgf@circuit@fulldiode + \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width}} + \pgftransformscale{\pgfmathresult} + \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}} + \else + \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width}} + \pgftransformscale{\pgfmathresult} + \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}} + \fi + +} + +%% single phase ac/dc converter +\pgfcircdeclarebipolescaled{blocks} +{ + \anchor{dc1}{ + \northeast + \pgf@y=.4\pgf@y + } + \anchor{dc2}{ + \northeast + \pgf@y=-.4\pgf@y + } +} +{\ctikzvalof{bipoles/sacdc/width}} +{sacdc} +{\ctikzvalof{bipoles/sacdc/width}} +{\ctikzvalof{bipoles/sacdc/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/sacdc/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + % draw sin wave + \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + + % draw equal sign + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}} + \pgfusepath{draw} +} + + + +%% single phase dc/ac converter +\pgfcircdeclarebipolescaled{blocks} +{ + \anchor{dc1}{ + \northeast + \pgf@y=.4\pgf@y + \pgf@x=-\pgf@x + } + \anchor{dc2}{ + \northeast + \pgf@y=-.4\pgf@y + \pgf@x=-\pgf@x + } +} +{\ctikzvalof{bipoles/sdcac/width}} +{sdcac} +{\ctikzvalof{bipoles/sdcac/width}} +{\ctikzvalof{bipoles/sdcac/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/sdcac/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + % draw sin wave + \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + + % draw equal sign + \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}} + \pgfusepath{draw} +} + + +%% threephase ac/dc converter +\pgfcircdeclarebipolescaled{blocks} +{ + \anchor{dc1}{ + \northeast + \pgf@y=.4\pgf@y + } + \anchor{dc2}{ + \northeast + \pgf@y=-.4\pgf@y + } + \anchor{ac1}{ + \northeast + \pgf@y=.6\pgf@y + \pgf@x=-\pgf@x + } + \anchor{ac2}{ + \northeast + \pgf@y=0\pgf@y + \pgf@x=-\pgf@x + } + \anchor{ac3}{ + \northeast + \pgf@y=-.6\pgf@y + \pgf@x=-\pgf@x + } +} +{\ctikzvalof{bipoles/tacdc/width}} +{tacdc} +{\ctikzvalof{bipoles/tacdc/width}} +{\ctikzvalof{bipoles/tacdc/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/tacdc/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + % draw sin waves + \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.65\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.35\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + + + + + % draw equal sign + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}} + \pgfusepath{draw} +} + + +%% threephase dc/ac converter +\pgfcircdeclarebipolescaled{blocks} +{ + \anchor{dc1}{ + \northeast + \pgf@y=.4\pgf@y + \pgf@x=-\pgf@x + } + \anchor{dc2}{ + \northeast + \pgf@y=-.4\pgf@y + \pgf@x=-\pgf@x + } + \anchor{ac1}{ + \northeast + \pgf@y=.6\pgf@y + } + \anchor{ac2}{ + \northeast + \pgf@y=0\pgf@y + } + \anchor{ac3}{ + \northeast + \pgf@y=-.6\pgf@y + } +} +{\ctikzvalof{bipoles/tdcac/width}} +{tdcac} +{\ctikzvalof{bipoles/tdcac/width}} +{\ctikzvalof{bipoles/tdcac/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/tdcac/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + % draw sin waves + \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.65\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.35\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + + + + + % draw equal sign + \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}} + \pgfusepath{draw} +} + + +%%%%%%%%%%%%%%%%%%%%%%% +%% MECHANICAL SYMBOLS +%%%%%%%%%%%%%%%%%%%%%%% + +%% mechanical capacitance - stiffness/spring + +\pgfcircdeclarebipolescaled{mechanicals} +{} +{\ctikzvalof{bipoles/spring/height}} +{spring} +{\ctikzvalof{bipoles/spring/height}} +{\ctikzvalof{bipoles/spring/width}}{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/spring/width}*\pgf@circ@scaled@Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + \pgfsetcornersarced{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} +} + +%% mechanical capacitance - inerter +\pgfcircdeclarebipolescaled{mechanicals} +{} +{\ctikzvalof{bipoles/inerter/height}} +{inerter} +{\ctikzvalof{bipoles/inerter/height}} +{\ctikzvalof{bipoles/inerter/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill +} + + +%% mechanical inductance - mass +\pgfcircdeclarebipolescaled{mechanicals} +{} +{\ctikzvalof{bipoles/mass/box height}} +{mass} +{\ctikzvalof{bipoles/mass/height}} +{\ctikzvalof{bipoles/mass/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfpathrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{-2\pgf@circ@res@down}{-2\pgf@circ@res@down}} + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfsetrectcap + \pgfsetmiterjoin + \pgfusepath{stroke} +} + +%% mechanical resistor - damper +\pgfcircdeclarebipolescaled{mechanicals} +{} +{\ctikzvalof{bipoles/damper/height}} +{damper} +{\ctikzvalof{bipoles/damper/height}} +{\ctikzvalof{bipoles/damper/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@maybefill + + % line into the damper + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {\pgf@circ@res@zero}} + \pgfusepath{stroke} + + % damper box + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + + \pgfsetrectcap + \pgfsetmiterjoin + \pgfusepath{stroke} + + % damper vertical element + \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfusepath{stroke} + +} +%% mechanical viscoelastic element, suggested by @alex +%% in https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz +\pgfcircdeclarebipolescaled{mechanicals} +{} % extra anchors +{\ctikzvalof{bipoles/damper/height}} % depth (under the path line) +{viscoe} % name +{\ctikzvalof{bipoles/damper/height}} % height (above the path line) +{\ctikzvalof{bipoles/damper/width}} % width +{ % draw the bipole + \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@maybefill + + % spring into the damper + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfsetcornersarced{\pgfpoint{.25\pgf@circ@res@up}{.25\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.75\pgf@circ@res@left}{.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@left}{-.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{.75\pgf@circ@res@up}} + \pgfusepath{stroke} + \endpgfscope + % damper box + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + + \pgfsetrectcap + \pgfsetmiterjoin + \pgfusepath{stroke} + + % damper vertical element + \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfusepath{stroke} + +} + +%%%%%%%%%%%%%%%% +%% Crossing +%%%%%%%%%%%%%%%% + +%% crossing bipole (but see also nodes) +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/crossing/size}} +{crossing} +{\ctikzvalof{bipoles/crossing/size}} +{\ctikzvalof{bipoles/crossing/size}}{ + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} + \pgfsetbeveljoin + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \endpgfscope +} + +%%%%%%%%%%%%%%%%%%%%%%%%% +%% Miscellaneous bipoles +%%%%%%%%%%%%%%%%%%%%%%%%% + +%% loudspeaker and microphone + +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/loudspeaker/depth}} +{loudspeaker} +{\ctikzvalof{bipoles/loudspeaker/height}} +{\ctikzvalof{bipoles/loudspeaker/width}}{ + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}} + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.4\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill +} + +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/mic/depth}} +{mic} +{\ctikzvalof{bipoles/mic/height}} +{\ctikzvalof{bipoles/mic/width}}{ + + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{0pt}{.6\pgf@circ@res@up}}{.4\pgf@circ@res@up} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{0pt}} + % 0.25358 is 0.6-0.4*cos(30) + \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + + \pgfusepath{draw} + \endpgfscope +} + +%% european gas filled surge arrester +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/european gas filled surge arrester/height}} +{european gas filled surge arrester} +{\ctikzvalof{bipoles/european gas filled surge arrester/height}} +{\ctikzvalof{bipoles/european gas filled surge arrester/width}} +{ + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@draworfill + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/european gas filled surge arrester/inside}\pgf@circ@res@left}{0pt}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfusepath{draw} + + \endpgfscope +} + +%% american gas filled surge arrester +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/american gas filled surge arrester/height}} +{american gas filled surge arrester} +{\ctikzvalof{bipoles/american gas filled surge arrester/height}} +{\ctikzvalof{bipoles/american gas filled surge arrester/width}}{ + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpointorigin \pgf@circ@res@other = \pgf@x \advance \pgf@circ@res@other by -\pgf@circ@res@up + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfscope + \pgfsetarrowsend{latex} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \endpgfscope{} + + \pgfcircle{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/dot x}\pgf@circ@res@left}{\ctikzvalof{bipoles/american gas filled surge arrester/dot y}\pgf@circ@res@down}}{\ctikzvalof{bipoles/american gas filled surge arrester/size}\pgf@circ@res@down} + \pgfusepath{fill} +} + +%% thermocouple +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/thermocouple/height 2}} +{thermocouple} +{\ctikzvalof{bipoles/thermocouple/height}} +{\ctikzvalof{bipoles/thermocouple/width}} +{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfusepath{draw} +} + +%% fuse +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/fuse/height}} +{fuse} +{\ctikzvalof{bipoles/fuse/height}} +{\ctikzvalof{bipoles/fuse/width}} +{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfusepath{draw} + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@draworfill +} + +%% asymmetric fuse +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/afuse/height}} +{afuse} +{\ctikzvalof{bipoles/afuse/height}} +{\ctikzvalof{bipoles/afuse/width}} +{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfusepath{draw} + + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{stroke,fill} +} + +%% SQUID added by Cor Molenaar 5 March 2010 +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/squid/height}} +{squid} +{\ctikzvalof{bipoles/squid/height}} +{\ctikzvalof{bipoles/squid/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@down}} + + \pgfusepath{draw} +} + +% Generic barrier added by Cor Molenaar 5 March 2010 +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/barrier/height}} +{barrier} +{\ctikzvalof{bipoles/barrier/height}} +{\ctikzvalof{bipoles/barrier/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}} + + \pgfusepath{draw} +} + +% +% open version of the barrier symbol +% suggested by Radványi Patrik Tamás +% +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/barrier/height}} +{openbarrier} +{\ctikzvalof{bipoles/barrier/height}} +{\ctikzvalof{bipoles/barrier/width}} +{ + % this is set with normal wire linewidth + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + + % do the cross part + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}} + + \pgfusepath{draw} +} +%% Lamp +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/lamp/height}} +{lamp} +{\ctikzvalof{bipoles/lamp/height}} +{\ctikzvalof{bipoles/lamp/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% bulb +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/bulb/height}} +{bulb} +{\ctikzvalof{bipoles/bulb/height}} +{\ctikzvalof{bipoles/bulb/width}} +{% + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} + \pgfsetbeveljoin + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} +} + + +% end of pgfcircbipoles.tex +%%%---------- close: tex/pgfcircbipoles +%%%%%%%%%%% Springe nach tex/pgfcirctripoles +%%%---------- open: tex/pgfcirctripoles.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Tripoles + +%%%%%%%%%%%%% +%% switches +%%%%%%%%%%%%% + +% Legacy spdt +\pgfdeclareshape{spdt}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/spdt/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out 1}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{out 2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@res@other = \ctikzvalof{tripoles/spdt/margin}\pgf@circ@res@left + + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + + \pgfusepath{draw} + + \pgfscope + \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}} + \endpgfscope + + \pgfscope + \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}} + \pgfpathlineto{ + \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}} + {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}} + } + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + } +} + + +% cute switch "node" shapes, matching with cute "to" shapes +% #1 -> name +% #2 -> barposition +% #3 -> arrowcode +\long\def\pgfcircdeclarecutespdt#1#2#3{ + \pgfdeclareshape{#1} + { + \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen + \pgf@x=.25\pgf@x + } + \savedanchor\midlever{ + % these values are calculated when we create the definition of the shape. + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgf@circ@res@down = -.5\pgf@y + \pgf@circ@res@up = .5\pgf@y + \pgfextracty{\pgf@circ@res@other}{#2} + \pgf@x=0pt + \pgf@y=.5\pgf@circ@res@other + } + % radius of the connector + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} + % shapename + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + % shape type + \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}} + % mid of the lever, to stack switches + \anchor{mid}{\midlever} + % center anchors + \anchor{cin}{ \northwest \pgf@y=0pt} + \anchor{cout 1}{ \northwest \pgf@x=-\pgf@x } + \anchor{cout 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + % horizontal angles + \anchor{in}{ \northwest \pgf@y=0pt\advance\pgf@x by -\radius} + \anchor{out 1}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius} + \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius \pgf@y=-\pgf@y } + + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \pgf@circ@res@temp=\radius\relax + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgfsetlinewidth{2\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{#2} + \pgfsetroundcap\pgfusepath{draw} + \endpgfscope + \pgfscope % arrow + #3 + \endpgfscope + % terminals + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}} + \endpgfscope + + } + } +} + +\pgfcircdeclarecutespdt{cute spdt up} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up-1.5\pgf@circ@res@temp}} +{} + +\pgfcircdeclarecutespdt{cute spdt mid} +{\pgfpoint{\pgf@circ@res@right}{0pt}} +{} + +\pgfcircdeclarecutespdt{cute spdt down} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}} +{} + +\pgfcircdeclarecutespdt{cute spdt up arrow} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up-1.5\pgf@circ@res@temp}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}} + \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} +} + +\pgfcircdeclarecutespdt{cute spdt mid arrow} +{\pgfpoint{\pgf@circ@res@right}{0pt}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfsetarrowsstart{latexslim} + \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}} + \pgfpatharc{-60}{60}{1.5\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} +} + +\pgfcircdeclarecutespdt{cute spdt down arrow} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}} + \pgfpatharc{-50}{70}{1.5\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Logic ports +%% +%% Code from John Kormylo at tex.stackexchange.com +%% See https://tex.stackexchange.com/questions/372993/is-it-possible-to-implement-multiple-input-logic-ports-with-circuitikz +%% Integration and fixes from Romano Giannetti and TheTeXnician <38565529+TheTeXnician@users.noreply.github.com> +%% + +\newcount\pgf@circ@res@count% reserve global register + +\def\pgf@circ@logicport@input#1% #1 = \pgfmathcounter +{% + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@step\relax +}% + +% #1 = \pgfmathcounter #2=type #3 specificic port +% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor, 4 for european. +\def\pgf@circ@logicport@baseinput#1#2#3% +{% + % and and nand + \ifnum #2=1\relax + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@step\relax + \pgf@x=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@left + \fi + % or and nor + \ifnum #2=2\relax + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfextractx{\pgf@circ@res@right}{\northeast}% + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@step\relax + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american #3 port/angle}}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + \pgf@circ@res@temp=\pgf@y + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgf@x=\pgf@circ@res@other + \fi + % xor and xnor + \ifnum #2=3\relax + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american #3 port/angle}{\pgf@circ@math@angle}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + \pgf@circ@res@temp=\ctikzvalof{tripoles/american #3 port/distance}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} + % this compensates for the effect of the line width on the gap between the arcs + \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% + \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}% + + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@step\relax + \pgf@circ@res@temp=\pgf@y + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \advance\pgf@circ@res@other by -\pgf@circ@math@distance + \pgf@x=\pgf@circ@res@other + \fi + % european + \ifnum #2=4\relax + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@other}{\left}% + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@step\relax + \pgf@x=\pgf@circ@res@other + \fi +}% + +%%% american +\long\def\pgfcircdeclarelogicport#1#2#3{% + \pgfdeclareshape{american #1 port}% + {% + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro\resize{% automatic + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@up = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgf@circ@res@down = -\pgf@circ@res@up + \pgf@circ@res@right = \ctikzvalof{tripoles/american #1 port/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@right = .5\pgf@circ@res@right + \pgf@circ@res@left = -\pgf@circ@res@right + }% + \savedmacro\inputs{% get number of inputs + \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax% + \ifnum\pgf@circ@res@count=0 + \pgf@circ@res@count=\ctikzvalof{tripoles/american #1 port/inputs}\relax% + \fi + \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi + \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi + \def\inputs{\the\pgf@circ@res@count}% + }% + \savedanchor\step{% 1/2 gap at edges + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen + \divide\pgf@circ@res@step by \pgf@circ@res@count + \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}% + }% + \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@left}{0pt}} + \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@right}{0pt}} + \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/american #1 port/origin}\pgf@circ@res@right}{0pt}} + + \anchor{center}{\origin}% for backwards compatibility + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + % create input anchors + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@american #1 port\endcsname{% + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@circ@res@count% + \else% + %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@american #1 port@in \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above + }% + \expandafter\xdef\csname pgf@anchor@american #1 port@bin \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{#2}{#1}% defined above + }% + %}{}% + \repeatpgfmathloop% + } + + \anchor{out}{\northeast\pgf@y=0pt} + \anchor{bout}{\right\pgf@y=0pt} + + + \anchor{left}{\left}% edges of component minus leads + \anchor{right}{\right} + + \anchor{north east}{\northeast}% see \Compass macro + \anchor{south west}{\southwest} + \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfpoint{0cm}{\pgf@circ@res@up}} + \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfpoint{\pgf@circ@res@left}{0cm}} + \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}% + \pgfpoint{0cm}{\pgf@circ@res@down}} + \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}% + \pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfpoint{\pgf@circ@res@right}{0cm}} + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + #3 + } +} +} +%%% american and %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{and}{1}{ + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \ifpgfcirc@draw@input@leads + %input leads + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left} + {\pgf@circ@res@temp}} + \advance\pgf@circ@res@count by -1 + \repeat + \fi + % output lead + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@right} {0pt}} + \pgfusepath{draw} + \fi + + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgf@circ@res@other=\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpatharc{-90}{90}{-2\pgf@circ@res@other and \pgf@circ@res@up} + \pgfpathclose + \pgf@circ@draworfill + } +%%% american nand %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \pgfcircdeclarelogicport{nand}{1}{ + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \ifpgfcirc@draw@input@leads + %input leads + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@left} + {\pgf@circ@res@temp}} + \advance\pgf@circ@res@count by -1 + \repeat + \fi + + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}} + \pgfusepath{draw} + \fi + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgf@circ@res@step = \ctikzvalof{tripoles/american nand port/circle width}\pgf@circ@res@right + \pgf@circ@res@other = \ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right + \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpatharc{-90}{90}{\pgf@circ@res@temp and \pgf@circ@res@up} + \pgfpathclose + + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@other-.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@step}} + + \pgf@circ@draworfill +} +%%% american nor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{nor}{2}{ + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \ifpgfcirc@draw@input@leads + %input leads + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + \fi + + \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}% + \pgf@circ@res@step = \ctikzvalof{tripoles/american nor port/circle width}\pgf@circ@res@right + \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax + \advance\pgf@circ@res@other by -\pgf@circ@res@step + + % main shape + \ifpgfcirc@roundy@or@shapes + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpathclose + \else + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathclose + \fi + + % not dot + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@step}} + + \pgf@circ@draworfill +} +%%% american or %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{or}{2}{ + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \ifpgfcirc@draw@input@leads + %input leads + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + \fi + + \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}% + + % main shape + \ifpgfcirc@roundy@or@shapes + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpathclose + \else + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathclose + \fi + + \pgf@circ@draworfill +} +%%% american xor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{xor}{3}{ + \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xor port/angle}{\pgf@circ@math@angle}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} + % this compensates for the effect of the line width on the gap between the arcs + \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% + \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}% + + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \ifpgfcirc@draw@input@leads + %input leads + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \advance\pgf@circ@res@other by -\pgf@circ@math@distance + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + \fi + + \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xor port/angle}}% + + % main shape + \ifpgfcirc@roundy@or@shapes + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpathclose + \else + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathclose + \fi + \pgf@circ@draworfill + + \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}% + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}% + + \pgfusepath{draw} +} +%%% american xnor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{xnor}{3}{ + \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xnor port/angle}{\pgf@circ@math@angle}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} + % this compensates for the effect of the line width on the gap between the arcs + \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% + \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}% + + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \ifpgfcirc@draw@input@leads + %input leads + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \advance\pgf@circ@res@other by -\pgf@circ@math@distance + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + \fi + + \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xnor port/angle}}% + \pgf@circ@res@step = \ctikzvalof{tripoles/american xnor port/circle width}\pgf@circ@res@right + \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax + \advance\pgf@circ@res@other by -\pgf@circ@res@step + + % main shape + \ifpgfcirc@roundy@or@shapes + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpathclose + \else + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathclose + \fi + + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@step}} + \pgf@circ@draworfill + + \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@left + \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}% + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}% + + \pgfusepath{draw} +} + +%%% Original one-input ports + +\pgfdeclareshape{american not port}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{left}{ + \northwest + \pgf@x=0.7\pgf@x + \pgf@y=0pt + } + \anchor{bin}{ + \northwest + \pgf@x=0.7\pgf@x + \pgf@y=0pt + } + \anchor{bin 1}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{right}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } + \anchor{bout}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchorborder{% this is used when the node is used as a path element + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + } + \anchor{text}{% + % centered and a bit to the left (it's a triangle)! + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right + + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgf@circ@draworfill + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@step-.5\pgf@circ@res@other}{0pt}} + {\pgfpoint{.5\pgf@circ@res@other}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@other}} + \pgf@circ@draworfill + \endpgfscope + + \ifpgfcirc@draw@input@leads + %input leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + \fi + + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + \fi + + \pgfusepath{draw} + } +} + +\pgfdeclareshape{american buffer port}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{left}{ + \northwest + \pgf@x=0.7\pgf@x + \pgf@y=0pt + } + \anchor{bin}{ + \northwest + \pgf@x=0.7\pgf@x + \pgf@y=0pt + } + \anchor{bin 1}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{right}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } + \anchor{bout}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchorborder{% this is used when the node is used as a path element + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + } + \anchor{text}{% + % centered and a bit to the left (it's a triangle)! + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgf@circ@draworfill + \endpgfscope + + \ifpgfcirc@draw@input@leads + %input leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + \fi + + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + \fi + + \pgfusepath{draw} + } +} +\pgfdeclareshape{invschmitt}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{left}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{bin}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{bin 1}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{right}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } + \anchor{bout}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchorborder{% this is used when the node is used as a path element + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + } + \anchor{text}{% + % centered and a bit to the left (it's a triangle)! + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right + + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@step-.5\pgf@circ@res@other}{0pt}} + {\pgfpoint{.5\pgf@circ@res@other}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@other}} + \pgf@circ@draworfill + \endpgfscope + + \ifpgfcirc@draw@input@leads + %input leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + \fi + + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + \fi + \pgfusepath{draw} + %draw inner shape + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfusepath{draw} + + } +} + +\pgfdeclareshape{schmitt}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{left}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{bin}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{bin 1}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{right}{ + \northwest + \pgf@y=0pt + \pgf@x=-.7\pgf@x + } + \anchor{bout}{ + \northwest + \pgf@y=0pt + \pgf@x=-.7\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchorborder{% this is used when the node is used as a path element + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + } + \anchor{text}{% + % centered and a bit to the left (it's a triangle)! + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \ifpgfcirc@draw@input@leads + %input leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + \fi + + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right-\pgf@circ@res@other}{0pt}} + \fi + \pgfusepath{draw} + %draw inner shape + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfusepath{draw} + + } +} + + +%%% start european logic ports, from John Kormylo +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% + +% #1 - name +% #2 - text inside +% #3 - number of inputs +% #4 = is it a not? +% +% option to add a circle for not-output, see +% https://github.com/circuitikz/circuitikz/issues/385 +% +\newif\ifpgf@circ@european@port@circle\pgf@circ@european@port@circlefalse +\newif\ifpgf@circ@european@port@circle@ieee\pgf@circ@european@port@circle@ieeefalse +\ctikzset{tripoles/european not shape/.initial=ocirc} +\ctikzset{tripoles/european not symbol/.is choice} +\ctikzset{tripoles/european not symbol/triangle/.code={\pgf@circ@european@port@circlefalse}} +\ctikzset{tripoles/european not symbol/circle/.code={% +\pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeefalse\ctikzset{tripoles/european not shape=ocirc}}} +\ctikzset{tripoles/european not symbol/ieee circle/.code={% +\pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeetrue\ctikzset{tripoles/european not shape=notcirc}}} + +\long\def\pgfcircdeclareeurologicport#1#2#3#4{ + \pgfdeclareshape{european #1 port} + { + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \saveddimen{\boutshift}{% + \edef\pgf@temp{not} + \edef\pgf@circ@temp{#4} + \ifx\pgf@temp\pgf@circ@temp % is a not + \ifpgf@circ@european@port@circle + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \edef\pgf@temp{ocirc} + \edef\pgf@circ@temp{\ctikzvalof{tripoles/european not shape}} + \ifx\pgf@temp\pgf@circ@temp % it's ocirc + \pgfmathsetlength{\pgf@x}{2*\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \else % it's ieee not circ + \pgf@circ@notradius % defined together with ieeestd ports + \pgf@x=2\pgf@circ@res@temp + \fi + \else + \pgf@x=0pt + \fi + \else + \pgf@x=0pt + \fi + } + \savedmacro\resize{% automatic + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@up = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgf@circ@res@down = -\pgf@circ@res@up + \pgf@circ@res@right = \ctikzvalof{tripoles/european #1 port/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@right = .5\pgf@circ@res@right + \pgf@circ@res@left = -\pgf@circ@res@right + }% + \savedmacro\inputs{% get number of inputs + \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax% + \ifnum\pgf@circ@res@count=0 + \pgf@circ@res@count=\ctikzvalof{tripoles/european #1 port/inputs}\relax% + \fi + \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi + \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi + \def\inputs{\the\pgf@circ@res@count}% + }% + \savedanchor\step{% 1/2 gap at edges + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen + \divide\pgf@circ@res@step by #3 + \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}% + }% + \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}% + \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}% + \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% + \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}% + \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/european #1 port/origin}\pgf@circ@res@right}{0pt}}% + + \anchor{center}{\origin}% for backwards compatibility + % the text anchor overlaps the logic symbol + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}% + % create input anchors + \ifnum#3=1\relax + \anchor{in}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step + \anchor{in 1}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step + \anchor{bin}{\left\pgfpoint{\pgf@x}{0pt}}% or \step + \anchor{bin 1}{\left\pgfpoint{\pgf@x}{0pt}}% or \step + \else + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@european #1 port\endcsname{% + \pgfmathloop% + \ifnum\pgfmathcounter>#3% + \else% + %\pgfutil@ifundefined{pgf@anchor@european #1 port@in \pgfmathcounter}{% redundant + \expandafter\xdef\csname pgf@anchor@european #1 port@in \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above + }% + \expandafter\xdef\csname pgf@anchor@european #1 port@bin \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{4}{#1}% defined above + }% + %}{}% + \repeatpgfmathloop% + } + \fi + \anchor{out}{\northeast\pgf@y=0pt} + \anchor{bout}{\right\advance\pgf@x by \boutshift\pgf@y=0pt} + + \anchor{left}{\left}% edges of component minus leads + \anchor{right}{\right\advance\pgf@x by \boutshift\pgf@y=0pt} + + \anchor{north east}{\northeast}% see \Compass macro + \anchor{south west}{\southwest} + \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfpoint{0cm}{\pgf@circ@res@up}} + \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfpoint{\pgf@circ@res@left}{0cm}} + \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}% + \pgfpoint{0cm}{\pgf@circ@res@down}} + \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}% + \pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfpoint{\pgf@circ@res@right}{0cm}} + + \anchorborder{% this is used when the node is used as a path element + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgfstartlinewidth=\pgflinewidth + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathrectanglecorners + {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \endpgfscope + \ifpgfcirc@draw@input@leads + %input leads + \ifnum#3=1\relax + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}% + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% + \else + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + %\pgf@circ@res@count = #3\relax% redundant + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left} + {\pgf@circ@res@temp}} + \advance\pgf@circ@res@count by -1 + \repeat + \fi + \pgfusepath{draw} + \fi + % + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{ \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \fi + % + \edef\pgf@temp{not} + \edef\pgf@circ@temp{#4} + \ifx\pgf@temp\pgf@circ@temp % is a not + \ifpgf@circ@european@port@circle + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right} + % reset linewidth for IEEE ports, otherwise they will multiply... + \ifpgf@circ@european@port@circle@ieee\pgfsetlinewidth{\pgfstartlinewidth}\fi + \pgfnode{\ctikzvalof{tripoles/european not shape}}{west}{}{NOT}{\pgfusepath{stroke}} + \endpgfscope + \else + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}% + {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}} + \pgfusepath{draw} + \fi + \fi + % + \pgfpathmoveto{\pgfpointorigin} + \pgftext{#2} + } + } +} +\pgfcircdeclareeurologicport{and}{\&}{\pgf@circ@res@count}{} +\pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf@circ@res@count}{} +\pgfcircdeclareeurologicport{xor}{$=1$}{\pgf@circ@res@count}{} +\pgfcircdeclareeurologicport{not}{$1$}{1}{not} +\pgfcircdeclareeurologicport{buffer}{$1$}{1}{} +\pgfcircdeclareeurologicport{nand}{\&}{\pgf@circ@res@count}{not} +\pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf@circ@res@count}{not} +\pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not} + +%% end european logic ports + +%%%%%%%%%%%%%%%%%%%%%%%% +%% Transistors +%%%%%%%%%%%%%%%%%%%%%%%% + +% +% definitions for transistor circles +% +\ctikzset{transistor circle/.is family} +\ctikzset{transistor circle/relative thickness/.initial=1} +\ctikzset{transistor circle/color/.initial=default} +\ctikzset{transistor circle/dash/.initial=none} +\ctikzset{transistor circle/scale circle radius/.initial=1} +\ctikzset{transistor circle/default base in/.initial=0.9} +\ctikzset{transistor circle/njfet base in/.initial=1.05} +\ctikzset{transistor circle/pjfet base in/.initial=1.05} +\ctikzset{transistor circle/isfet base in/.initial=0.65} + +\newif\ifpgf@circ@trcircle\pgf@circ@trcirclefalse +\ctikzset{tr circle/.is if=pgf@circ@trcircle} +\tikzset{tr circle/.is if=pgf@circ@trcircle} +% +% add a circle to the transistor: +% +\def\pgfcirc@transistorcircle{ + \ifpgf@circ@trcircle + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfsetlinewidth{\ctikzvalof{transistor circle/relative thickness}\pgflinewidth} + \edef\@@none{none}\edef\@@default{default} + \edef\@@tmp{\ctikzvalof{transistor circle/color}} + \ifx\@@tmp\@@default\else + \pgfsetcolor{\@@tmp} + \fi + \edef\@@tmp{\ctikzvalof{transistor circle/dash}} + \ifx\@@tmp\@@none\else + \expandafter\pgfsetdash\expandafter{\@@tmp}{0cm} + \fi + % radius of the circle + % \pgfmathsetlength{\pgf@circ@res@temp}{((#2+\extrabodydiodelen)-(#1)+(#3)*(#3)/((#2+\extrabodydiodelen)-(#1)))/2} + % \pgfpathcircle{\pgfpoint{#1+\pgf@circ@res@temp}{0pt}}{\pgf@circ@res@temp} + \pgfpathcircle{\pgfpoint{\circleleft+\circleradius}{0pt}}{\circleradius} + \pgf@circ@draworfill + \endpgfscope + \fi +} + +\long\def\pgfcircdeclaretransistor#1#2#3{ + \pgfdeclareshape{#1} + { + \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\circlebase}{ + \pgfkeysifdefined{\circuitikzbasekey/transistor circle/#1 base in}% + {% yes, we have it + \edef\circlebase{\ctikzvalof{transistor circle/#1 base in}}% + }{% no, use default + \edef\circlebase{\ctikzvalof{transistor circle/default base in}} + }} + % \savedmacro{\thistypeoftr}{\edef\thistypeoftr{#1}} + \saveddimen{\extrabodydiodelen}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@fet@bodydiode + % try to put the text to the right of the flyback diode + \pgfmathsetlength{\pgf@x}{( + \ctikzvalof{tripoles/#1/bodydiode distance}* + \ctikzvalof{tripoles/#1/width} + + \ctikzvalof{tripoles/#1/bodydiode scale}* + \ctikzvalof{bipoles/diode/height}/2 + )*\pgf@circ@scaled@Rlen} + \else + \pgf@x=0pt\relax + \fi + } + \savedmacro{\scaecircleradius}{ + \edef\scalecircleradius{\ctikzvalof{transistor circle/scale circle radius}} + } + \saveddimen{\circleradius}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + % repeat the extrabodydiodelen (grrr) + \ifpgf@circuit@fet@bodydiode + % try to put the text to the right of the flyback diode + \pgfmathsetlength{\pgf@circ@res@other}{( + \ctikzvalof{tripoles/#1/bodydiode distance}* + \ctikzvalof{tripoles/#1/width} + + \ctikzvalof{tripoles/#1/bodydiode scale}* + \ctikzvalof{bipoles/diode/height}/2 + )*\pgf@circ@scaled@Rlen} + \else + \pgf@circ@res@other=0pt\relax + \fi + % left + \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen + \pgf@xa=\circlebase\pgf@xa % this is the base point of the circle + % northeast + \pgf@yb=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen % y of the left point of circle + \pgf@yb=.5\pgf@yb + \pgf@xb=\pgf@circ@res@other % this is the x of the right points of the circle + % + \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@yb %this is #3 of the circle + % find the radius of the circle + \pgfmathsetlength{\pgf@x}{((\pgf@xb)-(\pgf@xa)+(\pgf@yb)*(\pgf@yb)/((\pgf@xb)-(\pgf@xa)))/2*\scalecircleradius} + } + \saveddimen{\circleleft}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen + \pgf@x=\circlebase\pgf@xa + } + \anchor{circle center}{ + \pgf@y=0pt\pgf@x=\circleleft\advance\pgf@x by\circleradius + } + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northeast{% upper right + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=0pt + } + \savedanchor\left{%center left + \pgf@y=0pt + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen + } + \savedanchor\right{%center right -- added by Burak Kelleci % this is really 0,0 + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{text}{ + \northeast + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@transisors@fixlabels + \ifpgf@circuit@fet@bodydiode + \advance \pgf@x by \extrabodydiodelen + \fi + \ifpgf@circ@trcircle + \left\pgf@xa=\pgf@x + \pgfmathsetlength{\pgf@x}{\circleleft+2*\circleradius} + % \advance \pgf@x by \circleradius + \fi + % add a bit of space to avoid central (substrate) terminal if drawn + \advance\pgf@x by 0.05\pgf@circ@scaled@Rlen\relax + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + \else + \pgf@y=.7\pgf@y + \pgf@x= \pgf@circ@scaled@Rlen + \pgf@x=0.1\pgf@x + \fi + } + \anchor{pathstart}{ % south + \northeast + \pgf@y=-\pgf@y + } + \anchor{pathend}{ + \northeast + } + \anchor{north}{ + \northeast + \pgf@circ@res@step=\pgf@y + \left + \pgf@y=\pgf@circ@res@step + \pgf@x=.5\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \northeast + \pgf@y=0pt + } + \anchor{south}{ + \northeast + \pgf@circ@res@step=\pgf@y + \left + \pgf@y=-\pgf@circ@res@step + \pgf@x=.5\pgf@x + } + \anchor{south west}{ + \northeast + \pgf@circ@res@step=\pgf@y + \left + \pgf@y=-\pgf@circ@res@step + } + \anchor{north east}{ + \northeast + } + \anchor{north west}{ + \northeast + \pgf@circ@res@step=\pgf@y + \left + \pgf@y=\pgf@circ@res@step + } + \anchor{south east}{ + \northeast + \pgf@y=-\pgf@y + } + \anchor{B}{ + \northeast + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y + \left + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step + } + \anchor{base}{ + \northeast + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y + \left + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step + } + \anchor{bulk}{ %added by Burak Kelleci + \northeast + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y + \right + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step + } + \anchor{nobulk}{ %added by Burak Kelleci + \left + \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x + } + \anchor{G}{ + \northeast + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y + \left + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step + } + \anchor{gate}{ + \northeast + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y + \left + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step + } + \anchor{nobase}{ + \left + \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x + } + \anchor{circle base}{ + \left + \pgf@x=\circlebase\pgf@x + } + \anchor{nogate}{ + \left + \pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x + } + \anchor{E}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y + } + \anchor{emitter}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y + } + \anchor{C}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y + } + \anchor{collector}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y + } + \anchor{S}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y + } + \anchor{source}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y + } + \anchor{D}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y + } + \anchor{drain}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y + } + \anchor{body C in}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y + \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y + } + \anchor{circle C}{ + \left + \pgf@xa=\circlebase\pgf@x % this is #1 of the circle + \northeast + \pgf@xb=\pgf@x %this is #2 of the circle + \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y %this is #3 of the circle + % the base of the triangle is x_2 - x_1 - r + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@xb-\pgf@xa-\circleradius} + % so let's go with the height + \pgfmathsetlength{\pgf@ya}{sqrt(abs(\circleradius*\circleradius-\pgf@circ@res@other*\pgf@circ@res@other))} + % finally, direction + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@ya + } + \anchor{circle E}{ + \left + \pgf@xa=\circlebase\pgf@x % this is #1 of the circle + \northeast + \pgf@xb=\pgf@x %this is #2 of the circle + \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y %this is #3 of the circle + % the base of the triangle is x_2 - x_1 - r + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@xb-\pgf@xa-\circleradius} + % so let's go with the height + \pgfmathsetlength{\pgf@ya}{sqrt(abs(\circleradius*\circleradius-\pgf@circ@res@other*\pgf@circ@res@other))} + % finally, direction + % finally, direction + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@ya + } + \anchor{body E in}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y + \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y + } + \anchor{body C out}{ + \northeast + \pgf@ya=\ctikzvalof{tripoles/#1/curr direction}\pgf@y + \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya + \pgf@y=\pgf@ya + \left + \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x + \pgf@y=\pgf@ya + } + \anchor{body E out}{ + \northeast + \pgf@ya=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y + \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya + \pgf@y=\pgf@ya + \left + \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x + \pgf@y=\pgf@ya + } + #2 + \backgroundpath{ + \pgftransformationadjustments + \pgfsetcolor{\ctikzvalof{color}} + % + \ifnum \ctikzvalof{tripoles/#1/curr direction} > 0 + \pgf@circuit@trans@ntypetrue + \else + \pgf@circuit@trans@ntypefalse + \fi + \northeast + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = \pgf@x + \left + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + % + #3 + % BODY DIODE + \ifpgf@circuit@fet@bodydiode + \drawbodydiode{#1} + \fi + % + } +} +} + +\long\def\drawbodydiode#1{ + \pgfscope + \pgftransformshift{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgftransformrotate{90} + % diode scale and bodydiode scale interacts. We want the size of the diode + % proportional to the transistor, so we will: + % 1) undo diode scale 2) apply transistor scale (using the current class) 3) apply bodydiode scale + \pgfmathsetmacro{\@@BDscale}{\ctikzvalof{tripoles/#1/bodydiode scale}* \ctikzvalof{\ctikzclass/scale}/\ctikzvalof{diodes/scale}} + \pgftransformscale{\@@BDscale} + \ifpgf@circuit@fulldiode + \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}} + \else + \pgfnode{emptydiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}} + \fi + \endpgfscope + % Draw stroke line + \ifpgf@circuit@strokediode + \pgfpathmoveto{\pgfpointanchor{pgf@bodydiode}{west}} + \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}} + \pgfusepath{stroke} + \fi + %Draw upper connection to body diode + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}} + \pgftransformscale{0.5} + \pgfnode{circ}{center}{}{}{\pgfusepath{fill}} + \endpgfscope{} + %Draw lower connection to body diode + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{west}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right} {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}} + \pgftransformscale{0.5} + \pgfnode{circ}{center}{}{}{\pgfusepath{fill}} + \endpgfscope +} + +\long\def\declarebpt#1{ + \pgfcircdeclaretransistor{#1}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/#1/base height}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/#1/base height}\pgf@y + } + }{ + + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}} + \pgfusepath{draw} + + % drawing base + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \ifpgf@circuit@bpt@schottky + % upper + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+ + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+ + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+ + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+ + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} + % % lower + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down- + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left- + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down- + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left- + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} + \fi + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + %draw arrow depending on type of transistor + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \edef\@@anchor{center} + \ifpgf@circuit@trans@ntype + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{btip} + \pgftransformlineattime{1.0}{% + \pgfpoint% + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}% + }{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}% + } + \else + \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{% + \pgfpoint% + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}% + }{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}% + } + \fi + \else % p-type + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip} + \pgftransformlineattime{1.0}{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}% + }{% + \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}% + } + \else + \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}% + }{% + \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}% + } + \fi + \fi + \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + \endpgfscope + + \ifpgf@circuit@bpt@drawphoto + \pgfscope + \pgfsetarrowsstart{latexslim} + \pgfpathmoveto{\pgfpointadd{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + {\pgfpoint{0.05\pgf@circ@res@left}{0.1\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpointadd{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + {\pgfpoint{0.5\pgf@circ@res@left}{0.3\pgf@circ@res@up}}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpointadd{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + {\pgfpoint{0.05\pgf@circ@res@left}{-0.1\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpointadd{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + {\pgfpoint{0.5\pgf@circ@res@left}{0.1\pgf@circ@res@up}}} + \pgfusepath{draw} + \endpgfscope + \else + \ifpgf@circuit@bpt@drawbase + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi + \fi + } +} + +\declarebpt{npn} +\declarebpt{pnp} +% +% multi-emitter and multi-collector BJTs by Romano Giannetti +% +\def\pgf@circ@bjt@C@anchor#1{% #1: collector number + \pgfextractx{\pgf@circ@res@temp}{\basedimension} + \pgfextracty{\pgf@circ@res@other}{\basedimension} + \ifnum\cdir>0 % NPN, above + \pgfpoint{\pgf@circ@res@temp}{% + \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep} + \else % PNP, below + \pgfpoint{\pgf@circ@res@temp}{% + -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep} + \fi +} +\def\pgf@circ@bjt@E@anchor#1{% #1: collector number + \pgfextractx{\pgf@circ@res@temp}{\basedimension} + \pgfextracty{\pgf@circ@res@other}{\basedimension} + \ifnum\cdir<0 % PNP, above + \pgfpoint{\pgf@circ@res@temp}{% + \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep} + \else % PNP, below + \pgfpoint{\pgf@circ@res@temp}{% + -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep} + \fi +} + +\long\def\declarebjt#1{ + \pgfdeclareshape{bjt#1}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + % \cdir is 1 for npn, -1 for pnp + \savedmacro{\cdir}{\edef\cdir{\ctikzvalof{tripoles/bjt/#1/curr direction}}} + \savedmacro{\numE}{\edef\numE{\ctikzvalof{tripoles/bjt/emitters}}} + \savedmacro{\numC}{\edef\numC{\ctikzvalof{tripoles/bjt/collectors}}} + % step up or down for the additional C/Es + \saveddimen{\multistep}{\pgfmathsetlength{\pgf@x}{% + \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}* + \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}} + \saveddimen{\external}{\pgfmathsetlength{\pgf@x}{% + \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}} + \savedanchor\basedimension{% these are the dimensions if nC=1 y nE=1 + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\northeast{% upper right + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@step}{% + \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}* + \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \ifnum\cdir> 0 + \edef\numup{\numC}\edef\numdown{\numE} + \else + \edef\numup{\numE}\edef\numdown{\numC} + \fi + \pgfmathsetlength{\pgf@y}{0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen + + (\numup-1)*\pgf@circ@res@step+\pgfverticaltransformationadjustment*.5*\pgflinewidth + + \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\southeast{% lower right + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@step}{% + \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}* + \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \ifnum\cdir> 0 + \edef\numup{\numC}\edef\numdown{\numE} + \else + \edef\numup{\numE}\edef\numdown{\numC} + \fi + \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen + - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth + - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\southwest{% lower left + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@step}{% + \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}* + \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \ifnum\cdir> 0 + \edef\numup{\numC}\edef\numdown{\numE} + \else + \edef\numup{\numE}\edef\numdown{\numC} + \fi + \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen + - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth + - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{tripoles/bjt/width}*\pgf@circ@scaled@Rlen + - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + } + \anchor{center}{\pgfpointorigin} + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\southwest\pgf@x=0cm\relax} + \anchor{west}{\southwest\pgf@y=0cm} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@ya=\pgf@y\southwest\pgf@y=\pgf@ya} + \anchor{south west}{\southwest} + \anchor{south east}{\southeast} + + \anchor{text}{\northeast\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax} + \anchor{B}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external} + \anchor{base}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external} + \anchor{nobase}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x} + % center of the base "bar" + \anchor{cbase}{\basedimension\pgf@x=-\pgf@x + \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}% + } + % geometrical centers + \anchor{vcenter}{\pgf@x=0cm\relax + \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}% + } + \anchor{gcenter}{% + \northeast\pgf@xa=0.5\pgf@x + \southwest\advance\pgf@xa by 0.5\pgf@x + \pgf@x=\pgf@xa + \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}% + } + % external connections + \anchor{E}{ + \ifnum\cdir>0% npn, emitter down + \southeast + \else + \northeast + \fi + }% first emitter + \anchor{emitter}{\ifnum\cdir>0\southeast\else\northeast\fi}% first emitter + \anchor{C}{\ifnum\cdir<0\southeast\else\northeast\fi} + \anchor{collector}{\ifnum\cdir<0\southeast\else\northeast\fi} + + \backgroundpath{ + \pgftransformationadjustments + \pgfsetcolor{\ctikzvalof{color}} + % + % set the type and up and down number of connections + % + \ifnum\cdir> 0 + \pgf@circuit@trans@ntypetrue + \edef\numup{\numC} + \edef\numdown{\numE} + \else + \pgf@circuit@trans@ntypefalse + \edef\numup{\numE} + \edef\numdown{\numC} + \fi + \basedimension + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = \pgf@x + \pgf@circ@res@left = -\pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\multistep + % + % set arrow positions options + % + \edef\@@anchor{center}\edef\@@pos{\ctikzvalof{tripoles/#1/arrow pos}} + \ifpgf@circuit@trans@arrowatend + \edef\@@pos{1.0} + \ifpgf@circuit@trans@ntype % arrow is toward outside, push it a bit + \edef\@@anchor{btip} + \else + \edef\@@anchor{tip} + \fi + \fi + % + % Drawing upper connections + % + \pgfscope + \pgf@circ@count@a=\numup\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \advance\pgf@circ@count@a-1\relax + \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}% + \ifnum\pgf@circ@count@a=\numexpr\numup-1\relax % draw the external pin connection + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@right}% + {\pgf@circ@res@up+\external+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}% + \pgfpathlineto{\pgfpoint + {\pgf@circ@res@right}% + {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}% + \else + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@right}% + {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}% + \fi + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}}% + \pgfsetroundcap % better when connecting to sloped lines + \pgfusepath{draw} + \ifpgf@circuit@trans@ntype\else % it's a PNP; draw arrow + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\@@pos}{% + \pgfpoint + {\pgf@circ@res@right}% + {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}% + }{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}% + } + \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + \endpgfscope + \fi + \repeatpgfmathloop + \endpgfscope + % + % Drawing base + % + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \ifpgf@circuit@bpt@schottky + % upper + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+ + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+ + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+ + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+ + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}} + % lower + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep- + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left- + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep- + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left- + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}} + \fi + \pgfsetroundcap % I like it more... + \pgfusepath{draw} + \endpgfscope + % + % draw base external connection + % + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-\external}{0pt}} + \pgfusepath{draw} + % + % Drawing lower connections + % + \pgfscope + \pgf@circ@count@a=\numdown\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \advance\pgf@circ@count@a-1\relax + \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}% + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint + {\pgf@circ@res@right} + {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}} + \ifnum\pgf@circ@count@a=\numexpr\numdown-1\relax % draw the external pin connection + \pgfpathlineto{\pgfpoint + {\pgf@circ@res@right} + {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other-\external}} + \fi + \pgfsetroundcap % better when connecting to sloped lines + \pgfusepath{draw} + \ifpgf@circuit@trans@ntype % it's a NPN; draw arrow + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\@@pos}{% + \pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}% + }{\pgfpoint + {\pgf@circ@res@right}% + {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}% + } + \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + \endpgfscope + \fi + \repeatpgfmathloop + \endpgfscope + } + % \pgf@sh@s@ contains all the code for the shape + % and is executed just before a node is drawn. + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@bjt#1\endcsname{% + % Start with the maximum collector number and go backwards. + \pgf@circ@count@a=\numC\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `pin 1` for the + % electrical contact, and the "border one" like `bpin 1` for labels. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@bjt#1@C\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@bjt@C@anchor{\the\pgf@circ@count@a}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + % and emitters + \pgf@circ@count@a=\numE\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `pin 1` for the + % electrical contact, and the "border one" like `bpin 1` for labels. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@bjt#1@E\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@bjt@E@anchor{\the\pgf@circ@count@a}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + }% + } +} + +\declarebjt{npn} +\declarebjt{pnp} + +% end of multi-bjts + +\long\def\declareigbt#1{ + \pgfcircdeclaretransistor{#1}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y + } + } + { + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + %draw upper connection + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}} + \pgfusepath{draw} + + %draw thicker gate lines + \pgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} + % set the normal thickness + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}} + \pgfsetlinewidth{\@@extrat\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + %draw lower connection + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + %draw arrow depending on type of transistor + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \ifpgf@circuit@trans@arrowatend + \ifpgf@circuit@trans@ntype + \edef\@@anchor{btip}\edef\@@pos{1.0} + \else + \edef\@@anchor{tip}\edef\@@pos{1.0} + \fi + \else + \edef\@@anchor{center}\edef\@@pos{0.5} + \fi + \ifpgf@circuit@trans@ntype + \pgftransformlineattime{\@@pos}{% + \pgfpoint% + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}% + }{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}% + } + \else + \pgftransformlineattime{\@@pos}{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}% + }{% + \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}% + } + \fi + \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + \endpgfscope + %draw gate + \ifpgf@circuit@trans@ntype + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}% + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}% + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}} + \fi + \pgfusepath{draw} + } +} + +\declareigbt{pigbt} +\declareigbt{nigbt} +\declareigbt{Lnigbt} +\declareigbt{Lpigbt} + +\pgfcircdeclaretransistor{nmos}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/nmos/gate height}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/nmos/gate height}\pgf@y + } + }{% + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + \ifpgf@circuit@mos@arrows + \pgfscope + \ifpgf@circuit@trans@arrowatend + \pgftransformshift{\pgfpoint + {\pgf@circ@res@right}% + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}% + } + \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}} + \else + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\ctikzvalof{tripoles/nmos/arrow pos}}{% + \pgfpoint% + {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}% + }{% + \pgfpoint + {\pgf@circ@res@right}% + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \fi + \endpgfscope + \fi + + \ifpgf@circuit@bpt@drawgate + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi + + \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi +} + +\pgfcircdeclaretransistor{pmos}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/pmos/gate height}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/pmos/gate height}\pgf@y + } + }{% + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}} + \pgfusepath{draw} + + \ifpgf@circuit@mos@arrows + \pgfscope + \ifpgf@circuit@trans@arrowatend + \pgftransformshift{\pgfpoint + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}% + } + \pgftransformrotate{180} + \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}} + \else + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\ctikzvalof{tripoles/pmos/arrow pos}}{% + \pgfpoint% + {\pgf@circ@res@right}% + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}% + }{% + \pgfpoint + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \fi + \endpgfscope + \fi + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + + + \pgfusepath{draw} + \ifpgf@circuit@bpt@drawgate + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi + + \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi + + \ifpgf@circuit@pmos@nocircle\else + % we are not scaling the circle with the MOS --- I think it's better to have it + % coherent with the poles/nodes of the rest of the circuit. + \pgfpathcircle{\pgfpoint + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen} + {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \ifpgf@circuit@pmos@emptycircle + \pgfsetfillcolor{white} + \fi + \pgfusepath{draw,fill} + \fi +} + +%%% depletion MOSFET (simplified symbols) + +\long\def\pgfcirc@filldraw@depletion#1{% + \ifx\tikz@fillcolor\pgfutil@empty + % if there is no explicit fill check the specific key + \edef\@@tmp{\ctikzvalof{tripoles/#1/depletion color}}\edef\@@none{none}% + \ifx\@@tmp\@@none % if it's none + \pgfusepath{draw}% + \else + \edef\@@default{default}% + \ifx\@@tmp\@@default % fill with the pen color + \pgfusepath{draw, fill}% + \else + \pgfsetfillcolor{\@@tmp}% + \pgfusepath{draw, fill}% + \fi + \fi + \else + \pgfsetfillcolor{\tikz@fillcolor}% + \pgfusepath{draw, fill}% + \fi +} + +\pgfcircdeclaretransistor{nmosd}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/nmosd/gate height}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/nmosd/gate height}\pgf@y + } + \anchor{nobulk}{ %override + \left + \pgf@circ@res@temp=\ctikzvalof{tripoles/nmosd/depletion width}\pgf@x + \pgf@x=\ctikzvalof{tripoles/nmosd/base width}\pgf@x + \advance\pgf@x by -\pgf@circ@res@temp + } + }{% + % draw depletion channel + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + \pgfscope + \pgfpathrectanglecorners + {\pgfpoint + {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}} + {\pgfpoint + {(\ctikzvalof{tripoles/nmosd/base width} - \ctikzvalof{tripoles/nmosd/depletion width})*\pgf@circ@res@left} + {-\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}} + \pgfcirc@filldraw@depletion{nmosd} + \endpgfscope + % draw drain and source terminals + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmosd/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmosd/base height}\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + \ifpgf@circuit@mos@arrows + \pgfscope + \ifpgf@circuit@trans@arrowatend + \pgftransformshift{\pgfpoint + {\pgf@circ@res@right}% + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}% + } + \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}} + \else + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\ctikzvalof{tripoles/nmosd/arrow pos}}{% + \pgfpoint% + {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}% + }{% + \pgfpoint + {\pgf@circ@res@right-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}% + {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \fi + \endpgfscope + \fi + + \ifpgf@circuit@bpt@drawgate + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi + + \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi +} + +\pgfcircdeclaretransistor{pmosd}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/pmosd/gate height}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/pmosd/gate height}\pgf@y + } + \anchor{nobulk}{ %override + \left + \pgf@circ@res@temp=\ctikzvalof{tripoles/pmosd/depletion width}\pgf@x + \pgf@x=\ctikzvalof{tripoles/pmosd/base width}\pgf@x + \advance\pgf@x by -\pgf@circ@res@temp + } + }{% + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + % draw depletion channel + \pgfscope + \pgfpathrectanglecorners + {\pgfpoint + {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}} + {\pgfpoint + {(\ctikzvalof{tripoles/pmosd/base width} - \ctikzvalof{tripoles/pmosd/depletion width})*\pgf@circ@res@left} + {-\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}} + \pgfcirc@filldraw@depletion{pmosd} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}} + \pgfusepath{draw} + + \ifpgf@circuit@mos@arrows + \pgfscope + \ifpgf@circuit@trans@arrowatend + \pgftransformshift{\pgfpoint + {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}% + } + \pgftransformrotate{180} + \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}} + \else + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\ctikzvalof{tripoles/pmosd/arrow pos}}{% + \pgfpoint% + {\pgf@circ@res@right-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}% + }{% + \pgfpoint + {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \fi + \endpgfscope + \fi + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmosd/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmosd/base height}\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + + + \pgfusepath{draw} + \ifpgf@circuit@bpt@drawgate + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi + + \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi + + \ifpgf@circuit@pmos@nocircle\else + % we are not scaling the circle with the MOS --- I think it's better to have it + % coherent with the poles/nodes of the rest of the circuit. + \pgfpathcircle{\pgfpoint + {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen} + {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \ifpgf@circuit@pmos@emptycircle + \pgfsetfillcolor{white} + \fi + \pgfusepath{draw,fill} + \fi +} +%% HEMT FET Transistor +\pgfcircdeclaretransistor{hemt}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/hemt/gate height}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/hemt/gate height}\pgf@y + } + }{% + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} +} + +\long\def\drawfetcore#1{ + \pgftransformationadjustments + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + + %top connection + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} + \ifpgf@circuit@trans@depletiontype + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} + \else + + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.45}} + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.25}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down*0.25}} + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nfet/base height}\pgf@circ@res@down*0.45}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} + \fi + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + %Bulk connection line + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\pgf@circ@res@up+\pgf@circ@res@down}} + + %bottom connection + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + %draw thick gate line + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + % arrows + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \ifpgf@circuit@trans@arrowatend + \ifpgf@circuit@trans@ntype + \edef\@@anchor{tip} + \edef\@@pos{1.0} + \else + \edef\@@anchor{btip} + \edef\@@pos{0.0} + \fi + \else + \edef\@@anchor{center}\edef\@@pos{0.6} + \fi + \pgftransformlineattime{\@@pos}{% + \pgfpoint + {\pgf@circ@res@right}% + {\pgf@circ@res@up+\pgf@circ@res@down}% + }{% + \pgfpoint% + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\pgf@circ@res@up+\pgf@circ@res@down}% + } + \ifpgf@circuit@trans@ntype + \else + \pgftransformrotate{180} + \fi + \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + \endpgfscope + +% GATE CONNECTION +\ifpgf@circuit@bpt@drawgate + \ifpgf@circuit@trans@ntype + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +\fi + +} + +\long\def\pgfdeclaretransistorwrapperaddbulk#1#2#3 +{\pgfcircdeclaretransistor{#1}{ + \anchor{bulk}{\left\pgf@x=0pt} + \anchor{B}{\left\pgf@x=0pt}%override Base anchor from npn&igbt + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y + } + #2 + } + {#3} +} + +\pgfdeclaretransistorwrapperaddbulk{nfet}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{nfet} +} + +\pgfdeclaretransistorwrapperaddbulk{pfet}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{pfet} +} + +\pgfdeclaretransistorwrapperaddbulk{nfetd}{}{% + \pgf@circuit@trans@depletiontypetrue + \drawfetcore{nfetd} +} + +\pgfdeclaretransistorwrapperaddbulk{pfetd}{}{% + \pgf@circuit@trans@depletiontypetrue + \drawfetcore{pfetd} +} +% N-CHANNEL IGFET ENHANCEMENT TYPE +\pgfdeclaretransistorwrapperaddbulk{nigfete}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{nigfete} + + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} +\fi +} + +% N-CHANNEL IGFET ENHANCEMENT TYPE with Bulk connector +\pgfdeclaretransistorwrapperaddbulk{nigfetebulk}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{nigfetebulk} + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \ctikzvalof{tripoles/nigfetebulk/gate height}\pgf@circ@res@down}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} + \fi +} + +% N-CHANNEL IGFET DEPLETION TYPE +\pgfdeclaretransistorwrapperaddbulk{nigfetd}{}{% + \pgf@circuit@trans@depletiontypetrue + \drawfetcore{nigfetd} + + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} + \fi +} + +% P-CHANNEL IGFET ENHANCEMENT TYPE +\pgfdeclaretransistorwrapperaddbulk{pigfete}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{pigfete} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \ctikzvalof{tripoles/pigfete/gate height}\pgf@circ@res@up}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope + \fi +} + +% P-CHANNEL IGFET ENHANCEMENT TYPE with bulk connector +\pgfdeclaretransistorwrapperaddbulk{pigfetebulk}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{pigfetebulk} +} + +% P-CHANNEL IGFET DEPLETION TYPE +\pgfdeclaretransistorwrapperaddbulk{pigfetd}{}{% + \pgf@circuit@trans@depletiontypetrue + \drawfetcore{pigfetd} + + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@up}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} + \fi +} + +\pgfcircdeclaretransistor{njfet}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y + } + }{% + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + % arrow + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip}\edef\@@pos{1.0} + \else + \edef\@@anchor{center}\edef\@@pos{0.6} + \fi + \pgftransformlineattime{\@@pos}{% + \pgfpoint{\pgf@circ@res@left}% + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}% + }{% + \pgfpoint + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}% + } + \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} + \pgfusepath{draw} +} + +\pgfcircdeclaretransistor{pjfet}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y + } + }{% + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{btip}\edef\@@pos{1.0} + \else + \edef\@@anchor{center}\edef\@@pos{0.4} + \fi + \pgftransformlineattime{\@@pos}{% + \pgfpoint% + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}% + }{% + \pgfpoint{\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}% + } + \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + \pgfusepath{draw} +} + +\pgfdeclaretransistorwrapperaddbulk{isfet}{ + }{% + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + % DRAIN CONNECTION + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}} + % DRAIN + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}} + \pgfusepath{draw} + + % GATE, DEPLETION TYPE + \pgfscope %% added + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} %% added + \pgfusepath{draw} %% added + \endpgfscope %% added + + % BULK + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+.5\pgflinewidth} + {\pgf@circ@res@up+\pgf@circ@res@down}} + + % SOURCE + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}} + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} + \fi + % ARROW + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip}\edef\@@pos{1.0} + \else + \edef\@@anchor{center}\edef\@@pos{0.6} + \fi + \pgftransformlineattime{\@@pos}{% + \pgfpoint + {\pgf@circ@res@right}% + {\pgf@circ@res@up+\pgf@circ@res@down}% + }{% + \pgfpoint% + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}% + {\pgf@circ@res@up+\pgf@circ@res@down}% + } + \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + \endpgfscope + \pgfusepath{draw} + + % Wavy lines + \pgfscope + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +% end of transistors + +%%%%%%%%%%%%% +%% Switches +%%%%%%%%%%%%% + +\pgfcircdeclarebipole{ + \anchor{out 1}{ + \northeast + \pgf@y=0cm + } + \anchor{out 2}{ + \northeast + \pgf@y=.8\pgf@y + } +} +{\ctikzvalof{tripoles/toggleswitch/height 2}} +{toggleswitch} +{\ctikzvalof{tripoles/toggleswitch/height}} +{\ctikzvalof{tripoles/toggleswitch/width}} +{ + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} + \pgfusepath{draw} + \pgfscope + \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}} + \pgfusepath{draw} + + + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetdash{{.08\pgf@circ@res@up}{.04\pgf@circ@res@up}{.7\pgf@circ@res@up}{.04\pgf@circ@res@up}{.8\pgf@circ@res@up}}{0cm} + \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@left}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfsetdash{}{0cm} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% operational and instrumentation amplifiers +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\pgfdeclareshape{op amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\left{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \savedanchor\left{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=0pt + } + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/op amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + + % Triangle + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + % Negative input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} + + % Positive input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} + + % Output terminal + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}} + \pgfsetrectcap + \pgfusepath{draw} + } +} + +% Op amp shape as in european standard EN 60617 +\pgfdeclareshape{en amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\left{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \anchor{up}{ + \northwest + \pgf@x=0pt + } + \anchor{down}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/en amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/en amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + \pgfsetrectcap + \pgfusepath{draw} + + + \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\hbox{\ctikzvalof{tripoles/en amp/font2}\ctikzvalof{tripoles/en amp/text}}} + % \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font2}$\mathstrut{\triangleright}\,\mathrm{A}$} + } +} + +% Fully differential output op amp +% Contributed by Kristofer M. Monisit +\pgfdeclareshape{fd op amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\outline{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y\pgf@x=0pt\relax + } + \anchor{north}{ + \northwest\pgf@x=0pt\relax + } + \savedanchor\left{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=0pt + } + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/fd op amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@right}{0pt}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out up}{ + \northwest + \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x + } + \anchor{out down}{ + \northwest + \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x + } + \anchor{out +}{ + \outline + \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x + } + \anchor{out -}{ + \outline + \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x + } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/fd op amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{bout +}{ + \outline + \pgf@xa=\pgf@x\pgf@ya=\pgf@y + \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}} + {\pgfpoint{\pgf@xa}{0pt}} + {\pgfpoint{0pt}{\pgf@ya}} + } + \anchor{bout -}{ + \outline + \pgf@xa=\pgf@x\pgf@ya=\pgf@y + \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}} + {\pgfpoint{\pgf@xa}{0pt}} + {\pgfpoint{0pt}{\pgf@ya}} + \pgf@y=-\pgf@y + } + \anchor{bout up}{ + \northwest + \pgf@xa=\pgf@x\pgf@ya=\pgf@y + \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}} + {\pgfpoint{\pgf@xa}{0pt}} + {\pgfpoint{0pt}{\pgf@ya}} + } + \anchor{bout down}{ + \northwest + \pgf@xa=\pgf@x\pgf@ya=\pgf@y + \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}} + {\pgfpoint{\pgf@xa}{0pt}} + {\pgfpoint{0pt}{\pgf@ya}} + \pgf@y=-\pgf@y + } + % end border anchors + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x + } + \anchor{out}{% should not be used + \left + \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x \pgf@y=-\pgf@y } + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + + % Triangle + % Includes output terminals in the traingular shape + % to ensure that diagonal joins are properly displayed + % we first draw the main triangle and the leads with normal thickness, + % and the redraw the main triangle with the component shape + \pgfscope + % shift origin a bit to ease calculations + \pgftransformxshift{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@step + + % Initial point (right vertex) + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + + % Negative output terminal + \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}} + + % Top vertex + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + + % Bottom vertex + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + + % Positive output terminal + \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}} + + % Right vertex + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + + \pgfpathclose + \pgfusepath{stroke} + + % ok, now we'll redraw the triangle with the class specific + % thickness and optionally fill + + \pgfscope + \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth} + + % Initial point (right vertex) + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + % Top vertex + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + % Bottom vertex + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope % thick and fill + \endpgfscope % shift + + % Negative input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} + + % Positive input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} + + % Negative output terminal label + \pgftext[right, bottom, x=3pt, y=1pt, at=\pgfpoint{0pt}{0.425\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@oplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} + + % Positive output terminal label + \pgftext[right, top, x=3pt, y=-1pt, at=\pgfpoint{0pt}{0.425\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@oplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} + + \pgfsetrectcap + \pgfusepath{draw} + } +} + + +% Instrumentation amplifier with differential output +\pgfdeclareshape{fd inst amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + % when tikz calls the anchor it wants the relative position in the lengths + % \pgf@x \pgf@y + % \pgfpoint* functions set that variables + % anchors are visible outside and run on use + \anchor{center}{\pgfpointorigin} + % savedanchors are internals and run on node creation (not use) + % bounding-box top left + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{nw}{ + \northwest + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y\pgf@x=0pt\relax + } + \anchor{north}{ + \northwest\pgf@x=0pt\relax + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x + } + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/fd inst amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + % reference voltage input anchors. + \savedanchor\refv{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/fd inst amp/refv pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}} + } + % we need both because they are normally drawn under the amp, and if you + % mirror it vertically you need them + \anchor{refv up}{ + \refv + } + \anchor{refv down}{ + \refv + \pgf@y=-\pgf@y + } + \savedanchor\outport{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=-.5\pgf@x + \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi + } + \anchor{out}{ + \outport + \pgf@y=0pt + } + \anchor{out +}{ + \outport + } + \anchor{out -}{ + \outport + \pgf@y=-\pgf@y + } + \savedanchor\outportfixed{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=-.5\pgf@x + } + \anchor{out up}{ + \outportfixed + } + \anchor{out down}{ + \outportfixed + \pgf@y=-\pgf@y + } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@x=-\pgf@x \pgf@y=0pt + } + \anchor{bout +}{ + \outport + \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya + } + \anchor{bout -}{ + \outport + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya + } + \anchor{bout up}{ + \outportfixed + \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya + } + \anchor{bout down}{ + \outportfixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya + } + % end border anchors + % + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + + % let's start drawing the component + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + % + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + % main component, normally in thicker lines + \pgfscope + \newdimen\pgf@circ@res@right@double + \pgf@circ@res@right@double=2\pgf@circ@res@right + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@step + %first point (near output) + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{0}} + %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}} + % and then to the input "front up", "down", to the output short side "down" + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@down}} + % ...and close + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + % input terminal up + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}} + % + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} + + % input terminal down + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} + + % output leads down and up + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} % + \pgftext[right, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$-\;$\else$+\;$\fi} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}} % + \pgftext[right, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$+\;$\else$-\;$\fi} + % + \pgfsetrectcap + \pgfusepath{draw} + } +} + +% Transconductance amplifier (Transkonduktanzverstärker) +\pgfdeclareshape{gm amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x + } + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/gm amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/gm amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgfscope + \newdimen\pgf@circ@res@right@double + \pgf@circ@res@right@double=2\pgf@circ@res@right + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@step + %Umrandung: + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{0}} %geändert startpunkt neu am ausgangsstrich + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}}%vom Ausgang nach oben + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} %neu ecke links oben nach rechts oben + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} %bei deneigängen runter + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@down}}%ecke links unten nach rechts unten + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/gm amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} + + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/gm amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{0pt}} % + \pgfsetrectcap + \pgfusepath{draw} + + } +} + +% Instrumentation amplifier +\pgfdeclareshape{inst amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + % when tikz calls the anchor it wants the relative position in the lengths + % \pgf@x \pgf@y + % \pgfpoint* functions set that variables + % anchors are visible outside and run on use + \anchor{center}{\pgfpointorigin} + % savedanchors are internals and run on node creation (not use) + % bounding-box top left + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{nw}{ + \northwest + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x + } + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/inst amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + % reference voltage input anchors. + \savedanchor\refv{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/inst amp/refv pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}} + } + % we need both because they are normally drawn under the amp, and if you + % mirror it vertically you need them + \anchor{refv up}{ + \refv + } + \anchor{refv down}{ + \refv + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/inst amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + + % let's start drawing the component + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + % + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + + % main component, normally in thicker lines + \pgfscope + \newdimen\pgf@circ@res@right@double + \pgf@circ@res@right@double=2\pgf@circ@res@right + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@step + %first point (near output) + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{0}} + %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}} + % and then to the input "front up", "down", to the output short side "down" + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@down}} + % ...and close + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + % Negative input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}} + % + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} + + % Positive input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} + + % Output terminal + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{0pt}} % + % + \pgfsetrectcap + \pgfusepath{draw} + } +} + +% Instrumentation amplifier with terminals for gain resistance between inputs +\pgfdeclareshape{inst amp ra} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + % bounding-box top left + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{nw}{ + \northwest + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y\pgf@x=0pt\relax + } + \anchor{north}{ + \northwest\pgf@x=0pt\relax + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x + } + % inputs (+-) + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + % R ampli anchors. They are by default at 20% more than R-length distance + % you can change that with the `ra pos` key (use 0.5 for one-R). + \savedanchor\raOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\pgf@circ@scaled@Rlen + \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{ra up}{ + \raOneFixed + } + \anchor{ra down}{ + \raOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\raOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\pgf@circ@scaled@Rlen + \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{ra-}{ + \raOne + } + \anchor{ra+}{ + \raOne + \pgf@y=-\pgf@y + } + % power supplies + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/inst amp ra/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + % reference voltage input anchors. + \savedanchor\refv{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen + \pgf@y=0.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=0.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/inst amp ra/refv pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}} + } + % we need both because they are normally drawn under the amp, and if you + % mirror it vertically you need them + \anchor{refv up}{ + \refv + } + \anchor{refv down}{ + \refv + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/inst amp ra/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bra up}{ + \raOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bra down}{ + \raOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bra-}{ + \raOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bra+}{ + \raOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + + % drawing of the component + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + + \newdimen\pgf@circ@res@right@double + \pgf@circ@res@right@double=2\pgf@circ@res@right + + % main component, normally in thicker lines + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@step + %primer punto: la linea de salida (lado componente) + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{0}} + %from the exit to the top (short side)... (note that the .6 must be copied in \up anchor + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}} + % and then to the input "front up", "down", to the output short side "down" + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@down}} + % ...and close + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + % ra terminal - + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + % ra terminal + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + + % Negative input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}} + % + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} + + % Positive input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} + + % Output terminal + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{0pt}} % + % + \pgfsetrectcap + \pgfusepath{draw} + } +} + +% Buffer +% Contributed by Danilo Piazzalunga +\pgfdeclareshape{buffer} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/buffer/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/buffer/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{bin}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{bout}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } + + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \northwest + \pgfmathsetlength{\pgf@x}{0.7*\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + } +} + +% plain amplifier, no symbols +\pgfdeclareshape{plain amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \savedanchor\left{% + \pgf@y=0pt + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/plain amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}} + + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + } +} + +% plain amplifier, no symbols, one input +\pgfdeclareshape{plain mono amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \savedanchor\left{% + \pgf@y=0pt + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=0pt\relax + } + \anchor{in}{ + \inOne + } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/plain amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {0pt}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + {0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + } +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% electromechanical device (motor/generator) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\pgfdeclareshape{elmech} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{electromechanicals}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{text}{ + \pgfpointorigin + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \advance \pgf@y by -.5\ht\pgfnodeparttextbox + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{right}{% + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{top}{ + \northwest + \pgf@x=0pt + } + \anchor{pathstart}{ + \northwest + \pgf@x=0pt + } + \anchor{pathend}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{bottom}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{% + \@tempdima=\pgf@x\@tempdimb=\pgf@y + \northwest\pgf@circ@res@other=-\pgf@x + \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}{\pgfqpoint{\pgf@circ@res@other}{\pgf@circ@res@other}} + } + \anchor{block north west}{\northwest\pgf@x=0.5\pgf@x} + \anchor{block south west}{\northwest\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y} + \anchor{block north east}{\northwest\pgf@x=-0.5\pgf@x} + \anchor{block south east}{\northwest\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y} + \anchor{block up right}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@x=-0.5\pgf@x + } + \anchor{block up left}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@x=0.5\pgf@x + } + \anchor{block down right}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@y=-\pgf@y + \pgf@x=-0.5\pgf@x + } + \anchor{block down left}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@y=-\pgf@y + \pgf@x=0.5\pgf@x + } + \behindbackgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope % clip the bar: whole size minus the circle + \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgfseteorule + \pgfusepath{clip} + \pgfpathrectangle{\pgfpoint{-.25\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfsetfillcolor{\ctikzvalof{color}} + \pgfusepath{fill, draw} + \endpgfscope + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white + \pgfsetfillcolor{white} + % ...but override it if the class is defined! + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \pgfusepath{draw, fill} + \fi + \endpgfscope + } +} + +%%%%%%%%%%%%%%%%%%% +%% Magnetron +%%%%%%%%%%%%%%%%%%% + +\pgfdeclareshape{magnetron} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} % class of these components + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{anode}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{cathode1}{ + \northwest + \pgf@circ@res@step=\pgf@y + \pgfmathparse{cos(105)} + \pgf@x=\pgfmathresult\pgf@circ@res@step + \pgfmathparse{sin(105)} + \pgf@y=\pgfmathresult\pgf@circ@res@step + %\pgfpointorigin + %\pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@step}}%not working in a scaled tikzpicture + } + \anchor{cathode2}{ + \northwest + \pgf@circ@res@step=\pgf@y + \pgfmathparse{cos(75)} + \pgf@x=\pgfmathresult\pgf@circ@res@step + \pgfmathparse{sin(75)} + \pgf@y=\pgfmathresult\pgf@circ@res@step + %\pgfpointorigin + %\pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@step}}%not working in a scaled tikzpicture + } + \anchor{text}{ + \pgfpointorigin + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \advance \pgf@y by -.5\ht\pgfnodeparttextbox + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{right}{% + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{top}{ + \northwest + \pgf@x=0pt + } + \anchor{pathstart}{ + \northwest + \pgf@x=0pt + } + \anchor{pathend}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{bottom}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfmathsetlength{\pgf@circ@res@other}{sin(15)*\pgf@circ@res@up} + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + %create outer circle + \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@right} + \pgf@circ@draworfill + %create chambers + \foreach \angle in {45,135,225,315}{ + \pgfpathmoveto{ \pgfpointpolar{\angle}{0.6\pgf@circ@res@right}} + \pgfpathlineto{ \pgfpointpolar{\angle}{\pgf@circ@res@right}} + } + \pgfsetroundcap + \pgfusepath{draw} + \pgfscope + %draw connection from outside + %anode + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0\pgf@circ@res@right}{.5\pgf@circ@res@down}} + %cathodes + \pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfusepath{draw} + \endpgfscope + %create cathode + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.15\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + %create anode + \pgfpathmoveto{\pgfpoint{0.3\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{.5\pgf@circ@res@down}} + + \pgfsetbuttcap + \pgfusepath{draw} + \endpgfscope + } +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Electronic tubes, submitted by J. op den Brouw +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Draw tube outline +\def\pgf@circ@tubes@drawtube{% + \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfutil@tempdima=\pgf@circ@res@right + \advance\pgfutil@tempdima by -\pgf@circ@res@up + \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}} + \pgfpatharc{90}{-90}{\pgf@circ@res@up} + \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}} + \pgfpatharc{270}{90}{\pgf@circ@res@up} + \else + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}} + \pgfutil@tempdima=\pgf@circ@res@up + \advance\pgfutil@tempdima by -\pgf@circ@res@right + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} + \pgfpatharc{180}{0}{\pgf@circ@res@right} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}} + \pgfpatharc{180}{0}{-\pgf@circ@res@right} + \fi + \pgfpathclose +} + +%% The diode (tube), triode, tetrode and pentode only differ in the +%% number of grids. So we construct a generic declare function in +%% which we can put code for the grid anchors and grid drawing code +%% \pgfcircdeclaretube{tube name}{grid anchors}{grid drawing code} +\long\def\pgfcircdeclaretube#1#2#3{% + \pgfdeclareshape{#1}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen + % x and y should be half the Rlen + \pgf@y=\pgf@circ@res@up + \pgf@y=.5\pgf@y + \pgf@x=-\pgf@circ@res@right + \pgf@x=.5\pgf@x + } + \anchor{north} {% + \northwest + \pgf@x=0pt + } + \anchor{east}{% + \northwest + \pgf@x=-\pgf@x + \pgf@y=0pt + } + \anchor{south}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{west}{% + \northwest + \pgf@y=0pt + } + \anchor{north west}{% + \northwest + } + \anchor{north east}{% + \northwest + \pgf@x=-\pgf@x + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{anode} {% + \northwest + \pgf@x=0pt + } + \anchor{cathode}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x + } + \anchor{cathode 1}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x + } + \anchor{cathode 2}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=-\ctikzvalof{tubes/cathode width}\pgf@x + } + \anchor{filament 1}{% + \northwest + \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgf@x=\pgfmathresult\pgf@x + \pgf@y=-\pgf@y + } + \anchor{filament 2}{% + \northwest + \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgf@x=-\pgfmathresult\pgf@x + \pgf@y=-\pgf@y + } + + % Extra anchors + #2 + + \backgroundpath{ + \pgfscope + % Line width for tripoles + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgf@circ@scaled@Rlen=\scaledRlen + + % Setup to draw tube + \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up + \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + + % Tube outline + \pgf@circ@tubes@drawtube + + % Setup to draw grid, filament, anode and cathode + \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@up=0.5\pgf@circ@res@up + \pgf@circ@res@right=0.5\pgf@circ@res@right + + % Tube fill color (if any) + \pgf@circ@draworfill + + % Grid drawing + #3 + + % Filament (is not drawn by default) + \ifpgf@circuit@tubes@filament + \pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up + \advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up + \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgf@xa=\pgfmathresult\pgf@circ@res@right + \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}} + \pgf@ya=\pgfmathresult\pgf@circ@res@up + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}} + \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}} + \pgf@circuit@tubes@filamentfalse + \fi + + % Anode (or plate) + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north + \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} + + % Cathode + \ifpgf@circuit@tubes@nocathode + \pgf@circuit@tubes@nocathodefalse + \else + \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} + \ifpgf@circuit@tubes@fullcathode + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgf@circuit@tubes@fullcathodefalse + \else + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-\ctikzvalof{tubes/cathode right extend}\pgf@circ@res@up}} + \fi + \fi + + % Draw the background + \pgfusepath{draw} + \endpgfscope + } + } +} + +\pgfcircdeclaretube{diodetube}{}{} % shape diode already exists + +\pgfcircdeclaretube{triode} +{ + \anchor{grid} {% should not be used + \northwest + \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y + } + \anchor{control} {% + \northwest + \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y + } +} +{ + % Grid protrusion + \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} + % Grid dashes: calculations + \pgf@xb=2\pgf@circ@res@right + \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 + \multiply\pgf@circ@count@a by 2\relax + \advance\pgf@circ@count@a by 1\relax + \advance\pgf@circ@res@step by -\pgf@xa + \divide\pgf@circ@res@step by \pgf@circ@count@a + % Grid dashes: draw + \pgf@circ@res@temp=\pgf@xa + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} + \loop + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} + \advance\pgf@circ@count@a by-1 + \ifnum\pgf@circ@count@a>0\relax + \repeat +} + +\pgfcircdeclaretube{tetrode} +{ + \anchor{grid} {% should not be used + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \pgf@y=0.5\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{control} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \pgf@y=0.5\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{screen} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y + \pgf@y=0.5\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } +} +{ + % Grid x/y points + \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right + \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up + \pgfutil@tempdimb=-\pgfutil@tempdima + \pgfutil@tempdima=0.5\pgfutil@tempdima + \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \pgfutil@tempdimb=0.5\pgfutil@tempdimb + \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + % Grid protrusion + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}} + % Grid dashes: calculations + \pgf@xb=2\pgf@circ@res@right + \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 + \multiply\pgf@circ@count@a by 2\relax + \advance\pgf@circ@count@a by 1\relax + \advance\pgf@circ@res@step by -\pgf@xa + \divide\pgf@circ@res@step by \pgf@circ@count@a + % Grid dashes: draw + \pgf@circ@res@temp=\pgf@xa + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} + \loop + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}} + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \advance\pgf@circ@count@a by-1 + \ifnum\pgf@circ@count@a>0\relax + \repeat +} + +\pgfcircdeclaretube{pentode} +{ + \anchor{grid} {% should not be used + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{control} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{screen} {% + \northwest + \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y + } + \anchor{suppressor} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } +} +{ + % Grid x/y points + \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right + \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up + \pgfutil@tempdimb=-\pgfutil@tempdima + \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up + % Grid protrusion + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}} + % Grid dashes: calculations + \pgf@xb=2\pgf@circ@res@right + \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 + \multiply\pgf@circ@count@a by 2\relax + \advance\pgf@circ@count@a by 1\relax + \advance\pgf@circ@res@step by -\pgf@xa + \divide\pgf@circ@res@step by \pgf@circ@count@a + % Grid dashes: draw + \pgf@circ@res@temp=\pgf@xa + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} + \loop + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}} + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \advance\pgf@circ@count@a by-1 + \ifnum\pgf@circ@count@a>0\relax + \repeat +} + +\pgfcircdeclaretube{pentode suppressor to cathode} +{ + \anchor{grid} {% should not be used + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{control} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{screen} {% + \northwest + \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y + } +} +{ + % Grid x/y points + \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right + \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up + \pgfutil@tempdimb=-\pgfutil@tempdima + \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up + % Grid protrusion + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}} + % Grid dashes: calculations + \pgf@xb=2\pgf@circ@res@right + \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 + \multiply\pgf@circ@count@a by 2\relax + \advance\pgf@circ@count@a by 1\relax + \advance\pgf@circ@res@step by -\pgf@xa + \divide\pgf@circ@res@step by \pgf@circ@count@a + % Grid dashes: draw + \pgf@circ@res@temp=\pgf@xa + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} + \loop + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \ifnum\pgf@circ@count@a>1\relax + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}} + \fi + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}} + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \advance\pgf@circ@count@a by-1 + \ifnum\pgf@circ@count@a>0\relax + \repeat + % Grid: connection from suppressor to cathode + \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima-2*\ctikzvalof{tubes/grid separation}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right-0.4142136*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-0.4142136*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} + +} + +%%%---------- close: tex/pgfcirctripoles +%%%%%%%%%%% Springe nach tex/pgfcircquadpoles +%%%---------- open: tex/pgfcircquadpoles.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Quadripoles + +\long\def\pgfcircdeclarequadpole#1#2#3{ + \pgfdeclareshape{#1} + { + \savedmacro{\ctikzclass}{\edef\ctikzclass{inductors}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + % shapename + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + \anchor{center}{ + \northwest + \pgf@x=0pt + \pgf@y=0pt + } + \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=.5\pgf@circ@scaled@Rlen + \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x + } + %% we define the upper right (positive coord) dot (which is B1) + \savedanchor{\innerdot}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@xa=.5\pgf@circ@scaled@Rlen + \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa + % by default use the cute inductor size + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2} + % check if it's american + \edef\pgf@circ@temp{\ctikzvalof{inductor}} + \edef\pgf@temp{american} + \ifx\pgf@circ@temp\pgf@temp + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2} + \fi + % check if it's european + \edef\pgf@temp{european} + \ifx\pgf@circ@temp\pgf@temp + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2} + \fi + \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen} + } + \savedanchor{\outerdot}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@xa=.5\pgf@circ@scaled@Rlen + \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa + % by default use the cute inductor size + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2} + % check if it's american + \edef\pgf@circ@temp{\ctikzvalof{inductor}} + \edef\pgf@temp{american} + \ifx\pgf@circ@temp\pgf@temp + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2} + \fi + % check if it's european + \edef\pgf@temp{european} + \ifx\pgf@circ@temp\pgf@temp + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2} + \fi + \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen} + } + \anchor{A2}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{B1}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{A1}{ + \northwest + } + \anchor{B2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + %% dot's anchors + \anchor{inner dot A1}{\innerdot\pgf@x=-\pgf@x} + \anchor{outer dot A1}{\outerdot\pgf@x=-\pgf@x} + \anchor{inner dot A2}{\innerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{outer dot A2}{\outerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{inner dot B1}{\innerdot} + \anchor{outer dot B1}{\outerdot} + \anchor{inner dot B2}{\innerdot\pgf@y=-\pgf@y} + \anchor{outer dot B2}{\outerdot\pgf@y=-\pgf@y} + % geographical + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{base}{ + \northwest + \pgf@x=0pt + } + #3 + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + #2 + } + } +} + + +\def\pgf@circ@drawtransformerbasicanchor{ + \ctikzvalof{quadpoles/trans/height} + \anchor{AA2}{ + \northwest + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=-\pgf@y + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y + } + \anchor{BB1}{ + \northwest + \pgf@x=-\pgf@x + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y + } + \anchor{AA1}{ + \northwest + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y + } + \anchor{BB2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=-\pgf@y + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y + } +} + +%% Null styles that can be used to change individually the L1 and L2 +%% inductors of the transformer. + +\ctikzset{transformer L1/.style={}} +\ctikzset{transformer L2/.style={}} + +\def\pgf@circ@drawtransformerbasicbody{ + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgftransformlineattime{.5}{% + \pgfpoint% + {\stretto\pgf@circ@res@left}% + {\pgf@circ@res@up}% + }{% + \pgfpoint + {\stretto\pgf@circ@res@left}% + {\pgf@circ@res@down}% + } + + \pgfkeys{\circuitikzbasekey/.cd, transformer L1} + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{fullgenericshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}} + \else% + \def\pgf@temp{cute} + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{cuteinductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}} + \else% + \pgfnode{americaninductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}} + \fi% + \fi% + + + \endpgfscope + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgftransformlineattime{.5}{% + \pgfpoint% + {\stretto\pgf@circ@res@right}% + {\pgf@circ@res@down}% + }{% + \pgfpoint + {\stretto\pgf@circ@res@right}% + {\pgf@circ@res@up}% + } + + \pgfkeys{\circuitikzbasekey/.cd, transformer L2} + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{fullgenericshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}} + \else% + \def\pgf@temp{cute} + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{cuteinductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}} + \else% + \pgfnode{americaninductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}} + \fi% + \fi% + + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{\thisshape-L1}{b}} + + \pgfpathmoveto{\pgfpointanchor{\thisshape-L1}{a}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{\thisshape-L2}{a}} + + \pgfpathmoveto{\pgfpointanchor{\thisshape-L2}{b}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfusepath{draw} + +} + + +\pgfcircdeclarequadpole{transformer}{ + \pgf@circ@drawtransformerbasicbody +}{\pgf@circ@drawtransformerbasicanchor} + +\pgfcircdeclarequadpole{transformer core}{ + + \pgf@circ@drawtransformerbasicbody + + % use the chocke line thickness + \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth} + + % Find the distance from center for the lines representing the core + % the 2.5 is for backward compatibility --- the distance was calculated as a fraction + % of the whole component, now as a fraction of the distance between coils, to be + % compatible with the quadpoles "inner" style. + \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@right} + + \pgfmoveto{\pgfpoint% + {\pgf@circ@res@other}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}% + } + \pgflineto{ + \pgfpoint% + {\pgf@circ@res@other}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}% + } + + %% this should be just -\pgf@circ@res@other, but in case someone define an asymmetric trafo someday... + \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@left} + \pgfmoveto{\pgfpoint% + {\pgf@circ@res@other}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}% + } + \pgflineto{ + \pgfpoint% + {\pgf@circ@res@other}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}% + } + + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgfusepath{draw} +}{\pgf@circ@drawtransformerbasicanchor} + + +\pgfcircdeclarequadpole{gyrator}{ + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth} + \pgfmathsetlength{\pgf@circ@res@other}{min(.7*\stretto*\pgf@circ@res@up, .8*\pgf@circ@res@right)} % radius + \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{-\pgf@circ@res@other}} + \pgfpatharc{-90}{90}{\pgf@circ@res@other} + \pgfpathclose + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@other}} + \pgfpatharc{90}{270}{\pgf@circ@res@other} + \pgfpathclose + \pgf@circ@draworfill +}{} + +%%%%%%%%%%%%%%%%%%%% +%% Block elements +%%%%%%%%%%%%%%%%%%%% + +\pgfdeclareshape{mixer} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@boxed + \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \else + \pgf@y=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{right}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{1}{ + \northwest + \pgf@y=0pt + } + \anchor{2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{3}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{4}{ + \northwest + \pgf@y=\pgf@y + \pgf@x=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{in1}{ + \northwest + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{in2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{e}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{w}{ + \northwest + \pgf@y=0pt + } + \anchor{s}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{n}{ + \northwest + \pgf@x=0pt + } + \anchor{down}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{up}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{\ctikzvalof{tripoles/mixer/width}*\scaledRlen/2}{\ctikzvalof{tripoles/mixer/width}*\scaledRlen/2}} + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgf@circ@res@step=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed + \pgf@circ@res@step=.7\pgf@circ@res@step + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{135}{0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{-45}{0.5\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{45}{0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{-135}{0.5\pgf@circ@res@step}} + \pgfusepath{draw} + + \endpgfscope + } +} + +\pgfdeclareshape{adder} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@boxed + \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \else + \pgf@y=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{right}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{1}{ + \northwest + \pgf@y=0pt + } + \anchor{2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{3}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{4}{ + \northwest + \pgf@y=\pgf@y + \pgf@x=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{in1}{ + \northwest + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{in2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{e}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{w}{ + \northwest + \pgf@y=0pt + } + \anchor{s}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{n}{ + \northwest + \pgf@x=0pt + } + \anchor{down}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{up}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{\ctikzvalof{tripoles/adder/width}*\scaledRlen/2}{\ctikzvalof{tripoles/adder/width}*\scaledRlen/2}} + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgf@circ@res@step=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed + \pgf@circ@res@step=.7\pgf@circ@res@step{} + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf@circ@res@step}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + + \endpgfscope + } +} + +\pgfdeclareshape{oscillator} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@boxed + \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \else + \pgf@y=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{north}{ + \northwest + \pgf@x=.5\pgf@x + } + \anchor{south}{ + \northwest + \pgf@x=.5\pgf@x + \pgf@y=-\pgf@y + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{up}{ + \northwest + \pgf@x=.5\pgf@x + } + \anchor{down}{ + \northwest + \pgf@x=.5\pgf@x + \pgf@y=-\pgf@y + } + \anchor{n}{ + \northwest + \pgf@x=.5\pgf@x + } + \anchor{s}{ + \northwest + \pgf@x=.5\pgf@x + \pgf@y=-\pgf@y + } + \anchor{e}{ + \northwest + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{w}{ + \northwest + \pgf@y=0pt + } + \anchor{up}{ + \northwest + \pgf@x=.5\pgf@x + } + \anchor{down}{ + \northwest + \pgf@x=.5\pgf@x + \pgf@y=-\pgf@y + } + \anchor{right}{ + \northwest + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{left}{ + \northwest + \pgf@y=0pt + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y} + \anchor{north east}{ \northwest \pgf@x=0pt\relax} + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{text}{ + \pgf@x=-2\pgf@x + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \advance \pgf@y by -1.5\ht\pgfnodeparttextbox + } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{\ctikzvalof{tripoles/oscillator/width}*\scaledRlen/2}{\ctikzvalof{tripoles/oscillator/width}*\scaledRlen/2}} + \pgfmathsetlength{\pgf@x}{\pgf@x-\ctikzvalof{tripoles/oscillator/width}*\scaledRlen/2} + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgf@circ@res@step=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen{} + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + \pgftransformxshift{-0.5\pgf@circ@res@step} % The oscillator is shifted to the left, so a connection comes out of the anchor "east" + + % draw outer box + \ifpgf@circuit@boxed{} + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed + \pgf@circ@res@step=.7\pgf@circ@res@step{} + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % draw inner sine waves + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners! + \pgfpathmoveto{\pgfpoint{-0.3\pgf@circ@res@step}{0\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}} + + \pgfusepath{draw} + + \endpgfscope + } +} + +\pgfdeclareshape{circulator} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@boxed + \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \else + \pgf@y=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{right}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{1}{ + \northwest + \pgf@y=0pt + } + \anchor{2}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{3}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{e}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{w}{ + \northwest + \pgf@y=0pt + } + \anchor{s}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{n}{ + \northwest + \pgf@x=0pt + } + \anchor{down}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{up}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{\ctikzvalof{tripoles/circulator/width}*\scaledRlen/2}{\ctikzvalof{tripoles/circulator/width}*\scaledRlen/2}} + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgf@circ@res@step=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed{} + \pgf@circ@res@step=.7\pgf@circ@res@step{} + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % inner arrow + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0}} + \pgfpatharc{180}{-90} {0.25\pgf@circ@res@step} + \pgfpathlineto{\pgfpoint{-5pt}{-0.2\pgf@circ@res@step}} + \pgfusepath{draw} + + \endpgfscope + } +} + +%% gridnode +\pgfdeclareshape{gridnode} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{up}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{down}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{right}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{left}{ + \northwest + \pgf@y=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + \relax + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{text}{ + \pgf@x=-2\pgf@x + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \advance \pgf@y by -1.5\ht\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgf@circ@res@step=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgf@circ@res@step = \ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{0.05mm} + + % draw grid + \foreach \line in {-1,-.5,...,1} + { + \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@down}} + } + + %prevent from draw the inner cross twice + \foreach \line in {-.5,0,...,.5} + { + \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@down}} + } + \pgfusepath{draw} + } +} + + +% Wilkinson divider +\pgfdeclareshape{wilkinson}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x= \pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x + } + \anchor{center}{ + \northwest + \pgf@x=0pt + \pgf@y=0pt + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out1}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-0.5\pgf@y + } + \anchor{out2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0.5\pgf@y + } + \anchor{text}{ + \northwest + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \pgf@circ@twoportbox + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + % draw inner resisitor - european or american style is recognised + { + \pgftransformshift{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} + \pgftransformrotate{90} + + % calculate size of resistor + \ifpgf@circuit@europeanresistor + \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2} + \pgftransformscale{\pgfmathresult} + \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}} + \else + \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2} + \pgftransformscale{\pgfmathresult} + \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}} + \fi + } + + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}} + + \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfusepath{draw} + + } +} + +%% resistive splitter +\pgfdeclareshape{splitter}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x= \pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x + } + \anchor{center}{ + \northwest + \pgf@x=0pt + \pgf@y=0pt + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out1}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-0.5\pgf@y + } + \anchor{out2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0.5\pgf@y + } + \anchor{text}{ + \northwest + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \pgf@circ@twoportbox + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + % draw inner resisitors - european or american style is recognised + \foreach \respt/\resang/\linepta/\lineptb in % + { \pgfpoint{0.5\pgf@circ@res@right}{0pt}/90/% + \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down},% + \pgfpoint{0}{0.25\pgf@circ@res@up}/25/% + \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@left}{0},% + \pgfpoint{0}{0.25\pgf@circ@res@down}/-25/% + \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}/\pgfpoint{0.5\pgf@circ@res@left}{0}} + { + { + \pgftransformshift{\respt} + \pgftransformrotate{\resang} + + % calculate size of resistor + \ifpgf@circuit@europeanresistor + \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2} + \pgftransformscale{\pgfmathresult} + \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}} + \else + \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2} + \pgftransformscale{\pgfmathresult} + \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}} + \fi + } + + \pgfpathmoveto{\linepta} + \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}} + + \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}} + \pgfpathlineto{\lineptb} + \pgfusepath{draw} + } + } +} + +%% couplers generics +\long\def\pgfcircdeclarefourport#1#2{ + + \pgfdeclareshape{#1}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{ + \northwest + \pgf@x=0pt + \pgf@y=0pt + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=.5\pgf@circ@scaled@Rlen + \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{port1}{ + \northwest + \pgf@y=-0.5\pgf@y + } + \anchor{port2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-0.5\pgf@y + } + \anchor{port3}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0.5\pgf@y + } + \anchor{port4}{ + \northwest + \pgf@y=0.5\pgf@y + } + \anchor{left down}{ + \northwest + \pgf@y=-0.5\pgf@y + } + \anchor{right down}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-0.5\pgf@y + } + \anchor{right up}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0.5\pgf@y + } + \anchor{left up}{ + \northwest + \pgf@y=0.5\pgf@y + } + \anchor{1}{ + \northwest + \pgf@y=-0.5\pgf@y + } + \anchor{2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-0.5\pgf@y + } + \anchor{3}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0.5\pgf@y + } + \anchor{4}{ + \northwest + \pgf@y=0.5\pgf@y + } + + \anchor{text}{ + \northwest + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + + % draw inner stuff + #2 + + % draw inner text + \pgftext[center,x=-0.15\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} + } + } +} + +% four-port +\pgfcircdeclarefourport{fourport}{} + +% straight coupler +\pgfcircdeclarefourport{coupler}{ + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfsetarrows{latex-latex} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@down}} + \pgfsetarrows{latex-latex} + \pgfusepath{draw} +} + +% "bended" coupler +\pgfcircdeclarefourport{coupler2}{ + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}} + \pgfpatharc{0}{90} {0.4\pgf@circ@res@up} + \pgfsetarrowsend{latex} + \pgfusepath{draw} + \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}} + \pgfpatharc{0}{-90} {0.4\pgf@circ@res@up} + \pgfsetarrowsend{latex} + \pgfusepath{draw} + \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}} + \pgfpatharc{180}{90} {0.4\pgf@circ@res@up} + \pgfsetarrowsend{latex} + \pgfusepath{draw} + \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}} + \pgfpatharc{-180}{-90} {0.4\pgf@circ@res@up} + \pgfsetarrowsend{latex} + \pgfusepath{draw} + \endpgfscope +} + +% mach zehnder modulator +\pgfdeclareshape{mzm}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/mzm/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x= \pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x=-\ctikzvalof{tripoles/mzm/width}\pgf@x + } + \anchor{center}{ + \northwest + \pgf@x=0pt + \pgf@y=0pt + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{mod}{ + \northwest + \pgf@x=0pt + } + \anchor{out}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0pt + } + \anchor{text}{ + \northwest + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \pgf@circ@twoportbox + + % draw inner stuff + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{0.35\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.25\pgf@circ@res@right}{0.1\pgf@circ@res@up}} + \pgfusepath{draw} + + } +} +%%%---------- close: tex/pgfcircquadpoles +%%%%%%%%%%% Springe nach tex/pgfcircmultipoles +%%%---------- open: tex/pgfcircmultipoles.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Multipoles by Romano Giannetti +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%% +%% Chips +%%%%%%%%% + +% let's use the same shifts everywhere, no magic numbers +\def\pgf@circ@dip@pin@shift{0.5} +\def\pgf@circ@qfp@pin@shift{0.25} + +% derived from https://tex.stackexchange.com/a/146753/38080 +% original author Mark Wibrow +% Thanks also to John Kormylo https://tex.stackexchange.com/a/372996/38080 +% a lot of thanks to @marmot for the un-rotation hint +% https://tex.stackexchange.com/a/473571/38080 + +% DIP (dual in line package) chips + +\pgfdeclareshape{dipchip}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro\numpins{% + \pgf@circ@count@a=\ctikzvalof{multipoles/dipchip/num pins}% + \def\numpins{\the\pgf@circ@count@a} + } + \savedanchor\centerpoint{% + \pgf@x=-.5\wd\pgfnodeparttextbox% + \pgf@y=-.5\ht\pgfnodeparttextbox% + \advance\pgf@y by+.5\dp\pgfnodeparttextbox% + }% + \savedanchor\origin{\pgfpoint{0pt}{0pt}} + \anchor{center}{\origin} + \anchor{text}{\centerpoint}% to adjust text + \saveddimen\height{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{((\numpins) + *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}% + }% + \saveddimen{\chipspacing}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/pin spacing}}} + \saveddimen{\width}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}} + \saveddimen{\extshift}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}} + % standard anchors + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{0.5*((\numpins) + *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}% + \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}} + } + \anchor{dot}{\northwest + \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing} + \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing} + } + \anchor{nw}{\northwest} + \anchor{ne}{\northwest\pgf@x=-\pgf@x} + \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{sw}{\northwest\pgf@y=-\pgf@y} + \anchor{north west}{\northwest} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{n}{\northwest\pgf@x=0pt } + \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{w}{\northwest\pgf@y=0pt } + \anchor{north}{\northwest\pgf@x=0pt } + \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{west}{\northwest\pgf@y=0pt } + % start drawing + \backgroundpath{% + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step = \ctikzvalof{multipoles/dipchip/pin spacing}\pgf@circ@scaled@Rlen + \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen + \pgfscope% (for the line width) + \pgf@circ@setlinewidth{multipoles}{\pgflinewidth} + \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}% + \pgf@circ@draworfill + %% upside mark + \ifpgf@circuit@chip@topmark + \pgfpathmoveto{\pgfpoint{0.2*\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpatharc{0}{180}{0.2*\pgf@circ@res@left} + \fi + \pgfusepath{stroke}% + \pgfsetcolor{\ctikzvalof{color}} + % Adding the pin number + \ifpgf@circuit@chip@shownumbers + \pgf@circ@count@a=\numpins\relax + \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a + % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080 + \ifpgf@circuit@chip@straightnumbers + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)} + \else + \pgfmathsetmacro{\rot}{0} + \pgfmathsetmacro{\quadrant}{0} + \fi + \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax} + \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space} + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \ifcase\quadrant % rotation 0 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or % rotation -90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or %rotation 180 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or % rotation +90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \fi + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + \fi + \endpgfscope + \ifdim\pgf@circ@res@other>0pt + \pgfscope + \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} + \pgf@circ@count@a=\numpins\relax + \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}} + \ifnum\padfrac>0 + \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac + % left side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % right side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \else + % left side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % right side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \fi + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop + \pgfusepath{stroke} + \endpgfscope + \fi + }% + % \pgf@sh@s@ contains all the code for the shape + % and is executed just before a node is drawn. + \pgfutil@g@addto@macro\pgf@sh@s@dipchip{% + % Start with the maximum pin number and go backwards. + \pgf@circ@count@a=\numpins\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `pin 1` for the + % electrical contact, and the "border one" like `bpin 1` for labels. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@dipchip@pin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@dipchip@bpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + }% + } + +% QFP (quad flat package) chips + +\pgfdeclareshape{qfpchip}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro\numpins{% + \pgf@circ@count@a=\ctikzvalof{multipoles/qfpchip/num pins}% + \def\numpins{\the\pgf@circ@count@a} + } + \savedanchor\centerpoint{% + \pgf@x=-.5\wd\pgfnodeparttextbox% + \pgf@y=-.5\ht\pgfnodeparttextbox% + \advance\pgf@y by+.5\dp\pgfnodeparttextbox% + }% + \savedanchor\origin{\pgfpoint{0pt}{0pt}} + \anchor{center}{\origin} + \anchor{text}{\centerpoint}% to adjust text + \saveddimen\height{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{((\numpins+2) + *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}% + }% + \saveddimen\width{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{((\numpins+2) + *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}% + }% + \saveddimen{\chipspacing}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/qfpchip/pin spacing}}} + \saveddimen{\extshift}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}} + % standard anchors + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{0.5*((\numpins+2) + *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}% + \pgf@x=-\pgf@y + } + \anchor{dot}{\northwest + \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing} + \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing} + } + \anchor{nw}{\northwest} + \anchor{ne}{\northwest\pgf@x=-\pgf@x} + \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{sw}{\northwest\pgf@y=-\pgf@y} + \anchor{north west}{\northwest} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{n}{\northwest\pgf@x=0pt } + \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{w}{\northwest\pgf@y=0pt } + \anchor{north}{\northwest\pgf@x=0pt } + \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{west}{\northwest\pgf@y=0pt } + % start drawing + \backgroundpath{% + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step = \ctikzvalof{multipoles/qfpchip/pin spacing}\pgf@circ@scaled@Rlen + \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen + \pgfscope% (for the line width) + \pgf@circ@setlinewidth{multipoles}{\pgflinewidth} + %% upside mark + \ifpgf@circuit@chip@topmark + \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2-\pgf@circ@res@step/2}} + \pgfpathlineto{\pgfpoint{-\width/2+\pgf@circ@res@step/2}{\height/2}} + \else + \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2}} + \fi + %% rest of the shape + \pgfpathlineto{\pgfpoint{\width/2}{\height/2}} + \pgfpathlineto{\pgfpoint{\width/2}{-\height/2}} + \pgfpathlineto{\pgfpoint{-\width/2}{-\height/2}} + \pgfpathclose + \pgf@circ@draworfill + % Adding the pin number + \pgfsetcolor{\ctikzvalof{color}} + \ifpgf@circuit@chip@shownumbers + \pgf@circ@count@a=\numpins% + \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a + % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080 + \ifpgf@circuit@chip@straightnumbers + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)} + \else + \pgfmathsetmacro{\rot}{0} + \pgfmathsetmacro{\quadrant}{0} + \fi + \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax} + \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space} + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \ifcase\quadrant % rotation 0 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % bottom + \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % top + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}, + rotate=\rot]{\mytext} + \or % rotation -90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % bottom + \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % top + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}, + rotate=\rot]{\mytext} + \or %rotation 180 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % bottom + \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % top + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}, + rotate=\rot]{\mytext} + \or % rotation +90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % bottom + \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % top + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}, + rotate=\rot]{\mytext} + \fi + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + \fi + \endpgfscope + \ifdim\pgf@circ@res@other>0pt + \pgfscope + \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} + \pgf@circ@count@a=\numpins% + \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}} + \ifnum\padfrac>0 + \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac + % left side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % bottom side pads + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}} + % right side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % top side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}} + \else + % left side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % bottom side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}} + % right side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % top side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}} + \fi + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + \pgfusepath{stroke} + \endpgfscope + \fi + }% + % \pgf@sh@s@ contains all the code for the shape + % and is executed just before a node is drawn. + \pgfutil@g@addto@macro\pgf@sh@s@qfpchip{% + % Start with the maximum pin number and go backwards. + \pgf@circ@count@a=\numpins% + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \expandafter\xdef\csname pgf@anchor@qfpchip@pin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@qfpchip@bpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop% + }% + } + +%% anchors for DIP +\def\pgf@circ@dippinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \c@pgf@countc=\numpins\relax + \divide\c@pgf@countc by 2 + \ifnum #1 > \the\c@pgf@countc + % right side + \pgfpoint{\width/2+#2*\extshift}{-\height/2+(\pgf@circ@dip@pin@shift-\c@pgf@countc+#1-1)*\chipspacing} + \else + \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@dip@pin@shift-#1)*\chipspacing} +\fi +} + +%% anchors for QFP +\def\pgf@circ@qfppinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \c@pgf@countc=\numpins\relax + \divide\c@pgf@countc by 4 + \ifnum #1 > \the\c@pgf@countc + \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 2 + \ifnum #1 > \the\c@pgf@countb + \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 3 + \ifnum #1 > \the\c@pgf@countb + % 3*npins/4 < pin, top side + \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift+\c@pgf@countb-#1)*\chipspacing}{\height/2+#2*\extshift}% + \else + % 2*npins/4 < pin <= 3*npins/4, right side + \pgfpoint{\width/2+#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}% + \fi + \else + % npins/4 < pin <= 2*npins/4, bottom side + \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}{-\height/2-#2*\extshift}% + \fi + \else + % <= npins/4, left side + \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}% + \fi +} + +%%%%%%%%%%%%%%%%% +%% Rotary Switch +%%%%%%%%%%%%%%%%% + +\pgfdeclareshape{rotaryswitch} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northeast{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt + % the magic number is 0.25/cos(35) + % try to recalculate it for the actual switch + \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=.3052\pgf@circ@res@temp + \edef\a{\ctikzvalof{multipoles/rotary/angle}} + \edef\r{\ctikzvalof{nodes width}} + \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@x}{\r*\pgf@circ@scaled@Rlen + \pgf@circ@res@temp} + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt + % the magic number is 0.25/cos(35) + % try to recalculate it for the actual switch + \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=.3052\pgf@circ@res@temp + \edef\a{\ctikzvalof{multipoles/rotary/angle}} + \edef\r{\ctikzvalof{nodes width}} + \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@x}{-\r*\pgf@circ@scaled@Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf@circ@res@temp} + } + \savedanchor\central{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt + % the magic number is 0.25/cos(35) + % try to recalculate it for the actual switch + \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=.3052\pgf@circ@res@temp + \edef\a{\ctikzvalof{multipoles/rotary/angle}} + \edef\r{\ctikzvalof{nodes width}} + \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@x}{(\a<90 ? 0 : cos(\a))*\pgf@circ@res@temp} + } + % external square limits + \savedanchor\extnorthwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen + % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt + \pgf@x=.3052\pgf@x % the magic number is 0.25/cos(35) + \pgf@x=2.5\pgf@x % external square size + \pgf@y=-\pgf@x %square thing when angle=180? + } + \saveddimen{\width}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{0.3052*\pgf@circ@scaled@Rlen*\ctikzvalof{tripoles/spdt/width}}} + % radius of the connector + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} + % shapename + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + % shape type + \savedmacro{\cshape}{\def\cshape{\ctikzvalof{multipoles/rotary/shape}}} + \savedmacro{\channels}{\def\channels{\ctikzvalof{multipoles/rotary/channels}}} + \savedmacro{\angle}{\def\angle{\ctikzvalof{multipoles/rotary/angle}}} + \savedmacro{\wiper}{\def\wiper{\ctikzvalof{multipoles/rotary/wiper}}} + \savedmacro{\stepa}{\pgfmathsetmacro{\stepa}{2*\ctikzvalof{multipoles/rotary/angle}/(\ctikzvalof{multipoles/rotary/channels}-1)}} + % mid of the lever, to stack switches + %\anchor{mid}{\midlever} + \anchor{mid}{\northwest + \pgf@circ@res@temp=-\pgf@x + \pgfmathsetlength{\pgf@x}{\pgf@circ@res@temp*(-1+cos(\wiper))} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp*sin(\wiper)} + } + % center anchors + \anchor{cin}{ \northwest \pgf@y=0pt\advance\pgf@x by \radius} + % horizontal angles + \anchor{in}{ \northwest \pgf@y=0pt} + \anchor{ain}{ \northwest \pgf@y=0pt} + + \anchor{center}{ \central \pgf@y=0pt } + \anchor{east}{ \northeast \pgf@y=0pt } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \central \pgf@y=-\pgf@y } + \anchor{north}{ \central } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northeast } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northeast \pgf@y=-\pgf@y } + + \anchor{ext center}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width} + \anchor{ext east}{ \extnorthwest \pgf@y=0pt \pgf@x=-\pgf@x \advance\pgf@x by -\width} + \anchor{ext west}{ \extnorthwest \pgf@y=0pt \advance\pgf@x by -\width} + \anchor{ext south}{ \extnorthwest \pgf@x=0pt \pgf@y=-\pgf@y \advance\pgf@x by -\width} + \anchor{ext north}{ \extnorthwest \pgf@x=0pt \advance\pgf@x by -\width} + \anchor{ext south west}{ \extnorthwest \pgf@y=-\pgf@y \advance\pgf@x by -\width} + \anchor{ext north east}{ \extnorthwest \pgf@x=-\pgf@x \advance\pgf@x by -\width} + \anchor{ext north west}{ \extnorthwest \advance\pgf@x by -\width} + \anchor{ext south east}{ \extnorthwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y \advance\pgf@x by -\width} + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@res@right = \width + \pgf@circ@res@left = -\width + + \pgfscope %wiper + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \pgf@circ@res@temp=\radius\relax + \pgf@circ@res@temp=\ctikzvalof{multipoles/rotary/thickness}\pgf@circ@res@temp + \pgfsetlinewidth{2\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\wiper}{2\pgf@circ@res@right}}} + \pgfsetroundcap\pgfusepath{draw} + \endpgfscope + + \ifpgf@circ@rotaryarrow + \pgfscope % arrow + \ifpgf@circ@rotaryarrow@ccw\pgfsetarrowsstart{latexslim}\fi + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % center of cin node + \pgftransformrotate{\wiper} + \pgfpathmoveto{\pgfpointpolar{50}{1.0\pgf@circ@res@right}} + \pgfpatharc{50}{-50}{1.0\pgf@circ@res@right} + \ifpgf@circ@rotaryarrow@cw\pgfsetarrowsend{latexslim}\fi + \pgfusepath{draw} + \endpgfscope + \fi + + % \typeout{CHANNELS\space\channels\space ANGLE\space\angle STEPA\space\stepa} + \pgf@circ@count@a=\channels\relax + \pgfmathsetmacro{\currenta}{-\angle} + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % \typeout{LOOPIN\space\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right} + \pgfscope + \pgftransformshift{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\currenta}{2\pgf@circ@res@right}}} + \pgfnode{\cshape}{center}{}{\thisshape-out \the\pgf@circ@count@a}{\pgfusepath{stroke}} + \endpgfscope + \pgfmathsetmacro{\currenta}{\currenta+\stepa} + % \typeout{LOOPOUT\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right} + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop + + \pgfscope % input + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}} + \endpgfscope + } + % \pgf@sh@s@ contains all the code for the shape + % and is executed just before a node is drawn. + \pgfutil@g@addto@macro\pgf@sh@s@rotaryswitch{% + % Start with the maximum pin number and go backwards. + \pgf@circ@count@a=\channels\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `pin 1` for the + % electrical contact, and the "border one" like `bpin 1` for labels. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@rotaryswitch@out\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{1}{0}% + } + \expandafter\xdef\csname pgf@anchor@rotaryswitch@cout\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{0}% + } + \expandafter\xdef\csname pgf@anchor@rotaryswitch@aout\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{1}% + } + \expandafter\xdef\csname pgf@anchor@rotaryswitch@sqout\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@rotarysqanchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + }% +} + +\def\pgf@circ@rotaryanchor#1#2#3{% #1: numero del pin; #2: 1 - x pos, 0 - center; #3 0: inner, 1 outer + \pgf@circ@res@temp=\width + \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa} + \pgfmathsetlength{\pgf@x}{2*(\pgf@circ@res@temp+#3*\radius/2)*cos(\myangle))+#2*\radius} + \pgfmathsetlength{\pgf@y}{2*(\pgf@circ@res@temp+#3*\radius/2)*sin(\myangle)} + \advance\pgf@x by -\pgf@circ@res@temp +} + +\def\pgf@circ@rotarysqanchor#1{% external square anchors + \pgf@circ@res@temp=\width + \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa} + \pgfpointborderrectangle{\pgfpointpolar{\myangle}{1pt}}{\pgfpoint{2.5\pgf@circ@res@temp}{2.5\pgf@circ@res@temp}} + \advance\pgf@x by -\pgf@circ@res@temp +} + +%%%%%%%%%%%%%%%%%%%%%%%%%% +% Seven segments displays +%%%%%%%%%%%%%%%%%%%%%%%%%% + +\pgfdeclareshape{bare7seg}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{displays}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\dotstatus}{\edef\dotstatus{\pgf@circ@sevenseg@dotstate}} + \saveddimen{\dotspace}{% the dot is on the right, and occupy the same as the thickness + \ifpgf@circ@sevenseg@dot + \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/thickness}} + \else + \pgf@x=0pt + \fi + } + % The object extension is more or less (-width/2,-width) to (width/2,width) + % and adjusted for line thickness (both sides) and eventually the dot + \saveddimen{\width}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}} + \saveddimen{\gap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/segment sep}}} + \saveddimen{\boxgap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/box sep}}} + \savedanchor{\southwest}{% both negative + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen + -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}} + \pgfmathsetlength{\pgf@y}{-\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen + -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}} + } + \savedanchor{\northeast}{% both positive + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circ@sevenseg@dot + \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{seven seg/thickness}} + \else + \pgf@circ@res@other=0pt + \fi + \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen + +0.5*\ctikzvalof{seven seg/thickness}+\pgf@circ@res@other+\ctikzvalof{seven seg/box sep}} + \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen + +0.5*\ctikzvalof{seven seg/thickness}+\ctikzvalof{seven seg/box sep}} + } + \savedanchor{\topright}{% anchor without the box sep and the thickness + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen} + \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen} + } + \anchor{center}{\pgfpointorigin} + \anchor{north west}{\southwest\pgf@y=-\pgf@y} + \anchor{north east}{\northeast} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\southwest} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{east}{\northeast\pgf@y=0pt} + \anchor{south}{\southwest\pgf@x=0pt} + \anchor{west}{\southwest\pgf@y=0pt} + \anchor{a}{\topright\pgf@x=0pt} + \anchor{b}{\topright\pgf@y=0.5\pgf@y} + \anchor{c}{\topright\pgf@y=-0.5\pgf@y} + \anchor{d}{\topright\pgf@y=-\pgf@y\pgf@x=0pt} + \anchor{e}{\topright\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y} + \anchor{f}{\topright\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{g}{\pgfpointorigin} + \anchor{dot}{\topright\pgf@y=-\pgf@y\advance\pgf@x by \dotspace} + \behindbackgroundpath{% + \southwest % I do not want the dot here, it will stick out + \pgf@circ@res@up = -\pgf@y + \pgf@circ@res@down = \pgf@y + \pgf@circ@res@right = \pgf@x + \pgf@circ@res@left = -\pgf@x + \pgfscope + \pgf@circ@setlinewidth{multipoles}{\pgflinewidth} + \pgfsetcolor{\ctikzvalof{color}} + \pgfpathrectanglecorners% + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@left+\dotspace}{\pgf@circ@res@up}} + \ifpgf@circ@sevenseg@box + \pgf@circ@draworfill + \else + \pgf@circ@maybefill + \fi + \endpgfscope + \edef\bits{\ctikzvalof{seven seg/bits}} + \pgfscope + \pfg@circ@sseg@drawbits{\bits} + \endpgfscope + \pgfscope + \ifpgf@circ@sevenseg@dot + \pgf@circ@sseg@drawdots + \fi + \endpgfscope + } +} + +\def\pgf@circ@sseg@splitbits#1#2#3#4#5#6#7\relax{%split the seven bits + \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}\edef\@@e{#5}\edef\@@f{#6}\edef\@@g{#7}% +} +\def\pgf@circ@sseg@drawone#1#2#3#4#5{% #1 on off the x1, y1, x2 , y2 + \ifnum #1 > 0\relax + \pgfsetcolor{\ctikzvalof{seven seg/color on}} + \else + \pgfsetcolor{\ctikzvalof{seven seg/color off}} + \fi + \pgfpathmoveto{\pgfpoint{#2}{#3}} + \pgfpathlineto{\pgfpoint{#4}{#5}} + \pgfusepath{draw} +} +\def\pfg@circ@sseg@drawbits#1{% #1 must be 7 bits + \expandafter\pgf@circ@sseg@splitbits#1\relax% a bit of magic... + \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}} + \pgfsetlinewidth{\ctikzvalof{seven seg/thickness}} + % \pgfsetroundcap + \pgfsetarrowsstart{Triangle Cap[]} + \pgfsetarrowsend{Triangle Cap[]} + % segments + \pgf@circ@sseg@drawone{\@@a}{-\width/2+\gap}{\width}{\width/2-\gap}{\width} + \pgf@circ@sseg@drawone{\@@b}{\width/2}{\width-\gap}{\width/2}{0pt+\gap} + \pgf@circ@sseg@drawone{\@@c}{\width/2}{0pt-\gap}{\width/2}{-\width+\gap} + \pgf@circ@sseg@drawone{\@@d}{\width/2-\gap}{-\width}{-\width/2+\gap}{-\width} + \pgf@circ@sseg@drawone{\@@e}{-\width/2}{-\width+\gap}{-\width/2}{0pt-\gap} + \pgf@circ@sseg@drawone{\@@f}{-\width/2}{0pt+\gap}{-\width/2}{\width-\gap} + \pgf@circ@sseg@drawone{\@@g}{-\width/2+\gap}{0pt}{\width/2-\gap}{0pt} +} +\def\pgf@circ@sseg@drawdots{% dots + \edef\what{empty} + \ifx\what\pgf@circ@sevenseg@dotstate + % do nothing + \else + \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}} + \edef\what{off} + \ifx\what\pgf@circ@sevenseg@dotstate + % dot off + \pgfsetfillcolor{\ctikzvalof{seven seg/color off}} + \pgfsetcolor{\ctikzvalof{seven seg/color off}} + \else + % dot on + \pgfsetfillcolor{\ctikzvalof{seven seg/color on}} + \pgfsetcolor{\ctikzvalof{seven seg/color on}} + \fi + \pgfpathcircle{\pgfpoint{\width/2+2*\pgf@circ@res@other}{-\width}}{\pgf@circ@res@other} + \pgfusepath{draw,fill} + \fi +} + + +%%%%%% +%%%%%% Flip-flops +%%%%%% + +% Flip flops are a specialized kind of dipchip. +% they have a class by themselves + +%% flip flop definitions --- by default empty +%% pin texts +\ctikzset{multipoles/flipflop/t1/.initial={}} +\ctikzset{multipoles/flipflop/t2/.initial={}} +\ctikzset{multipoles/flipflop/t3/.initial={}} +\ctikzset{multipoles/flipflop/t4/.initial={}} +\ctikzset{multipoles/flipflop/t5/.initial={}} +\ctikzset{multipoles/flipflop/t6/.initial={}} +\ctikzset{multipoles/flipflop/tu/.initial={}} +\ctikzset{multipoles/flipflop/td/.initial={}} +% pin clock wedge flags +\ctikzset{multipoles/flipflop/c1/.initial={0}} +\ctikzset{multipoles/flipflop/c2/.initial={0}} +\ctikzset{multipoles/flipflop/c3/.initial={0}} +\ctikzset{multipoles/flipflop/c4/.initial={0}} +\ctikzset{multipoles/flipflop/c5/.initial={0}} +\ctikzset{multipoles/flipflop/c6/.initial={0}} +\ctikzset{multipoles/flipflop/cu/.initial={0}} +\ctikzset{multipoles/flipflop/cd/.initial={0}} +% pin negation circle flags +\ctikzset{multipoles/flipflop/n1/.initial={0}} +\ctikzset{multipoles/flipflop/n2/.initial={0}} +\ctikzset{multipoles/flipflop/n3/.initial={0}} +\ctikzset{multipoles/flipflop/n4/.initial={0}} +\ctikzset{multipoles/flipflop/n5/.initial={0}} +\ctikzset{multipoles/flipflop/n6/.initial={0}} +\ctikzset{multipoles/flipflop/nu/.initial={0}} +\ctikzset{multipoles/flipflop/nd/.initial={0}} + + +% Thanks to @marmot +\tikzset{flipflop def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/flipflop}{#1}} + +% default set of flip flops +\tikzset{ + % async + latch/.style={flipflop, flipflop def={t1=D, t6=Q, t3=CLK, t4=\ctikztextnot{Q}}}, + flipflop SR/.style={flipflop, flipflop def={t1=S, t3=R, t6=Q, t4=\ctikztextnot{Q}}}, + % sync + flipflop D/.style={flipflop, flipflop def={t1=D, t6=Q, c3=1, t4=\ctikztextnot{Q}}}, + flipflop T/.style={flipflop, flipflop def={t1=T, t6=Q, c3=1, t4=\ctikztextnot{Q}}}, + flipflop JK/.style={flipflop, flipflop def={t1=J, t3=K, c2=1, t6=Q, t4=\ctikztextnot{Q}}}, + % additional features + add async SR/.style={flipflop def={tu={\ctikztextnot{SET}}, td={\ctikztextnot{RST}}}}, + dot on notQ/.style={flipflop def={t4={Q}, n4=1}}, +} + +% +% commodity macro to draw the clock wedges. They leave the size of the +% wedge in \pgf@circ@res@temp so that a possible label can be displaced. +% +\def\pgf@circ@do@wedge@left{ + \pgf@circ@res@temp=0pt\relax + \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step+\wedge}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\wedge}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step-\wedge}} + \pgfusepath{stroke} + \pgf@circ@res@temp=\wedge + \fi +} +\def\pgf@circ@do@wedge@right{ + \pgf@circ@res@temp=0pt\relax + \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step+\wedge}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\wedge}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step-\wedge}} + \pgfusepath{stroke} + \pgf@circ@res@temp=-\wedge + \fi +} +\def\pgf@circ@do@wedge@up{ + \pgf@circ@res@temp=0pt\relax + \ifnum\ctikzvalof{multipoles/flipflop/cu}>0 + \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up-\wedge}} + \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@up}} + \pgfusepath{stroke} + \pgf@circ@res@temp=-\wedge + \fi +} +\def\pgf@circ@do@wedge@down{ + \pgf@circ@res@temp=0pt\relax + \ifnum\ctikzvalof{multipoles/flipflop/cd}>0 + \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down+\wedge}} + \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@down}} + \pgfusepath{stroke} + \pgf@circ@res@temp=\wedge + \fi +} +% generic flip-flop shape +\pgfdeclareshape{flipflop}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{flipflops}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + \savedmacro\numpins{\def\numpins{6}} + \savedanchor\centerpoint{% + \pgf@x=-.5\wd\pgfnodeparttextbox% + \pgf@y=-.5\ht\pgfnodeparttextbox% + \advance\pgf@y by+.5\dp\pgfnodeparttextbox% + }% + \savedanchor\origin{\pgfpoint{0pt}{0pt}} + \anchor{center}{\origin} + \anchor{text}{\centerpoint}% to adjust text + \saveddimen\height{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{((\numpins) + *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}% + }% + \saveddimen{\chipspacing}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/pin spacing}}} + \saveddimen{\width}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}} + \saveddimen{\extshift}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}} + % standard anchors + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{0.5*((\numpins) + *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}% + \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}} + } + \anchor{dot}{\northwest + \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing} + \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing} + } + \anchor{nw}{\northwest} + \anchor{ne}{\northwest\pgf@x=-\pgf@x} + \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{sw}{\northwest\pgf@y=-\pgf@y} + \anchor{north west}{\northwest} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{n}{\northwest\pgf@x=0pt } + \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{w}{\northwest\pgf@y=0pt } + \anchor{north}{\northwest\pgf@x=0pt } + \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{west}{\northwest\pgf@y=0pt } + % upper and lower pin + \anchor{up}{\northwest\pgf@x=0pt\advance\pgf@y by\extshift } + \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y\advance\pgf@y by-\extshift} + \anchor{bup}{\northwest\pgf@x=0pt } + \anchor{bdown}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + % start drawing + \backgroundpath{% + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step = \ctikzvalof{multipoles/flipflop/pin spacing}\pgf@circ@scaled@Rlen + \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen + \pgfsetcolor{\ctikzvalof{color}} + \pgfscope% (for the line width) + \pgf@circ@setlinewidth{multipoles}{\pgflinewidth} + \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}% + \pgf@circ@draworfill + \pgfusepath{stroke}% + \endpgfscope + % Adding the pin number + \pgf@circ@count@a=\numpins\relax + \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a + % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080 + \ifpgf@circuit@chip@straightnumbers + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)} + \else + \pgfmathsetmacro{\rot}{0} + \pgfmathsetmacro{\quadrant}{0} + \fi + \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax} + % text + \def\mytext{\ctikzvalof{multipoles/flipflop/font}\space + \ctikzvalof{multipoles/flipflop/t\the\pgf@circ@count@c}% + \pgf@circ@strut\space} + % \typeout{TEXT\space\mytext} + \pgfmathloop% + \def\wedge{\ctikzvalof{multipoles/flipflop/clock wedge size}\pgf@circ@res@step} + \pgf@circ@res@temp=0pt\relax + \ifnum\pgf@circ@count@a>0 + \ifcase\quadrant % rotation 0 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgf@circ@do@wedge@left + % \typeout{TEXT Left Q1\space\mytext} + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgf@circ@do@wedge@right + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or % rotation -90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgf@circ@do@wedge@left + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgf@circ@do@wedge@right + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or %rotation 180 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgf@circ@do@wedge@left + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgf@circ@do@wedge@right + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or % rotation +90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgf@circ@do@wedge@left + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgf@circ@do@wedge@right + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \fi + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + % Now the up and down text + % up + \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/tu}\space} + \pgf@circ@do@wedge@up + \ifcase\quadrant % rotation 0 + \pgftext[top, + at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \or % rotation -90 + \pgftext[right, + at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \or %rotation 180 + \pgftext[bottom, + at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \or % rotation +90 + \pgftext[left, + at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \fi + % down + \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/td}\space} + \pgf@circ@do@wedge@down + \ifcase\quadrant % rotation 0 + \pgftext[bottom, + at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \or % rotation -90 + \pgftext[left, + at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \or %rotation 180 + \pgftext[top, + at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \or % rotation +90 + \pgftext[right, + at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \fi + % external pins + \ifdim\pgf@circ@res@other>0pt + \pgfscope + \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} + \pgf@circ@count@a=\numpins\relax + \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % left side pins + \pgf@circ@count@c=\pgf@circ@count@a + %% we draw the pin only if it's defined either a text, a clock wedge or a not pin + %% Or'ing tests in core TeX is tough + \edef\@@or{0} + % Just expand the key the minimum needed + \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x} + \ifx\@@tmp\@@x\else\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + \ifnum\@@or>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfusepath{stroke} + \fi + % right side pins + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \edef\@@or{0} + \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x} + \ifx\@@tmp\@@x\else\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + % \typeout{TEST\space\@@tmp\space\@@x} + \ifnum\@@or>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfusepath{stroke} + \fi + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop + % up side + \edef\@@or{0} + \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/tu}}\edef\@@x{x} + \ifx\@@tmp\@@x\else\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cu}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + % \typeout{TEST\space\@@tmp\space\@@x} + \ifnum\@@or>0 + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@other}} + \pgfusepath{stroke} + \fi + % down side + \edef\@@or{0} + \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/td}}\edef\@@x{x} + \ifx\@@tmp\@@x\else\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cd}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + % \typeout{TEST\space\@@tmp\space\@@x} + \ifnum\@@or>0 + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down-\pgf@circ@res@other}} + \pgfusepath{stroke} + \fi + \endpgfscope + \fi % external pin width >0 + % + % draw "inverting" circles on outputs, they must be last + % + \pgfscope + \ifpgf@circuit@ieeelogicport + \def\@@notcirc{notcirc} + \else + \ifpgf@circ@european@port@circle@ieee + \def\@@notcirc{notcirc} + \else + \def\@@notcirc{ocirc} + \fi + \fi + \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} + \pgf@circ@count@a=\numpins\relax + \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % left side pins + \pgf@circ@count@c=\pgf@circ@count@a + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}} + \ifnum\@@tmp>0\pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfnode{\@@notcirc}{east}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}} + \endpgfscope\fi + % right side pins + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}} + \ifnum\@@tmp>0\pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfnode{\@@notcirc}{west}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}} + \endpgfscope\fi + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop + % up side + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}} + \ifnum\@@tmp>0\pgfscope + \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfnode{\@@notcirc}{south}{}{\thisshape-Nu}{\pgfusepath{stroke}} + \endpgfscope\fi + % down side + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}} + \ifnum\@@tmp>0\pgfscope + \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfnode{\@@notcirc}{north}{}{\thisshape-Nd}{\pgfusepath{stroke}} + \endpgfscope\fi + \endpgfscope + }% + % \pgf@sh@s@ contains all the code for the shape + % and is executed just before a node is drawn. + \pgfutil@g@addto@macro\pgf@sh@s@flipflop{% + % Start with the maximum pin number and go backwards. + \pgf@circ@count@a=\numpins\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `pin 1` for the + % electrical contact, and the "border one" like `bpin 1` for labels. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@flipflop@pin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@flipflop@bpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + }% +} + +% +% MUX-DEMUXES +% +% Thanks to @marmot +\tikzset{muxdemux def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/muxdemux}{#1}} +\tikzset{demux/.style={muxdemux, muxdemux def={Lh=4, Rh=8, NL=1, NB=3, NR=8}}} +\tikzset{one bit adder/.style={muxdemux, + muxdemux def={Lh=4, NL=2, Rh=2, NR=1, NB=1, w=1.5, + inset w=0.5, inset Lh=2, inset Rh=1.5}}} +\tikzset{ALU/.style={muxdemux, + muxdemux def={Lh=5, NL=2, Rh=2, NR=1, NB=2, NT=1, w=2, + inset w=1, inset Lh=2, inset Rh=0, square pins=1}}} +%generic mux-demux shape +\pgfdeclareshape{muxdemux}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + % pins on the four sides + % \savedmacro\NL{% + % \pgf@circ@count@a=\ctikzvalof{multipoles/muxdemux/NL}% + % \def\NL{\the\pgf@circ@count@a} + % } + \savedmacro\NL{\edef\NL{\ctikzvalof{multipoles/muxdemux/NL}}} + \savedmacro\NR{\edef\NR{\ctikzvalof{multipoles/muxdemux/NR}}} + \savedmacro\NT{\edef\NT{\ctikzvalof{multipoles/muxdemux/NT}}} + \savedmacro\NB{\edef\NB{\ctikzvalof{multipoles/muxdemux/NB}}} + \savedmacro\squarepins{\edef\squarepins{\ctikzvalof{multipoles/muxdemux/square pins}}} + % topleft and topright sizes + \savedanchor{\topleft}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Lh}*\pgf@circ@scaled@Rlen/2} + \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2} + } + \savedanchor{\topright}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Rh}*\pgf@circ@scaled@Rlen/2} + \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2} + } + \savedanchor{\insetnortheast}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Lh}*\pgf@circ@scaled@Rlen/2} + \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}* + (\ctikzvalof{multipoles/muxdemux/w}-2*\ctikzvalof{multipoles/muxdemux/inset w})*\pgf@circ@scaled@Rlen/2} + } + \saveddimen{\insethright}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Rh}*\pgf@circ@scaled@Rlen/2}} + \saveddimen{\extshift}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}} + \savedanchor{\northwest}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*max(\ctikzvalof{multipoles/muxdemux/Rh},\ctikzvalof{multipoles/muxdemux/Lh})*\pgf@circ@scaled@Rlen/2} + \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2} + } + \anchor{nw}{\northwest} + \anchor{ne}{\northwest\pgf@x=-\pgf@x} + \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{sw}{\northwest\pgf@y=-\pgf@y} + \anchor{north west}{\northwest} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{n}{\northwest\pgf@x=0pt } + \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{w}{\northwest\pgf@y=0pt } + \anchor{north}{\northwest\pgf@x=0pt } + \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{west}{\northwest\pgf@y=0pt } + \anchor{center}{\pgfpointorigin} + \anchor{top right}{\topright} + \anchor{bottom right}{\topright\pgf@y=-\pgf@y} + \anchor{right}{\topright\pgf@y=0pt\relax} + \anchor{top left}{\topleft} + \anchor{bottom left}{\topleft\pgf@y=-\pgf@y} + \anchor{left}{\topleft\pgf@y=0pt\relax} + \anchor{top}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya + \divide\pgf@y by 2 \pgf@x=0pt\relax} + \anchor{bottom}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya + \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax} + \anchor{inset top right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya} + \anchor{inset bottom right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya\pgf@y=-\pgf@y} + \anchor{inset right}{\insetnortheast\pgf@y=0pt\relax} + \anchor{inset top left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=\pgf@ya} + \anchor{inset bottom left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=-\pgf@ya} + \anchor{inset left}{\topleft\pgf@y=0pt\relax} + \anchor{inset bottom}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright + \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x + \pgfpoint{(\pgf@xa+\pgf@xb)/2}{-\pgf@ya+\pgf@yb/2}} + \anchor{inset top}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright + \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x + \pgfpoint{(\pgf@xa+\pgf@xb)/2}{\pgf@ya-\pgf@yb/2}} + \anchor{inset center}{\topleft\pgf@xa=\pgf@x\insetnortheast + \advance\pgf@x by \pgf@xa \divide\pgf@x by 2 \pgf@y=0pt\relax} + \anchor{narrow center}{\insetnortheast\pgf@xa=\pgf@x\topright + \advance\pgf@x by \pgf@xa \divide\pgf@x by 2\pgf@y=0pt\relax} + \anchor{center up}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya + \divide\pgf@y by 2 + \pgf@yb = \insethright \advance\pgf@y by \pgf@yb + \divide\pgf@y by 2 \pgf@x=0pt\relax} + \anchor{center down}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya + \divide\pgf@y by 2 + \pgf@yb = \insethright \advance\pgf@y by \pgf@yb + \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax} + \anchor{text}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}* + \ctikzvalof{multipoles/muxdemux/inset w}*\pgf@circ@scaled@Rlen/2} + \advance\pgf@x by -.5\wd\pgfnodeparttextbox% + \pgf@y=-.5\ht\pgfnodeparttextbox% + \advance\pgf@y by+.5\dp\pgfnodeparttextbox% + }% + \backgroundpath{% + \topleft + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@left = \pgf@x + \topright + \pgf@circ@res@other = \pgf@y + \pgf@circ@res@right = \pgf@x + \insetnortheast + \pgf@circ@res@step = \pgf@x + \pgf@circ@res@temp = \pgf@y + % + % external block + % + \pgfscope% (for the line width) + \pgf@circ@setlinewidth{multipoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + % inset, starting down + \ifdim\pgf@circ@res@temp>0pt % inset + % \typeout{INSETw\space\the\pgf@circ@res@right\space x\space\the\pgf@circ@res@step\space y\space\the\pgf@circ@res@temp} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\insethright}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\insethright}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}} + \fi + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + % now we have to draw the pins, if needed + \ifdim\extshift>0pt\ifpgfcirc@draw@input@leads\pgfscope % let's avoid too much indent + % Ok, we have to draw the leads (a.k.a. pins) + \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} + % We mimic the anchors here --- probably there is a better way + % left pins + \ifnum\NL>0\relax % not indented, closed on \repeatpgfmathloop + \pgf@circ@count@a=\NL\relax + \pgf@circ@count@b=\NL \divide\pgf@circ@count@b by 2 % see https://tex.stackexchange.com/questions/146523/why-does-numexpr-integer-division-round-rather-than-truncate + \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y + \insetnortheast\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y + \ifdim\pgf@circ@res@down>0pt % check if we have an inset + % we have to check oddity + \ifodd\NL + \ifnum\NL=1 + % only centerpin, step should not be used, but anyway... + \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL)} + \else + \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL-1)} + \fi + \else + \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/\NL} + \fi + \else % no inset + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NL} + \fi + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + %%%%% + \ifdim\pgf@circ@res@down>0pt % check if we have an inset + \ifnum\pgf@circ@count@a>\pgf@circ@count@b\relax + % for lower pins we have to shift them down + % \typeout{DEBUGTEST1\space #1\space entering\space \NL} + \ifodd\NL + % odd number of pins + \ifnum\pgf@circ@count@a=\numexpr\the\pgf@circ@count@b+1\relax + % centerpin! + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \ifnum\squarepins>0 + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{0pt}} + \else + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\extshift}{0pt}} + \fi + \else + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a+1)*\pgf@circ@res@step-2*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a+1)*\pgf@circ@res@step-2*\pgf@circ@res@down}} + \fi + \else + % even numer of pins: just go down + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step-2*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step-2*\pgf@circ@res@down}} + \fi + \else + % nothing need for #1<=NL/2 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}} + \fi + \else + % no inset + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}} + \fi + %%%%% + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop\fi% + % right pins + \ifnum\NR>0\pgf@circ@count@a=\NR\relax + \pgfmathloop% + \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@up=\pgf@y + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NR} + \ifnum\pgf@circ@count@a>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}} + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop\fi% + % bottom pins + \ifnum\NB>0\pgf@circ@count@a=\NB\relax %%% + \pgfmathloop% + \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y + \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NB} + \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@res@down-\pgf@circ@res@up)/(\pgf@circ@res@right-\pgf@circ@res@left)*\pgf@circ@res@step} + \ifnum\pgf@circ@count@a>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step} + {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}} + \ifnum\squarepins>0 + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step} + {-max(\pgf@circ@res@down, \pgf@circ@res@up)-\extshift}} + \else + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step} + {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other-\extshift}} + \fi + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop\fi% + % top pins + \ifnum\NT>0\pgf@circ@count@a=\NT\relax + \pgfmathloop% + \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y + \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NT} + \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@res@down-\pgf@circ@res@up)/(\pgf@circ@res@right-\pgf@circ@res@left)*\pgf@circ@res@step} + \ifnum\pgf@circ@count@a>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step} + {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}} + \ifnum\squarepins>0 + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step} + {max(\pgf@circ@res@down, \pgf@circ@res@up)+\extshift}} + \else + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step} + {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other+\extshift}} + \fi + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop\fi% + % end drawing pins; stroke them + \pgfusepath{stroke} + \endpgfscope\fi\fi + } + % let's start adding anchors + \pgfutil@g@addto@macro\pgf@sh@s@muxdemux{% + % left side anchors + \pgf@circ@count@a=\NL\relax + % \typeout{STARTGENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL} + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % \typeout{GENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL} + % we will create two anchors per pin: the "normal one" like `lpin 1` for the + % external leads, and the "border one" like `blpin 1` for internal ones. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@muxdemux@lpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@L@anchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@muxdemux@blpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@L@anchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + % right anchors + \pgf@circ@count@a=\NR\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `rpin 1` for the + % external leads, and the "border one" like `brpin 1` for internal ones. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@muxdemux@rpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@R@anchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@muxdemux@brpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@R@anchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + % bottom anchors + \pgf@circ@count@a=\NB\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `bpin 1` for the + % external leads, and the "border one" like `bbpin 1` for internal ones. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@muxdemux@bpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@B@anchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@muxdemux@bbpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@B@anchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + % top anchors + \pgf@circ@count@a=\NT\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `tpin 1` for the + % external leads, and the "border one" like `btpin 1` for internal ones. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@muxdemux@tpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@T@anchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@muxdemux@btpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@T@anchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + }% +} + +%% left anchors for muxdemux + +\def\pgf@circ@muxdemux@L@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \topleft + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \insetnortheast + \pgf@xb=\pgf@x + \pgf@yb=\pgf@y + \ifnum#1>\NL + \PackageError{circuitikz}{% + You requested left pin #1 for mux/demux shape \thisshape\space \MessageBreak + which has been defined with \NL\space left pins% + }{Please check the manual about mux/demux shapes; if you press return I'll try to continue} + \fi + \pgf@circ@count@a=\NL \divide\pgf@circ@count@a by 2 % see https://tex.stackexchange.com/questions/146523/why-does-numexpr-integer-division-round-rather-than-truncate + % \typeout{LEFT \the\pgf@xa \space \the\pgf@ya \space \NL} + \ifnum\NL>1 + \ifdim\pgf@yb>0pt % check if we have an inset + % we have to check oddity + \ifodd\NL + \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/(\NL-1)} + \else + \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/\NL} + \fi + \else % no inset + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NL} + \fi + \ifdim\pgf@yb>0pt % check if we have an inset + \ifnum#1>\pgf@circ@count@a\relax + % for lower pins we have to shift them down + % \typeout{DEBUGTEST1\space #1\space entering\space \NL} + \ifodd\NL + % odd number of pins + \ifnum#1=\numexpr\the\pgf@circ@count@a+1\relax + % centerpin! + \ifnum#2=0\relax + \pgfpoint{\pgf@xb}{0pt} + \else + \ifnum\squarepins>0 + \pgfpoint{\pgf@xa-#2*\extshift}{0pt} + \else + \pgfpoint{\pgf@xb-#2*\extshift}{0pt} + \fi + \fi + \else + \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1+1)*\pgf@circ@res@step-2*\pgf@yb} + \fi + \else + % even numer of pins: just go down + \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step-2*\pgf@yb} + \fi + \else + % nothing need for #1<=NL/2 + \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step} + \fi + \else + % no inset + \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step} + \fi + \else + \pgfpoint{\pgf@xa-#2*\extshift}{0pt} + \fi +} + +% right anchors +\def\pgf@circ@muxdemux@R@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \topright + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \ifnum#1>\NR + \PackageError{circuitikz}{% + You requested right pin #1 for mux/demux shape \thisshape\space \MessageBreak + which has been defined with \NR\space right pins% + }{Please check the manual about mux/demux shapes; if you press return I'll try to continue} + \fi + \ifnum\NR>1 + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NR} + \pgfpoint{\pgf@xa+#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step} + \else + \pgfpoint{\pgf@xa+#2*\extshift}{0pt} + \fi +} + +% bottom anchors +\def\pgf@circ@muxdemux@B@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \topleft + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \topright + \pgf@xb=\pgf@x + \pgf@yb=\pgf@y + \ifnum#1>\NB + \PackageError{circuitikz}{% + You requested bottom pin #1 for mux/demux shape \thisshape\space \MessageBreak + which has been defined with \NB\space bottom pins% + }{Please check the manual about mux/demux shapes; if you press return I'll try to continue} + \fi + \ifnum\NB>0 + % \typeout{DEBUGTESTtopleft\space\the\pgf@ya \space topright\space\the\pgf@yb \space\NB} + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NB} + \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step} + \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step} + \ifnum#2=0\relax + \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other} + \else + \ifnum\squarepins>0\relax + \pgfmathsetlength\pgf@y{-max(\pgf@ya,\pgf@yb)-\extshift} + \else + \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other-\extshift} + \fi + \fi + \else + % should not happen, give the same as pin 1 anyway + \ifnum#2=0\relax + \pgfpoint{0pt}{-\pgf@yb+(\pgf@yb-\pgf@ya)/2} + \else + \pgfpoint{0pt}{-max(\pgf@ya,\pgf@yb)-\extshift} + \fi + \fi +} + +% top anchors +\def\pgf@circ@muxdemux@T@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \topleft + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \topright + \pgf@xb=\pgf@x + \pgf@yb=\pgf@y + \ifnum#1>\NT + \PackageError{circuitikz}{% + You requested top pin #1 for mux/demux shape \thisshape\space \MessageBreak + which has been defined with \NT\space top pins% + }{Please check the manual about mux/demux shapes; if you press return I'll try to continue} + \fi + \ifnum\NT>0 + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NT} + \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step} + \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step} + \ifnum#2=0\relax + \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other} + \else + \ifnum\squarepins>0 + \pgfmathsetlength\pgf@y{max(\pgf@ya,\pgf@yb)+\extshift} + \else + \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other+\extshift} + \fi + \fi + \else + % should not happen, give the same as pin 1 anyway + \ifnum#2=0\relax + \pgfpoint{0pt}{\pgf@yb-(\pgf@yb-\pgf@ya)/2} + \else + \pgfpoint{0pt}{max(\pgf@ya,\pgf@yb)+\extshift} + \fi + \fi +} + +%% IEEE standard logic ports module +%% +%% Original multi-input code from John Kormylo at tex.stackexchange.com +%% Help by TheTeXnician <38565529+TheTeXnician@users.noreply.github.com> +%% Suggested idea and example code by Jason Sachs +%% Please see https://github.com/circuitikz/circuitikz/issues/383 for a lot of details +%% Most of the code, all errors and bugs by Romano Giannetti +%% Everything is in the same place here --- more or less; first step to move towards +%% a module interface for circutikz +%% + +% base parameters for ieeestd ports. + +\ctikzset{ieeestd ports/.is family} +% baselen is relative to pgfcirc@Rlen as ever; scaled if the class says so. +% the value of 0.4 is the standard pin distance for a port with height=num pins +% and matches the chip distance +\ctikzset{ieeestd ports/baselen/.initial=0.4} +% these are in term of baselen; width depends on height (fixed proportions) +\ctikzset{ieeestd ports/height/.initial=2} +\ctikzset{ieeestd ports/pin length/.initial=0.7} +% the standard "not" circle should be 1/6.5 of height (diameter); +% so radius/baselen=1/3.25/2 --- using 0.1 and no scaling is as a pole +\ctikzset{ieeestd ports/not radius/.initial=0.154} +\ctikzset{ieeestd ports/not radius fill/.initial=1}% change ony if you know why +% the suggested xnor distance is is 1.24, so 1.25/3.25/2 +% xor/xnor leads go full in in IEEE; let this be optional +\ctikzset{ieeestd ports/xor bar distance/.initial=0.192}% +\ctikzset{ieeestd ports/xor leads in/.initial=1}% +% +% base size of a small external schmitt symbol +% +\ctikzset{ieeestd ports/schmitt symbol size/.initial=0.3}% +% +% input management +% we are using the same /tikz/number inputs than the legacy ports +% +\tikzset{/tikz/inner inputs/.initial=0} % using 0 means that all inputs are inner +% +% integrate with the other logic ports +% +% +\newif\ifpgf@circuit@ieeelogicport\pgf@circuit@ieeelogicportfalse +\ctikzset{logic ports/ieee/.code= {% + \pgf@circuit@ieeelogicporttrue + \pgf@circuit@europeanlogicportfalse + \tikzset{and port/.style={shape=ieeestd and port}}% + \tikzset{or port/.style={shape=ieeestd or port}}% + \tikzset{xor port/.style={shape=ieeestd xor port}}% + \tikzset{buffer port/.style={shape=ieeestd buffer port}}% + \tikzset{not port/.style={shape=ieeestd not port}}% + \tikzset{nand port/.style={shape=ieeestd nand port}}% + \tikzset{nor port/.style={shape=ieeestd nor port}}% + \tikzset{xnor port/.style={shape=ieeestd xnor port}}% + \tikzset{schmitt port/.style={shape=ieeestd schmitt port}}% + \tikzset{invschmitt port/.style={shape=ieeestd invschmitt port}}% +}} +% add code to be compatible with the other ports +\ctikzset{logic ports/european/.add code={\pgf@circuit@ieeelogicportfalse}} +\ctikzset{logic ports/american/.add code={\pgf@circuit@ieeelogicportfalse}} +\tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}} +% +% the base angle for the or port. See the drawings. This will not change with height +% +\pgfmathsetmacro{\pgf@circ@orangle}{atan(3.25/6.5)} +% \typeout{ANGLE-IS\space\pgf@circ@orangle} +\def\pgf@circ@ieeeport@input#1% #1 = \pgfmathcounter +{% + \ifnum#1>\inputs + \PackageError{circuitikz}{% + You requested input pin #1 for logic port shape \thisshape\space \MessageBreak + which has been defined with \inputs\space pins% + }{Please check the manual about logic ports; if you press return I'll try to continue} + \fi + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgf@circ@res@step=\pind + \pgf@y=\pgf@circ@res@up\advance\pgf@y by -#1\pgf@circ@res@step\relax + \pgf@x=\pgf@circ@res@left\advance\pgf@x by -\pinlen +}% + +% #1 = \pgfmathcounter #2=type +% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor +\def\pgf@circ@ieeeport@baseinput#1#2% +{% + \ifnum#1>\inputs + \PackageError{circuitikz}{% + You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak + which has been defined with \inputs\space pins% + }{Please check the manual about logic ports; if you press return I'll try to continue} + \fi + % Find the vertical position (this is the same for any port) + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port + \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax + % rack (extended) pins; they are the same for all the ports + % call K = (inputs-inner)/2, rounded up; pins on the rack are: + % above: 1..K (included) + % below: inputs-K..inputs + % Find the pins on the rack; they are 1... + \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! + \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1 + % border anchors for rack should be ok + \pgfextractx{\pgf@circ@res@left}{\topleft} + \pgfextractx{\pgf@circ@res@right}{\bodyleft} + \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left + % we have finished if we are in the rack + \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b + % we are on the inner ports; we have to do the hard work here + % and and nand + \ifnum #2=1 + \relax % It's an and/nand, all border ports are on the rack line + \fi + % or and nor + \ifnum #2=2 + \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} + \fi + % xor and xnor + \ifnum #2=3\relax + \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-\xorbar-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} + \fi + \fi\fi +}% +% inner base ports for xor types port +% #1 = \pgfmathcounter #2=type +% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor +\def\pgf@circ@ieeeport@innerbaseinput#1% +{% + \ifnum#1>\inputs + \PackageError{circuitikz}{% + You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak + which has been defined with \inputs\space pins% + }{Please check the manual about logic ports; if you press return I'll try to continue} + \fi + % Find the vertical position (this is the same for any port) + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port + \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax + % rack (extended) pins; they are the same for all the ports + % call K = (inputs-inner)/2, rounded up; pins on the rack are: + % above: 1..K (included) + % below: inputs-K..inputs + % Find the pins on the rack; they are 1... + \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! + \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1 + % border anchors for rack should be ok + \pgfextractx{\pgf@circ@res@left}{\topleft} + \pgfextractx{\pgf@circ@res@right}{\bodyleft} + \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left + % we have finished if we are in the rack + \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b + % we are on the inner ports; we have to do the hard work here + \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} + \fi\fi +}% + +%%% macro to find basic lenghts --- they leave it in \pgf@circ@res@temp +\def\pgf@circ@ieeestd@baselen{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*\pgf@circ@scaled@Rlen} +} +\def\pgf@circ@ieeestd@stdH{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@temp}{0.5*\ctikzvalof{ieeestd ports/baselen}* + \ctikzvalof{ieeestd ports/height}*\pgf@circ@scaled@Rlen} +} +\def\pgf@circ@ieeestd@pinlen{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}* + \ctikzvalof{ieeestd ports/pin length}*\pgf@circ@scaled@Rlen} +} +\def\pgf@circ@ieeestd@xorbar{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}* + \ctikzvalof{ieeestd ports/xor bar distance}*\pgf@circ@scaled@Rlen} +} +%% Not circle +\def\pgf@circ@notradius{ + \pgf@circ@ieeestd@stdH % got the standard length. Notice that his is 3.25H for IEEE + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/not radius}*\pgf@circ@res@temp} + % \typeout{NOTRADIUS\space\the\pgf@circ@res@temp} +} +%% Find (in ...@other) the height of the rack +\def\pgf@circ@findrackH{% + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax% + \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax% + \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins + \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % + \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi% + \pgf@circ@ieeestd@stdH + \multiply\pgf@circ@res@temp by 2\relax% full height + \divide\pgf@circ@res@temp by \pgf@circ@count@b % the pin spacing + \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@count@a/2)*\pgf@circ@res@temp} %top of the rack/port + % \typeout{RACK-\thisshape\space\the\pgf@circ@res@other} +} +%% +\def\pgf@circ@find@ieeeport@up{% leave it in up + % Normal port limits + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@circ@res@up}{\pgf@circ@res@temp} + % rack top size + \pgf@circ@findrackH + \ifdim\pgf@circ@res@other > \pgf@circ@res@up + \pgf@circ@res@up=\pgf@circ@res@other + \else + \fi +} +\def\pgf@circ@find@ieeeport@left#1{% leave it in left; #1 is type + % Normal port limits + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@circ@res@left}{8*\pgf@circ@res@temp/6.5} + \pgf@circ@res@right=\pgf@circ@res@left % save the border value + \pgf@circ@res@step=\pgf@circ@res@temp % save the stdH value + \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@left by \pgf@circ@res@temp + % \typeout{LEFT1-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + % this is the normal left border + % For the or or xor port, the limit can be the pointy thing (in case the + % pinlen is zero or too small) + % add to the body margin the or/nor peak: + \ifnum #1 > 1\relax% "or", "nor", "xor", "xnor" gates. + \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@step*(1-cos(\pgf@circ@orangle))} + \advance\pgf@circ@res@right by \pgf@circ@res@other + % \typeout{LEFT2-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + \fi + % add to the body margin the xor/xnor distance + \ifnum #1 = 3\relax% "xor" or "xnor" gates. + \pgf@circ@ieeestd@xorbar + \advance\pgf@circ@res@right by \pgf@circ@res@temp + % \typeout{LEFT3-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + \fi + % and if this exceeds the normal margin, this is it + % \typeout{LEFT4-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + \ifdim \pgf@circ@res@right > \pgf@circ@res@left + \pgf@circ@res@left=\pgf@circ@res@right + \fi + % \typeout{LEFT5-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + \pgf@circ@res@left=-\pgf@circ@res@left +} +\def\pgf@circ@find@ieeeport@right#1{% leave it in right; #1 is plain or negated + % Normal port limits + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@circ@res@right}{8*\pgf@circ@res@temp/6.5} + \pgf@circ@notradius + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp} + \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp + \ifdim\pgf@circ@res@other > \pgf@circ@res@right + \pgf@circ@res@right=\pgf@circ@res@other + \fi +} +\def\pgf@circ@find@ieeeport@not@right#1{% leave it in right; #1 is plain or negated + % Normal port limits + \pgf@circ@ieeestd@stdH + % notice 0.8660254 is cos(30) + \pgfmathsetlength{\pgf@circ@res@right}{0.8660254*\pgf@circ@res@temp} + \pgf@circ@notradius + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp} + \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp + \ifdim\pgf@circ@res@other > \pgf@circ@res@right + \pgf@circ@res@right=\pgf@circ@res@other + \fi +} + + +%%% ieeestd multi-input ports +%%% #1: name +%%% #2: type: 1 for and,nand; 2 for or,nor; 3 for xor,xnor +%%% #3: polarity: 0 for direct, 1 for inverted (not at the output) +%%% #4: drawing for the port +\long\def\pgfcircdeclareieeeport#1#2#3#4{% + \pgfdeclareshape{ieeestd #1 port}% + {% + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + \saveddimen{\baselen}{% + \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\stdH}{% This is HALF the height of the inner port + \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\notdiameter}{ + \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp + } + \saveddimen{\pind}{% pin distance; + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax% + \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax% + \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins + \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % + \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi% + \pgf@circ@ieeestd@stdH\pgf@x=2\pgf@circ@res@temp % full height + \divide\pgf@x by \pgf@circ@count@b + } + \saveddimen{\pinlen}{% + \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\xorbar}{% + \pgf@circ@ieeestd@xorbar\pgf@x=\pgf@circ@res@temp + } + % anchors for the body (no pins included here) + \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\topleft}{% + \pgf@circ@ieeestd@xorbar\pgf@circ@res@right=\pgf@circ@res@temp % save \xorbar + \pgf@circ@ieeestd@stdH + \pgf@circ@res@other=0pt\relax + \ifnum #2 = 2\relax% "or" or "nor" gates. + \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))} + \fi + \ifnum #2 = 3\relax% "xor" or "xnor" gates. + \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle)) + +\pgf@circ@res@right} + \fi + \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5-\pgf@circ@res@other} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5} + \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} + } + \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle + \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp + \pgf@circ@ieeestd@stdH + % #3 is =1 if the port is a negated output one + \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5+#3*2*\pgf@circ@res@other} + \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} + } + % geographical anchors --- must be rectangulars! + \savedanchor{\northwest}{% + \pgf@circ@find@ieeeport@up + \pgf@circ@find@ieeeport@left{#2} + % \typeout{ANCH5-\thisshape\space L\space\the\pgf@circ@res@left\space U\space\the\pgf@circ@res@up} + \pgf@x=\pgf@circ@res@left + \pgf@y=\pgf@circ@res@up + } + \savedanchor{\southwest}{% + \pgf@circ@find@ieeeport@up + \pgf@circ@find@ieeeport@left{#2} + \pgf@x=\pgf@circ@res@left + \pgf@y=-\pgf@circ@res@up + } + \savedanchor{\southeast}{% + \pgf@circ@find@ieeeport@up + \pgf@circ@find@ieeeport@right{#3} + \pgf@x=\pgf@circ@res@right + \pgf@y=-\pgf@circ@res@up + } + \savedanchor{\northeast}{% + \pgf@circ@find@ieeeport@up + \pgf@circ@find@ieeeport@right{#3} + \pgf@x=\pgf@circ@res@right + \pgf@y=\pgf@circ@res@up + } + \savedmacro\inputs{% get number of inputs + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax + \ifnum\pgf@circ@count@a=0\pgf@circ@count@a=2\fi % default + \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins + % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi + \def\inputs{\the\pgf@circ@count@a}% + }% + \savedmacro\inners{% get number of "inner" inputs (for racks) + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax + \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax + \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins + \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins + \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi + % \typeout{INNER is \the\pgf@circ@count@b}% + % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi + \def\inners{\the\pgf@circ@count@b}% + }% + \anchor{center}{\pgfpointorigin} + \anchor{text}{ + \ifpgf@circ@center@text + \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \else + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@circ@res@left}{-8*\pgf@circ@res@temp/6.5} % left border + \pgfpoint{\pgf@circ@res@left + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \fi + } + % create input anchors + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@ieeestd #1 port\endcsname{% + \pgf@circ@count@a=\inputs + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@circ@count@a% + \else% + %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@in \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@ieeeport@input{\pgfmathcounter}% defined above + }% + \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@bin \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@ieeeport@baseinput{\pgfmathcounter}{#2}% defined above + }% + \ifnum #2 = 3\relax % xor/xnor inner border pins + \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@ibin \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@ieeeport@innerbaseinput{\pgfmathcounter}% defined above + }% + \fi + %}{}% + \repeatpgfmathloop% + } + % output anchor + \anchor{out}{% + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball + \advance\pgf@circ@res@other by\pinlen + \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border + \ifdim \pgf@circ@res@temp > \pgf@circ@res@other + \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... + \fi + \pgf@x=\pgf@circ@res@other\pgf@y=0pt + } + \anchor{bout}{\bottomright\pgf@y=0pt} + + \anchor{body right}{\bodyright\pgf@y=0pt} + \anchor{right}{\bottomright\pgf@y=0pt} + \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body + \anchor{left}{% central edge of the component + \bodyleft\pgf@y=0pt + \ifnum #2=3\relax + \advance\pgf@x by -\xorbar + \fi + } + \anchor{up}{% + \bodyleft + \ifnum #2 > 1 % pointy shapes + \pgf@circ@ieeestd@stdH + % horizontal coordinate where the right semicircle starts + \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)} + % vertical drop of the circle at the above coordinate + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))} + \advance \pgf@y by -\pgf@circ@res@step + \fi + \pgf@x=0pt + } + \anchor{down}{% + \bodyleft + \ifnum #2 > 1 % pointy shapes + \pgf@circ@ieeestd@stdH + % horizontal coordinate where the right semicircle starts + \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)} + % vertical drop of the circle at the above coordinate + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))} + \advance \pgf@y by -\pgf@circ@res@step + \fi + \pgf@y=-\pgf@y\pgf@x=0pt + } + + % geographical anchors + \anchor{nw}{\northwest} + \anchor{ne}{\northeast} + \anchor{se}{\southeast} + \anchor{sw}{\southwest} + \anchor{north west}{\northwest} + \anchor{north east}{\northeast} + \anchor{south east}{\southeast} + \anchor{south west}{\southwest} + % over 0,0 even if asymmetric + % will break if the geocoords are not rectangular + \anchor{n}{\northwest\pgf@x=0pt\relax} + \anchor{e}{\northeast\pgf@y=0pt\relax} + \anchor{s}{\southwest\pgf@x=0pt\relax} + \anchor{w}{\northwest\pgf@y=0pt\relax} + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{east}{\northeast\pgf@y=0pt\relax} + \anchor{south}{\southwest\pgf@x=0pt\relax} + \anchor{west}{\northwest\pgf@y=0pt\relax} + + \backgroundpath{ + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + #4 + \endpgfscope + % output lead: + \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball + \advance\pgf@circ@res@other by \pinlen\relax + \ifdim \pgf@circ@res@other > \pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + \fi + \ifnum #3=1\relax\pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}} + \endpgfscope\fi + } + } +} + +%%% #1 direct name #2 negated name #3 type #4 drawing (without output) +\long\def\pgfcircdeclareieeeportpair#1#2#3#4{% + \pgfcircdeclareieeeport{#1}{#3}{0}{#4}% direct + \pgfcircdeclareieeeport{#2}{#3}{1}{#4}% negated +} +% +% ieeestd "and" and "nand" +% +\pgfcircdeclareieeeportpair{and}{nand}{1}{% + \pgf@circ@count@a = \inputs\relax + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@down}{\bodyleft} + \ifpgfcirc@draw@input@leads + %input leads --- all the same for AND ports + \loop\ifnum\pgf@circ@count@a>0 + \advance\pgf@circ@res@temp by -\pind + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}% + \advance\pgf@circ@count@a by -1 + \repeat + \fi + \pgfusepath{draw} + %% Body. let's start from the top left + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}} + \pgfpathlineto{\pgfpoint{1.5*\stdH/6.5}{\stdH}} + \pgfpatharc{90}{-90}{\stdH} + \pgfpathlineto{\pgfpoint{-8*\stdH/6.5}{-\stdH}} + \pgfpathclose + \pgf@circ@draworfill + % rack now; skip if not needed. + % \typeout{WHAT\space \inputs\space \inners} + \ifnum\inputs>\inners + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + \fi + \endpgfscope +} +% +% or/nor and xor/xnor are practically the same. Let factor out everything +% the argument #1 is put just before the drawing of the inner pins +% the argument #2 is put after the drawing of the body +% +\long\def\pgf@circ@ieeeport@orxor#1#2{% + \pgf@circ@count@a = \inputs\relax + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@down}{\bodyleft} + % rack (extended) pins; they are the same for all the ports + % call K = (inputs-inner)/2, rounded up; pins on the rack are: + % above: 1..K (included) + % below: inputs-K..inputs + % Find the pins on the rack; they are 1... + \pgf@circ@count@b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! + \pgf@circ@count@c=\numexpr \inputs - \pgf@circ@count@b +1 \relax % =inputs - K +1 + \ifpgfcirc@draw@input@leads + %input leads --- for or ports + \loop\ifnum\pgf@circ@count@a>0 + \pgfextractx{\pgf@circ@res@right}{\topleft} + \advance\pgf@circ@res@temp by -\pind + % this is the height; let's find the "right" position + \ifnum \pgf@circ@count@a > \pgf@circ@count@b \ifnum \pgf@circ@count@a < \pgf@circ@count@c + % inner pins + % \typeout{INNER\space\pgf@circ@count@a} + \pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@left-2*\stdH*(1-cos(atan(\pgf@circ@res@temp/(2*\stdH))))} + % hook for xor/xnor + #1 + \fi\fi + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}% + \pgfusepath{draw} + \advance\pgf@circ@count@a by -1 + \repeat + \fi + %% Body. let's start from the top left + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + % it should start here, but with this trick the close comes out better. + % \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} + \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}} + \pgfpathlineto{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{\stdH}} % + \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5}{0pt}} + \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{-\stdH}} + \pgfpathlineto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}} + %% this should be 2 and 2; but the round part is not a perfect circle that way + %% so the 2.15 is ajusted "by taste" to touch the anchors exactly. + \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} + \pgfpathclose + \pgf@circ@draworfill + % hook for xor/xnor + #2 + % rack now; skip if not needed. + % \typeout{WHAT\space \inputs\space \inners} + \ifnum\inputs>\inners + \pgfextractx{\pgf@circ@res@left}{\topleft} + \pgfextracty{\pgf@circ@res@down}{\topleft} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + \fi + \endpgfscope +} +% +% ieeestd "or" and "nor" +% +\pgfcircdeclareieeeportpair{or}{nor}{2}{% + \pgf@circ@ieeeport@orxor{}{} +} +\pgfcircdeclareieeeportpair{xor}{xnor}{3}{% + \pgf@circ@ieeeport@orxor{ + \edef\@@tmp{\ctikzvalof{ieeestd ports/xor leads in}} + \ifnum\@@tmp=0\relax + % move pin start to the left to leave the xor gap free (not standard) + \advance\pgf@circ@res@right by -\xorbar + \fi + }{% + % add the xor/xnor bar + \pgfpathmoveto{\pgfpoint{-\xorbar-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}} + % see the comment on the main body about the 2.2 + \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-\xorbar -8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} + \pgfusepath{draw} + } +} +% +% Buffer and inverters +% +% #1: name +% #2: polarity +% #3: content +\long\def\pgfcircdeclareieeebufferport#1#2#3{% + \pgfdeclareshape{ieeestd #1 port}% + {% + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + \saveddimen{\baselen}{% + \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\stdH}{% This is HALF the height of the inner port + \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\notdiameter}{ + \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp + } + \saveddimen{\pinlen}{% + \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp + } + % anchors for the body (no pins included here) + % Notice that 0.8660254 is cos(30) + \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\topleft}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle + \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp + \pgf@circ@ieeestd@stdH + % #2 is =1 if the port is a negated output one + \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp+#2*2*\pgf@circ@res@other} + \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} + } + % geographical anchors --- must be rectangulars! + \savedanchor{\northwest}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\southwest}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} + } + \savedanchor{\southeast}{% + \pgf@circ@ieeestd@stdH + \pgf@circ@res@up=\pgf@circ@res@temp + \pgf@circ@find@ieeeport@not@right{#2} + \pgf@x=\pgf@circ@res@right + \pgf@y=-\pgf@circ@res@up + } + \savedanchor{\northeast}{% + \pgf@circ@ieeestd@stdH + \pgf@circ@res@up=\pgf@circ@res@temp + \pgf@circ@find@ieeeport@not@right{#2} + \pgf@x=\pgf@circ@res@right + \pgf@y=\pgf@circ@res@up + } + \anchor{center}{\pgfpointorigin} + \anchor{text}{ + \ifpgf@circ@center@text + \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \else + \pgf@circ@ieeestd@stdH + \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \fi + } + % input anchors + \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} + \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} + \anchor{bin}{\bodyleft\pgf@y=0pt\relax} + \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax} + % output anchors + \anchor{out}{% + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball + \advance\pgf@circ@res@other by\pinlen + \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border + \ifdim \pgf@circ@res@temp > \pgf@circ@res@other + \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... + \fi + \pgf@x=\pgf@circ@res@other\pgf@y=0pt + } + \anchor{bout}{\bottomright\pgf@y=0pt} + + \anchor{body right}{\bodyright\pgf@y=0pt} + \anchor{right}{\bottomright\pgf@y=0pt} + \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body + \anchor{left}{\bodyleft\pgf@y=0pt} + \anchor{up}{% + \bodyleft + \pgf@y=+0.5\pgf@y\pgf@x=0pt + } + \anchor{down}{% + \bodyleft + \pgf@y=-0.5\pgf@y\pgf@x=0pt + } + % this is for when it's used as a bipole + % we use the enclosing rectangle (see below) + \anchorborder{% + %% This (commented out) is the correct border anchor. But if we use the correct + %% border anchor there is no horizontal space for the label ;-) because + %% the triangle is too steep. So we will use a simple square border + %% + %% find the border anchor of a triangle (like a not port or an + %% amplifier) --- + %% + %% -----^ up + %% I --- | + %% I -|-- + %%left I | --- right + %% ----I-----|-------I----- + %% + %% + %\pgf@xa=\pgf@x + %% it's simmetrical w/ vertical side, use only positive y + %\pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)} + %\pgfmathsetlength{\pgf@ya}{abs(\pgf@y)} + %\pgfextracty{\pgf@circ@res@up}{\bodyleft} + %\pgfextractx{\pgf@circ@res@left}{\bodyleft} + %\pgfextractx{\pgf@circ@res@right}{\bodyright} + %% limit angle for the left (vertical) side + %\pgfmathsetmacro{\@@phimax}{atan2(\pgf@circ@res@up,\pgf@circ@res@left)} + %\pgfmathsetmacro{\@@phi}{atan2(\pgf@ya,\pgf@xa)} + %\pgfmathsetmacro{\@@leftside}{ifthenelse(\@@phi>\@@phimax,1,0)} + %% find the border + %\ifnum\@@leftside>0 + % % vertical side + % \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + % {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + %\else + % % triangle upper line + % \pgfpointintersectionoflines + % {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}} + % {\pgfqpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@right}{0pt}} + %\fi + %% readjust y sign + %\pgf@y=\@@switchy\pgf@y + % + % this is the square border to position the path label with a bit of horizontal space + % + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + } + % geographical anchors + \anchor{nw}{\northwest} + \anchor{ne}{\northeast} + \anchor{se}{\southeast} + \anchor{sw}{\southwest} + \anchor{north west}{\northwest} + \anchor{north east}{\northeast} + \anchor{south east}{\southeast} + \anchor{south west}{\southwest} + % over 0,0 even if asymmetric + % will break if the geocoords are not rectangular + \anchor{n}{\northwest\pgf@x=0pt\relax} + \anchor{e}{\northeast\pgf@y=0pt\relax} + \anchor{s}{\southwest\pgf@x=0pt\relax} + \anchor{w}{\northwest\pgf@y=0pt\relax} + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{east}{\northeast\pgf@y=0pt\relax} + \anchor{south}{\southwest\pgf@x=0pt\relax} + \anchor{west}{\northwest\pgf@y=0pt\relax} + + \backgroundpath{ + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + #3 + \endpgfscope + % output lead: + \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball + \advance\pgf@circ@res@other by \pinlen\relax + \ifdim \pgf@circ@res@other > \pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + \fi + \ifnum #2=1\relax\pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}} + \endpgfscope\fi + } + } +} + +%%% #1 direct name #2 negated name #3 drawing (without output) +\long\def\pgfcircdeclareieeebufferportpair#1#2#3{% + \pgfcircdeclareieeebufferport{#1}{0}{#3}% direct + \pgfcircdeclareieeebufferport{#2}{1}{#3}% negated +} + +\pgfcircdeclareieeebufferportpair{buffer}{not}{% + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@right}{\bodyright} + % \draw input pin + \ifpgfcirc@draw@input@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} + \pgfusepath{draw} + \fi + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope +} + +\pgfcircdeclareieeebufferportpair{schmitt}{invschmitt}{% + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@right}{\bodyright} + % \draw input pin + \ifpgfcirc@draw@input@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} + \pgfusepath{draw} + \fi + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + % draw schmitt symbol in normal line thickness + \pgfpathmoveto{\pgfpoint{0.75*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.00*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0.25*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.25*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} + \pgfusepath{draw} +} + + +\pgfdeclareshape{schmitt symbol}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@circ@ieeestd@stdH + \pgf@y=\ctikzvalof{ieeestd ports/schmitt symbol size}\pgf@circ@res@temp + \pgf@x=-1.5\pgf@y + } + \anchor{center}{\pgf@y=0pt \pgf@x=0pt} + \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x} + \anchor{west}{\northwest\pgf@y=0pt} + \anchor{w}{\northwest \pgf@y=0pt} + \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{north}{\northwest\pgf@x=0pt} + \anchor{n}{\northwest\pgf@x=0pt} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{north west}{\northwest} + \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \backgroundpath{ + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgf@circ@res@left=0.7\pgf@circ@res@left + \pgf@circ@res@up=0.7\pgf@circ@res@up + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left/3}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left/3}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + } +} + +\pgfdeclareshape{notcirc}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@circ@notradius + \pgf@y=\pgf@circ@res@temp + \pgf@x=-\pgf@y + } + \anchor{center}{\pgf@y=0pt \pgf@x=0pt} + \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x} + \anchor{left}{\northwest\pgf@y=0pt} + \anchor{west}{\northwest\pgf@y=0pt} + \anchor{w}{\northwest \pgf@y=0pt} + \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{north}{\northwest\pgf@x=0pt} + \anchor{n}{\northwest\pgf@x=0pt} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{north west}{\northwest} + \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \northwest\pgf@circ@res@temp=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}% + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + } + \behindforegroundpath{ + \pgfscope + \northwest\pgf@circ@res@temp=\pgf@y + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@temp} + \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white + \pgfsetfillcolor{white} + % ...but override it if the class is defined! + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \fi + \pgfsetfillopacity{\ctikzvalof{ieeestd ports/not radius fill}}% normally 1.0 + \pgfusepath{draw,fill} + \endpgfscope + } +} + +%%%% Transmission gates +% tgates are only ieee style for now +\tikzset{% + tgate/.style ={shape=ieee tgate}, + double tgate/.style ={shape=ieee double tgate}, +} +\ctikzset{tgate scale/.initial=0.7} +% Buffer and inverters +% +% #1: name +% #2: 1: one-not, 2:double-not +% #3: content +\long\def\pgfcircdeclareieeetgate#1#2#3{% + \pgfdeclareshape{ieee #1}% + {% + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + \saveddimen{\baselen}{% + \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\stdH}{% This is HALF the height of the inner port + \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\notdiameter}{ + \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp + } + \saveddimen{\notradius}{ + \pgf@circ@notradius\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\pinlen}{% + \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp + } + % anchors for the body (no pins included here) + % Notice that 0.8660254 is cos(30) + \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\topleft}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\bodyright}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\bottomright}{% Here it is the same as \bodyright + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + % geographical anchors --- must be rectangulars! + \savedanchor{\northwest}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\southwest}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\southeast}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\northeast}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \anchor{center}{\pgfpointorigin} + \anchor{text}{ + \ifpgf@circ@center@text + \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \else + \pgf@circ@ieeestd@stdH + \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \fi + } + % input anchors + \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} + \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} + \anchor{bin}{\bodyleft\pgf@y=0pt\relax} + \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax} + % gates + \anchor{gate}{\bodyleft\pgf@circ@res@up=\pgf@y + \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}} + \anchor{bgate}{\bodyleft\pgf@circ@res@up=\pgf@y + \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up}} + % gate (up) (2.1547 = 1+1/cos(30) + \anchor{notgate}{\bodyleft\pgf@circ@res@up=\pgf@y + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius} + \ifdim\pinlen>\pgf@circ@res@temp + \pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen} + \else + \pgf@y=\pgf@circ@res@temp + \fi + } + \anchor{bnotgate}{\bodyleft\pgf@circ@res@up=\pgf@y + \pgf@x=0pt\pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+2.1547*\notradius}} + + % output anchors + \anchor{out}{% + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball + \advance\pgf@circ@res@other by\pinlen + \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border + \ifdim \pgf@circ@res@temp > \pgf@circ@res@other + \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... + \fi + \pgf@x=\pgf@circ@res@other\pgf@y=0pt + } + \anchor{bout}{\bottomright\pgf@y=0pt} + + \anchor{body right}{\bodyright\pgf@y=0pt} + \anchor{right}{\bottomright\pgf@y=0pt} + \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body + \anchor{left}{\bodyleft\pgf@y=0pt} + \anchor{up}{% + \bodyleft + \pgf@x=0pt + \ifnum#2=1\relax + \pgf@y=0pt + \else + \pgf@y=.5\pgf@y + \fi + \advance\pgf@y by \notdiameter + } + \anchor{down}{% + \bodyleft + \pgf@x=0pt + \ifnum#2=1\relax + \pgf@y=0pt + \else + \pgf@y=-.5\pgf@y + \fi + } + % this is for when it's used as a bipole + % we use the enclosing rectangle (see below) + \anchorborder{% + % + % this is the square border to position the path label with a bit of horizontal space + % + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + } + % geographical anchors + \anchor{nw}{\northwest} + \anchor{ne}{\northeast} + \anchor{se}{\southeast} + \anchor{sw}{\southwest} + \anchor{north west}{\northwest} + \anchor{north east}{\northeast} + \anchor{south east}{\southeast} + \anchor{south west}{\southwest} + % over 0,0 even if asymmetric + % will break if the geocoords are not rectangular + \anchor{n}{\northwest\pgf@x=0pt\relax} + \anchor{e}{\northeast\pgf@y=0pt\relax} + \anchor{s}{\southwest\pgf@x=0pt\relax} + \anchor{w}{\northwest\pgf@y=0pt\relax} + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{east}{\northeast\pgf@y=0pt\relax} + \anchor{south}{\southwest\pgf@x=0pt\relax} + \anchor{west}{\northwest\pgf@y=0pt\relax} + + \backgroundpath{ + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@right}{\bodyright} + % \draw input pins + \ifpgfcirc@draw@input@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} + % gate (down) + \pgfpathmoveto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}} + % gate (up) (2.1547 = 1+1/cos(30) + \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius} + \ifdim\pinlen>\pgf@circ@res@temp + \pgfpathmoveto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}} + \fi + \pgfusepath{draw} + \fi + #3 + \endpgfscope + % output lead: + \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball + \advance\pgf@circ@res@other by \pinlen\relax + \ifdim \pgf@circ@res@other > \pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + \fi + } + } +} + +\pgfcircdeclareieeetgate{tgate}{1}{% + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfscope + % 1.1547 is 1/cos(30) + \pgftransformshift{\pgfpoint{0pt}{1.1547*\notradius}} + \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}} + \endpgfscope +} + +\pgfcircdeclareieeetgate{double tgate}{2}{% + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + % bottom triangles + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfscope + % 1.1547 is 1/cos(30) + \pgftransformshift{\pgfpoint{0pt}{.5*\pgf@circ@res@up+1.1547*\notradius}} + \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}} + \endpgfscope +} + +%%%---------- close: tex/pgfcircmultipoles + +%%%%%%%%%%% Springe nach tex/pgfcirclabel +%%%---------- open: tex/pgfcirclabel.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Bipole label positioning + +%% bipole labels and annotation extra style + +\ctikzset{bipole label style/.style={}} +\tikzset{bipole label style/.code={ + \ctikzset{bipole label style/.style={#1}} +}} +\tikzset{bipole label append style/.code={ + \ctikzset{bipole label style/.append style={#1}} +}} +\ctikzset{bipole annotation style/.style={}} +\tikzset{bipole annotation style/.code={ + \ctikzset{bipole annotation style/.style={#1}} +}} +\tikzset{bipole annotation append style/.code={ + \ctikzset{bipole annotation style/.append style={#1}} +}} + +%% Options +\ctikzset{label/.style = { l=#1 } } +\ctikzset{l/.code = { + \pgfkeys{/tikz/circuitikz/bipole/label/name=#1} + \ctikzsetvalof{bipole/label/unit}{} + \ifpgf@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp} + \else + \fi + \else + \fi +}} + +\ctikzset{label above/.code = { + l=#1, + \circuitikzbasekey/bipole/label/position=90 } +} + +\ctikzset{l^/.style = { + l=#1, + \circuitikzbasekey/bipole/label/position=90 } +} + +\ctikzset{label below/.code = { + l=#1, + \circuitikzbasekey/bipole/label/position=-90 } +} + +\ctikzset{l_/.style = { + l=#1, + \circuitikzbasekey/bipole/label/position=-90 } +} + +\ctikzset{annotation/.style = { a=#1 } } +\ctikzset{a/.code = { + \pgfkeys{/tikz/circuitikz/bipole/annotation/name=#1} + \ctikzsetvalof{bipole/annotation/unit}{} + \ifpgf@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/annotation/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/annotation/unit}{\pgf@temp} + \else + \fi + \else + \fi +}} + +\ctikzset{annotation above/.code = { + a=#1, + \circuitikzbasekey/bipole/annotation/position=90 } +} + +\ctikzset{a^/.style = { + a=#1, + \circuitikzbasekey/bipole/annotation/position=90 } +} + +\ctikzset{annotation below/.code = { + a=#1, + \circuitikzbasekey/bipole/annotation/position=-90 } +} +\ctikzset{a_/.style = { + a=#1, + \circuitikzbasekey/bipole/annotation/position=-90 } +} + +% This is to adjust spacing for the labels so that they are not cramped on components +\def\pgf@circ@ls{.75ex} % labelspace to have just one point to change + +\def\pgf@circ@drawlabels#1{ + \pgfextra{ + % This function will be called with argument #1 equal + % to "label" or "annotation" form pgfcircpath.tex. + % pgf@circ@direction is the direction of the path, + % its value is set in pgfcircpath.tex + \pgfmathsubtract{\pgf@circ@direction}{90} + \pgfmathround{\pgfmathresult} % avoid precision loss errors + \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + + \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/position}} + \ifnum \pgf@circ@temp < 0 + \pgfmathadd{\pgf@circ@labanc}{180} + \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \fi + % \typeout{INI: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc} + % + % normalize the angle values + % + \pgfmathmod{\pgf@circ@labanc}{360} + \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + % + \ifpgf@circuit@bipole@inverted + \pgfmathadd{\pgf@circ@temp}{180} %If shape is inverted, use opposite anchor + \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \fi + % + \ifnum \ctikzvalof{mirror value} = -1 + \pgfmathadd{\pgf@circ@temp}{180} %If shape is mirrored, use opposite anchor + \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \fi + % \typeout{FIN: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc} + } + %Firstly, place a coordinate directly at the edge of the shape + (\ctikzvalof{bipole/name}.\pgf@circ@temp) coordinate (pgfcirc@labelcoor) + %now decide, which labels should be drawn + \pgfextra{ + \edef\pgf@temp{\ctikzvalof{label/align}} + \def\pgf@circ@temp{straight} + } + \ifx\pgf@temp\pgf@circ@temp %straight + \pgf@circ@drawreglabels{#1} + \else + \pgfextra{\def\pgf@circ@temp{rotate}} + \ifx\pgf@temp\pgf@circ@temp %rotate + \pgf@circ@drawrotlabels{#1} + \else% smart + \pgf@circ@drawsmartlabels{#1} + \fi + \fi +} + + +\def\pgf@circ@drawsmartlabels#1{ + \pgfextra{ + \pgfmathmod{\pgf@circ@direction}{90} + \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + } + \ifnum \pgfcircmathresult > 20 + \ifnum \pgfcircmathresult < 70 + \pgf@circ@drawrotlabels{#1} + \else + \pgf@circ@drawreglabels{#1} + \fi + \else + \pgf@circ@drawreglabels{#1} + \fi + } + + +\def\pgf@circ@drawrotlabels#1{ + \pgfextra{ + % scale the distances in function of zoom, so that they are not + % dependent on it but on font size. Thanks to @marmot + % https://tex.stackexchange.com/a/476018/38080 + % the coeffcient is adjusted so that the distance is more or less + % the same for rotated labels and straight ones (although it will + % depend on the font, so it's not exact). + \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}% + \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed + % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale} + \pgfmathsetlength\pgf@circ@res@temp{1.5*\pgf@circ@ls/\myscale} + \ifnum \ctikzvalof{bipole/#1/position}>0 + %we need some more space for placement below, due to mid-anchor + \else % we do not have <= in \ifnum... + \pgf@circ@res@temp=1.5\pgf@circ@res@temp + \fi + %Calculate rotation of the label from direction and strip decimals + \pgfmathsetmacro{\pgfcirclabrot}{round(\pgf@circ@direction)} + \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfcirclabrot\pgf@nil} + % rotate the label at second or third quadrant: + \ifnum \pgfcirclabrot > 90 \ifnum \pgfcirclabrot < 270 + \pgfmathsubtract{\pgf@circ@direction}{180} + \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + %invert the space relationships due to rotated strings + \ifnum \ctikzvalof{bipole/#1/position}>0 + \pgf@circ@res@temp=1.5\pgf@circ@res@temp + \fi + \fi\fi + \pgfmathparse{\ctikzvalof{bipole/#1/position}>0?\pgf@circ@direction+90:\pgf@circ@direction-90}% + \edef\pgf@circ@labposangle{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}% + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix#1-direction\endcsname{\pgfcirclabrot}% + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-#1-anchor\endcsname{mid}% + } + % reset cm is not working correctly here + (pgfcirc@labelcoor)++(\pgf@circ@labposangle:\the\pgf@circ@res@temp) coordinate(pgfcirc@labelcoor) + node[anchor=mid, rotate=\pgfcirclabrot, \circuitikzbasekey/bipole #1 style] + (\ctikzvalof{bipole/name}#1){\pgf@circ@finallabels{#1}} +} + +\def\pgf@circ@drawreglabels#1{ + %Now calculate all shape positions + %Use mid-anchor at x-axis and base-anchor at y-axis, respectively. + %All points between will be addressed by angled-anchors: + \pgfextra{ + % scale ex-distance to make it independent on scale + % thanks @marmot see https://tex.stackexchange.com/a/476018/38080 + \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}% + \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed + % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale} + \pgfmathsetlength\pgf@circ@res@temp{\pgf@circ@ls/\myscale} + \pgfmathadd{\pgf@circ@labanc}{90} + \pgfmathround{\pgfmathresult} + \def\pgf@circ@labanctext{\pgf@circ@labanc} + \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \pgfmathparse{mod(\pgf@circ@temp,180)>135?mod(\pgf@circ@temp,180)-180:mod(\pgf@circ@temp,180)} + \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + } + %Values around 90 are at both y-axis + \ifnum \pgfcircmathresult > 84 \ifnum \pgfcircmathresult< 96 + \pgfextra{\edef\pgf@circ@labpos{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}} + \ifnum \pgf@circ@labpos > 180 + \ifnum \ctikzvalof{bipole/#1/position} > 0 + \pgfextra{\def\pgf@circ@labanctext{mid west}} + \else + \pgfextra{\def\pgf@circ@labanctext{mid east}} + \fi + \else + \ifnum \ctikzvalof{bipole/#1/position} > 0 + \pgfextra{\def\pgf@circ@labanctext{mid east}} + \else + \pgfextra{\def\pgf@circ@labanctext{mid west}} + \fi + \fi + \fi\fi + %Values between -5 and 5 are at pos /neg x-axis + \ifnum \pgfcircmathresult <6 \ifnum \pgfcircmathresult > -6 + \ifnum \ctikzvalof{bipole/#1/position} < 0 + \ifnum \pgf@circ@labanc > 90 + % using base coordinate instead of south to naturally align + % symbols with descendants; but this invalidate the effect of + % the inner sep, so recover it by shifting the anchor + % reset cm is not working sometime, use @marmot solution + % see https://tex.stackexchange.com/a/476018/38080 + (pgfcirc@labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(pgfcirc@labelcoor) + \pgfextra{\def\pgf@circ@labanctext{base}}%base + \else + \pgfextra{\def\pgf@circ@labanctext{north}}%north + \fi + \else + \ifnum \pgf@circ@labanc < 90 + % shift, as above + (pgfcirc@labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(pgfcirc@labelcoor) + \pgfextra{\def\pgf@circ@labanctext{base}}%base + \else + \ifnum \pgf@circ@labanc > 180 + % this shouldn't happen, but somehow it does (270 degree anchors) + % shift, as above + (pgfcirc@labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(pgfcirc@labelcoor) + \pgfextra{\def\pgf@circ@labanctext{base}}%base + \else + \pgfextra{\def\pgf@circ@labanctext{north}}%north + \fi + \fi + \fi + \fi\fi + \pgfextra{% + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix#1-direction\endcsname{0}% + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-#1-anchor\endcsname{\pgf@circ@labanctext}% + } + (pgfcirc@labelcoor) node[anchor=\pgf@circ@labanctext, + inner sep=0.5\pgf@circ@res@temp, outer sep=0pt, \circuitikzbasekey/bipole #1 style, + ](\ctikzvalof{bipole/name}#1){\strut\pgf@circ@finallabels{#1}% + } +} + +\def\pgf@circ@finallabels#1{% + \edef\pgf@temp{}% + \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/unit}}% + \ifx\pgf@temp\pgf@circ@temp% + \ctikzvalof{bipole/#1/name}% + \else% + $\SI{\ctikzvalof{bipole/#1/name}}{\ctikzvalof{bipole/#1/unit}}$% + \fi% +} + + +%%%% Stacked labels +% +% stacked labels by Romano Giannetti romano@rgtti.com +% heavily based on Claudo Fiandrinos's https://tex.stackexchange.com/a/65792/38080 +% \expandafter trick inspired by Matthew Leingang's https://tex.stackexchange.com/a/12272/38080 +% +% labels are in a tabular, globally aligned: +% vertically with key l2 valign (default c) +% c: center t: top b: bottom +% horizontally with key l2 align (default l) +% l: left c: centered r: right +% you can switch sides using l2_=... and l2^=... +% syntax is l2_ = line1 and line2 (same for l2^) +% +\ctikzset{% + l2 valign/.store in=\ltwo@valign, l2 valign=c, + l2 halign/.store in=\ltwo@halign, l2 halign=l, +} +\ctikzset{l2base/.code n args={2}{ + \pgfkeys{/tikz/circuitikz/bipole/label/name=% + \bgroup + \setlength{\tabcolsep}{2pt}% + \def\ltwo@tabu{\tabular[\ltwo@valign]}% + \expandafter\ltwo@tabu\expandafter{\ltwo@halign}% + #1\\ #2% + \endtabular + \egroup + }% + \ctikzsetvalof{bipole/label/unit}{} + \ifpgf@circ@siunitx + \pgf@circ@handleSI{#2} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp} + \else + \fi + \else + \fi +}} +\ctikzset{l2/.style args={#1 and #2}{ + l2base={#1}{#2}, + \circuitikzbasekey/bipole/label/position=90 } +} +\ctikzset{l2 above/.style args={#1 and #2}{ + l2base={#1}{#2}, + \circuitikzbasekey/bipole/label/position=90 } +} +\ctikzset{l2^/.style args={#1 and #2}{ + l2base={#1}{#2}, + \circuitikzbasekey/bipole/label/position=90 } +} +\ctikzset{l2 below/.style args={#1 and #2}{ + l2base={#1}{#2}, + \circuitikzbasekey/bipole/label/position=-90 } +} +\ctikzset{l2_/.style args={#1 and #2}{ + l2base={#1}{#2}, + \circuitikzbasekey/bipole/label/position=-90 } +} + +%%%---------- close: tex/pgfcirclabel +%%%%%%%%%%% Springe nach tex/pgfcircvoltage +%%%---------- open: tex/pgfcircvoltage.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Voltage management + +%% styles +\ctikzset{bipole voltage style/.style={}} +\tikzset{bipole voltage style/.code={ + \ctikzset{bipole voltage style/.style={#1}} +}} +\tikzset{bipole voltage append style/.code={ + \ctikzset{bipole voltage style/.append style={#1}} +}} + +\ctikzset{v^>/.style = { + v = #1, + \circuitikzbasekey/bipole/voltage/direction = forward, + \circuitikzbasekey/bipole/voltage/position = above + } +} + +\ctikzset{v^/.style = { + v = #1, + \circuitikzbasekey/bipole/voltage/direction = forward, + \circuitikzbasekey/bipole/voltage/position = below + } +} + +\ctikzset{v_/.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = forward} } +\ctikzset{v4 \ifnum\pgfcircmathresult <86 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north west} + \else + \def\pgf@circ@bipole@voltage@label@anchor{south east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{west} + \else + \def\pgf@circ@bipole@voltage@label@anchor{east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{south west} + \else \def\pgf@circ@bipole@voltage@label@anchor{north east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{south} + \else\def\pgf@circ@bipole@voltage@label@anchor{north} + \fi + \fi\fi + \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{south east} + \else\def\pgf@circ@bipole@voltage@label@anchor{north west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{east} + \else \def\pgf@circ@bipole@voltage@label@anchor{west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north east} + \else\def\pgf@circ@bipole@voltage@label@anchor{south west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >-1 \ifnum\pgfcircmathresult <5 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north} + \else\def\pgf@circ@bipole@voltage@label@anchor{south} + \fi + \fi\fi + \ifnum\pgfcircmathresult >355 \ifnum\pgfcircmathresult <361 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north} + \else\def\pgf@circ@bipole@voltage@label@anchor{south} + \fi + \fi\fi + + % export anchor position (if not needed, is always the same macro) + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Vlab-anchor\endcsname{\pgf@circ@bipole@voltage@label@anchor} + % this must be set *before* changing for mirroring and inverting; in that case + % the xscale/yscale parameters take it into account + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@where{-90} + \else + \def\pgf@circ@bipole@voltage@label@where{90} + \fi + + % magic to counteract the scale and yscale effects (there should be a better way...) + \ifnum \ctikzvalof{mirror value}=-1 + \ifpgf@circuit@bipole@voltage@below + \pgf@circuit@bipole@voltage@belowfalse + \else + \pgf@circuit@bipole@voltage@belowtrue + \fi + \fi + + \ifpgf@circuit@bipole@inverted + \ifpgf@circuit@bipole@voltage@below + \pgf@circuit@bipole@voltage@belowfalse + \else + \pgf@circuit@bipole@voltage@belowtrue + \fi + \fi + + % take into account scaling + \setscaledRlenforclass + + \ifpgf@circuit@europeanvoltage + \ifpgf@circuit@bipole@voltage@straight + % check for straight + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance} + \pgfkeysifdefined{\pgf@temp}{% + \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}}% + % \typeout{ST:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \stdist} + }{\edef\labeldist{\ctikzvalof{voltage/straight label distance}}} + \ifpgf@circ@debugv\edef\whichtypeshift{STR}\fi + \else + % check for european + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance} + \pgfkeysifdefined{\pgf@temp}{% + \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}}% + % \typeout{EU:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \eudist} + }{ \edef\labeldist{\ctikzvalof{voltage/european label distance}}} + \ifpgf@circ@debugv\edef\whichtypeshift{EUR}\fi + \fi + \else + % check for american + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance} + \pgfkeysifdefined{\pgf@temp}{% + \ifpgf@circuit@bipole@voltage@raised + % do not apply the shift if we are using raised american style + \edef\labeldist{1.4}% default value + \else + \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}}% + \fi + % \typeout{AL:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \aldist} + }{\edef\labeldist{\ctikzvalof{voltage/american label distance}}} + \ifpgf@circ@debugv\edef\whichtypeshift{AME}\fi + \fi + % find the height of the bipole or use a default value + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height} + \pgfkeysifdefined{\pgf@temp} + {\pgfmathsetmacro{\partheightf}{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}} + \edef\partheight{\partheightf\pgf@circ@scaled@Rlen}} + {\edef\partheight{(.5\pgf@circ@scaled@Rlen)}} %fallback to fixed value + + \ifpgf@circuit@bipole@isvoltage + \pgfmathsetlength{\pgfcirc@labelshift}{(\labeldist-1.2)*\partheight} + \else + \pgfmathsetlength{\pgfcirc@labelshift}{(\labeldist-1.4)*\partheight} + \fi + % the value for the european was by default 1.4 + \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners! + % set the macro for detecting open + \edef\@@kind{\ctikzvalof{bipole/kind}}\edef\@@open{open} + \ifpgf@adjust@open@voltage\else\edef\@@open{this-will-nEver-match}\fi + % \typeout{KIND\space\@@kind} + }%end pgfextra + + \ifpgf@circuit@bipole@isvoltage + \pgf@circ@drawvoltagegenerator + % add fake cont1 and cont2 anchors for export + coordinate (\pgfcirc@a@prefix-Vcont1) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$) + coordinate (\pgfcirc@a@prefix-Vcont2) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$) + \else + \pgf@circ@drawvoltagegeneric + \fi + % % debugging + % \pgfextra{% + % \typeout{LABEL\space KIND:\@@kind\space EU:\the\pgfcirc@eushift\space AL:\the\pgfcirc@alshift\space + % DIRECTION:\pgf@circ@bipole@voltage@label@where} + % \pgf@circ@debugvtrue} + + % move a bit if requested + coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vlab) ! \pgfcirc@labelshift ! \pgf@circ@bipole@voltage@label@where :(pgfcirc@Vdir)$) + + % check for the case of american AND open + \ifpgf@circuit@europeanvoltage + \else + \ifx\@@kind\@@open + % override pgfcirc@Vlab + coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@Vfrom@flat)!0.5!(pgfcirc@Vto@flat)$)\fi + \fi + + \ifpgf@circ@debugv + node [odiamondpole, color=blue] at (\pgfcirc@a@prefix-Vlab) {} + node [odiamondpole, color=red] at (pgfcirc@Vdir) {} + node [overlay, red, font=\tiny, anchor=south east, align=right] at(pgfcirc@Vdir) + {\whichtypeshift:\the\pgfcirc@labelshift\\ DIR:\pgf@circ@bipole@voltage@label@where} + \fi + + % put the node only if it's not empty + \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else + node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt, + \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage) + at (\pgfcirc@a@prefix-Vlab) {\pgf@circ@finallabels{voltage/label}} + \fi + + \ifpgfcirc@v@curved\else + % fake Vcont1 and Vcont2 for when they are exported --- in the middle of Vto and Vfrom + coordinate (\pgfcirc@a@prefix-Vcont1) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$) + coordinate (\pgfcirc@a@prefix-Vcont2) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$) + \fi + % revert from and to (and c1 - c2) if needed (simpler than rework the positioning above...) + \ifpgf@circuit@bipole@voltage@backward + \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Vfrom}{\pgfcirc@a@prefix-Vto} + \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Vcont1}{\pgfcirc@a@prefix-Vcont2} + \fi + +}%end drawvoltages +%%%---------- close: tex/pgfcircvoltage +%%%%%%%%%%% Springe nach tex/pgfcirccurrent +%%%---------- open: tex/pgfcirccurrent.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Current handling + +%% styles +\ctikzset{bipole current style/.style={}} +\tikzset{bipole current style/.code={ + \ctikzset{bipole current style/.style={#1}} +}} +\tikzset{bipole current append style/.code={ + \ctikzset{bipole current style/.append style={#1}} +}} + +%% Options +\ctikzset{i^>/.style = { + i = #1, + \circuitikzbasekey/bipole/current/direction = forward, + \circuitikzbasekey/bipole/current/x position = after, + \circuitikzbasekey/bipole/current/y position = above + } +} + +\ctikzset{i_>/.style = { + i = #1, + \circuitikzbasekey/bipole/current/direction = forward, + \circuitikzbasekey/bipole/current/x position = after, + \circuitikzbasekey/bipole/current/y position = below + } +} + +\ctikzset{i>^/.style = { + i = #1, + \circuitikzbasekey/bipole/current/direction = forward, + \circuitikzbasekey/bipole/current/x position = before, + \circuitikzbasekey/bipole/current/y position = above + } +} + +\ctikzset{i>_/.style = { + i = #1, + \circuitikzbasekey/bipole/current/direction = forward, + \circuitikzbasekey/bipole/current/x position = before, + \circuitikzbasekey/bipole/current/y position = below + } +} + +\ctikzset{i^/.style = {i = #1, \circuitikzbasekey/bipole/current/direction = forward } } +\ctikzset{i^/.style = { i= #1, \circuitikzbasekey/bipole/current/y position = above } } + +%% Output routine +\def\pgf@circ@drawcurrent{ + \pgfextra{ + \edef\pgf@circ@rounded@dir{\pgf@circ@direction} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@rounded@dir\pgf@nil} + + \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north} + \fi + \fi\fi + \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west} + \fi + \fi\fi + \ifnum\pgfcircmathresult <5 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} + \fi + \fi + \ifnum\pgfcircmathresult >355 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} + \fi + \fi + % export anchor position (if not needed, is always the same macro) + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Ilab-anchor\endcsname{\pgf@circ@dir} + + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@bipole@current@label@where{-90} + \else + \def\pgf@circ@bipole@current@label@where{+90} + \fi + } + + % + \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}} + \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line + coordinate (\pgfcirc@a@prefix-Ifrom) at (\tikztostart) + coordinate (\pgfcirc@a@prefix-Ito) at (\tikztotarget) + \else% normal bipole or source + \ifpgf@circuit@bipole@current@before + coordinate (\pgfcirc@a@prefix-Ifrom) at (\tikztostart) + coordinate (\pgfcirc@a@prefix-Ito) at (pgfcirc@anchorstartnode) + \else + coordinate (\pgfcirc@a@prefix-Ifrom) at (pgfcirc@anchorendnode) + coordinate (\pgfcirc@a@prefix-Ito) at (\tikztotarget) + \fi + \fi + \ifpgf@circuit@bipole@current@backward + \pgfextra{ + \pgfmathsubtract{\pgf@circ@rounded@dir}{180} + \edef\pgf@circ@rounded@dir{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + } + \fi + coordinate (\pgfcirc@a@prefix-Ipos) at ($(\pgfcirc@a@prefix-Ifrom)! \ctikzvalof{current/distance} !(\pgfcirc@a@prefix-Ito)$) + % if the current label is not empty (in which case we have already all the anchors) + \pgf@circ@ifkeyempty{bipole/current/label/name}\else + % put the arrow node + node[currarrow, rotate=\pgf@circ@rounded@dir, anchor=center](Iarrow) at (\pgfcirc@a@prefix-Ipos) {} + % put the label + node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole current style] + (\ctikzvalof{bipole/name}current) + at (Iarrow.\pgf@circ@bipole@current@label@where){\pgf@circ@finallabels{current/label}} + \fi % end ifempty + \ifpgf@circuit@bipole@current@backward + \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Ifrom}{\pgfcirc@a@prefix-Ito} + \fi +} + +%%%---------- close: tex/pgfcirccurrent +%%%%%%%%%%% Springe nach tex/pgfcircflow +%%%---------- open: tex/pgfcircflow.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% flow handling + + +%% styles +\ctikzset{bipole flow style/.style={}} +\tikzset{bipole flow style/.code={ + \ctikzset{bipole flow style/.style={#1}} +}} +\tikzset{bipole flow append style/.code={ + \ctikzset{bipole flow style/.append style={#1}} +}} + +%% Options +\ctikzset{f^>/.style = { + f = #1, + \circuitikzbasekey/bipole/flow/direction = forward, + \circuitikzbasekey/bipole/flow/x position = after, + \circuitikzbasekey/bipole/flow/y position = above + } +} + +\ctikzset{f_>/.style = { + f = #1, + \circuitikzbasekey/bipole/flow/direction = forward, + \circuitikzbasekey/bipole/flow/x position = after, + \circuitikzbasekey/bipole/flow/y position = below + } +} + +\ctikzset{f>^/.style = { + f = #1, + \circuitikzbasekey/bipole/flow/direction = forward, + \circuitikzbasekey/bipole/flow/x position = before, + \circuitikzbasekey/bipole/flow/y position = above + } +} + +\ctikzset{f>_/.style = { + f = #1, + \circuitikzbasekey/bipole/flow/direction = forward, + \circuitikzbasekey/bipole/flow/x position = before, + \circuitikzbasekey/bipole/flow/y position = below + } +} + +\ctikzset{f^/.style = { f = #1, \circuitikzbasekey/bipole/flow/direction = forward } } +\ctikzset{f^/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = above } } + +\ctikzset{f/.code = { + \pgfcirc@has@ftrue + \pgfkeys{\circuitikzbasekey/bipole/flow/direction = forward, + \circuitikzbasekey/bipole/flow/x position = after, + \circuitikzbasekey/bipole/flow/y position = above } + \pgfkeys{/tikz/circuitikz/bipole/flow/label/name=#1} + \ctikzsetvalof{bipole/flow/label/unit}{} + \ifpgf@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/unit}{\pgf@temp} + \else + \fi + \else + \fi +} +} + +%% Output routine + +\def\pgf@circ@drawflow{ + \pgfextra{ + \edef\pgf@circ@rounded@dir{\pgf@circ@direction} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@rounded@dir\pgf@nil} + + \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north} + \fi + \fi\fi + \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west} + \fi + \fi\fi + \ifnum\pgfcircmathresult <5 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} + \fi + \fi + \ifnum\pgfcircmathresult >355 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} + \fi + \fi + + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@bipole@flow@label@where{-90} + \else + \def\pgf@circ@bipole@flow@label@where{+90} + \fi + % export anchor position (if not needed, is always the same macro) + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Flab-anchor\endcsname{\pgf@circ@dir} + } + + \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}} + \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line + coordinate (pgfcirc@Ffrom@flat) at (\tikztostart) + coordinate (pgfcirc@Fto@flat) at (\tikztotarget) + \else% normal bipole or source + \ifpgf@circuit@bipole@flow@before + coordinate (pgfcirc@Ffrom@flat) at (\tikztostart) + coordinate (pgfcirc@Fto@flat) at (pgfcirc@anchorstartnode) + \else + coordinate (pgfcirc@Ffrom@flat) at (pgfcirc@anchorendnode) + coordinate (pgfcirc@Fto@flat) at (\tikztotarget) + \fi + \fi + \pgfextra{ + \newdimen{\absfshift} + \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen} + \absfshift=\flow@offset + \ifpgf@circuit@bipole@flow@backward + \pgfmathsubtract{\pgf@circ@rounded@dir}{180} + \edef\pgf@circ@rounded@dir{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \fi + } + \ifpgf@circuit@bipole@flow@below + coordinate (pgfcirc@Ffrom@up) at ($(pgfcirc@Ffrom@flat) ! \absfshift !-90: (pgfcirc@Fto@flat)$) + coordinate (pgfcirc@Fto@up) at ($(pgfcirc@Fto@flat) ! \absfshift !90: (pgfcirc@Ffrom@flat)$) + \else + coordinate (pgfcirc@Ffrom@up) at ($(pgfcirc@Ffrom@flat) ! \absfshift !90: (pgfcirc@Fto@flat)$) + coordinate (pgfcirc@Fto@up) at ($(pgfcirc@Fto@flat) ! \absfshift !-90: (pgfcirc@Ffrom@flat)$) + \fi + coordinate (\pgfcirc@a@prefix-Fpos) at ($(pgfcirc@Ffrom@up) ! \ctikzvalof{flow/distance} !(pgfcirc@Fto@up)$) + \pgfextra{ + \absfshift=0.25\pgf@circ@Rlen% This is half size of the "flowarrow" shape! + } + coordinate (\pgfcirc@a@prefix-Ffrom) at ($(\pgfcirc@a@prefix-Fpos)!\absfshift!(pgfcirc@Ffrom@up)$) + coordinate (\pgfcirc@a@prefix-Fto) at ($(\pgfcirc@a@prefix-Fpos)!\absfshift!(pgfcirc@Fto@up) $) + % + % coordinate (\pgfcirc@a@prefix-Fpos) at + % ([yshift=\flow@offset]$(\pgfcirc@a@prefix-Ffrom)! \ctikzvalof{flow/distance} !(\pgfcirc@a@prefix-Fto)$) + % if the flow label is not empty (in which case we have already all the anchors) + \pgf@circ@ifkeyempty{bipole/flow/label/name}\else + % the flow arrow is really a node "flowarrow", not a real arrow + node[flowarrow, rotate=\pgf@circ@rounded@dir, anchor=center](Farrowpos) at (\pgfcirc@a@prefix-Fpos) {} + + node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole flow style] + (\ctikzvalof{bipole/name}flow) at (Farrowpos.\pgf@circ@bipole@flow@label@where) {\pgf@circ@finallabels{flow/label}} + \fi + + % adjust from and to before exporting --- it's much more simple like this then rework the algorithm above + \ifpgf@circuit@bipole@flow@backward + \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Ffrom}{\pgfcirc@a@prefix-Fto} + \fi + +} + +%%%---------- close: tex/pgfcircflow + +% notice that the default is nooldvoltagedirection; it's not explicitly set to allow for the warning +\ExecuteOptions{nofetbodydiode, nofetsolderdot, europeancurrents, europeanvoltages, americanports, americanresistors, cuteinductors ,europeangfsurgearrester, nosiunitx, noarrowmos, smartlabels} + +\ProcessOptions\relax + +%%%%%%%%%%% Springe nach tex/pgfcircpath +%%%---------- open: tex/pgfcircpath.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + + +\def\pgf@circ@direction{0.0} + +% swap two coordinates +\def\pgfcirc@swap@coordinates#1#2{% + coordinate (pgfcirc@tmp@swap) at (#1) + coordinate (#1) at (#2) + coordinate (#2) at (pgfcirc@tmp@swap) +} + +% Names +\ctikzset{name/.style = { n=#1 } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@ +\ctikzset{n/.code = { + \pgfkeys{/tikz/circuitikz/bipole/name=#1} +}} + +% Reflect the node along +\ctikzset{mirrored/.is choice} +\ctikzset{mirror value/.initial=1} +\ctikzset{mirrored/true/.code = {\ctikzsetvalof{mirror value}{-1}} } +\ctikzset{mirrored/false/.code = {\ctikzsetvalof{mirror value}{1}} } +\ctikzset{mirror/.style = {/tikz/circuitikz/mirrored=true}} + +% Invert node along path +\ctikzset{inverted/.is choice} +\ctikzset{invert value/.initial=1} +\ctikzset{inverted/true/.code = {\ctikzsetvalof{invert value}{-1}\pgf@circuit@bipole@invertedtrue}} +\ctikzset{inverted/false/.code = {\ctikzsetvalof{invert value}{1}\pgf@circuit@bipole@invertedfalse}} +\ctikzset{invert/.style = {/tikz/circuitikz/inverted=true}} +\newif\ifpgf@circuit@bipole@inverted +\ctikzset{bipole/inverted/.is if=pgf@circuit@bipole@inverted} + +\newif\ifpgf@circuit@bipole@voltage@backward +\ctikzset{bipole/voltage/direction/.is choice} +\ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}} +\ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}} + +% Initialize paths +\def\pgfcircresetpath{ + \ctikzset{bipole/name=, bipole/label/name=, bipole/label/position=90, ,bipole/annotation/name=, bipole/annotation/position=-90, + bipole/inverted=false, bipole/kind=, + bipole/voltage/direction=backward, bipole/voltage/label/name=, bipole/voltage/position=below, + bipole/nodes/left=none, bipole/nodes/right=none, bipole/is voltage=false,bipole/is voltageoutsideofsymbol=false,bipole/is strokedsymbol=false, + bipole/is current=false, bipole/current/label/name=, bipole/current/x position=after, + bipole/current/y position=above, bipole/current/direction=forward, + mirrored=false + } +} + +% +% expandable IF for the extra nodes (thanks to Henri Menke) +% see https://chat.stackexchange.com/transcript/message/56560808#56560808 +% +\def\pgfcirc@if@has@i{% + \ifpgfcirc@has@i + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi} +\def\pgfcirc@if@has@v{% + \ifpgfcirc@has@v + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi} +\def\pgfcirc@if@has@f{% + \ifpgfcirc@has@f + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi} + + + +%% Generic bipole path +\def\pgf@circ@bipole@path#1#2{ + % Create a bipole path from the shapes defined with \pgfcircdeclarebipole + % or \pgfcircdeclarebipolescaled; the node shapes are named with a "shape" + % appended to the main (path-style) name + % #1 path-style node name + % #2 the argument passed from the to-path structure; don't touch + % + % Example: + % \def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}} + % + \pgf@circ@bipole@path@base{shape}{}{#1}{#2} +} +% +% this is used for components that are mainly node-style but have a path-style form +% +\def\pgfcirc@node@to@path#1#2#3{% + % add a path-style component based on a node-style one without mangling the name + % of the shape. + % #1: node-type shape name (existing) + % #2: path-type name (to be created) + % #3: additional options to add to the path style + % + \expandafter\def\csname pgf@circ@#1@path\endcsname##1{\pgf@circ@bipole@path@base{}{##1}{#1}{}}% + \compattikzset{#2/.style = {\circuitikzbasekey, + /tikz/to path=\csname pgf@circ@#1@path\endcsname{##1}, + #3}}% + \ctikzset{bipoles/#1/height/.initial=1}% +} +%% +%% ultra-generic bipole path +%% I am not sure what the last argument is needed for, but don't touch it or everything explodes +%% +\def\pgf@circ@bipole@path@base#1#2#3#4{% + % + % Create a path-style component based on a node-style shape + % #1: postfix to be added to the name path to obtain the main shape name + % #2: text to be passed as text to the node + % #3: name of the bipole component + % #4: this will be filled by the argument of the to-path + % + \pgfextra{ + \ctikzset{bipole/kind = #3} + \edef\pgf@temp{\ctikzvalof{bipole/name}} + \def\pgf@circ@temp{} + \ifx\pgf@temp\pgf@circ@temp % if it has not a name + \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999} + \ctikzset{bipole/name = pgfcirc@#3\pgf@circ@rand} % create it (re-usage should not create problem, but...) + \edef\pgfcirc@a@prefix{pgfcirc}% do not pollute the namespace for nothing + \else + \edef\pgfcirc@a@prefix{\ctikzvalof{bipole/name}}% for exporting v-i-f anchors + \fi + } + % save start and stop values + % notice that we DO NOT MOVE the path position at all! + coordinate (\ctikzvalof{bipole/name}start) at (\tikztostart) + coordinate (\ctikzvalof{bipole/name}end) at (\tikztotarget) + \pgfextra{ + % find the direction (angle) of the path + \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}} + {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}} + \edef\pgf@circ@direction{\pgfmathresult} + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-direction\endcsname{\pgf@circ@direction} + } + % position the component in the middle of the path. We DO NOT MOVE the current position! + node[#3#1, rotate=\pgf@circ@direction, yscale=\ctikzvalof{mirror value}, + xscale=\ctikzvalof{invert value}] (\ctikzvalof{bipole/name}) + at ($(\tikztostart) ! .5 ! (\tikztotarget)$) {#2} + % set start and end labels + \ifpgf@circuit@bipole@inverted + \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them! + coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.pathend) + coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.pathstart) + \else + coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.right) + coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.left) + \fi + \else + \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them! + coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.pathstart) + coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.pathend) + \else + coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.left) + coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.right) + \fi + \fi + % draw the leads unless it's an open circuit + % stop at the component + \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}} + \ifx\pgf@temp\pgf@circ@temp % if it is an open do nothing + \else + % it is important to start the path with -- to have correct line joins! + -- (\tikztostart) -- (pgfcirc@anchorstartnode) + \fi + % Add all the "ornaments": labels, annotations, voltages, currents and flows + \drawpoles + \pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabels{label}\fi + \pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi + % the following must be made in their own path scope to avoid crash in TikZ 3.1.8/3.1.8a + % it should be logically safe for older version too --- even if TikZ reverted the change + % use explandable ifs too, thanks to Henri Menke + {\pgfcirc@if@has@v{\pgf@circ@drawvoltage}{}}% + {\pgfcirc@if@has@i{\pgf@circ@drawcurrent}{}}% + {\pgfcirc@if@has@f{\pgf@circ@drawflow}{}}% + % finish the path from the component to the final target + % you never know --- re-set \pgf@temp to detect open + \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}} + \ifx\pgf@temp\pgf@circ@temp % if it is an open do nothing + (\tikztotarget) + \else + (pgfcirc@anchorendnode) -- (\tikztotarget) + \fi + % reset internal circuit keys + \pgfextra{\pgfcircresetpath} + %draw pending nodes an path + \tikztonodes +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Handling of terminals + +\ctikzset{bipole/nodes/.is family} +\ctikzset{bipole/nodes/left/.initial=none} +\ctikzset{bipole/nodes/right/.initial=none} +\tikzset{bipole nodes/.style n args={2}{% + \circuitikzbasekey/bipole/nodes/left=#1, + \circuitikzbasekey/bipole/nodes/right=#2 + } +} + +%% Easily usable styles + +\ctikzset{o-o/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=ocirc}} +\ctikzset{-o/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=ocirc}} +\ctikzset{o-/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=none}} +\ctikzset{*-o/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=ocirc}} +\ctikzset{o-*/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=circ}} +\ctikzset{d-o/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=ocirc}} +\ctikzset{o-d/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=diamondpole}} +\ctikzset{*-/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=none}} +\ctikzset{-*/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=circ}} +\ctikzset{d-/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=none}} +\ctikzset{-d/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=diamondpole}} +\ctikzset{*-*/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=circ}} +\ctikzset{d-*/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=circ}} +\ctikzset{*-d/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=diamondpole}} +\ctikzset{d-d/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=diamondpole}} + +% rectjoinfill workarounds + +\ctikzset{.-/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=none}} +\ctikzset{.-*/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=circ}} +\ctikzset{.-o/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=ocirc}} +\ctikzset{.-d/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=diamondpole}} +\ctikzset{-./.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}} +\ctikzset{o-./.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}} +\ctikzset{*-./.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}} +\ctikzset{d-./.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}} +\ctikzset{.-./.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}} + +\tikzset{reversed/.style = {\circuitikzbasekey/bipole/inverted=true}} + +\def\drawpoles{ + \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{none}} + \ifx\pgf@temp\pgf@circ@temp\else(\tikztostart) node[\pgf@circ@temp] {}\fi + \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} } + \ifx\pgf@temp\pgf@circ@temp\else(\tikztotarget) node[\pgf@circ@temp] {}\fi +} + +%% Path definitions +\def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi} +\def\pgf@circ@vresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{tgeneric}{#1}\else\pgf@circ@bipole@path{vresistor}{#1}\fi} +\def\pgf@circ@sresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{thermistor}{#1}\else\pgf@circ@bipole@path{resistivesens}{#1}\fi} +\def\pgf@circ@potentiometer@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{genericpotentiometer}{#1}\else\pgf@circ@bipole@path{potentiometer}{#1}\fi} +\def\pgf@circ@thermistor@path#1{\pgf@circ@bipole@path{thermistor}{#1}} +\def\pgf@circ@thermistorptc@path#1{\pgf@circ@bipole@path{thermistorptc}{#1}} +\def\pgf@circ@thermistorntc@path#1{\pgf@circ@bipole@path{thermistorntc}{#1}} +\def\pgf@circ@varistor@path#1{\pgf@circ@bipole@path{varistor}{#1}} +\def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}} +\def\pgf@circ@capacitivesens@path#1{\pgf@circ@bipole@path{capacitivesens}{#1}} +\def\pgf@circ@ecapacitor@path#1{\pgf@circ@bipole@path{ecapacitor}{#1}} +%% polar capacitor is deprectaed, use curved capacitor instead +\def\pgf@circ@polarcapacitor@path#1{\pgf@circ@bipole@path{polarcapacitor}{#1}} +\def\pgf@circ@ccapacitor@path#1{\pgf@circ@bipole@path{ccapacitor}{#1}} +\def\pgf@circ@vcapacitor@path#1{\pgf@circ@bipole@path{vcapacitor}{#1}} +\def\pgf@circ@piezoelectric@path#1{\pgf@circ@bipole@path{piezoelectric}{#1}} +\def\pgf@circ@battery@path#1{\pgf@circ@bipole@path{battery}{#1}} +\def\pgf@circ@batteryone@path#1{\pgf@circ@bipole@path{battery1}{#1}} +\def\pgf@circ@batterytwo@path#1{\pgf@circ@bipole@path{battery2}{#1}} +\def\pgf@circ@europeaninductor@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}} +\def\pgf@circ@americaninductor@path#1{\pgf@circ@bipole@path{americaninductor}{#1}} +\def\pgf@circ@cuteinductor@path#1{\pgf@circ@bipole@path{cuteinductor}{#1}} +\def\pgf@circ@cutechoke@path#1{\pgf@circ@bipole@path{cutechoke}{#1}} +\def\pgf@circ@inductor@path#1{% + \pgfextra{ + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + } + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@europeaninductor@path{#1}% + \else% + \pgfextra{ \def\pgf@temp{cute} }% + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@cuteinductor@path{#1}% + \else% + \pgf@circ@americaninductor@path{#1}% + \fi% + \fi% +} +\def\pgf@circ@vinductor@path#1{ + \pgfextra{ + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + } + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@veuropeaninductor@path{#1}% + \else% + \pgfextra{ \def\pgf@temp{cute} }% + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@vcuteinductor@path{#1}% + \else% + \pgf@circ@vamericaninductor@path{#1}% + \fi% + \fi% +} +\def\pgf@circ@inductivesens@path#1{% + \pgfextra{ + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + } + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@europeaninductivesens@path{#1}% + \else% + \pgfextra{ \def\pgf@temp{cute} }% + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@cuteinductivesens@path{#1}% + \else% + \pgf@circ@americaninductivesens@path{#1}% + \fi% + \fi% +} +\def\pgf@circ@veuropeaninductor@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}} +\def\pgf@circ@vamericaninductor@path#1{\pgf@circ@bipole@path{vamericaninductor}{#1}} +\def\pgf@circ@vcuteinductor@path#1{\pgf@circ@bipole@path{vcuteinductor}{#1}} +\def\pgf@circ@europeaninductivesens@path#1{\pgf@circ@bipole@path{sfullgeneric}{#1}} +\def\pgf@circ@americaninductivesens@path#1{\pgf@circ@bipole@path{samericaninductor}{#1}} +\def\pgf@circ@cuteinductivesens@path#1{\pgf@circ@bipole@path{scuteinductor}{#1}} +\def\pgf@circ@lamp@path#1{\pgf@circ@bipole@path{lamp}{#1}} +\def\pgf@circ@bulb@path#1{\pgf@circ@bipole@path{bulb}{#1}} +\def\pgf@circ@esource@path#1{\pgf@circ@bipole@path{esource}{#1}} +\def\pgf@circ@pvsource@path#1{\pgf@circ@bipole@path{pvsource}{#1}} +\def\pgf@circ@vsource@path#1{\pgf@circ@bipole@path{vsource}{#1}} +\def\pgf@circ@dcvsource@path#1{\pgf@circ@bipole@path{dcvsource}{#1}} +\def\pgf@circ@vsourceam@path#1{\pgf@circ@bipole@path{vsourceAM}{#1}} +\def\pgf@circ@vsourcesin@path#1{\pgf@circ@bipole@path{vsourcesin}{#1}} +\def\pgf@circ@isource@path#1{\pgf@circ@bipole@path{isource}{#1}} +\def\pgf@circ@oosource@path#1{\pgf@circ@bipole@path{oosource}{#1}} +\def\pgf@circ@oosourcetrans@path#1{\pgf@circ@bipole@path{oosourcetrans}{#1}} +\def\pgf@circ@ooosource@path#1{\pgf@circ@bipole@path{ooosource}{#1}} +\def\pgf@circ@dcisource@path#1{\pgf@circ@bipole@path{dcisource}{#1}} +\def\pgf@circ@isourcesin@path#1{\pgf@circ@bipole@path{isourcesin}{#1}} +\def\pgf@circ@vsourcesquare@path#1{\pgf@circ@bipole@path{vsourcesquare}{#1}} +\def\pgf@circ@vsourcetri@path#1{\pgf@circ@bipole@path{vsourcetri}{#1}} +\def\pgf@circ@isourceam@path#1{\pgf@circ@bipole@path{isourceAM}{#1}} +\def\pgf@circ@ecsource@path#1{\pgf@circ@bipole@path{ecsource}{#1}} +\def\pgf@circ@cvsource@path#1{\pgf@circ@bipole@path{cvsource}{#1}} +\def\pgf@circ@cvsourceam@path#1{\pgf@circ@bipole@path{cvsourceAM}{#1}} +\def\pgf@circ@cvsourcesin@path#1{\pgf@circ@bipole@path{cvsourcesin}{#1}} +\def\pgf@circ@cisource@path#1{\pgf@circ@bipole@path{cisource}{#1}} +\def\pgf@circ@cisourceam@path#1{\pgf@circ@bipole@path{cisourceAM}{#1}} +\def\pgf@circ@cisourcesin@path#1{\pgf@circ@bipole@path{cisourcesin}{#1}} +\def\pgf@circ@short@path#1{\pgf@circ@bipole@path{short}{#1}} +\def\pgf@circ@cspst@path#1{\pgf@circ@bipole@path{cspst}{#1}} +\def\pgf@circ@ospst@path#1{\pgf@circ@bipole@path{ospst}{#1}} +\def\pgf@circ@nos@path#1{\pgf@circ@bipole@path{nos}{#1}} +\def\pgf@circ@ncs@path#1{\pgf@circ@bipole@path{ncs}{#1}} +\def\pgf@circ@pushbutton@path#1{\pgf@circ@bipole@path{pushbutton}{#1}} +\def\pgf@circ@ncpushbutton@path#1{\pgf@circ@bipole@path{ncpushbutton}{#1}} +\def\pgf@circ@pushbuttonc@path#1{\pgf@circ@bipole@path{pushbuttonc}{#1}} +\def\pgf@circ@ncpushbuttono@path#1{\pgf@circ@bipole@path{ncpushbuttono}{#1}} +\def\pgf@circ@open@path#1{\pgf@circ@bipole@path{open}{#1}} +\def\pgf@circ@generic@path#1{\pgf@circ@bipole@path{generic}{#1}} +\def\pgf@circ@ageneric@path#1{\pgf@circ@bipole@path{ageneric}{#1}} +\def\pgf@circ@tgeneric@path#1{\pgf@circ@bipole@path{tgeneric}{#1}} +\def\pgf@circ@xgeneric@path#1{\pgf@circ@bipole@path{xgeneric}{#1}} +\def\pgf@circ@fullgeneric@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}} +\def\pgf@circ@tfullgeneric@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}} +\def\pgf@circ@ammeter@path#1{\pgf@circ@bipole@path{ammeter}{#1}} +\def\pgf@circ@ohmmeter@path#1{\pgf@circ@bipole@path{ohmmeter}{#1}} +\def\pgf@circ@voltmeter@path#1{\pgf@circ@bipole@path{voltmeter}{#1}} +\def\pgf@circ@oscope@path#1{\pgf@circ@bipole@path{oscope}{#1}} +\def\pgf@circ@empty@path#1{} +\def\pgf@circ@photoresistor@path#1{\pgf@circ@bipole@path{photoresistor}{#1}} +\def\pgf@circ@emptythyristor@path#1{\pgf@circ@bipole@path{emptythyristor}{#1}} +\def\pgf@circ@fullthyristor@path#1{\pgf@circ@bipole@path{fullthyristor}{#1}} +\def\pgf@circ@toggleswitch@path#1{\pgf@circ@bipole@path{toggleswitch}{#1}} +\def\pgf@circ@memristor@path#1{\pgf@circ@bipole@path{memristor}{#1}} +\def\pgf@circ@emptytriac@path#1{\pgf@circ@bipole@path{emptytriac}{#1}} +\def\pgf@circ@fulltriac@path#1{\pgf@circ@bipole@path{fulltriac}{#1}} +\def\pgf@circ@tline@path#1{\pgf@circ@bipole@path{tline}{#1}} +\def\pgf@circ@mstline@path#1{\pgf@circ@bipole@path{mstline}{#1}} +\def\pgf@circ@squid@path#1{\pgf@circ@bipole@path{squid}{#1}} +\def\pgf@circ@barrier@path#1{\pgf@circ@bipole@path{barrier}{#1}} +\def\pgf@circ@openbarrier@path#1{\pgf@circ@bipole@path{openbarrier}{#1}} +\def\pgf@circ@thermocouple@path#1{\pgf@circ@bipole@path{thermocouple}{#1}} +\def\pgf@circ@fuse@path#1{\pgf@circ@bipole@path{fuse}{#1}} +\def\pgf@circ@afuse@path#1{\pgf@circ@bipole@path{afuse}{#1}} + +\def\pgf@circ@gfsurgearrester@path#1{\ifpgf@circuit@europeangfsurgearrester\pgf@circ@europeangfsurgearrester@path{#1}\else\pgf@circ@americangfsurgearrester@path{#1}\fi} +\def\pgf@circ@europeangfsurgearrester@path#1{\pgf@circ@bipole@path{european gas filled surge arrester}{#1}} +\def\pgf@circ@americangfsurgearrester@path#1{\pgf@circ@bipole@path{american gas filled surge arrester}{#1}} + +\def\pgf@circ@twoport@path#1{\pgf@circ@bipole@path{twoport}{#1}} +\def\pgf@circ@twoportsplit@path#1{\pgf@circ@bipole@path{twoportsplit}{#1}} +\def\pgf@circ@vco@path#1{\pgf@circ@bipole@path{vco}{#1}} +\def\pgf@circ@bandpass@path#1{\pgf@circ@bipole@path{bandpass}{#1}} +\def\pgf@circ@bandstop@path#1{\pgf@circ@bipole@path{bandstop}{#1}} +\def\pgf@circ@highpass@path#1{\pgf@circ@bipole@path{highpass}{#1}} +\def\pgf@circ@lowpass@path#1{\pgf@circ@bipole@path{lowpass}{#1}} +\def\pgf@circ@allpass@path#1{\pgf@circ@bipole@path{allpass}{#1}} +\def\pgf@circ@adc@path#1{\pgf@circ@bipole@path{adc}{#1}} +\def\pgf@circ@dac@path#1{\pgf@circ@bipole@path{dac}{#1}} +\def\pgf@circ@dsp@path#1{\pgf@circ@bipole@path{dsp}{#1}} +\def\pgf@circ@fft@path#1{\pgf@circ@bipole@path{fft}{#1}} +\def\pgf@circ@amp@path#1{\pgf@circ@bipole@path{amp}{#1}} +\def\pgf@circ@vamp@path#1{\pgf@circ@bipole@path{vamp}{#1}} +\def\pgf@circ@piattenuator@path#1{\pgf@circ@bipole@path{piattenuator}{#1}} +\def\pgf@circ@vpiattenuator@path#1{\pgf@circ@bipole@path{vpiattenuator}{#1}} +\def\pgf@circ@tattenuator@path#1{\pgf@circ@bipole@path{tattenuator}{#1}} +\def\pgf@circ@vtattenuator@path#1{\pgf@circ@bipole@path{vtattenuator}{#1}} +\def\pgf@circ@phaseshifter@path#1{\pgf@circ@bipole@path{phaseshifter}{#1}} +\def\pgf@circ@vphaseshifter@path#1{\pgf@circ@bipole@path{vphaseshifter}{#1}} +\def\pgf@circ@detector@path#1{\pgf@circ@bipole@path{detector}{#1}} +% +\def\pgf@circ@sacdc@path#1{\pgf@circ@bipole@path{sacdc}{#1}} +\def\pgf@circ@sdcac@path#1{\pgf@circ@bipole@path{sdcac}{#1}} +\def\pgf@circ@tacdc@path#1{\pgf@circ@bipole@path{tacdc}{#1}} +\def\pgf@circ@tdcac@path#1{\pgf@circ@bipole@path{tdcac}{#1}} + +%%Mechanical +\def\pgf@circ@spring@path#1{\pgf@circ@bipole@path{spring}{#1}} +\def\pgf@circ@inerter@path#1{\pgf@circ@bipole@path{inerter}{#1}} +\def\pgf@circ@mass@path#1{\pgf@circ@bipole@path{mass}{#1}} +\def\pgf@circ@damper@path#1{\pgf@circ@bipole@path{damper}{#1}} +\def\pgf@circ@viscoe@path#1{\pgf@circ@bipole@path{viscoe}{#1}} + +%% Styles + +\def\comnpatname{\ifpgf@circuit@compat *\else\fi} +\def\compattikzset#1{% + % \typeout{BIPOLEDEF:\space \detokenize{#1}}% + \tikzset{\comnpatname#1}} + +%\def\ctikzsetbipole#1#2{% +% \tikzset{#1/.style= {to path=#2, \circuitikzbasekey, l=##1}}% +%} + +\compattikzset{spring/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@spring@path, l=#1}} +\compattikzset{inerter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inerter@path, l=#1}} +\compattikzset{mass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mass@path, l=#1}} +\compattikzset{damper/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@damper@path, l=#1}} +\compattikzset{viscoe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@viscoe@path, l=#1}} +\compattikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l=#1}} +\compattikzset{american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{resistor}{#1}, l=#1}} +\compattikzset{european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{generic}{#1}, l=#1}} +\compattikzset{potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@potentiometer@path, l=#1}} +\compattikzset{varistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@varistor@path, l=#1}} +\compattikzset{photoresistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@photoresistor@path, l=#1}} +\compattikzset{thermistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistor@path, l=#1}} +\compattikzset{thermistor ptc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorptc@path, l=#1}} +\compattikzset{thermistor ntc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}} +\compattikzset{american potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{potentiometer}{#1}, l=#1}} +\compattikzset{european potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{genericpotentiometer}{#1}, l=#1}} +\compattikzset{variable resistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vresistor@path, l=#1}} +\compattikzset{variable american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{vresistor}{#1}, l=#1}} +\compattikzset{variable european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{tgeneric}{#1}, l=#1}} +\compattikzset{capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitor@path, l=#1}} +\compattikzset{elko/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}} +\compattikzset{ecapacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}} +% polar capacitor is deprecated, use curved capacitor instead +\compattikzset{polar capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@polarcapacitor@path, l=#1}} +\compattikzset{curved capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ccapacitor@path, l=#1}} +\compattikzset{variable capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcapacitor@path, l=#1}} +\compattikzset{piezoelectric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piezoelectric@path, l=#1}} +\compattikzset{battery/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@battery@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{battery1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batteryone@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{battery2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batterytwo@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductor@path, l=#1}} +\compattikzset{gf surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}} +\compattikzset{american gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americangfsurgearrester@path, l=#1}} +\compattikzset{european gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeangfsurgearrester@path, l=#1}} +\compattikzset{gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}} +\compattikzset{american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductor@path, l=#1}} +\compattikzset{cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductor@path, l=#1}} +\compattikzset{cute choke/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cutechoke@path, l=#1}} +\compattikzset{european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductor@path, l=#1}} +\compattikzset{variable inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vinductor@path, l=#1}} +\compattikzset{variable european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@veuropeaninductor@path, l=#1}} +\compattikzset{variable american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamericaninductor@path, l=#1}} +\compattikzset{variable cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcuteinductor@path, l=#1}} +\compattikzset{tline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tline@path, l=#1}} +\compattikzset{transmission line/.style = {tline = #1}} +\compattikzset{TL/.style = {tline = #1}} +\compattikzset{mstline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mstline@path, l=#1}} +\compattikzset{european voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{american voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\compattikzset{european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isource@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{american current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{empty controlled source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{american controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\compattikzset{european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisource@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{american controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{sinusoidal voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcesin@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }} +\compattikzset{square voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcesquare@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }} +\compattikzset{triangle voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcetri@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }} +\compattikzset{sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{controlled sinusoidal voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourcesin@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{controlled sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}} + +\compattikzset{voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\compattikzset{current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi current source = #1, \circuitikzbasekey/bipole/is current=true}} +\compattikzset{controlled voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi controlled voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\compattikzset{controlled current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi controlled current source = #1, \circuitikzbasekey/bipole/is current=true}} + + +\compattikzset{generic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@generic@path, l=#1}} +\compattikzset{xgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@xgeneric@path, l=#1}} +\compattikzset{ageneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ageneric@path, l=#1}} +\compattikzset{tgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tgeneric@path, l=#1}} +\compattikzset{fullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullgeneric@path, l=#1}} +\compattikzset{tfullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tfullgeneric@path, l=#1}} +\compattikzset{short/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@short@path}} +\compattikzset{open/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@open@path}} + +\compattikzset{lamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lamp@path}} +\compattikzset{bulb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bulb@path, l=#1}} + +\compattikzset{squid/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@squid@path}} +\compattikzset{barrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@barrier@path}} +\compattikzset{openbarrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@openbarrier@path}} +\compattikzset{thermocouple/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermocouple@path}} +\compattikzset{fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fuse@path}} +\compattikzset{asymmetric fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@afuse@path}} + +\compattikzset{twoport/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@twoport@path}} +\compattikzset{twoportsplit/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@twoportsplit@path}} +\compattikzset{vco/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vco@path}} +\compattikzset{bandpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandpass@path}} +\compattikzset{bandstop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandstop@path}} +\compattikzset{highpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@highpass@path}} +\compattikzset{lowpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lowpass@path}} +\compattikzset{allpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@allpass@path}} +\compattikzset{adc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@adc@path}} +\compattikzset{dac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dac@path}} +\compattikzset{dsp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dsp@path}} +\compattikzset{fft/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fft@path}} +\compattikzset{amp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@amp@path}} +\compattikzset{vamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamp@path}} +\compattikzset{piattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piattenuator@path}} +\compattikzset{vpiattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vpiattenuator@path}} +\compattikzset{tattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tattenuator@path}} +\compattikzset{vtattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vtattenuator@path}} +\compattikzset{phaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@phaseshifter@path}} +\compattikzset{vphaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vphaseshifter@path}} +\compattikzset{detector/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@detector@path}} +% +\compattikzset{sacdc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@sacdc@path, l=#1}} +\compattikzset{sdcac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@sdcac@path, l=#1}} +\compattikzset{tacdc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tacdc@path, l=#1}} +\compattikzset{tdcac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tdcac@path, l=#1}} + +% % % % % % +% % Begin of Diodes +% % % % % % + +\def\pgf@circ@fulldiode@path#1{\pgf@circ@bipole@path{fulldiode}{#1}} +\def\pgf@circ@fullzdiode@path#1{\pgf@circ@bipole@path{fullzdiode}{#1}} +\def\pgf@circ@fullzzdiode@path#1{\pgf@circ@bipole@path{fullzzdiode}{#1}} +\def\pgf@circ@fullsdiode@path#1{\pgf@circ@bipole@path{fullsdiode}{#1}} +\def\pgf@circ@fulltdiode@path#1{\pgf@circ@bipole@path{fulltdiode}{#1}} +\def\pgf@circ@fulllediode@path#1{\pgf@circ@bipole@path{fulllediode}{#1}} +\def\pgf@circ@fullpdiode@path#1{\pgf@circ@bipole@path{fullpdiode}{#1}} +\def\pgf@circ@fullvarcap@path#1{\pgf@circ@bipole@path{fullvarcap}{#1}} +\def\pgf@circ@fullbidirectionaldiode@path#1{\pgf@circ@bipole@path{fullbidirectionaldiode}{#1}} +\def\pgf@circ@emptydiode@path#1{\pgf@circ@bipole@path{emptydiode}{#1}} +\def\pgf@circ@emptyzdiode@path#1{\pgf@circ@bipole@path{emptyzdiode}{#1}} +\def\pgf@circ@emptyzzdiode@path#1{\pgf@circ@bipole@path{emptyzzdiode}{#1}} +\def\pgf@circ@emptysdiode@path#1{\pgf@circ@bipole@path{emptysdiode}{#1}} +\def\pgf@circ@emptytdiode@path#1{\pgf@circ@bipole@path{emptytdiode}{#1}} +\def\pgf@circ@emptylediode@path#1{\pgf@circ@bipole@path{emptylediode}{#1}} +\def\pgf@circ@emptypdiode@path#1{\pgf@circ@bipole@path{emptypdiode}{#1}} +\def\pgf@circ@emptyvarcap@path#1{\pgf@circ@bipole@path{emptyvarcap}{#1}} +\def\pgf@circ@emptybidirectionaldiode@path#1{\pgf@circ@bipole@path{emptybidirectionaldiode}{#1}} + +\compattikzset{full diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulldiode@path}} +\compattikzset{full Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullsdiode@path}} +\compattikzset{full Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzdiode@path}} +\compattikzset{full ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzzdiode@path}} +\compattikzset{full tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltdiode@path}} +\compattikzset{full photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullpdiode@path}} +\compattikzset{full led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulllediode@path}} +\compattikzset{full varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullvarcap@path}} +\compattikzset{full bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullbidirectionaldiode@path}} +\compattikzset{full thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullthyristor@path}} +\compattikzset{full triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltriac@path}} + +\compattikzset{empty diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptydiode@path}} +\compattikzset{empty Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptysdiode@path}} +\compattikzset{empty Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzdiode@path}} +\compattikzset{empty ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzzdiode@path}} +\compattikzset{empty tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytdiode@path}} +\compattikzset{empty photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptypdiode@path}} +\compattikzset{empty led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptylediode@path}} +\compattikzset{empty varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyvarcap@path}} +\compattikzset{empty bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptybidirectionaldiode@path}} +\compattikzset{empty thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptythyristor@path}} +\compattikzset{empty triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytriac@path}} + +\compattikzset{stroke diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptydiode@path}} +\compattikzset{stroke Schottky diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptysdiode@path}} +\compattikzset{stroke Zener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzdiode@path}} +\compattikzset{stroke ZZener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzzdiode@path}} +\compattikzset{stroke tunnel diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytdiode@path}} +\compattikzset{stroke photodiode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptypdiode@path}} +\compattikzset{stroke led/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptylediode@path}} +\compattikzset{stroke varcap/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyvarcap@path}} +\compattikzset{stroke thyristor/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptythyristor@path}} +%\compattikzset{stroke triac/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytriac@path}} + +\def\pgfcircdiodestylemacro{\ifpgf@circuit@strokediode stroke \else\ifpgf@circuit@fulldiode full \else empty \fi\fi} + +\compattikzset{Schottky diode/.style = {\comnpatname \pgfcircdiodestylemacro Schottky diode}} +\compattikzset{Zener diode/.style = {\comnpatname \pgfcircdiodestylemacro Zener diode}} +\compattikzset{ZZener diode/.style = {\comnpatname \pgfcircdiodestylemacro ZZener diode}} +\compattikzset{tunnel diode/.style = {\comnpatname \pgfcircdiodestylemacro tunnel diode}} +\compattikzset{photodiode/.style = {\comnpatname \pgfcircdiodestylemacro photodiode}} +\compattikzset{led/.style = {\comnpatname \pgfcircdiodestylemacro led}} +\compattikzset{varcap/.style = {\comnpatname \pgfcircdiodestylemacro varcap}} +\compattikzset{diode/.style = {\comnpatname \pgfcircdiodestylemacro diode}} +\compattikzset{thyristor/.style = {\comnpatname \pgfcircdiodestylemacro thyristor}} +\compattikzset{triac/.style = {\comnpatname \ifpgf@circuit@fulldiode full \else empty \fi triac}}%no stroke triac! +\compattikzset{bidirectionaldiode/.style = {\comnpatname \ifpgf@circuit@fulldiode full \else empty \fi bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac) + +%% Define Shortcuts +\compattikzset{Do/.style = {\comnpatname empty diode}} +\compattikzset{tDo/.style = {\comnpatname empty tunnel diode}} +\compattikzset{zDo/.style = {\comnpatname empty Zener diode}} +\compattikzset{zzDo/.style = {\comnpatname empty ZZener diode}} +\compattikzset{sDo/.style = {\comnpatname empty Schottky diode}} +\compattikzset{pDo/.style = {\comnpatname empty photodiode}} +\compattikzset{leDo/.style = {\comnpatname empty led}} +\compattikzset{VCo/.style = {\comnpatname empty varcap}} +\compattikzset{biDo/.style = {\comnpatname empty bidirectionaldiode}} +\compattikzset{Tyo/.style = {\comnpatname empty thyristor}} +\compattikzset{Tro/.style = {\comnpatname empty triac}} + +\compattikzset{D*/.style = {\comnpatname full diode}} +\compattikzset{tD*/.style = {\comnpatname full tunnel diode}} +\compattikzset{zD*/.style = {\comnpatname full Zener diode}} +\compattikzset{zzD*/.style = {\comnpatname full ZZener diode}} +\compattikzset{sD*/.style = {\comnpatname full Schottky diode}} +\compattikzset{pD*/.style = {\comnpatname full photodiode}} +\compattikzset{leD*/.style = {\comnpatname full led}} +\compattikzset{VC*/.style = {\comnpatname full varcap}} +\compattikzset{biD*/.style = {\comnpatname full bidirectionaldiode}} +\compattikzset{Ty*/.style = {\comnpatname full thyristor}} +\compattikzset{Tr*/.style = {\comnpatname full triac}} + +\compattikzset{D/.style = {\comnpatname diode}} +\compattikzset{tD/.style = {\comnpatname tunnel diode}} +\compattikzset{zD/.style = {\comnpatname Zener diode}} +\compattikzset{zzD/.style = {\comnpatname ZZener diode}} +\compattikzset{sD/.style = {\comnpatname Schottky diode}} +\compattikzset{pD/.style = {\comnpatname photodiode}} +\compattikzset{leD/.style = {\comnpatname led}} +\compattikzset{VC/.style = {\comnpatname varcap}} +\compattikzset{biD/.style = {\comnpatname bidirectionaldiode}} +\compattikzset{Ty/.style = {\comnpatname thyristor}} +\compattikzset{Tr/.style = {\comnpatname triac}} + +\compattikzset{D-/.style = {\comnpatname stroke diode}} +\compattikzset{tD-/.style = {\comnpatname stroke tunnel diode}} +\compattikzset{zD-/.style = {\comnpatname stroke Zener diode}} +\compattikzset{zzD-/.style = {\comnpatname stroke ZZener diode}} +\compattikzset{sD-/.style = {\comnpatname stroke Schottky diode}} +\compattikzset{pD-/.style = {\comnpatname stroke photodiode}} +\compattikzset{leD-/.style = {\comnpatname stroke led}} +\compattikzset{VC-/.style = {\comnpatname stroke varcap}} +\compattikzset{Ty-/.style = {\comnpatname stroke thyristor}} +\compattikzset{Tr-/.style = {\comnpatname empty triac}}%no stroke triac! +\compattikzset{biD-/.style = {\comnpatname empty bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac) + +% % % % % % +% % End of Diodes +% % % % % % + + +\compattikzset{memristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@memristor@path}} +\compattikzset{closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}} +\compattikzset{opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ospst@path, l=#1}} +\compattikzset{ncs/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}} +\compattikzset{nos/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}} +\compattikzset{normal closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}} +\compattikzset{normal open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}} +\compattikzset{switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}} +\compattikzset{push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}} +\compattikzset{nopb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}} +\compattikzset{normally open push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}} +\compattikzset{ncpb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}} +\compattikzset{normally closed push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}} +\compattikzset{nopbc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbuttonc@path, l=#1}} +\compattikzset{normally open push button closed/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbuttonc@path, l=#1}} +\compattikzset{ncpbo/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbuttono@path, l=#1}} +\compattikzset{normally closed push button open/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbuttono@path, l=#1}} +\compattikzset{toggle switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@toggleswitch@path}} + +\compattikzset{ammeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ammeter@path}} +\compattikzset{voltmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@voltmeter@path}} +\compattikzset{ohmmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ohmmeter@path}} +\tikzset{oscope/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@oscope@path, l=#1}} + +% cute switches +%% closed cute switch +\def\pgf@circ@cuteclosedswitch@path#1{\pgf@circ@bipole@path{cuteclosedswitch}{#1}} +\compattikzset{cute closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosedswitch@path, l=#1}} +\compattikzset{ccsw/.style= {\comnpatname cute closed switch= #1}} + +%% open cute switch +\def\pgf@circ@cuteopenswitch@path#1{\pgf@circ@bipole@path{cuteopenswitch}{#1}} +\compattikzset{cute open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopenswitch@path, l=#1}} +\compattikzset{cosw/.style= {\comnpatname cute open switch= #1}} + +%% closing cute switch +\def\pgf@circ@cuteclosingswitch@path#1{\pgf@circ@bipole@path{cuteclosingswitch}{#1}} +\compattikzset{cute closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosingswitch@path, l=#1}} +\compattikzset{ccgsw/.style= {\comnpatname cute closing switch= #1}} + +%% opening cute switch +\def\pgf@circ@cuteopeningswitch@path#1{\pgf@circ@bipole@path{cuteopeningswitch}{#1}} +\compattikzset{cute opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopeningswitch@path, l=#1}} +\compattikzset{cogsw/.style= {\comnpatname cute opening switch= #1}} + + +% short forms +\compattikzset{esource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@esource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{pvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{dcvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{dcisource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcisource@path, \circuitikzbasekey/bipole/is current=true, l=#1}} + +\compattikzset{ioosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is current=true,/tikz/to path=\pgf@circ@oosource@path, i=#1}} +\compattikzset{voosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@oosource@path, v=#1}} +\compattikzset{oosourcetrans/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@oosourcetrans@path, v=#1}} +\compattikzset{ooosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@ooosource@path, v=#1}} + +\compattikzset{vsource/.style = {\comnpatname voltage source = #1}} +\compattikzset{isource/.style = {\comnpatname current source = #1}} +\compattikzset{cisource/.style = {\comnpatname controlled current source = #1}} +\compattikzset{ecsource/.style = {\comnpatname empty controlled source = #1}} +\compattikzset{cvsource/.style = {\comnpatname controlled voltage source = #1}} +\compattikzset{vsourcesin/.style = {\comnpatname sinusoidal voltage source = #1}} +\compattikzset{vsourcesquare/.style = {\comnpatname square voltage source = #1}} +\compattikzset{vsourcetri/.style = {triangle voltage source = #1}} +\compattikzset{isourcesin/.style = {\comnpatname sinusoidal current source = #1}} +\compattikzset{cisourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}} +\compattikzset{cvsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}} + +\compattikzset{controlled vsource/.style = {\comnpatname controlled voltage source = #1}} +\compattikzset{controlled isource/.style = {\comnpatname controlled current source = #1}} +\compattikzset{controlled vsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}} +\compattikzset{controlled isourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}} + +\compattikzset{R/.style= {\comnpatname resistor = #1}} +\compattikzset{vR/.style= {\comnpatname variable resistor = #1}} +\compattikzset{phR/.style= {\comnpatname photoresistor = #1}} +\compattikzset{thR/.style= {\comnpatname thermistor = #1}} +\compattikzset{thRp/.style= {\comnpatname thermistor ptc= #1}} +\compattikzset{thRn/.style= {\comnpatname thermistor ntc= #1}} +\compattikzset{pR/.style= {\comnpatname potentiometer = #1}} +\compattikzset{C/.style = {\comnpatname capacitor = #1}} +\compattikzset{eC/.style = {\comnpatname ecapacitor = #1}} +%% pC is deprecated, use cC instead +\compattikzset{pC/.style = {\comnpatname polar capacitor = #1}} +\compattikzset{cC/.style = {\comnpatname curved capacitor = #1}} +\compattikzset{vC/.style = {\comnpatname variable capacitor = #1}} +\compattikzset{PZ/.style = {\comnpatname piezoelectric = #1}} +\compattikzset{L/.style = {\comnpatname inductor = #1}} +\compattikzset{vL/.style = {\comnpatname variable inductor = #1}} +\compattikzset{V/.style = {\comnpatname voltage source = #1}} +\compattikzset{cV/.style = {\comnpatname controlled voltage source = #1}} +\compattikzset{sV/.style = {\comnpatname sinusoidal voltage source = #1}} +\compattikzset{sqV/.style = {\comnpatname square voltage source = #1}} +\compattikzset{tV/.style = {\comnpatname triangle voltage source = #1}} +\compattikzset{csV/.style = {\comnpatname controlled sinusoidal voltage source = #1}} +\def\pgf@temp#1{ + \compattikzset{V#1/.style = {\comnpatname voltage source, v#1=##1} } + \compattikzset{cV#1/.style = {\comnpatname controlled voltage source, v#1=##1} } + \compattikzset{sV#1/.style = {\comnpatname sinusoidal voltage source, v#1=##1} } + \compattikzset{csV#1/.style = {\comnpatname controlled sinusoidal voltage source, v#1=##1} } +} +\pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<} +\pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_} + +%current sources +\compattikzset{I/.style = {\comnpatname current source = #1}} +\compattikzset{cI/.style = {\comnpatname controlled current source = #1}} +\compattikzset{sI/.style = {\comnpatname sinusoidal current source = #1}} +\compattikzset{csI/.style = {\comnpatname controlled sinusoidal current source = #1}} +\def\pgf@temp#1{ + \compattikzset{I#1/.style = {\comnpatname current source, i#1=##1} } + \compattikzset{cI#1/.style = {\comnpatname controlled current source, i#1=##1} } + \compattikzset{sI#1/.style = {\comnpatname sinusoidal current source, i#1=##1} } + \compattikzset{csI#1/.style = {\comnpatname controlled sinusoidal current source, i#1=##1} } +} +\pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<} +\pgf@temp{>_} \pgf@temp{<_} \pgf@temp{>^} \pgf@temp{<^} +\pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_} + +% cute sources +\def\pgf@circ@vsourceC@path#1{\pgf@circ@bipole@path{vsourceC}{#1}} +\compattikzset{cute european voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceC@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{vsourceC/.style= {\comnpatname cute european voltage source= #1}} +\compattikzset{ceV/.style= {\comnpatname cute european voltage source= #1}} + +\def\pgf@circ@isourceC@path#1{\pgf@circ@bipole@path{isourceC}{#1}} +\compattikzset{cute european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceC@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{isourceC/.style= {\comnpatname cute european current source= #1}} +\compattikzset{ceI/.style= {\comnpatname cute european current source= #1}} + +\def\pgf@circ@cvsourceC@path#1{\pgf@circ@bipole@path{cvsourceC}{#1}} +\compattikzset{cute european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceC@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{cvsourceC/.style= {\comnpatname cute european controlled voltage source= #1}} +\compattikzset{cceV/.style= {\comnpatname cute european controlled voltage source= #1}} + +\def\pgf@circ@cisourceC@path#1{\pgf@circ@bipole@path{cisourceC}{#1}} +\compattikzset{cute european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceC@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{cisourceC/.style= {\comnpatname cute european controlled current source= #1}} +\compattikzset{cceI/.style= {\comnpatname cute european controlled current source= #1}} + +% noise sources +\def\pgf@circ@vsourceN@path#1{\pgf@circ@bipole@path{vsourceN}{#1}} +\compattikzset{noise voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceN@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{vsourceN/.style= {\comnpatname noise voltage source= #1}} +\compattikzset{nV/.style= {\comnpatname noise voltage source= #1}} + +\def\pgf@circ@isourceN@path#1{\pgf@circ@bipole@path{isourceN}{#1}} +\compattikzset{noise current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceN@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{isourceN/.style= {\comnpatname noise current source= #1}} +\compattikzset{nI/.style= {\comnpatname noise current source= #1}} + +% resistive sensor american style +\def\pgf@circ@resistivesens@path#1{\pgf@circ@bipole@path{resistivesens}{#1}} +\compattikzset{american resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistivesens@path, l=#1}} +\compattikzset{european resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}} +\compattikzset{resistive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@sresistor@path, l=#1}} +\compattikzset{sR/.style= {\comnpatname resistive sensor= #1}} + +\compattikzset{capacitive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitivesens@path, l=#1}} +\compattikzset{sC/.style= {\comnpatname capacitive sensor= #1}} + +\compattikzset{cute inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductivesens@path, l=#1}} +\compattikzset{european inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductivesens@path, l=#1}} +\compattikzset{american inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductivesens@path, l=#1}} +\compattikzset{inductive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductivesens@path, l=#1}} +\compattikzset{sL/.style= {\comnpatname inductive sensor= #1}} + +\compattikzset{Mr/.style = {\comnpatname memristor}} + +\compattikzset{cspst/.style = {\comnpatname closing switch = #1}} +\compattikzset{ospst/.style = {\comnpatname opening switch = #1}} +\compattikzset{spst/.style = {\comnpatname switch = #1}} + +\compattikzset{afuse/.style = {\comnpatname asymmetric fuse=#1}} + +\compattikzset{vdd/.style = {\comnpatname vcc = #1}} +\compattikzset{vss/.style = {\comnpatname vee = #1}} + +% activate the to-style crossing +\def\pgf@circ@crossing@path#1{\pgf@circ@bipole@path{crossing}{#1}} +\compattikzset{crossing/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@crossing@path, l=#1}} +\compattikzset{xing/.style= {\comnpatname crossing= #1}} + +%% loudspeaker and microphone + +\def\pgf@circ@loudspeaker@path#1{\pgf@circ@bipole@path{loudspeaker}{#1}} +\compattikzset{loudspeaker/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@loudspeaker@path, l=#1}} + +\def\pgf@circ@mic@path#1{\pgf@circ@bipole@path{mic}{#1}} +\compattikzset{mic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mic@path, l=#1}} + +% more instrument +\def\pgf@circ@rmeter@path#1{\pgf@circ@bipole@path{rmeter}{#1}} +\compattikzset{rmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeter@path, l=#1}} +\def\pgf@circ@rmeterwa@path#1{\pgf@circ@bipole@path{rmeterwa}{#1}} +\compattikzset{rmeterwa/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeterwa@path, l=#1}} +\def\pgf@circ@smeter@path#1{\pgf@circ@bipole@path{smeter}{#1}} +\compattikzset{smeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@smeter@path, l=#1}} +% current loop probes +\def\pgf@circ@iloop@path#1{\pgf@circ@bipole@path{iloop}{#1}} +\compattikzset{iloop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop@path, l=#1}} +\def\pgf@circ@iloop2@path#1{\pgf@circ@bipole@path{iloop2}{#1}} +\compattikzset{iloop2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop2@path, l=#1}} +% qucs-style probes +\def\pgf@circ@qiprobe@path#1{\pgf@circ@bipole@path{qiprobe}{#1}} +\compattikzset{qiprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qiprobe@path, l=#1}} +\def\pgf@circ@qvprobe@path#1{\pgf@circ@bipole@path{qvprobe}{#1}} +\compattikzset{qvprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qvprobe@path, l=#1}} +\def\pgf@circ@qpprobe@path#1{\pgf@circ@bipole@path{qpprobe}{#1}} +\compattikzset{qpprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qpprobe@path, l=#1}} +% multiwire(s) +\def\pgf@circ@bmultiwire@path#1{\pgf@circ@bipole@path{bmultiwire}{#1}} +\compattikzset{bmultiwire/.style = {\circuitikzbasekey, +/tikz/to path=\pgf@circ@bmultiwire@path, l=#1}} +\def\pgf@circ@multiwire@path#1{\pgf@circ@bipole@path{multiwire}{#1}} +\compattikzset{multiwire/.style = {\circuitikzbasekey, +/tikz/to path=\pgf@circ@multiwire@path, l=#1}} +\def\pgf@circ@tmultiwire@path#1{\pgf@circ@bipole@path{tmultiwire}{#1}} +\compattikzset{tmultiwire/.style = {\circuitikzbasekey, +/tikz/to path=\pgf@circ@tmultiwire@path, l=#1}} + +% reed switches +\def\pgf@circ@reed@path#1{\pgf@circ@bipole@path{reed}{#1}} +\compattikzset{reed/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@reed@path, l=#1}} + +% Transistor like bipoles + +\def\pgf@circ@trans@path#1#2{ + \pgfextra{ + \edef\pgf@temp{\ctikzvalof{bipole/name}} + \def\pgf@circ@temp{#2} + \ifx\pgf@temp\pgf@circ@temp % if it has not a name + \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999} + \ctikzset{bipole/name = trans\pgf@circ@rand} % create it + \fi + } + \ifpgf@circuit@bipole@inverted + (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}end) {} + (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}start) {} + \else + (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}start) {} + (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}end) {} + \fi + \pgfextra{ + \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}} + {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}} + \pgfmathadd{\pgfmathresult}{-90} + \pgfmathround{\pgfmathresult} + \edef\pgf@circ@direction{\pgfmathresult} + } + ($(\tikztostart) ! .5 ! (\tikztotarget)$) + node[#1, /tikz/rotate=\pgf@circ@direction, xscale=\ctikzvalof{mirror value}] + (\ctikzvalof{bipole/name}) {} + node {\ctikzvalof{bipole/label/name}} + \ifcsname pgf@anchor@#1@pathstart\endcsname%if special path-anchors are defined, use them! + (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.pathstart) + (\ctikzvalof{bipole/name}.pathend) -- (\ctikzvalof{bipole/name}end.center) + \else + (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.left) + (\ctikzvalof{bipole/name}.right) -- (\ctikzvalof{bipole/name}end.center) + \fi + \drawpoles + \pgfextra{ + \pgfcircresetpath + } + (\tikztotarget) \tikztonodes % e si continua +} + + +\def\pgf@circ@definetranspath#1{ + \compattikzset{T#1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@trans@path{#1}{}, l=##1}} +} + +\pgf@circ@definetranspath{elmech} +\pgf@circ@definetranspath{nmos} +\pgf@circ@definetranspath{pmos} +\pgf@circ@definetranspath{nmosd} +\pgf@circ@definetranspath{pmosd} +\pgf@circ@definetranspath{hemt} +\pgf@circ@definetranspath{npn} +\pgf@circ@definetranspath{pnp} +\pgf@circ@definetranspath{nfet} +\pgf@circ@definetranspath{nigfete} +\pgf@circ@definetranspath{nigfetd} +\pgf@circ@definetranspath{nigfetebulk} +\pgf@circ@definetranspath{pfet} +\pgf@circ@definetranspath{pigfete} +\pgf@circ@definetranspath{pigfetd} +\pgf@circ@definetranspath{pigfetebulk} +\pgf@circ@definetranspath{njfet} +\pgf@circ@definetranspath{pjfet} +\pgf@circ@definetranspath{pigbt} +\pgf@circ@definetranspath{nigbt} +\pgf@circ@definetranspath{Lpigbt} +\pgf@circ@definetranspath{Lnigbt} +% +% Path-style logical ports +% +% create path-style element for one input --- one output logical ports +% +\def\pgfcirc@port@node@to@path#1#2{% + % + % add a logic port path style component --- we need to suppress leads + % and use the correct center + % + \pgfcirc@node@to@path{#1}{#2}{/tikz/no leads, \circuitikzbasekey/logic ports origin=center}% +} +\pgfcirc@port@node@to@path{not port}{inline not} +\pgfcirc@port@node@to@path{buffer port}{inline buffer} +\pgfcirc@port@node@to@path{schmitt port}{inline schmitt} +\pgfcirc@port@node@to@path{invschmitt port}{inline invschmitt} + +\pgfcirc@port@node@to@path{tgate}{inline tgate} +\pgfcirc@port@node@to@path{double tgate}{inline double tgate} + +%%%---------- close: tex/pgfcircpath + +\ifpgf@circ@siunitx + \RequirePackage{xstring}[2009/03/13] + %\expandafter\let\csname angstrom\endcsname\relax + \RequirePackage{siunitx} +\fi + +\ifpgf@circ@explicitvdir\else + \PackageWarningNoLine{circuitikz}{% + You did not specify one of the voltage directions:\MessageBreak + \space\space oldvoltagedirection, nooldvoltagedirection, \MessageBreak + \space\space RPvoltages or EFvoltages \MessageBreak + Default directions may have changed, \MessageBreak + please check the manual% + } +\fi + +\newenvironment{circuitikz}{\begin{tikzpicture}}{\end{tikzpicture}} +%override (unused) circuitikz environment for compability to externalization) +\let\circuitikz\tikzpicture +\let\endcircuitikz\endtikzpicture + +\endinput diff --git a/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty b/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty index cd1637a3f7..7309dd6d18 100644 --- a/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty +++ b/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -12,8 +12,8 @@ \NeedsTeXFormat{LaTeX2e} -\def\pgfcircversion{1.2.7} -\def\pgfcircversiondate{2020/12/27} +\def\pgfcircversion{1.3.0} +\def\pgfcircversiondate{2021/01/19} \ProvidesPackage{circuitikz}% [\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion] @@ -32,183 +32,174 @@ % % global of options (better use styles!) % -\DeclareOption{european}{ +\DeclareOption{european}{\AtEndOfPackage{% \ctikzset{voltage=european} \ctikzset{current=european} \ctikzset{inductor=european} - \ctikzset{resistor=european} \ctikzset{logic ports=european} \ctikzset{gas filled surge arrester choice = european} +\ctikzset{resistor=european} \ctikzset{logic ports=european} \ctikzset{gas filled surge arrester choice = european}} } -\DeclareOption{american}{ +\DeclareOption{american}{\AtEndOfPackage{% \ctikzset{voltage=american} \ctikzset{current=american} \ctikzset{resistor=american} \ctikzset{inductor=american} \ctikzset{gas filled surge arrester choice = american} - \ctikzset{logic ports = american} -} -\DeclareOption{siunitx}{ - \pgf@circ@siunitxtrue -} -\DeclareOption{nosiunitx}{ - \pgf@circ@siunitxfalse -} -\DeclareOption{compatibility}{ - \pgf@circuit@compattrue +\ctikzset{logic ports = american}} } % % voltages % -\DeclareOption{europeanvoltage}{ - \ctikzset{voltage=european} +\DeclareOption{europeanvoltage}{\AtEndOfPackage{% + \ctikzset{voltage=european}} } -\DeclareOption{straightvoltages}{ - \ctikzset{voltage=straight} +\DeclareOption{straightvoltages}{\AtEndOfPackage{% + \ctikzset{voltage=straight}} } -\DeclareOption{americanvoltage}{ - \ctikzset{voltage=american} +\DeclareOption{americanvoltage}{\AtEndOfPackage{% + \ctikzset{voltage=american}} } -\DeclareOption{europeanvoltages}{ - \ctikzset{voltage=european} +\DeclareOption{europeanvoltages}{\AtEndOfPackage{% + \ctikzset{voltage=european}} } -\DeclareOption{americanvoltages}{ - \ctikzset{voltage=american} +\DeclareOption{americanvoltages}{\AtEndOfPackage{% + \ctikzset{voltage=american}} } % Voltage directions -\DeclareOption{oldvoltagedirection}{ +\DeclareOption{oldvoltagedirection}{\AtEndOfPackage{% \pgf@circ@oldvoltagedirectiontrue \pgf@circ@explicitvdirtrue - \pgf@circ@fixbatteriesfalse + \pgf@circ@fixbatteriesfalse} } -\DeclareOption{nooldvoltagedirection}{ +\DeclareOption{nooldvoltagedirection}{\AtEndOfPackage{% \pgf@circ@oldvoltagedirectionfalse \pgf@circ@explicitvdirtrue - \pgf@circ@fixbatteriesfalse + \pgf@circ@fixbatteriesfalse} } -\DeclareOption{RPvoltages}{ +\DeclareOption{RPvoltages}{\AtEndOfPackage{% \pgf@circ@oldvoltagedirectiontrue \pgf@circ@explicitvdirtrue - \pgf@circ@fixbatteriestrue + \pgf@circ@fixbatteriestrue} } -\DeclareOption{EFvoltages}{ +\DeclareOption{EFvoltages}{\AtEndOfPackage{% \pgf@circ@oldvoltagedirectionfalse \pgf@circ@explicitvdirtrue - \pgf@circ@fixbatteriestrue + \pgf@circ@fixbatteriestrue} } % % currents % -\DeclareOption{europeancurrent}{ - \ctikzset{current = european} +\DeclareOption{europeancurrent}{\AtEndOfPackage{% + \ctikzset{current = european}} } -\DeclareOption{americancurrent}{ - \ctikzset{current = american} +\DeclareOption{americancurrent}{\AtEndOfPackage{% + \ctikzset{current = american}} } -\DeclareOption{europeancurrents}{ - \ctikzset{current = european} +\DeclareOption{europeancurrents}{\AtEndOfPackage{% + \ctikzset{current = european}} } -\DeclareOption{americancurrents}{ - \ctikzset{current = american} +\DeclareOption{americancurrents}{\AtEndOfPackage{% + \ctikzset{current = american}} } % % resistors % -\DeclareOption{americanresistor}{ - \ctikzset{resistor = american} +\DeclareOption{americanresistor}{\AtEndOfPackage{% + \ctikzset{resistor = american}} } -\DeclareOption{europeanresistor}{ - \ctikzset{resistor = european} +\DeclareOption{europeanresistor}{\AtEndOfPackage{% + \ctikzset{resistor = european}} } -\DeclareOption{americanresistors}{ - \ctikzset{resistor = american} +\DeclareOption{americanresistors}{\AtEndOfPackage{% + \ctikzset{resistor = american}} } -\DeclareOption{europeanresistors}{ - \ctikzset{resistor = european} +\DeclareOption{europeanresistors}{\AtEndOfPackage{% + \ctikzset{resistor = european}} } % % inductors % -\DeclareOption{americaninductor}{ - \ctikzset{inductor = american} +\DeclareOption{americaninductor}{\AtEndOfPackage{% + \ctikzset{inductor = american}} } -\DeclareOption{europeaninductor}{ - \ctikzset{inductor = european} +\DeclareOption{europeaninductor}{\AtEndOfPackage{% + \ctikzset{inductor = european}} } -\DeclareOption{cuteinductor}{ - \ctikzset{inductor = cute} +\DeclareOption{cuteinductor}{\AtEndOfPackage{% + \ctikzset{inductor = cute}} } -\DeclareOption{americaninductors}{ - \ctikzset{inductor = american} +\DeclareOption{americaninductors}{\AtEndOfPackage{% + \ctikzset{inductor = american}} } -\DeclareOption{europeaninductors}{ - \ctikzset{inductor = european} +\DeclareOption{europeaninductors}{\AtEndOfPackage{% + \ctikzset{inductor = european}} } -\DeclareOption{cuteinductors}{ - \ctikzset{inductor = cute} +\DeclareOption{cuteinductors}{\AtEndOfPackage{% + \ctikzset{inductor = cute}} } % % logic ports % -\DeclareOption{americanport}{ - \ctikzset{logic ports = american} +\DeclareOption{americanport}{\AtEndOfPackage{% + \ctikzset{logic ports = american}} } -\DeclareOption{europeanport}{ - \ctikzset{logic ports = european} +\DeclareOption{europeanport}{\AtEndOfPackage{% + \ctikzset{logic ports = european}} } -\DeclareOption{americanports}{ - \ctikzset{logic ports = american} +\DeclareOption{americanports}{\AtEndOfPackage{% + \ctikzset{logic ports = american}} } -\DeclareOption{europeanports}{ - \ctikzset{logic ports = european} +\DeclareOption{europeanports}{\AtEndOfPackage{% + \ctikzset{logic ports = european}} } % % surge arresters (really?) % -\DeclareOption{americangfsurgearrester}{ - \ctikzset{gas filled surge arrester choice = american} +\DeclareOption{americangfsurgearrester}{\AtEndOfPackage{% + \ctikzset{gas filled surge arrester choice = american}} } -\DeclareOption{europeangfsurgearrester}{ - \ctikzset{gas filled surge arrester choice = european} +\DeclareOption{europeangfsurgearrester}{\AtEndOfPackage{% + \ctikzset{gas filled surge arrester choice = european}} } % % diodes % -\DeclareOption{fulldiodes}{ - \ctikzset{diode = full} +\DeclareOption{fulldiodes}{\AtEndOfPackage{% + \ctikzset{diode = full}} } -\DeclareOption{emptydiodes}{ - \ctikzset{diode = empty} +\DeclareOption{emptydiodes}{\AtEndOfPackage{% + \ctikzset{diode = empty}} } -\DeclareOption{strokediodes}{ - \ctikzset{diode = stroke} +\DeclareOption{strokediodes}{\AtEndOfPackage{% + \ctikzset{diode = stroke}} } -\DeclareOption{fulldiode}{ - \ctikzset{diode = full} +\DeclareOption{fulldiode}{\AtEndOfPackage{% + \ctikzset{diode = full}} } -\DeclareOption{emptydiode}{ - \ctikzset{diode = empty} +\DeclareOption{emptydiode}{\AtEndOfPackage{% + \ctikzset{diode = empty}} } -\DeclareOption{strokediode}{ - \ctikzset{diode = stroke} +\DeclareOption{strokediode}{\AtEndOfPackage{% + \ctikzset{diode = stroke}} } % % MOSes and FETs % -\DeclareOption{arrowmos}{ - \pgf@circuit@mos@arrowstrue +\DeclareOption{arrowmos}{\AtEndOfPackage{% + \pgf@circuit@mos@arrowstrue} } -\DeclareOption{noarrowmos}{ - \pgf@circuit@mos@arrowsfalse +\DeclareOption{noarrowmos}{\AtEndOfPackage{% + \pgf@circuit@mos@arrowsfalse} } -\DeclareOption{fetbodydiode}{ - \pgf@circuit@fet@bodydiodetrue +\DeclareOption{fetbodydiode}{\AtEndOfPackage{% + \pgf@circuit@fet@bodydiodetrue} } -\DeclareOption{nofetbodydiode}{ - \pgf@circuit@fet@bodydiodefalse +\DeclareOption{nofetbodydiode}{\AtEndOfPackage{% + \pgf@circuit@fet@bodydiodefalse} } -\DeclareOption{fetsolderdot}{ - \pgf@circuit@fet@solderdottrue +\DeclareOption{fetsolderdot}{\AtEndOfPackage{% + \pgf@circuit@fet@solderdottrue} } -\DeclareOption{nofetsolderdot}{ - \pgf@circuit@fet@solderdotfalse +\DeclareOption{nofetsolderdot}{\AtEndOfPackage{% + \pgf@circuit@fet@solderdotfalse} } -\DeclareOption{emptypmoscircle}{ - \pgf@circuit@pmos@emptycircletrue +\DeclareOption{emptypmoscircle}{\AtEndOfPackage{% + \pgf@circuit@pmos@emptycircletrue} } -\DeclareOption{lazymos}{ +\DeclareOption{lazymos}{\AtEndOfPackage{% \ctikzset{tripoles/nmos/width=.5} \ctikzset{tripoles/nmos/gate height=.35} \ctikzset{tripoles/nmos/base height=.35} @@ -221,36 +212,36 @@ \ctikzset{tripoles/pmos/height/.initial=1.2} \ctikzset{tripoles/pmos/base width=.5} \ctikzset{tripoles/pmos/gate width=.65} - \pgf@circuit@pmos@emptycircletrue +\pgf@circuit@pmos@emptycircletrue} } % % BJTs labels % -\DeclareOption{legacytransistorstext}{ - \pgf@circuit@transisors@fixlabelsfalse +\DeclareOption{legacytransistorstext}{\AtEndOfPackage{% + \pgf@circuit@transisors@fixlabelsfalse} } -\DeclareOption{nolegacytransistorstext}{ - \pgf@circuit@transisors@fixlabelstrue +\DeclareOption{nolegacytransistorstext}{\AtEndOfPackage{% + \pgf@circuit@transisors@fixlabelstrue} } -\DeclareOption{centertransistorstext}{ - \pgf@circuit@transisors@fixlabelstrue +\DeclareOption{centertransistorstext}{\AtEndOfPackage{% + \pgf@circuit@transisors@fixlabelstrue} } % % labels % -\DeclareOption{straightlabels}{ - \ctikzset{label/align = straight} +\DeclareOption{straightlabels}{\AtEndOfPackage{% + \ctikzset{label/align = straight}} } -\DeclareOption{rotatelabels}{ - \ctikzset{label/align = rotate} +\DeclareOption{rotatelabels}{\AtEndOfPackage{% + \ctikzset{label/align = rotate}} } -\DeclareOption{smartlabels}{ - \ctikzset{label/align = smart} +\DeclareOption{smartlabels}{\AtEndOfPackage{% + \ctikzset{label/align = smart}} } % % Several options (better use styles) % -\DeclareOption{betterproportions}{ +\DeclareOption{betterproportions}{\AtEndOfPackage{% \ctikzset{monopoles/ground/width/.initial=.15} \ctikzset{bipoles/resistor/height/.initial=.23} \ctikzset{bipoles/resistor/width/.initial=.6} @@ -308,7 +299,7 @@ \ctikzset{tripoles/triac/height/.initial=.66} \ctikzset{tripoles/triac/width/.initial=.6} \ctikzset{tripoles/triac/diode width left/.initial=.3} - \ctikzset{tripoles/triac/diode width right/.initial=.3} + \ctikzset{tripoles/triac/diode width right/.initial=.3}} } % This is a nice hack that prints all the shapes declared % by the package. Very useful for coverage testing and debugging. @@ -321,8 +312,28 @@ % % %%%%%%%%% +%%% These is the only direct options! +\DeclareOption{siunitx}{ + \pgf@circ@siunitxtrue +} +\DeclareOption{nosiunitx}{ + \pgf@circ@siunitxfalse +} +\DeclareOption{compatibility}{ + \pgf@circuit@compattrue +} + + +%% we have to load this before options to define the magics for compatibility \input pgfcirc.defines.tex + +% setup option defaults and process them +% notice that the default is nooldvoltagedirection; it's not explicitly set to allow for the warning +\ExecuteOptions{nofetbodydiode, nofetsolderdot, europeancurrents, europeanvoltages, americanports, americanresistors, cuteinductors ,europeangfsurgearrester, nosiunitx, noarrowmos, smartlabels} +\ProcessOptions\relax + \input pgfcircutils.tex +\input pgfcircpath.tex \input pgfcircshapes.tex \input pgfcircmonopoles.tex @@ -336,19 +347,14 @@ \input pgfcirccurrent.tex \input pgfcircflow.tex -% notice that the default is nooldvoltagedirection; it's not explicitly set to allow for the warning -\ExecuteOptions{nofetbodydiode, nofetsolderdot, europeancurrents, europeanvoltages, americanports, americanresistors, cuteinductors ,europeangfsurgearrester, nosiunitx, noarrowmos, smartlabels} - -\ProcessOptions\relax - -\input pgfcircpath.tex - \ifpgf@circ@siunitx \RequirePackage{xstring}[2009/03/13] %\expandafter\let\csname angstrom\endcsname\relax \RequirePackage{siunitx} \fi +%% This should be executed *after* all the options! +\AtEndOfPackage{% \ifpgf@circ@explicitvdir\else \PackageWarningNoLine{circuitikz}{% You did not specify one of the voltage directions:\MessageBreak @@ -358,6 +364,7 @@ please check the manual% } \fi +} \newenvironment{circuitikz}{\begin{tikzpicture}}{\end{tikzpicture}} %override (unused) circuitikz environment for compability to externalization) diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex index 0ed0d2b586..b22da300ef 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -12,6 +12,17 @@ % % This file has folding marks for vim (See last line). % + +% +% This file is loaded *before* the options for the package are executed, mainly +% for the following three ifs +% +% these three ifs are fundamental for the package loading options; +% do not move away +\newif\ifpgf@circ@siunitx +\newif\ifpgf@circ@siunitx@res +\newif\ifpgf@circuit@compat + %% Key managements%<<<1 \long\def\pgf@circ@comment#1{} @@ -221,6 +232,228 @@ }% %>>> +%% Generic macro for defining a bipole shape%<<< +% #1 - additional anchors +% #2 - lower y-size of the bipole (from the center). +% #3 - #shape is the name of the shape +% #4 - upper y-size of the bipole (from the center) +% #5 - width of the bipole +% #6 - macros drawing the bipole +% +\long\def\pgfcircdeclarebipole{% + \pgfcircdeclarebipolescaled{default}} + +%% Generic macro for defining a bipole shape +% #1 - scale factor +% #2 - additional anchors +% #3 - lower y-size of the bipole (from the center). +% #4 - #shape is the name of the shape +% #5 - upper y-size of the bipole (from the center) +% #6 - width of the bipole +% #7 - macros drawing the bipole +% +\long\def\pgfcircdeclarebipolescaled#1#2#3#4#5#6#7{ + \pgfdeclareshape{#4shape}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{#1}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor{\northeast}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=#5\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=#6\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor{\northeastborder}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=#5\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y + \pgf@x=#6\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x + } + \savedanchor{\southwestborder}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=-#3\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y + \pgf@x=-#6\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x + } + \savedanchor{\southwest}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=-#3\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-#6\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor{\centerpoint}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@circ@res@down=-#3\pgf@circ@scaled@Rlen + \pgf@circ@res@up=#5\pgf@circ@scaled@Rlen + \pgfpointorigin + \pgf@y=\pgf@circ@res@up + \advance\pgf@y by\pgf@circ@res@down + \pgf@y=.5\pgf@y + } + \anchor{center}{\pgfpointorigin} + \anchor{n}{ + \northeast + \pgf@x=0cm + } + \anchor{north east}{ + \northeast + } + \anchor{north west}{ + \northeast + \pgf@x=-\pgf@x + } + \anchor{ne}{ + \northeast + } + \anchor{nw}{ + \northeast + \pgf@x=-\pgf@x + } + \anchor{e}{ + \northeast + \pgf@y=0cm + } + \anchor{s}{ + \southwest + \pgf@x=0cm + } + \anchor{south east}{ + \southwest + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \southwest + } + \anchor{se}{ + \southwest + \pgf@x=-\pgf@x + } + \anchor{sw}{ + \southwest + } + \anchor{w}{ + \southwest + \pgf@y=0cm + } + \anchor{north}{ + \northeast + \pgf@x=0cm + } + \anchor{east}{ + \northeast + \pgf@y=0cm + } + \anchor{south}{ + \southwest + \pgf@x=0cm + } + \anchor{west}{ + \southwest + \pgf@y=0cm + } + \anchor{right}{ + \northeast + \pgf@y=0cm + } + \anchor{above}{ + \northeast + \pgf@x=0cm + } + \anchor{left}{ + \southwest + \pgf@y=0cm + } + \anchor{below}{ + \southwest + \pgf@x=0cm + } + \anchor{a}{ + \northeast + \pgf@y=0cm + } + \anchor{b}{ + \southwest + \pgf@y=0cm + } + \savedanchor{\textanchor}{% + \pgf@y=\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \anchor{text}{ + \textanchor + } + \anchorborder{% + \ifpgf@circuit@bipole@inverted + \pgf@circ@res@left=-\pgf@x + \pgf@circ@res@up=-\pgf@y + \else + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \fi + \ifdim\pgf@circ@res@up>0cm + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\northeastborder} + \else + \southwestborder + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-\pgf@x}{-\pgf@y}} + \fi + } + + #2 + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northeast + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@zero = 0cm + \pgf@circ@res@left = -\pgf@x + \pgf@circ@res@right = \pgf@x + \southwest + \pgf@circ@res@down = \pgf@y + \pgf@circ@scaled@Rlen=\scaledRlen + \pgfstartlinewidth=\pgflinewidth + \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners! + #7 + + \pgfsetlinewidth{\pgfstartlinewidth} + } + } +}% %>>> + +%% anchor adjustment macros%<<< + +% Extend the border anchor position by the specified factors on the right-top (north east corner) +% and the left-down (southwest border). Argument must be number (possibly decimal) without sign + +\def\pgfcirc@border@extend@full#1#2#3#4{% right, top, left, down + \anchorborder{% + \ifpgf@circuit@bipole@inverted + \pgf@circ@res@left=-\pgf@x + \pgf@circ@res@up=-\pgf@y + \else + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \fi + \ifdim\pgf@circ@res@up>0cm + \northeastborder + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{#1\pgf@x}{#2\pgf@y}} + \else + \southwestborder + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-#3\pgf@x}{-#4\pgf@y}} + \fi + } +} + +% Just up and down (very common) +\def\pgfcirc@border@extend@updown#1#2{\pgfcirc@border@extend@full{1}{#1}{1}{#2}}% %>>> + % text position in some component.%<<<1 % (added with ieeestd logic ports. Maybe to be extended to other components, % like amplifiers) @@ -237,8 +470,6 @@ % voltage direction options%<<<1 -\newif\ifpgf@circ@siunitx -\newif\ifpgf@circuit@compat \newif\ifpgf@circ@oldvoltagedirection % default false \newif\ifpgf@circ@explicitvdir \newif\ifpgf@circ@fixbatteries @@ -324,8 +555,6 @@ \ctikzset{bipole/annotation/unit/.initial=} \ctikzset{bipole/annotation/name/.initial=} -\newif\ifpgf@circ@siunitx -\newif\ifpgf@circ@siunitx@res \ctikzset{label/align/.is choice} \ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}} @@ -477,1671 +706,6 @@ \tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}} %%>>> -% grounds and power supplies%<<<1 - -\ctikzset{monopoles/.is family} -\ctikzset{monopoles/ground/width/.initial=.25} -\ctikzset{monopoles/ground/connectionthickness/.initial=1} -\ctikzset{monopoles/ground/thickness/.initial=2} -\ctikzset{monopoles/rground/thickness/.initial=2} -\ctikzset{monopoles/tground/thickness/.initial=3} -\ctikzset{monopoles/vcc/width/.initial=.2} -\ctikzset{monopoles/vcc/arrow/.initial=legacy} -\ctikzset{monopoles/vee/arrow/.initial=legacy} -\ctikzset{monopoles/match/width/.initial=.4} -\ctikzset{monopoles/chassis/width/.initial=.25} -\ctikzset{monopoles/alternative chassis/width/.initial=.25} -\ctikzset{monopoles/equipotentiality/width/.initial=.25} -\ctikzset{monopoles/antenna/width/.initial=.25} -\ctikzset{monopoles/antenna/label/xanchor/.initial=.4} -\ctikzset{monopoles/antenna/label/yanchor/.initial=.75} -\ctikzset{monopoles/txantenna/label/xanchor/.initial=.4} -\ctikzset{monopoles/txantenna/label/yanchor/.initial=.75} -\ctikzset{monopoles/txantenna/width/.initial=.25} -\ctikzset{monopoles/rxantenna/label/xanchor/.initial=.4} -\ctikzset{monopoles/rxantenna/label/yanchor/.initial=.75} -\ctikzset{monopoles/rxantenna/width/.initial=.25} -\ctikzset{monopoles/bareantenna/width/.initial=.25} -\ctikzset{monopoles/bareantenna/label/xanchor/.initial=1} -\ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5} -\ctikzset{monopoles/waves/width/.initial=0.5}% -%>>> - -% microstrips %<<<1 -\ctikzset{bipoles/mstline/height/.initial=0.3} -\ctikzset{bipoles/mstline/width/.initial=1.2} -\pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}} -\ctikzset{monopoles/msport/width/.initial=.5} -\ctikzset{monopoles/msrstub/height/.initial=1.0} -\ctikzset{monopoles/msrstub/width/.initial=0.6}% -%>>> - -% microphone and loudspeaker%<<<1 -\ctikzset{bipoles/loudspeaker/height/.initial=.8} -\ctikzset{bipoles/loudspeaker/depth/.initial=.3} -\ctikzset{bipoles/loudspeaker/width/.initial=.8} -\ctikzset{bipoles/mic/height/.initial=1.2} -\ctikzset{bipoles/mic/depth/.initial=.1} -\ctikzset{bipoles/mic/width/.initial=.8}% -%>>> - -% resistors%<<<1 -% Zig Zag resistors -\ctikzset{resistors/zigs/.initial=3} -\ctikzset{resistors/width/.code={% - \ctikzset{bipoles/resistor/width=#1}% - \ctikzset{bipoles/vresistor/width=#1}% - \ctikzset{bipoles/potentiometer/width=#1}% - \ctikzset{bipoles/resistivesens/width=#1}% - \ctikzset{bipoles/photoresistor/width=#1}% - \ctikzset{bipoles/thermistor/width=#1}% - \ctikzset{bipoles/thermistorntc/width=#1}% - \ctikzset{bipoles/thermistorptc/width=#1}% - \ctikzset{bipoles/varistor/width=#1}% - \ctikzset{bipoles/generic/width=#1}% - \ctikzset{bipoles/generic potentiometer/width=#1}% - \ctikzset{bipoles/ageneric/width=#1}% - \ctikzset{bipoles/tgeneric/width=#1}% -}} -\ctikzset{wiper pos/.code={% - \ctikzset{bipoles/potentiometer/wiper pos=#1}% - \ctikzset{bipoles/generic potentiometer/wiper pos=#1}% -}} -% zigzag resistor -\ctikzset{bipoles/resistor/height/.initial=.3} -\ctikzset{bipoles/resistor/width/.initial=.8} -\ctikzset{bipoles/potentiometer/height/.initial=.8} -\ctikzset{bipoles/potentiometer/height 2/.initial=.3} -\ctikzset{bipoles/potentiometer/width/.initial=.8} -\ctikzset{bipoles/potentiometer/wiper pos/.initial=.5} -\ctikzset{bipoles/vresistor/height/.initial=.6} -\ctikzset{bipoles/vresistor/width/.initial=.8} -\ctikzset{bipoles/resistivesens/height/.initial=.6} -\ctikzset{bipoles/resistivesens/width/.initial=.8} -% square resistors -\ctikzset{bipoles/photoresistor/height/.initial=.6} -\ctikzset{bipoles/photoresistor/height 2/.initial=.3} -\ctikzset{bipoles/photoresistor/width/.initial=.8} -\ctikzset{bipoles/thermistor/main/.initial=.7} -\ctikzset{bipoles/thermistor/height/.initial=.428}%.3/.7 -\ctikzset{bipoles/thermistorntc/width/.initial=.8} -\ctikzset{bipoles/thermistorntc/main/.initial=.7} -\ctikzset{bipoles/thermistorntc/height/.initial=.428}%.3/.7 -\ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.3/.7 -\ctikzset{bipoles/thermistorptc/width/.initial=.8} -\ctikzset{bipoles/thermistorptc/main/.initial=.7} -\ctikzset{bipoles/thermistorptc/height/.initial=.428}%.3/.7 -\ctikzset{bipoles/thermistorptc/height 2/.initial=.75}%.3/.7 -\ctikzset{bipoles/thermistor/width/.initial=.8} -\ctikzset{bipoles/varistor/main/.initial=.7} -\ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7 -\ctikzset{bipoles/varistor/width/.initial=.8} -\ctikzset{bipoles/generic/height/.initial=.30} -\ctikzset{bipoles/generic/width/.initial=.80} -\ctikzset{bipoles/generic potentiometer/height/.initial=.80} -\ctikzset{bipoles/generic potentiometer/height 2/.initial=.30} -\ctikzset{bipoles/generic potentiometer/width/.initial=.80} -\ctikzset{bipoles/generic potentiometer/wiper pos/.initial=.5} -\ctikzset{bipoles/ageneric/height/.initial=.30} -\ctikzset{bipoles/tgeneric/height/.initial=.70} -\ctikzset{bipoles/tgeneric/width/.initial=.80} -\ctikzset{bipoles/ageneric/width/.initial=.80} -\ctikzset{bipoles/memristor/height/.initial=.30} -\ctikzset{bipoles/memristor/wave height/.initial=.5} -\ctikzset{bipoles/memristor/width/.initial=.80} - -\newif\ifpgf@circuit@europeanresistor -\ctikzset{resistor/.is choice} -\ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse } -\ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue } -\tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}} -\tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}} -%%>>> - -%% Capacitors%<<<1 -\ctikzset{bipoles/capacitor/height/.initial=.6} -\ctikzset{bipoles/capacitor/width/.initial=.2} -\ctikzset{bipoles/ecapacitor/height/.initial=.5} -\ctikzset{bipoles/ecapacitor/width/.initial=.2} -\ctikzset{bipoles/ecapacitor/font/.initial=\pgf@circ@font@sixbm} -%%% pcapacitor is deprecated -\ctikzset{bipoles/pcapacitor/height/.initial=.6} -\ctikzset{bipoles/pcapacitor/width/.initial=.2} -\ctikzset{bipoles/pcapacitor/bend width/.initial=1.1} -\ctikzset{bipoles/ccapacitor/height/.initial=.6} -\ctikzset{bipoles/ccapacitor/width/.initial=.12} -\ctikzset{bipoles/ccapacitor/bend width/.initial=1.1} -\ctikzset{bipoles/vcapacitor/height/.initial=.6} -\ctikzset{bipoles/vcapacitor/width/.initial=.5} -\ctikzset{bipoles/vcapacitor/capacitor width/.initial=.4} -\ctikzset{bipoles/piezoelectric/height/.initial=.7} -\ctikzset{bipoles/piezoelectric/width/.initial=.5}% -%>>> - -% Inductors%<<<1 -\ctikzset{inductors/coils/.code={% - \ctikzset{bipoles/cuteinductor/coils=#1}% - \ctikzset{bipoles/cutechoke/coils=#1}% - \ctikzset{bipoles/americaninductor/coils=#1}% - \ctikzset{bipoles/vcuteinductor/coils=#1}% - \ctikzset{bipoles/vamericaninductor/coils=#1}% -}} -\ctikzset{inductors/width/.code={% - \ctikzset{bipoles/cuteinductor/width=#1}% - \ctikzset{bipoles/cutechoke/width=#1}% - \ctikzset{bipoles/americaninductor/width=#1}% - \ctikzset{bipoles/vcuteinductor/width=#1}% - \ctikzset{bipoles/vamericaninductor/width=#1}% - \ctikzset{bipoles/fullgeneric/width=#1}% - \ctikzset{bipoles/tfullgeneric/width=#1}% -}} -\ctikzset{bipoles/cuteinductor/height/.initial=.3} -\ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15} -\ctikzset{bipoles/cuteinductor/width/.initial=.6} -\ctikzset{bipoles/cuteinductor/coils/.initial=5} -\ctikzset{bipoles/cuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil -%% Cute choke settings -\ctikzset{bipoles/cutechoke/height/.initial=.3} -\ctikzset{bipoles/cutechoke/lower coil height/.initial=.15} -\ctikzset{bipoles/cutechoke/width/.initial=.6} -\ctikzset{bipoles/cutechoke/coils/.initial=5} -\ctikzset{bipoles/cutechoke/coil aspect/.initial=.5}%percentage of choke width, which is covered by lower coil -\ctikzset{bipoles/cutechoke/cstep/.initial=.3} -\ctikzset{bipoles/cutechoke/cdist/.initial=1.3} -\ctikzset{bipoles/cutechoke/cthick/.initial=1} -\newif\ifpgf@circuit@bipole@twolineschoke -\pgf@circuit@bipole@twolineschokefalse -\pgfkeys{/tikz/onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}} -\ctikzset{onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}} -\pgfkeys{/tikz/twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}} -\ctikzset{twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}} -% -\ctikzset{bipoles/americaninductor/height/.initial=.3} -\ctikzset{bipoles/americaninductor/height 2/.initial=.1} -\ctikzset{bipoles/americaninductor/width/.initial=.8} -\ctikzset{bipoles/americaninductor/coils/.initial=4} -\ctikzset{bipoles/americaninductor/coil height/.initial=.15} -\ctikzset{bipoles/vcuteinductor/height/.initial=.6} -\ctikzset{bipoles/vcuteinductor/lower coil height/.initial=.3} -\ctikzset{bipoles/vcuteinductor/width/.initial=.6} -\ctikzset{bipoles/vcuteinductor/coils/.initial=5} -\ctikzset{bipoles/vcuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil -\ctikzset{bipoles/vamericaninductor/height/.initial=.6} -\ctikzset{bipoles/vamericaninductor/height 2/.initial=.2} -\ctikzset{bipoles/vamericaninductor/width/.initial=.8} -\ctikzset{bipoles/vamericaninductor/coils/.initial=4} -\ctikzset{bipoles/vamericaninductor/coil height/.initial=.15} -\ctikzset{bipoles/tfullgeneric/height/.initial=.70} -\ctikzset{bipoles/tfullgeneric/width/.initial=.80} -\ctikzset{bipoles/fullgeneric/height/.initial=.30} -\ctikzset{bipoles/fullgeneric/width/.initial=.80} -\ctikzset{inductor/.is choice} -\ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}} -\ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}} -\ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}} - -\tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}} -\tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}} -\tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}} -\tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}} -\tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}} - -%%>>> - -% Sources%<<<1 - -\ctikzset{bipoles/esource/height/.initial=.60} -\ctikzset{bipoles/esource/width/.initial=.60} -\ctikzset{bipoles/pvsource/height/.initial=.60} -\ctikzset{bipoles/pvsource/width/.initial=.60} -\ctikzset{bipoles/isource/height/.initial=.60} -\ctikzset{bipoles/isource/width/.initial=.60} -\ctikzset{bipoles/oosource/height/.initial=.60} -\ctikzset{bipoles/oosource/width/.initial=.60} -\ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1 -\ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1 -\ctikzset{bipoles/dcisource/angle/.initial=80} -\ctikzset{bipoles/dcisource/height/.initial=.60} -\ctikzset{bipoles/dcisource/width/.initial=.60} -\ctikzset{bipoles/dcvsource/height/.initial=.60} -\ctikzset{bipoles/dcvsource/width/.initial=.60} -\ctikzset{bipoles/vsourcetri/height/.initial=.60} -\ctikzset{bipoles/vsourcetri/width/.initial=.60} -\ctikzset{bipoles/isourceam/height/.initial=.60} -\ctikzset{bipoles/isourceam/width/.initial=.60} -\ctikzset{bipoles/vsource/height/.initial=.60} -\ctikzset{bipoles/vsource/width/.initial=.60} -\ctikzset{bipoles/vsourceam/height/.initial=.60} -\ctikzset{bipoles/vsourceam/width/.initial=.60} -\ctikzset{bipoles/vsourceam/margin/.initial=.7} -\ctikzset{bipoles/isourcesin/height/.initial=.60} -\ctikzset{bipoles/isourcesin/width/.initial=.60} -\ctikzset{bipoles/vsourcesin/height/.initial=.60} -\ctikzset{bipoles/vsourcesin/width/.initial=.60} -\ctikzset{bipoles/vsourcesquare/height/.initial=.60} -\ctikzset{bipoles/vsourcesquare/width/.initial=.60} -\ctikzset{bipoles/cisource/height/.initial=.7} -\ctikzset{bipoles/cisource/width/.initial=.7} -\ctikzset{bipoles/cisourceam/height/.initial=.7} -\ctikzset{bipoles/cisourceam/width/.initial=.7} -\ctikzset{bipoles/ecsource/height/.initial=.7} -\ctikzset{bipoles/ecsource/width/.initial=.7} -\ctikzset{bipoles/cvsource/height/.initial=.7} -\ctikzset{bipoles/cvsource/width/.initial=.7} -\ctikzset{bipoles/cvsourceam/height/.initial=.7} -\ctikzset{bipoles/cvsourceam/width/.initial=.7} -\ctikzset{bipoles/cvsourceam/margin/.initial=.7} -\ctikzset{bipoles/cvsourceam/text scale/.initial=1} -\ctikzset{bipoles/cisourcesin/width/.initial=.7} -\ctikzset{bipoles/cvsourcesin/height/.initial=.7} -\ctikzset{bipoles/cvsourcesin/width/.initial=.7} -\ctikzset{bipoles/battery/height/.initial=.6} -\ctikzset{bipoles/battery/width/.initial=.3} -\ctikzset{bipoles/battery1/height/.initial=.6} -\ctikzset{bipoles/battery1/width/.initial=.3} -\ctikzset{bipoles/battery2/height/.initial=.6} -\ctikzset{bipoles/battery2/width/.initial=.3} -% noise sources -\ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50} - -%%>>> - -% "oo" style transformers and power grid diagrams%<<<1 -% % % ootransformer -\ctikzset{bipoles/oosourcetrans/height/.initial=.6} -\ctikzset{bipoles/oosourcetrans/width/.initial=.6} -\ctikzset{bipoles/oosourcetrans/circlesize/.initial=.6}%circlesize+circleoffset should be =1 -\ctikzset{bipoles/oosourcetrans/circleoffset/.initial=.4}%circlesize+circleoffset should be =1 -\ctikzset{bipoles/oosourcetrans/vectorgroupscale/.initial=1} - -% % % oootransformer -\ctikzset{bipoles/ooosource/height/.initial=.6} -\ctikzset{bipoles/ooosource/circlesize/.initial=.55}%circlesize+circleoffset should be =1 -\ctikzset{bipoles/ooosource/circleoffset/.initial=.45}%circlesize+circleoffset should be =1 -\ctikzset{bipoles/ooosource/vectorgroupscale/.initial=1} - -% % % primary windings -\newif\ifpgf@circ@prim@delta -\newif\ifpgf@circ@prim@wye -\newif\ifpgf@circ@prim@zig -\pgfkeys{tikz/prim/.is choice} -\pgfkeys{tikz/prim/delta/.add code={}{\pgf@circ@prim@deltatrue}} -\pgfkeys{tikz/prim/wye/.add code={}{\pgf@circ@prim@wyetrue}} -\pgfkeys{tikz/prim/zig/.add code={}{\pgf@circ@prim@zigtrue}} - -% % % secondary windings -\newif\ifpgf@circ@sec@delta -\newif\ifpgf@circ@sec@wye -\newif\ifpgf@circ@sec@zig -\pgfkeys{tikz/sec/.is choice} -\pgfkeys{tikz/sec/delta/.add code={}{\pgf@circ@sec@deltatrue}} -\pgfkeys{tikz/sec/wye/.add code={}{\pgf@circ@sec@wyetrue}} -\pgfkeys{tikz/sec/zig/.add code={}{\pgf@circ@sec@zigtrue}} - -% % % tertiary windings (ooosource) -\newif\ifpgf@circ@tert@delta -\newif\ifpgf@circ@tert@wye -\newif\ifpgf@circ@tert@zig -\pgfkeys{tikz/tert/.is choice} -\pgfkeys{tikz/tert/delta/.add code={}{\pgf@circ@tert@deltatrue}} -\pgfkeys{tikz/tert/wye/.add code={}{\pgf@circ@tert@wyetrue}} -\pgfkeys{tikz/tert/zig/.add code={}{\pgf@circ@tert@zigtrue}}% -%>>> - -% diodes%<<<1 - -\ctikzset{bipoles/diode/height/.initial=.50} -\ctikzset{bipoles/diode/width/.initial=.40} -\ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1} -\ctikzset{bipoles/bidirectionaldiode/width/.initial=1} -\ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3} -\ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3} -\ctikzset{bipoles/varcap/height/.initial=.50} -\ctikzset{bipoles/varcap/width/.initial=.45} -\ctikzset{tripoles/thyristor/height/.initial=1.10} -\ctikzset{tripoles/thyristor/height 2/.initial=.5} -\ctikzset{tripoles/thyristor/width/.initial=1.0} -\ctikzset{tripoles/thyristor/diode height/.initial=.5} -\ctikzset{tripoles/thyristor/diode width left/.initial=.4} -\ctikzset{tripoles/thyristor/diode width right/.initial=.3} - -\ctikzset{tripoles/triac/height/.initial=1.1} -\ctikzset{tripoles/triac/width/.initial=1} -\ctikzset{tripoles/triac/diode width left/.initial=.3} -\ctikzset{tripoles/triac/diode width right/.initial=.3} -% -% Flipping arrows in LED and photodiodes -% -\newif\ifpgf@led@fliparrows -\newif\ifpgf@pd@fliparrows -\pgf@led@fliparrowsfalse -\pgf@pd@fliparrowsfalse -% -% by default the arrows start (LED) and go (PD) to the anode. -% -\ctikzset{led arrows from anode/.code=\pgf@led@fliparrowsfalse} -\ctikzset{pd arrows to anode/.code=\pgf@pd@fliparrowsfalse} -% -% but they can start form the cathode (LED) or go to it (PD) -% -\ctikzset{led arrows from cathode/.code=\pgf@led@fliparrowstrue} -\ctikzset{pd arrows to cathode/.code=\pgf@pd@fliparrowstrue} - -\newif\ifpgf@circuit@strokediode -\newif\ifpgf@circuit@fulldiode -\pgf@circuit@strokediodefalse -\pgf@circuit@fulldiodefalse - -\ctikzset{diode/.is choice} -\ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default -\ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue } -\ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue} - -\tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}} -\tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}} -\tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}} - -%%>>> - -% switches%<<<1 - -\ctikzset{bipoles/spst/height/.initial=.35} -\ctikzset{bipoles/spst/width/.initial=.35} -\ctikzset{bipoles/spst/depth/.initial=.2} -\ctikzset{bipoles/nos/height/.initial=.3} -\ctikzset{bipoles/nos/width/.initial=.35} -\ctikzset{bipoles/nos/depth/.initial=.2} -\ctikzset{bipoles/ncs/height/.initial=.35} -\ctikzset{bipoles/ncs/width/.initial=.35} -\ctikzset{bipoles/ncs/depth/.initial=.2} -\ctikzset{bipoles/pushbutton/height/.initial=.5} -\ctikzset{bipoles/pushbutton/height 2/.initial=.2} -\ctikzset{bipoles/pushbutton/width/.initial=.50} -%%% reed switch -\ctikzset{bipoles/reed/height/.initial=.4} -\ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos -\ctikzset{bipoles/reed/depth/.initial=.4} -%% Cute switches -\ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}} -\ctikzset{bipoles/cuteswitch/height/.initial=.6} -\ctikzset{bipoles/cuteswitch/height 2/.initial=.2} -\ctikzset{bipoles/cuteswitch/width/.initial=.50} -\ctikzset{bipoles/cuteswitch/thickness/.initial=1} - -\ctikzset{tripoles/spdt/width/.initial=.85} -\ctikzset{tripoles/spdt/height/.initial=.45} -\ctikzset{tripoles/spdt/margin/.initial=.45} - -\ctikzset{tripoles/toggleswitch/height/.initial=.8} -\ctikzset{tripoles/toggleswitch/height 2/.initial=.0} -\ctikzset{tripoles/toggleswitch/width/.initial=.80} -%%>>> - -% arresters, fuses, lamps, etc%<<<1 - -\ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30} -\ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80} -\ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30} -\ctikzset{bipoles/american gas filled surge arrester/height/.initial=.60} -\ctikzset{bipoles/american gas filled surge arrester/width/.initial=.60} -\ctikzset{bipoles/american gas filled surge arrester/inside/.initial=.15} -\ctikzset{bipoles/american gas filled surge arrester/dot x/.initial=.25} -\ctikzset{bipoles/american gas filled surge arrester/dot y/.initial=.45} -\ctikzset{bipoles/american gas filled surge arrester/size/.initial=.1} -\ctikzset{bipoles/fuse/height/.initial=.20} -\ctikzset{bipoles/fuse/width/.initial=.50} -\ctikzset{bipoles/afuse/height/.initial=.20} -\ctikzset{bipoles/afuse/width/.initial=.50} -\ctikzset{bipoles/lamp/height/.initial=.60} -\ctikzset{bipoles/lamp/width/.initial=.60} -\ctikzset{bipoles/bulb/height/.initial=.8} -\ctikzset{bipoles/bulb/width/.initial=.8} -\ctikzset{bipoles/tline/height/.initial=.3} -\ctikzset{bipoles/tline/width/.initial=.6} -\ctikzset{bipoles/squid/height/.initial=.60} -\ctikzset{bipoles/squid/width/.initial=.60} -\ctikzset{bipoles/barrier/height/.initial=.60} -\ctikzset{bipoles/barrier/width/.initial=.60} -\ctikzset{bipoles/openbarrier/gap/.initial=0.5} -\ctikzset{bipoles/thermocouple/height/.initial=.250} -\ctikzset{bipoles/thermocouple/height 2/.initial=.60} -\ctikzset{bipoles/thermocouple/width/.initial=.140} -\newif\ifpgf@circuit@europeangfsurgearrester -\ctikzset{gas filled surge arrester choice/.is choice} -\ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue}} -\ctikzset{gas filled surge arrester choice/american/.code= {\pgf@circuit@europeangfsurgearresterfalse}} - -\tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}} -\tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}} -%%>>> - -% wires (open, shorts, ...)%<<<1 - -\ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages -\ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages -\ctikzset{bipoles/open/voltage/straight label distance/.initial=0} -\ctikzset{bipoles/open/voltage/distance from node/.initial=.2} -\ctikzset{bipoles/short/height/.initial=.1} %dummy height for voltage positioning -\ctikzset{bipoles/short/width/.initial=.1} %dummy width for voltage positioning -% multiwire -\ctikzset{bipoles/multiwire/height/.initial=0.4} -\ctikzset{bipoles/multiwire/width/.initial=0.2} -\ctikzset{bipoles/multiwire/spacing/.initial=0.05} -% crossing wires -\ctikzset{bipoles/crossing/size/.initial=.2} -%%>>> - -% Instruments %<<<1 -\ctikzset{bipoles/ammeter/height/.initial=.60} -\ctikzset{bipoles/ammeter/width/.initial=.60} -\ctikzset{bipoles/ohmmeter/height/.initial=.60} -\ctikzset{bipoles/ohmmeter/width/.initial=.60} -\ctikzset{bipoles/voltmeter/height/.initial=.60} -\ctikzset{bipoles/voltmeter/width/.initial=.60} -\ctikzset{bipoles/smeter/height/.initial=.60} -\ctikzset{bipoles/smeter/width/.initial=.60} -\ctikzset{bipoles/smeter/voltage/additional shift/.initial=1} -\ctikzset{bipoles/qmeter/depth/.initial=.40} -\ctikzset{bipoles/qmeter/height/.initial=.80} -\ctikzset{bipoles/qmeter/width/.initial=.60} -% this must be specified for each one -\ctikzset{bipoles/qvprobe/voltage/additional shift/.initial=.5} -\ctikzset{bipoles/qiprobe/voltage/additional shift/.initial=.5} -\ctikzset{bipoles/qpprobe/voltage/additional shift/.initial=.5} -\ctikzset{bipoles/iloop/width/.initial=.40} -\ctikzset{bipoles/iloop/height/.initial=.60} - -\ctikzset{bipoles/oscope/height/.initial=.60} -\ctikzset{bipoles/oscope/width/.initial=.60} -\ctikzset{bipoles/oscope/voltage/additional shift/.initial=1} - - -% option to not rotate the new (Romano's) instruments -\newif\ifpgf@circuit@straightinstruments\pgf@circuit@straightinstrumentstrue -\pgfkeys{/tikz/straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}} -\ctikzset{straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}} -\pgfkeys{/tikz/rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}} -\ctikzset{rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}} -%%>>> - -% blocks (twoports and so)%<<<1 - -\ctikzset{bipoles/twoport/width/.initial=.7} -\ctikzset{bipoles/twoport/height/.initial=.7} -\ctikzset{bipoles/twoport/text/.initial=} -\ctikzset{bipoles/twoportsplit/width/.initial=.7} -\ctikzset{bipoles/twoport/text in/.initial=} -\ctikzset{bipoles/twoport/text out/.initial=} -\ctikzset{text/.style={t=#1}} -\ctikzset{t/.code={% - \ctikzsetvalof{bipoles/twoport/text}{#1}% -}} -\ctikzset{text in/.style={t1=#1}} -\ctikzset{t1/.code={% - \ctikzsetvalof{bipoles/twoport/text in}{#1}% -}} -\ctikzset{text out/.style={t2=#1}} -\ctikzset{t2/.code={% - \ctikzsetvalof{bipoles/twoport/text out}{#1}% -}} -\ctikzset{bipoles/vco/width/.initial=.7} -\ctikzset{bipoles/bandpass/width/.initial=.7} -\ctikzset{bipoles/bandstop/width/.initial=.7} -\ctikzset{bipoles/highpass/width/.initial=.7} -\ctikzset{bipoles/lowpass/width/.initial=.7} -\ctikzset{bipoles/allpass/width/.initial=.7} -\ctikzset{bipoles/adc/width/.initial=.7} -\ctikzset{bipoles/dac/width/.initial=.7} -\ctikzset{bipoles/dsp/width/.initial=.7} -\ctikzset{bipoles/fft/width/.initial=.7} -\ctikzset{bipoles/amp/width/.initial=.7} -\ctikzset{bipoles/vamp/width/.initial=.7} -\ctikzset{bipoles/piattenuator/width/.initial=.7} -\ctikzset{bipoles/vpiattenuator/width/.initial=.7} -\ctikzset{bipoles/tattenuator/width/.initial=.7} -\ctikzset{bipoles/vtattenuator/width/.initial=.7} -\ctikzset{bipoles/phaseshifter/width/.initial=.7} -\ctikzset{bipoles/vphaseshifter/width/.initial=.7} -\ctikzset{bipoles/detector/width/.initial=.7} -\ctikzset{tripoles/mixer/width/.initial=0.7} -\ctikzset{tripoles/adder/width/.initial=0.7} -\ctikzset{tripoles/circulator/width/.initial=.7} -\ctikzset{tripoles/oscillator/width/.initial=.7} - -\ctikzset{tripoles/wilkinson/height/.initial=1.3} -\ctikzset{tripoles/wilkinson/width/.initial=1.3} - -\ctikzset{tripoles/splitter/height/.initial=1.3} -\ctikzset{tripoles/splitter/width/.initial=1.3} - -\ctikzset{tripoles/mzm/height/.initial=1.3} -\ctikzset{tripoles/mzm/width/.initial=1.3} -%%>>> - -% Transistors %<<<1 - -\newif\ifpgf@circuit@trans@depletiontype -\pgf@circuit@trans@depletiontypefalse - -\newif\ifpgf@circuit@mos@arrows -\ctikzset{tripoles/mos style/.is choice} -\ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}} -\ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}} -\pgfkeys{/tikz/arrowmos/.add code={}{\pgf@circuit@mos@arrowstrue}} -\pgfkeys{/tikz/noarrowmos/.add code={}{\pgf@circuit@mos@arrowsfalse}} - -% Fixed label positions -\newif\ifpgf@circuit@transisors@fixlabels -\pgf@circuit@transisors@fixlabelstrue -\pgfkeys{/tikz/center transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}} -\ctikzset{fix transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}} -\pgfkeys{/tikz/legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}} -\ctikzset{legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}} - -% Option solderdot for fet -\newif\ifpgf@circuit@fet@solderdot -\pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}} -\ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}} -\pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}} -\ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}} - -% Option bodydiode for fet -\newif\ifpgf@circuit@fet@bodydiode -\pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}} -\ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}} -\pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}} -\ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}} - -% Option draw fet without gate connection -\newif\ifpgf@circuit@bpt@drawgate -\pgf@circuit@bpt@drawgatetrue -\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}} -\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}} -\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}} -\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}} - -% Option draw bpt with schottky base -\newif\ifpgf@circuit@bpt@schottky -\pgf@circuit@bpt@schottkyfalse -\pgfkeys{/tikz/schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}} -\ctikzset{schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}} -\pgfkeys{/tikz/no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}} -\ctikzset{no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}} -\ctikzset{tripoles/schottky base size/.initial=0.05} - -% Option draw bpt without base connection -\newif\ifpgf@circuit@bpt@drawbase -\pgf@circuit@bpt@drawbasetrue -\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}} -\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}} -\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}} -\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}} - -% Option draw bpt with optical input -\newif\ifpgf@circuit@bpt@drawphoto -\pgf@circuit@bpt@drawphotofalse -\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} -\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} -\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} -\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} - -% Option draw fet without bulk connection -- Added by Burak Kelleci -\newif\ifpgf@circuit@bpt@drawbulk -\pgfkeys{/tikz/bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}} -\ctikzset{bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}} -\pgfkeys{/tikz/nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}} -\ctikzset{nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}} - -% Option draw pmos with empty circle -\newif\ifpgf@circuit@pmos@emptycircle -\pgf@circuit@pmos@emptycirclefalse -\ctikzset{tripoles/pmos style/.is choice} -\pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} -\ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} -% Option draw pmos with no circle -\newif\ifpgf@circuit@pmos@nocircle -\pgf@circuit@pmos@nocirclefalse -\pgfkeys{/tikz/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}} -\ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}} -% back to normal -\pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} -\ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} -% arrows at the end, the correct way -\newif\ifpgf@circuit@trans@arrowatend -\pgf@circuit@trans@arrowatendfalse -\ctikzset{transistors/arrow pos/.is choice} -\ctikzset{transistors/arrow pos/legacy/.code={\pgf@circuit@trans@arrowatendfalse}} -\ctikzset{transistors/arrow pos/end/.code={\pgf@circuit@trans@arrowatendtrue}} - -\newif\ifpgf@circuit@trans@ntype -\pgf@circuit@trans@ntypetrue %default true -%\newif\ifpgf@circuit@trans@ptype -%\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@ntypetrue}} -\ctikzset{tripoles/nmos/width/.initial=.7} -\ctikzset{tripoles/nmos/gate height/.initial=.35} -\ctikzset{tripoles/nmos/base height/.initial=.5} -\ctikzset{tripoles/nmos/conn height/.initial=0} -\ctikzset{tripoles/nmos/height/.initial=1.1} -\ctikzset{tripoles/nmos/base width/.initial=.5} -\ctikzset{tripoles/nmos/gate width/.initial=.62} -\ctikzset{tripoles/nmos/arrow pos/.initial=.6} -\ctikzset{tripoles/nmos/bodydiode scale/.initial=.3} -\ctikzset{tripoles/nmos/bodydiode distance/.initial=.3} -\ctikzset{tripoles/nmos/bodydiode conn/.initial=.6} -\ctikzset{tripoles/nmos/curr direction/.initial=1} - -\ctikzset{tripoles/pmos/width/.initial=.7} -\ctikzset{tripoles/pmos/gate height/.initial=.35} -\ctikzset{tripoles/pmos/base height/.initial=.5} -\ctikzset{tripoles/pmos/conn height/.initial=0} -\ctikzset{tripoles/pmos/height/.initial=1.1} -\ctikzset{tripoles/pmos/base width/.initial=.5} -\ctikzset{tripoles/pmos/gate width/.initial=.62} -\ctikzset{tripoles/pmos/arrow pos/.initial=.4} -\ctikzset{tripoles/pmos/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pmos/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pmos/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pmos/curr direction/.initial=-1} - -\ctikzset{tripoles/nmosd/width/.initial=.7} -\ctikzset{tripoles/nmosd/gate height/.initial=.35} -\ctikzset{tripoles/nmosd/base height/.initial=.5} -\ctikzset{tripoles/nmosd/conn height/.initial=0} -\ctikzset{tripoles/nmosd/height/.initial=1.1} -\ctikzset{tripoles/nmosd/base width/.initial=.5} -\ctikzset{tripoles/nmosd/gate width/.initial=.62} -\ctikzset{tripoles/nmosd/arrow pos/.initial=.6} -\ctikzset{tripoles/nmosd/bodydiode scale/.initial=.3} -\ctikzset{tripoles/nmosd/bodydiode distance/.initial=.3} -\ctikzset{tripoles/nmosd/bodydiode conn/.initial=.6} -\ctikzset{tripoles/nmosd/curr direction/.initial=1} -\ctikzset{tripoles/nmosd/depletion width/.initial=.1} -\ctikzset{tripoles/nmosd/depletion color/.initial=default} - -\ctikzset{tripoles/pmosd/width/.initial=.7} -\ctikzset{tripoles/pmosd/gate height/.initial=.35} -\ctikzset{tripoles/pmosd/base height/.initial=.5} -\ctikzset{tripoles/pmosd/conn height/.initial=0} -\ctikzset{tripoles/pmosd/height/.initial=1.1} -\ctikzset{tripoles/pmosd/base width/.initial=.5} -\ctikzset{tripoles/pmosd/gate width/.initial=.62} -\ctikzset{tripoles/pmosd/arrow pos/.initial=.4} -\ctikzset{tripoles/pmosd/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pmosd/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pmosd/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pmosd/curr direction/.initial=-1} -\ctikzset{tripoles/pmosd/depletion width/.initial=.1} -\ctikzset{tripoles/pmosd/depletion color/.initial=default} -\ctikzset{tripoles/hemt/width/.initial=.7} -\ctikzset{tripoles/hemt/gate height/.initial=.35} -\ctikzset{tripoles/hemt/base height/.initial=.5} -\ctikzset{tripoles/hemt/conn height/.initial=0} -\ctikzset{tripoles/hemt/height/.initial=1.1} -\ctikzset{tripoles/hemt/base width/.initial=.5} -\ctikzset{tripoles/hemt/gate width/.initial=.62} -\ctikzset{tripoles/hemt/bodydiode scale/.initial=.3} -\ctikzset{tripoles/hemt/bodydiode distance/.initial=.3} -\ctikzset{tripoles/hemt/bodydiode conn/.initial=.6} -\ctikzset{tripoles/hemt/curr direction/.initial=1} - -\ctikzset{tripoles/nfet/width/.initial=.7} -\ctikzset{tripoles/nfet/gate height/.initial=.35} -\ctikzset{tripoles/nfet/base height/.initial=.5} -\ctikzset{tripoles/nfet/conn height/.initial=0} -\ctikzset{tripoles/nfet/height/.initial=1.1} -\ctikzset{tripoles/nfet/base width/.initial=.5} -\ctikzset{tripoles/nfet/gate width/.initial=.62} -\ctikzset{tripoles/nfet/bodydiode scale/.initial=.3} -\ctikzset{tripoles/nfet/bodydiode distance/.initial=.3} -\ctikzset{tripoles/nfet/bodydiode conn/.initial=.6} -\ctikzset{tripoles/nfet/curr direction/.initial=1} - -\ctikzset{tripoles/pfet/width/.initial=.7} -\ctikzset{tripoles/pfet/gate height/.initial=.35} -\ctikzset{tripoles/pfet/base height/.initial=.5} -\ctikzset{tripoles/pfet/conn height/.initial=0} -\ctikzset{tripoles/pfet/height/.initial=1.1} -\ctikzset{tripoles/pfet/base width/.initial=.5} -\ctikzset{tripoles/pfet/gate width/.initial=.62} -\ctikzset{tripoles/pfet/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pfet/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pfet/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pfet/curr direction/.initial=-1} - -\ctikzset{tripoles/nfetd/width/.initial=.7} -\ctikzset{tripoles/nfetd/gate height/.initial=.35} -\ctikzset{tripoles/nfetd/base height/.initial=.5} -\ctikzset{tripoles/nfetd/conn height/.initial=0} -\ctikzset{tripoles/nfetd/height/.initial=1.1} -\ctikzset{tripoles/nfetd/base width/.initial=.5} -\ctikzset{tripoles/nfetd/gate width/.initial=.62} -\ctikzset{tripoles/nfetd/bodydiode scale/.initial=.3} -\ctikzset{tripoles/nfetd/bodydiode distance/.initial=.3} -\ctikzset{tripoles/nfetd/bodydiode conn/.initial=.6} -\ctikzset{tripoles/nfetd/curr direction/.initial=1} - -\ctikzset{tripoles/pfetd/width/.initial=.7} -\ctikzset{tripoles/pfetd/gate height/.initial=.35} -\ctikzset{tripoles/pfetd/base height/.initial=.5} -\ctikzset{tripoles/pfetd/conn height/.initial=0} -\ctikzset{tripoles/pfetd/height/.initial=1.1} -\ctikzset{tripoles/pfetd/base width/.initial=.5} -\ctikzset{tripoles/pfetd/gate width/.initial=.62} -\ctikzset{tripoles/pfetd/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pfetd/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pfetd/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pfetd/curr direction/.initial=-1} - -\ctikzset{tripoles/nigfete/width/.initial=.7} -\ctikzset{tripoles/nigfete/gate height/.initial=.35} -\ctikzset{tripoles/nigfete/base height/.initial=.5} -\ctikzset{tripoles/nigfete/conn height/.initial=.35} -\ctikzset{tripoles/nigfete/height/.initial=1.1} -\ctikzset{tripoles/nigfete/base width/.initial=.5} -\ctikzset{tripoles/nigfete/gate width/.initial=.62} -\ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3} -\ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3} -\ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6} -\ctikzset{tripoles/nigfete/curr direction/.initial=1} - -\ctikzset{tripoles/nigfetd/width/.initial=.7} -\ctikzset{tripoles/nigfetd/gate height/.initial=.35} -\ctikzset{tripoles/nigfetd/base height/.initial=.5} -\ctikzset{tripoles/nigfetd/conn height/.initial=.35} -\ctikzset{tripoles/nigfetd/height/.initial=1.1} -\ctikzset{tripoles/nigfetd/base width/.initial=.5} -\ctikzset{tripoles/nigfetd/gate width/.initial=.62} -\ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3} -\ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3} -\ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6} -\ctikzset{tripoles/nigfetd/curr direction/.initial=1} - -\ctikzset{tripoles/nigfetebulk/width/.initial=.7} -\ctikzset{tripoles/nigfetebulk/gate height/.initial=.35} -\ctikzset{tripoles/nigfetebulk/base height/.initial=.5} -\ctikzset{tripoles/nigfetebulk/conn height/.initial=.35} -\ctikzset{tripoles/nigfetebulk/height/.initial=1.1} -\ctikzset{tripoles/nigfetebulk/base width/.initial=.5} -\ctikzset{tripoles/nigfetebulk/gate width/.initial=.62} -\ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3} -\ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3} -\ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6} -\ctikzset{tripoles/nigfetebulk/curr direction/.initial=1} - -\ctikzset{tripoles/pigfete/width/.initial=.7} -\ctikzset{tripoles/pigfete/gate height/.initial=.35} -\ctikzset{tripoles/pigfete/base height/.initial=.5} -\ctikzset{tripoles/pigfete/conn height/.initial=.35} -\ctikzset{tripoles/pigfete/height/.initial=1.1} -\ctikzset{tripoles/pigfete/base width/.initial=.5} -\ctikzset{tripoles/pigfete/gate width/.initial=.62} -\ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pigfete/curr direction/.initial=-1} - -\ctikzset{tripoles/pigfetd/width/.initial=.7} -\ctikzset{tripoles/pigfetd/gate height/.initial=.35} -\ctikzset{tripoles/pigfetd/base height/.initial=.5} -\ctikzset{tripoles/pigfetd/conn height/.initial=.35} -\ctikzset{tripoles/pigfetd/height/.initial=1.1} -\ctikzset{tripoles/pigfetd/base width/.initial=.5} -\ctikzset{tripoles/pigfetd/gate width/.initial=.62} -\ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pigfetd/curr direction/.initial=-1} - -\ctikzset{tripoles/pigfetebulk/width/.initial=.7} -\ctikzset{tripoles/pigfetebulk/gate height/.initial=.35} -\ctikzset{tripoles/pigfetebulk/conn height/.initial=.35} -\ctikzset{tripoles/pigfetebulk/base height/.initial=.5} -\ctikzset{tripoles/pigfetebulk/height/.initial=1.1} -\ctikzset{tripoles/pigfetebulk/base width/.initial=.5} -\ctikzset{tripoles/pigfetebulk/gate width/.initial=.62} -\ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1} - -\ctikzset{tripoles/npn/width/.initial=.6} -\ctikzset{tripoles/npn/base height/.initial=.45} -\ctikzset{tripoles/npn/base height 2/.initial=.15} -\ctikzset{tripoles/npn/base height/.initial=.4} -\ctikzset{tripoles/npn/conn height/.initial=0} -\ctikzset{tripoles/npn/height/.initial=1.1} -\ctikzset{tripoles/npn/base width/.initial=.5} -\ctikzset{tripoles/npn/arrow pos/.initial=.5} -\ctikzset{tripoles/npn/bodydiode scale/.initial=.3} -\ctikzset{tripoles/npn/bodydiode distance/.initial=.3} -\ctikzset{tripoles/npn/bodydiode conn/.initial=.6} -\ctikzset{tripoles/npn/curr direction/.initial=1} - -\ctikzset{tripoles/pnp/width/.initial=.6} -\ctikzset{tripoles/pnp/base height/.initial=.45} -\ctikzset{tripoles/pnp/base height 2/.initial=.15} -\ctikzset{tripoles/pnp/base height/.initial=.4} -\ctikzset{tripoles/pnp/conn height/.initial=0} -\ctikzset{tripoles/pnp/height/.initial=1.1} -\ctikzset{tripoles/pnp/base width/.initial=.5} -\ctikzset{tripoles/pnp/arrow pos/.initial=.5} -\ctikzset{tripoles/pnp/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pnp/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pnp/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pnp/curr direction/.initial=-1} - -\ctikzset{tripoles/pigbt/width/.initial=.6} -\ctikzset{tripoles/pigbt/gate height/.initial=.45} -\ctikzset{tripoles/pigbt/gate height 2/.initial=.15} -\ctikzset{tripoles/pigbt/base height/.initial=.4} -\ctikzset{tripoles/pigbt/outer base height/.initial=.4} -\ctikzset{tripoles/pigbt/outer base thickness/.initial=1} -\ctikzset{tripoles/pigbt/conn height/.initial=0} -\ctikzset{tripoles/pigbt/height/.initial=1.1} -\ctikzset{tripoles/pigbt/gate width/.initial=.62} -\ctikzset{tripoles/pigbt/base width/.initial=.5} -\ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pigbt/curr direction/.initial=-1} - -\ctikzset{tripoles/nigbt/width/.initial=.6} -\ctikzset{tripoles/nigbt/gate height/.initial=.45} -\ctikzset{tripoles/nigbt/gate height 2/.initial=.15} -\ctikzset{tripoles/nigbt/base height/.initial=.4} -\ctikzset{tripoles/nigbt/outer base height/.initial=.4} -\ctikzset{tripoles/nigbt/outer base thickness/.initial=1} -\ctikzset{tripoles/nigbt/conn height/.initial=0} -\ctikzset{tripoles/nigbt/height/.initial=1.1} -\ctikzset{tripoles/nigbt/gate width/.initial=.62} -\ctikzset{tripoles/nigbt/base width/.initial=.5} -\ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3} -\ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3} -\ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6} -\ctikzset{tripoles/nigbt/curr direction/.initial=1} - -\ctikzset{tripoles/Lpigbt/width/.initial=.6} -\ctikzset{tripoles/Lpigbt/gate height/.initial=.45} -\ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15} -\ctikzset{tripoles/Lpigbt/base height/.initial=.4} -\ctikzset{tripoles/Lpigbt/outer base height/.initial=.4} -\ctikzset{tripoles/Lpigbt/outer base thickness/.initial=1} -\ctikzset{tripoles/Lpigbt/conn height/.initial=.4} -\ctikzset{tripoles/Lpigbt/height/.initial=1.1} -\ctikzset{tripoles/Lpigbt/gate width/.initial=.62} -\ctikzset{tripoles/Lpigbt/base width/.initial=.5} -\ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3} -\ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3} -\ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6} -\ctikzset{tripoles/Lpigbt/curr direction/.initial=-1} - -\ctikzset{tripoles/Lnigbt/width/.initial=.6} -\ctikzset{tripoles/Lnigbt/gate height/.initial=.45} -\ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15} -\ctikzset{tripoles/Lnigbt/base height/.initial=.4} -\ctikzset{tripoles/Lnigbt/outer base height/.initial=.4} -\ctikzset{tripoles/Lnigbt/outer base thickness/.initial=1} -\ctikzset{tripoles/Lnigbt/conn height/.initial=.4} -\ctikzset{tripoles/Lnigbt/height/.initial=1.1} -\ctikzset{tripoles/Lnigbt/gate width/.initial=.62} -\ctikzset{tripoles/Lnigbt/base width/.initial=.5} -\ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3} -\ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3} -\ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6} -\ctikzset{tripoles/Lnigbt/curr direction/.initial=1} - -\ctikzset{tripoles/igbt/outer base height/.code={ - \ctikzset{tripoles/nigbt/outer base height/.initial=#1} - \ctikzset{tripoles/pigbt/outer base height/.initial=#1} - \ctikzset{tripoles/Lnigbt/outer base height/.initial=#1} - \ctikzset{tripoles/Lpigbt/outer base height/.initial=#1} - \ctikzset{tripoles/Lnigbt/conn height/.initial=#1} - \ctikzset{tripoles/Lpigbt/conn height/.initial=#1} -}} -\ctikzset{tripoles/igbt/outer base thickness/.code={ - \ctikzset{tripoles/nigbt/outer base thickness=#1} - \ctikzset{tripoles/pigbt/outer base thickness=#1} - \ctikzset{tripoles/Lnigbt/outer base thickness=#1} - \ctikzset{tripoles/Lpigbt/outer base thickness=#1} -}} - -\ctikzset{tripoles/njfet/width/.initial=.7} -\ctikzset{tripoles/njfet/gate height/.initial=.5} -\ctikzset{tripoles/njfet/gate height 2/.initial=.35} -\ctikzset{tripoles/njfet/gate width/.initial=.5} -\ctikzset{tripoles/njfet/conn height/.initial=.35} -\ctikzset{tripoles/njfet/height/.initial=1.1} -\ctikzset{tripoles/njfet/bodydiode scale/.initial=.3} -\ctikzset{tripoles/njfet/bodydiode distance/.initial=.3} -\ctikzset{tripoles/njfet/bodydiode conn/.initial=.6} -\ctikzset{tripoles/njfet/curr direction/.initial=1} - -\ctikzset{tripoles/pjfet/width/.initial=.7} -\ctikzset{tripoles/pjfet/gate height/.initial=.5} -\ctikzset{tripoles/pjfet/gate height 2/.initial=.35} -\ctikzset{tripoles/pjfet/gate width/.initial=.5} -\ctikzset{tripoles/pjfet/conn height/.initial=.35} -\ctikzset{tripoles/pjfet/height/.initial=1.1} -\ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3} -\ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3} -\ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6} -\ctikzset{tripoles/pjfet/curr direction/.initial=-1} - -\ctikzset{tripoles/isfet/width/.initial=1} -\ctikzset{tripoles/isfet/gate height/.initial=.35} -\ctikzset{tripoles/isfet/base height/.initial=.5} -\ctikzset{tripoles/isfet/height/.initial=1.1} -\ctikzset{tripoles/isfet/base width/.initial=.3} -\ctikzset{tripoles/isfet/gate width/.initial=.5} -\ctikzset{tripoles/isfet/conn height/.initial=0} -\ctikzset{tripoles/isfet/wave width/.initial=.16} -\ctikzset{tripoles/isfet/wave amp/.initial=.06} -\ctikzset{tripoles/isfet/waves y sep/.initial=.22} -\ctikzset{tripoles/isfet/waves x sep/.initial=.8} -\ctikzset{tripoles/isfet/bodydiode scale/.initial=.3} -\ctikzset{tripoles/isfet/bodydiode distance/.initial=.3} -\ctikzset{tripoles/isfet/bodydiode conn/.initial=.6} -\ctikzset{tripoles/isfet/curr direction/.initial=1} -% -% multi-emitter and multi-collector BJTs by Romano Giannetti -% -\ctikzset{tripoles/bjt/emitters/.initial=1} -\ctikzset{tripoles/bjt/collectors/.initial=1} -\pgfkeys{/tikz/emitters/.add code={}{\ctikzset{tripoles/bjt/emitters=#1}}} -\pgfkeys{/tikz/collectors/.add code={}{\ctikzset{tripoles/bjt/collectors=#1}}} -\ctikzset{tripoles/bjt/pins width/.initial=0.3} -\pgfkeys{/tikz/bjt pins width/.add code={}{\ctikzset{tripoles/bjt/pins width=#1}}} -\ctikzset{tripoles/bjt/multi height/.initial=.5} -\pgfkeys{/tikz/bjt multi height/.add code={}{\ctikzset{tripoles/bjt/multi height/.initial=#1}}} -% -\ctikzset{tripoles/bjt/width/.initial=.3} -\ctikzset{tripoles/bjt/base height 2/.initial=.4} -\ctikzset{tripoles/bjt/base height/.initial=1.1} -\ctikzset{tripoles/bjt/height/.initial=.4} -\ctikzset{tripoles/bjt/base width/.initial=1} -\ctikzset{tripoles/bjt/arrow pos/.initial=.5} -% do NOT touch these two! -\ctikzset{tripoles/bjt/npn/curr direction/.initial=1} -\ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1} - -%% transistors stop here -%%>>> - -% Electronic tubes: diodetube, triode, tetrode and pentode%<<<1 -\ctikzset{tubes/width/.initial=1} % relative width -\ctikzset{tubes/height/.initial=1.4} % relative height -\ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle -\ctikzset{tubes/anode distance/.initial=0.40} % distance from center -\ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate -\ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center -\ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes -\ctikzset{tubes/grid separation/.initial=0.2} % separation between grids -\ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center -\ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid -\ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode -\ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire -\ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side -\ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode -\ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint - -\newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse -\pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} -\ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} -\newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse -\pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} -\ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} -\newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse -\pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}} -\ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}% -%>>> - -%% Logic ports%<<<1 -%% beware that the third option is in IEEE ports in pgfcircmultipoles.tex - -% switches for logic gates -% -\pgfkeys{/tikz/number inputs/.initial=0} -\pgfkeys{/tikz/number inputs/.default=0} - -\newif\ifpgf@circuit@europeanlogicport -\ctikzset{logic ports/.is choice} -\ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue - \tikzset{and port/.style={shape=european and port}}% - \tikzset{or port/.style={shape=european or port}}% - \tikzset{xor port/.style={shape=european xor port}}% - \tikzset{buffer port/.style={shape=european buffer port}}% - \tikzset{not port/.style={shape=european not port}}% - \tikzset{nand port/.style={shape=european nand port}}% - \tikzset{nor port/.style={shape=european nor port}}% - \tikzset{xnor port/.style={shape=european xnor port}}% - % there is no Schmitt ports in european style (yet) - \tikzset{schmitt port/.style={shape=schmitt}}% - \tikzset{invschmitt port/.style={shape=invschmitt}}% -}} -\ctikzset{logic ports/american/.code= {\pgf@circuit@europeanlogicportfalse - \tikzset{and port/.style={shape=american and port}}% - \tikzset{or port/.style={shape=american or port}}% - \tikzset{xor port/.style={shape=american xor port}}% - \tikzset{buffer port/.style={shape=american buffer port}}% - \tikzset{not port/.style={shape=american not port}}% - \tikzset{nand port/.style={shape=american nand port}}% - \tikzset{nor port/.style={shape=american nor port}}% - \tikzset{xnor port/.style={shape=american xnor port}}% - \tikzset{schmitt port/.style={shape=schmitt}}% - \tikzset{invschmitt port/.style={shape=invschmitt}}% -}} - -\ctikzset{logic ports origin/.is choice} -\ctikzset{logic ports origin/legacy/.code={ - \ctikzset{tripoles/american and port/origin/.initial=0.8}% - \ctikzset{tripoles/american nand port/origin/.initial=0.8}% - \ctikzset{tripoles/american nor port/origin/.initial=0.8}% - \ctikzset{tripoles/american or port/origin/.initial=0.8}% - \ctikzset{tripoles/american xor port/origin/.initial=0.8}% - \ctikzset{tripoles/american xnor port/origin/.initial=0.8}% - \ctikzset{tripoles/european and port/origin/.initial=0.8}% - \ctikzset{tripoles/european nand port/origin/.initial=0.8}% - \ctikzset{tripoles/european or port/origin/.initial=0.8}% - \ctikzset{tripoles/european nor port/origin/.initial=0.8}% - \ctikzset{tripoles/european xor port/origin/.initial=0.8}% - \ctikzset{tripoles/european xnor port/origin/.initial=0.8}% - \ctikzset{tripoles/european buffer port/origin/.initial=0.8}% - \ctikzset{tripoles/european not port/origin/.initial=0.8}% - }% -} -\ctikzset{logic ports origin/center/.code={% - \ctikzset{tripoles/american and port/origin/.initial=0}% - \ctikzset{tripoles/american nand port/origin/.initial=0}% - \ctikzset{tripoles/american nor port/origin/.initial=0}% - \ctikzset{tripoles/american or port/origin/.initial=0}% - \ctikzset{tripoles/american xor port/origin/.initial=0}% - \ctikzset{tripoles/american xnor port/origin/.initial=0}% - \ctikzset{tripoles/european and port/origin/.initial=0}% - \ctikzset{tripoles/european nand port/origin/.initial=0}% - \ctikzset{tripoles/european or port/origin/.initial=0}% - \ctikzset{tripoles/european nor port/origin/.initial=0}% - \ctikzset{tripoles/european xor port/origin/.initial=0}% - \ctikzset{tripoles/european xnor port/origin/.initial=0}% - \ctikzset{tripoles/european buffer port/origin/.initial=0}% - \ctikzset{tripoles/european not port/origin/.initial=0}% - }% -} - -\newif\ifpgfcirc@roundy@or@shapes\pgfcirc@roundy@or@shapesfalse -\ctikzset{american or shape/.is choice} -\ctikzset{american or shape/roundy/.code={\pgfcirc@roundy@or@shapestrue}} -\ctikzset{american or shape/pointy/.code={\pgfcirc@roundy@or@shapesfalse}} - -\newif\ifpgfcirc@draw@input@leads\pgfcirc@draw@input@leadstrue -\ctikzset{logic ports draw input leads/.is choice} -\ctikzset{logic ports draw input leads/true/.code={\pgfcirc@draw@input@leadstrue}} -\ctikzset{logic ports draw input leads/false/.code={\pgfcirc@draw@input@leadsfalse}} -\tikzset{input leads/.code={\pgfcirc@draw@input@leadstrue}} -\tikzset{no input leads/.code={\pgfcirc@draw@input@leadsfalse}} - -\newif\ifpgfcirc@draw@output@leads\pgfcirc@draw@output@leadstrue -\ctikzset{logic ports draw output leads/.is choice} -\ctikzset{logic ports draw output leads/true/.code={\pgfcirc@draw@output@leadstrue}} -\ctikzset{logic ports draw output leads/false/.code={\pgfcirc@draw@output@leadsfalse}} -\tikzset{output leads/.code={\pgfcirc@draw@output@leadstrue}} -\tikzset{no output leads/.code={\pgfcirc@draw@output@leadsfalse}} - -\ctikzset{logic ports draw leads/.is choice} -\ctikzset{logic ports draw leads/true/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}} -\ctikzset{logic ports draw leads/false/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}} -\tikzset{all leads/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}} -\tikzset{no leads/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}} - -% adding a different style of xnor port -% see https://github.com/circuitikz/circuitikz/issues/467 -\ctikzset{european xnor style/.is choice} -\ctikzset{european xnor style/default/.code={% - \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}}% -} -\ctikzset{european xnor style/direct/.code={% - \pgfcircdeclareeurologicport{xnor}{$=$}{\pgf@circ@res@count}{}}% -} - - -% old, legacy keys that should be killed over -\ctikzset{bipoles/buffer/height/.initial=1} -\ctikzset{bipoles/buffer/width/.initial=1} -\ctikzset{bipoles/not port/width/.initial=1} -\ctikzset{bipoles/not port/height/.initial=.8} -\ctikzset{bipoles/not port/circle width/.initial=.15} - -\ctikzset{tripoles/american and port/width/.initial=1.1} -\ctikzset{tripoles/american and port/height/.initial=.8} -\ctikzset{tripoles/american and port/port width/.initial=.7} -\ctikzset{tripoles/american and port/input height/.initial=.5} -\ctikzset{tripoles/american nand port/width/.initial=1.1} -\ctikzset{tripoles/american nand port/height/.initial=.8} -\ctikzset{tripoles/american nand port/port width/.initial=.7} -\ctikzset{tripoles/american nand port/circle width/.initial=.15} -\ctikzset{tripoles/american nand port/input height/.initial=.5} -\ctikzset{tripoles/american or port/width/.initial=1.1} -\ctikzset{tripoles/american or port/height/.initial=.8} -\ctikzset{tripoles/american or port/port width/.initial=.7} -\ctikzset{tripoles/american or port/input height/.initial=.5} -\ctikzset{tripoles/american or port/input skip/.initial=.25} -\ctikzset{tripoles/american or port/aaa/.initial=.6} -\ctikzset{tripoles/american or port/bbb/.initial=.4} -\ctikzset{tripoles/american or port/ccc/.initial=.5} -\ctikzset{tripoles/american or port/ddd/.initial=.0} -\ctikzset{tripoles/american nor port/width/.initial=1.1} -\ctikzset{tripoles/american nor port/height/.initial=.8} -\ctikzset{tripoles/american nor port/port width/.initial=.7} -\ctikzset{tripoles/american nor port/input height/.initial=.5} -\ctikzset{tripoles/american nor port/input skip/.initial=.25} -\ctikzset{tripoles/american nor port/circle width/.initial=.15} -\ctikzset{tripoles/american nor port/aaa/.initial=.6} -\ctikzset{tripoles/american nor port/bbb/.initial=.4} -\ctikzset{tripoles/american nor port/ccc/.initial=.5} -\ctikzset{tripoles/american nor port/ddd/.initial=.0} -\ctikzset{tripoles/american xor port/width/.initial=1.1} -\ctikzset{tripoles/american xor port/height/.initial=.8} -\ctikzset{tripoles/american xor port/port width/.initial=.7} -\ctikzset{tripoles/american xor port/input height/.initial=.5} -\ctikzset{tripoles/american xor port/input skip/.initial=.15} -\ctikzset{tripoles/american xor port/distance/.initial=.1} -\ctikzset{tripoles/american xnor port/width/.initial=1.1} -\ctikzset{tripoles/american xnor port/height/.initial=.8} -\ctikzset{tripoles/american xnor port/port width/.initial=.7} -\ctikzset{tripoles/american xnor port/input height/.initial=.5} -\ctikzset{tripoles/american xnor port/input skip/.initial=.15} -\ctikzset{tripoles/american xnor port/distance/.initial=.1} -\ctikzset{tripoles/american xnor port/circle width/.initial=.15} -\ctikzset{tripoles/american and port/origin/.initial=0.8} -\ctikzset{tripoles/american and port/inputs/.initial=2} -% variable number of inputs -\ctikzset{tripoles/american nand port/origin/.initial=0.8} -\ctikzset{tripoles/american nand port/inputs/.initial=2} -\ctikzset{tripoles/american nor port/origin/.initial=0.8} -\ctikzset{tripoles/american nor port/inputs/.initial=2} -\ctikzset{tripoles/american nor port/angle/.initial=70} -\ctikzset{tripoles/american nor port/inner/.initial=0.3} -\ctikzset{tripoles/american or port/origin/.initial=0.8} -\ctikzset{tripoles/american or port/inputs/.initial=2} -\ctikzset{tripoles/american or port/angle/.initial=70} -\ctikzset{tripoles/american or port/inner/.initial=0.3} -\ctikzset{tripoles/american xor port/origin/.initial=0.8} -\ctikzset{tripoles/american xor port/inputs/.initial=2} -\ctikzset{tripoles/american xor port/angle/.initial=70} -\ctikzset{tripoles/american xor port/inner/.initial=0.3} -\ctikzset{tripoles/american xnor port/origin/.initial=0.8} -\ctikzset{tripoles/american xnor port/inputs/.initial=2} -\ctikzset{tripoles/american xnor port/angle/.initial=70} -\ctikzset{tripoles/american xnor port/inner/.initial=0.3} - -\ctikzset{tripoles/european and port/width/.initial=1.4} -\ctikzset{tripoles/european and port/height/.initial=.65} -\ctikzset{tripoles/european and port/reserved/.initial=.6} -\ctikzset{tripoles/european and port/input height/.initial=.6} -\ctikzset{tripoles/european or port/width/.initial=1.4} -\ctikzset{tripoles/european or port/height/.initial=.65} -\ctikzset{tripoles/european or port/reserved/.initial=.6} -\ctikzset{tripoles/european or port/input height/.initial=.6} -\ctikzset{tripoles/european xor port/width/.initial=1.4} -\ctikzset{tripoles/european xor port/height/.initial=.65} -\ctikzset{tripoles/european xor port/reserved/.initial=.6} -\ctikzset{tripoles/european xor port/input height/.initial=.6} -\ctikzset{tripoles/european nand port/width/.initial=1.4} -\ctikzset{tripoles/european nand port/not height/.initial=.3} -\ctikzset{tripoles/european nand port/not width/.initial=.8} -\ctikzset{tripoles/european nand port/height/.initial=.65} -\ctikzset{tripoles/european nand port/reserved/.initial=.6} -\ctikzset{tripoles/european nand port/input height/.initial=.6} -\ctikzset{tripoles/european buffer port/width/.initial=1.4} -\ctikzset{tripoles/european buffer port/not height/.initial=.3} -\ctikzset{tripoles/european buffer port/not width/.initial=.8} -\ctikzset{tripoles/european buffer port/height/.initial=.65} -\ctikzset{tripoles/european buffer port/reserved/.initial=.6} -\ctikzset{tripoles/european buffer port/input height/.initial=0} -\ctikzset{tripoles/european not port/width/.initial=1.4} -\ctikzset{tripoles/european not port/not height/.initial=.3} -\ctikzset{tripoles/european not port/not width/.initial=.8} -\ctikzset{tripoles/european not port/height/.initial=.65} -\ctikzset{tripoles/european not port/reserved/.initial=.6} -\ctikzset{tripoles/european not port/input height/.initial=0} -\ctikzset{tripoles/european xnor port/width/.initial=1.4} -\ctikzset{tripoles/european xnor port/not height/.initial=.3} -\ctikzset{tripoles/european xnor port/not width/.initial=.8} -\ctikzset{tripoles/european xnor port/height/.initial=.65} -\ctikzset{tripoles/european xnor port/reserved/.initial=.6} -\ctikzset{tripoles/european xnor port/input height/.initial=.6} -\ctikzset{tripoles/european nor port/width/.initial=1.4} -\ctikzset{tripoles/european nor port/not height/.initial=.3} -\ctikzset{tripoles/european nor port/not width/.initial=.8} -\ctikzset{tripoles/european nor port/height/.initial=.65} -\ctikzset{tripoles/european nor port/reserved/.initial=.6} -\ctikzset{tripoles/european nor port/input height/.initial=.6} -% variable number of inputs -\ctikzset{tripoles/european and port/origin/.initial=0.8} -\ctikzset{tripoles/european and port/inputs/.initial=2} -\ctikzset{tripoles/european nand port/origin/.initial=0.8} -\ctikzset{tripoles/european nand port/inputs/.initial=2} -\ctikzset{tripoles/european or port/origin/.initial=0.8} -\ctikzset{tripoles/european or port/inputs/.initial=2} -\ctikzset{tripoles/european nor port/origin/.initial=0.8} -\ctikzset{tripoles/european nor port/inputs/.initial=2} -\ctikzset{tripoles/european xor port/origin/.initial=0.8} -\ctikzset{tripoles/european xor port/inputs/.initial=2} -\ctikzset{tripoles/european xnor port/origin/.initial=0.8} -\ctikzset{tripoles/european xnor port/inputs/.initial=2} -\ctikzset{tripoles/european buffer port/origin/.initial=0.8} -\ctikzset{tripoles/european buffer port/inputs/.initial=1}% -\ctikzset{tripoles/european not port/origin/.initial=0.8} -\ctikzset{tripoles/european not port/inputs/.initial=1}% -%%% parameters that are not used anymore after multi-input -%%% gates --- left for compatibility of source code. -\ctikzset{tripoles/american xor port/aaa/.initial=.6} -\ctikzset{tripoles/american xor port/bbb/.initial=.4} -\ctikzset{tripoles/american xor port/ccc/.initial=.5} -\ctikzset{tripoles/american xor port/ddd/.initial=.0} -\ctikzset{tripoles/american xnor port/aaa/.initial=.6} -\ctikzset{tripoles/american xnor port/bbb/.initial=.4} -\ctikzset{tripoles/american xnor port/ccc/.initial=.5} -\ctikzset{tripoles/american xnor port/ddd/.initial=.0} -%%>>> - -% flip flops and muxdemxes%<<<1 - -%% flip-flop specific keys (most others are the same as chips) - -\ctikzset{multipoles/flipflop/font/.initial=\pgf@circ@font@small} -\ctikzset{multipoles/flipflop/fontud/.initial=\pgf@circ@font@tiny} -\ctikzset{multipoles/flipflop/width/.initial=1.2} -\ctikzset{multipoles/flipflop/pin spacing/.initial=0.6} -\ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2} - -%% muxdemuxes keys - -\ctikzset{multipoles/muxdemux/base len/.initial=0.4} -\ctikzset{multipoles/muxdemux/Lh/.initial=8.0} -\ctikzset{multipoles/muxdemux/Rh/.initial=6.0} -\ctikzset{multipoles/muxdemux/w/.initial=3.0} -\ctikzset{multipoles/muxdemux/inset w/.initial=0.0} -\ctikzset{multipoles/muxdemux/inset Lh/.initial=0.0} -\ctikzset{multipoles/muxdemux/inset Rh/.initial=0.0} -\ctikzset{multipoles/muxdemux/NL/.initial=8} -\ctikzset{multipoles/muxdemux/NR/.initial=1} -\ctikzset{multipoles/muxdemux/NB/.initial=3} -\ctikzset{multipoles/muxdemux/NT/.initial=0} -\ctikzset{multipoles/muxdemux/square pins/.initial=0}% -%>>> - -% Amplifiers%<<<1 -% -% switches for op amps -% changing input polarity -% -\newif\ifpgf@circuit@oa@iplusup\pgf@circuit@oa@iplusupfalse -\pgfkeys{/tikz/noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}} -\ctikzset{noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}} -\pgfkeys{/tikz/noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}} -\ctikzset{noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}} -% -% changing output polarity (for fully diff objects) -% -\newif\ifpgf@circuit@oa@oplusup\pgf@circuit@oa@oplusuptrue -\pgfkeys{/tikz/noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} -\ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} -\pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} -\ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} - -% Operational amplifier -\ctikzset{tripoles/op amp/width/.initial=1.7} % Total width -\ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length -\ctikzset{tripoles/op amp/height/.initial=1.4} % Total height -\ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation -\ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position -\ctikzset{tripoles/op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! - -% Fully differential operational amplifier -\ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width -\ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length -\ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height -\ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation -\ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation -\ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position -\ctikzset{tripoles/fd op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! - -\ctikzset{tripoles/en amp/width/.initial=1.7} -\ctikzset{tripoles/en amp/port width/.initial=.7} -\ctikzset{tripoles/en amp/height/.initial=1.6} -\ctikzset{tripoles/en amp/input height/.initial=.3} -\ctikzset{tripoles/en amp/up pos/.initial=.45} -\ctikzset{tripoles/en amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! -\ctikzset{tripoles/en amp/font2/.initial=\pgf@circ@font@twelve} % Absolute font size needed! -\ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}} -\tikzset{ - en amp text/.code = {% - \ctikzsetvalof{tripoles/en amp/text}{#1}% - }, - en amp text A/.code = {% - \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}% - }, -} - -% Transconductance amplifier -\ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width -\ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length -\ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid -\ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid -\ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation -\ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position -\ctikzset{tripoles/gm amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! - -% Instrumentation amplifier -\ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width -\ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length -\ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid -\ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid -\ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation -\ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position -\ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position -\ctikzset{tripoles/inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! - -% Instrumentation amplifier with differential output -\ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width -\ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length -\ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid -\ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid -\ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation -\ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation -\ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position -\ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position -\ctikzset{tripoles/fd inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! - -% Instrumentation amplifier with gain resistor terminals -\ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width -\ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length -\ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid -\ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid -\ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation -\ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position -\ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position -\ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation -\ctikzset{tripoles/inst amp ra/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! - -% Plain amplifier -\ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width -\ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length -\ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height -\ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation -\ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position - -% changing fonts and symbols of amplifiers -\ctikzset{amplifiers/symbol font/.code={% - \ctikzset{tripoles/inst amp ra/font=#1}% - \ctikzset{tripoles/fd inst amp/font=#1}% - \ctikzset{tripoles/inst amp/font=#1}% - \ctikzset{tripoles/gm amp/font=#1}% - \ctikzset{tripoles/en amp/font=#1}% - \ctikzset{tripoles/fd op amp/font=#1}% - \ctikzset{tripoles/op amp/font=#1}% -}} -\ctikzset{amplifiers/plus/.initial={$+$}} -\ctikzset{amplifiers/minus/.initial={$-$}} -\tikzset{amp symbol font/.code={% - \ctikzset{amplifiers/symbol font={#1}}% - } -} -\tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}} -\tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}} -\def\pgf@circ@ampli@plus{\ctikzvalof{amplifiers/plus}} -\def\pgf@circ@ampli@minus{\ctikzvalof{amplifiers/minus}} -%%>>> - -% Transformers%<<<1 - -\ctikzset{quadpoles/transformer/inner/.initial=0.4} -\ctikzset{quadpoles/transformer/width/.initial=1.5} -\ctikzset{quadpoles/transformer/width1/.initial=.4} -\ctikzset{quadpoles/transformer/height/.initial=1.5} -\ctikzset{quadpoles/transformer/height1/.initial=.8} -\ctikzset{quadpoles/transformer core/inner/.initial=0.4} -\ctikzset{quadpoles/transformer core/width/.initial=1.5} -\ctikzset{quadpoles/transformer core/height/.initial=1.5} -\ctikzset{quadpoles/transformer core/core height/.initial=.5} -\ctikzset{quadpoles/transformer core/core width/.initial=.05} -\ctikzset{quadpoles/gyrator/inner/.initial=0.4} -\ctikzset{quadpoles/gyrator/width/.initial=1.5} -\ctikzset{quadpoles/gyrator/height/.initial=1.5} -\ctikzset{quadpoles/fourport/width/.initial=1.3} -\ctikzset{quadpoles/fourport/height/.initial=1.3} -\ctikzset{quadpoles/coupler/width/.initial=1.3} -\ctikzset{quadpoles/coupler/height/.initial=1.3} -\ctikzset{quadpoles/coupler2/width/.initial=1.3} -\ctikzset{quadpoles/coupler2/height/.initial=1.3} - -\ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1} - -\ctikzset{quadpoles style/.is choice} -\ctikzset{quadpoles style/inward/.code={% default value - \ctikzset{quadpoles/transformer/inner=0.4}% - \ctikzset{quadpoles/transformer/width=1.5}% - \ctikzset{quadpoles/transformer core/inner=0.4}% - \ctikzset{quadpoles/transformer core/width=1.5}% - \ctikzset{quadpoles/gyrator/inner=0.4}% - \ctikzset{quadpoles/gyrator/width=1.5}% - }% -} -\ctikzset{quadpoles style/inline/.code={% now horizontal baffle - \ctikzset{quadpoles/transformer/inner=1}% - \ctikzset{quadpoles/transformer/width=0.6}% - \ctikzset{quadpoles/transformer core/inner=1}% - \ctikzset{quadpoles/transformer core/width=0.6}% - \ctikzset{quadpoles/gyrator/inner=1} % FIXME - \ctikzset{quadpoles/gyrator/width=0.6}% - }% -} -%%>>> - -% seven segment displays by RGtti%<<<1 - -\newif\ifpgf@circ@sevenseg@dot -\newif\ifpgf@circ@sevenseg@box -\def\pgf@circ@sevenseg@dotstate{empty} -\ctikzset{seven seg/.is family} -\ctikzset{seven seg/dot/.is choice} -% none means no dot, not space for it. Empty means no dot, but space -\ctikzset{seven seg/dot/none/.code={\pgf@circ@sevenseg@dotfalse}} -\ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}} -\ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}} -\ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}} -% -\ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen -\ctikzset{seven seg/thickness/.initial=4pt}% segment thickness -\ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments -\ctikzset{seven seg/box sep/.initial=1pt}% external box gap -\ctikzset{seven seg/color on/.initial=red}% color for segment "on" -\ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off" -\ctikzset{seven seg/box/.is choice} -\ctikzset{seven seg/box/off/.code={\pgf@circ@sevenseg@boxfalse}} -\ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@boxtrue}} - -\ctikzset{seven seg/bits/.initial=0000000} - -\ctikzset{seven seg/value/.code={% - \edef\@@tmp{#1}% - \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi - \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi - \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi - \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi - \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi - \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi - \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi - \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi - \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi - \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi - \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi - \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi - \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi - \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi - \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi - \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi - \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi - \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi - \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi - \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi - \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi - \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi - \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi - \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi - \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi - \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi - \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi - \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi - \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi -}} - -\tikzset{% - seven segment val/.style args={#1dot#2box#3}{% - shape=bare7seg, - /tikz/circuitikz/seven seg/value=#1, - /tikz/circuitikz/seven seg/dot=#2, - /tikz/circuitikz/seven seg/box=#3, - }, - seven segment bits/.style args={#1dot#2box#3}{% - shape=bare7seg, - /tikz/circuitikz/seven seg/bits=#1, - /tikz/circuitikz/seven seg/dot=#2, - /tikz/circuitikz/seven seg/box=#3, - }, -} -%%>>> - -% Options for twoports and blocks%<<<1 - -% Option ">" for twoports -\newif\ifpgf@circuit@inputarrow -\ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}} -\ctikzset{inputarrow/.is choice} -\ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}} -\ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}} - -% Option "boxed" for nodes and twoports -\newif\ifpgf@circuit@boxed -\pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue}} -\ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue}} -\pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue}} -\ctikzset{box/.add code={}{\pgf@circuit@boxedtrue}} - -% Option "dashed" for nodes and twoports -\newif\ifpgf@circuit@dashed -\pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}} -\ctikzset{dashed/.add code={}{\pgf@circuit@dashedtrue}}% -%>>> - -% Chips and Rotary switches (multipoles) %<<<1 -% -\ctikzset{multipoles/thickness/.initial=2} -\ctikzset{multipoles/font/.initial=\pgf@circ@font@tiny} -% DIP (dual in line package) chips -\ctikzset{multipoles/dipchip/width/.initial=1.2} -\ctikzset{multipoles/dipchip/num pins/.initial=8} -\ctikzset{multipoles/dipchip/pin spacing/.initial=0.4} -\pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/dipchip/num pins=#1}}} -% QFP (quad flat package) chips -\ctikzset{multipoles/qfpchip/num pins/.initial=8} -\ctikzset{multipoles/qfpchip/pin spacing/.initial=0.4} -\pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/qfpchip/num pins=#1}}} -% chip numbers -\newif\ifpgf@circuit@chip@shownumbers\pgf@circuit@chip@shownumberstrue -\pgfkeys{/tikz/show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}} -\ctikzset{show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}} -\pgfkeys{/tikz/hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}} -\ctikzset{hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}} -\newif\ifpgf@circuit@chip@straightnumbers\pgf@circuit@chip@straightnumberstrue -\pgfkeys{/tikz/straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}} -\ctikzset{straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}} -\pgfkeys{/tikz/rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}} -\ctikzset{rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}} -% external chip pins -\ctikzset{multipoles/external pins thickness/.initial=1} -\ctikzset{multipoles/external pins width/.initial=0.2} -\ctikzset{multipoles/external pad fraction/.initial=0} -\pgfkeys{/tikz/external pins width/.add code={}{\ctikzset{multipoles/external pins width=#1}}} -\pgfkeys{/tikz/external pad fraction/.add code={}{\ctikzset{multipoles/external pad fraction=#1}}} -% topmarks -\newif\ifpgf@circuit@chip@topmark\pgf@circuit@chip@topmarktrue -\pgfkeys{/tikz/topmark/.add code={}{\pgf@circuit@chip@topmarktrue}} -\ctikzset{topmark/.add code={}{\pgf@circuit@chip@topmarktrue}} -\pgfkeys{/tikz/no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}} -\ctikzset{no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}} - -% rotary switch by Romano -\ctikzset{multipoles/rotary/thickness/.initial=1} -\ctikzset{multipoles/rotary/shape/.initial=ocirc} -\ctikzset{multipoles/rotary/channels/.initial=5} -\ctikzset{multipoles/rotary/angle/.initial=60} -\ctikzset{multipoles/rotary/wiper/.initial=20} -\ctikzset{multipoles/rotary/arrow/.is choice} -\newif\ifpgf@circ@rotaryarrow\pgf@circ@rotaryarrowfalse -\newif\ifpgf@circ@rotaryarrow@cw\pgf@circ@rotaryarrow@cwfalse -\newif\ifpgf@circ@rotaryarrow@ccw\pgf@circ@rotaryarrow@ccwfalse -\ctikzset{multipoles/rotary/arrow/none/.code={\pgf@circ@rotaryarrowfalse\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwfalse}} -\ctikzset{multipoles/rotary/arrow/both/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwtrue}} -\ctikzset{multipoles/rotary/arrow/cw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwfalse}} -\ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwtrue}} - -\tikzset{% - rotary switch/.style args={#1in#2wiper#3}{% - shape=rotaryswitch, - /tikz/circuitikz/multipoles/rotary/channels=#1, - /tikz/circuitikz/multipoles/rotary/angle=#2, - /tikz/circuitikz/multipoles/rotary/wiper=#3, - }, - rotary switch -/.style args={#1in#2wiper#3}{ - rotary switch=#1 in #2 wiper #3, - /tikz/circuitikz/multipoles/rotary/arrow=none, - }, - rotary switch <-/.style args={#1in#2wiper#3}{ - rotary switch=#1 in #2 wiper #3, - /tikz/circuitikz/multipoles/rotary/arrow=ccw, - }, - rotary switch ->/.style args={#1in#2wiper#3}{ - rotary switch=#1 in #2 wiper #3, - /tikz/circuitikz/multipoles/rotary/arrow=cw, - }, - rotary switch <->/.style args={#1in#2wiper#3}{ - rotary switch=#1 in #2 wiper #3, - /tikz/circuitikz/multipoles/rotary/arrow=both, - }, - % Notice that these should be the same as the initial values of the keys - rotary switch/.default={5 in 60 wiper 20}, - rotary switch -/.default={5 in 60 wiper 20}, - rotary switch <-/.default={5 in 60 wiper 20}, - rotary switch ->/.default={5 in 60 wiper 20}, - rotary switch <->/.default={5 in 60 wiper 20}, -} -%%>>> - -% %Mechanical section%<<<1 -\ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8} -\ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6} -\ctikzset{bipoles/spring/height/.initial=.5} -\ctikzset{bipoles/spring/width/.initial=.5} -\ctikzset{bipoles/inerter/height/.initial=.7} -\ctikzset{bipoles/inerter/width/.initial=.175} -\ctikzset{bipoles/mass/height/.initial=.55} -\ctikzset{bipoles/mass/box height/.initial=.4} -\ctikzset{bipoles/mass/width/.initial=.5} - -\ctikzset{bipoles/damper/height/.initial=.35} -\ctikzset{bipoles/damper/length/.initial=.3} -\ctikzset{bipoles/damper/width/.initial=.4} -%%>>> - -% powerelectronic blocks%<<<1 -\ctikzset{bipoles/sacdc/width/.initial=.7} -\ctikzset{bipoles/sdcac/width/.initial=.7} -\ctikzset{bipoles/tacdc/width/.initial=.7} -\ctikzset{bipoles/tdcac/width/.initial=.7} -\ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole? -%>>> - % voltage and current options%<<<1 % \ctikzset{current arrow scale/.initial=16} @@ -2260,60 +824,5 @@ \tikzset{raised voltages/.style = {\circuitikzbasekey/voltage = raised}} %%>>> -% special cases for voltage positions%<<<1 -% the KIND is the node name without SHAPE -% See the definition above for meaning -% if bipoles/KIND/voltage/straight label distance is not defined, it uses the height -% if bipoles/KIND/voltage/additional shift is not defined, it is 0 (extra distance) -% -\ctikzset{bipoles/generic/voltage/distance from node/.initial=0.4} -\ctikzset{bipoles/generic/voltage/bump b/.initial=2} -% -\ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4} -\ctikzset{bipoles/ageneric/voltage/bump b/.initial=2} -% -\ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4} -\ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2} -% -\ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4} -\ctikzset{bipoles/memristor/voltage/bump b/.initial=2} -% -\ctikzset{bipoles/tline/voltage/bump b/.initial=2.4} -% -\ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4} -\ctikzset{bipoles/varistor/voltage/american label distance/.initial=1.8} -% -\ctikzset{bipoles/photoresistor/voltage/bump b/.initial=1.6} -% -\ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4} -\ctikzset{bipoles/thermistor/voltage/european label distance/.initial=0.8} -\ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6} -\ctikzset{bipoles/thermistorntc/voltage/european label distance/.initial=0.8} -\ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6} -\ctikzset{bipoles/thermistorptc/voltage/european label distance/.initial=0.8} -% -\ctikzset{bipoles/ccapacitor/voltage/bump b/.initial=2.2} -% -\ctikzset{bipoles/emptyzzdiode/voltage/bump b/.initial=2.5} -\ctikzset{bipoles/emptyzzdiode/voltage/european label distance/.initial=1.0} -\ctikzset{bipoles/fullzzdiode/voltage/bump b/.initial=2.5} -\ctikzset{bipoles/fullzzdiode/voltage/european label distance/.initial=1.0} -\ctikzset{bipoles/emptythyristor/voltage/bump b/.initial=2.0} -\ctikzset{bipoles/emptythyristor/voltage/european label distance/.initial=1.2} -\ctikzset{bipoles/fullthyristor/voltage/bump b/.initial=2.0} -\ctikzset{bipoles/fullthyristor/voltage/european label distance/.initial=1.2} -\ctikzset{bipoles/emptytriac/voltage/bump b/.initial=1.8} -\ctikzset{bipoles/emptytriac/voltage/european label distance/.initial=0.8} -\ctikzset{bipoles/fulltriac/voltage/bump b/.initial=1.8} -\ctikzset{bipoles/fulltriac/voltage/european label distance/.initial=0.8} -% -\ctikzset{bipoles/short/voltage/american label distance/.initial=2.8} -\ctikzset{bipoles/open/voltage/distance from node/.initial=0.3} -% -\ctikzset{bipoles/battery/voltage/bump a/.initial=1.4} -\ctikzset{bipoles/vsourceAM/voltage/american label distance/.initial=1.2} -\ctikzset{bipoles/cvsourceAM/voltage/american label distance/.initial=1.2} -%%>>> - \endinput % vim: set fdm=marker fmr=%<<<,%>>>: diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex index 47fab3e5a5..2044c1320c 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -9,239 +9,104 @@ % 2. under the GNU Public License. % % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. - -%% Generic macro for defining a bipole shape -% #1 - additional anchors -% #2 - lower y-size of the bipole (from the center). -% #3 - #shape is the name of the shape -% #4 - upper y-size of the bipole (from the center) -% #5 - width of the bipole -% #6 - macros drawing the bipole -% -\long\def\pgfcircdeclarebipole{% - \pgfcircdeclarebipolescaled{default}} - -%% Generic macro for defining a bipole shape -% #1 - scale factor -% #2 - additional anchors -% #3 - lower y-size of the bipole (from the center). -% #4 - #shape is the name of the shape -% #5 - upper y-size of the bipole (from the center) -% #6 - width of the bipole -% #7 - macros drawing the bipole -% -\long\def\pgfcircdeclarebipolescaled#1#2#3#4#5#6#7{ - \pgfdeclareshape{#4shape}{ - \savedmacro{\ctikzclass}{\edef\ctikzclass{#1}} - \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} - \savedanchor{\northeast}{ - \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen - \pgf@y=#5\pgf@circ@scaled@Rlen - \pgf@y=.5\pgf@y - \pgf@x=#6\pgf@circ@scaled@Rlen - \pgf@x=.5\pgf@x - } - \savedanchor{\northeastborder}{ - \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen - \pgf@y=#5\pgf@circ@scaled@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y - \pgf@x=#6\pgf@circ@scaled@Rlen - \pgf@x=.5\pgf@x - \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x - } - \savedanchor{\southwestborder}{ - \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen - \pgf@y=-#3\pgf@circ@scaled@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y - \pgf@x=-#6\pgf@circ@scaled@Rlen - \pgf@x=.5\pgf@x - \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x - } - \savedanchor{\southwest}{ - \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen - \pgf@y=-#3\pgf@circ@scaled@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-#6\pgf@circ@scaled@Rlen - \pgf@x=.5\pgf@x - } - \savedanchor{\centerpoint}{ - \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen - \pgf@circ@res@down=-#3\pgf@circ@scaled@Rlen - \pgf@circ@res@up=#5\pgf@circ@scaled@Rlen - \pgfpointorigin - \pgf@y=\pgf@circ@res@up - \advance\pgf@y by\pgf@circ@res@down - \pgf@y=.5\pgf@y - } - \anchor{center}{\pgfpointorigin} - \anchor{n}{ - \northeast - \pgf@x=0cm - } - \anchor{north east}{ - \northeast - } - \anchor{north west}{ - \northeast - \pgf@x=-\pgf@x - } - \anchor{ne}{ - \northeast - } - \anchor{nw}{ - \northeast - \pgf@x=-\pgf@x - } - \anchor{e}{ - \northeast - \pgf@y=0cm - } - \anchor{s}{ - \southwest - \pgf@x=0cm - } - \anchor{south east}{ - \southwest - \pgf@x=-\pgf@x - } - \anchor{south west}{ - \southwest - } - \anchor{se}{ - \southwest - \pgf@x=-\pgf@x - } - \anchor{sw}{ - \southwest - } - \anchor{w}{ - \southwest - \pgf@y=0cm - } - \anchor{north}{ - \northeast - \pgf@x=0cm - } - \anchor{east}{ - \northeast - \pgf@y=0cm - } - \anchor{south}{ - \southwest - \pgf@x=0cm - } - \anchor{west}{ - \southwest - \pgf@y=0cm - } - \anchor{right}{ - \northeast - \pgf@y=0cm - } - \anchor{above}{ - \northeast - \pgf@x=0cm - } - \anchor{left}{ - \southwest - \pgf@y=0cm - } - \anchor{below}{ - \southwest - \pgf@x=0cm - } - \anchor{a}{ - \northeast - \pgf@y=0cm - } - \anchor{b}{ - \southwest - \pgf@y=0cm - } - \savedanchor{\textanchor}{% - \pgf@y=\ht\pgfnodeparttextbox - \pgf@x=-.5\wd\pgfnodeparttextbox - } - \anchor{text}{ - \textanchor - } - \anchorborder{% - \ifpgf@circuit@bipole@inverted - \pgf@circ@res@left=-\pgf@x - \pgf@circ@res@up=-\pgf@y - \else - \pgf@circ@res@left=\pgf@x - \pgf@circ@res@up=\pgf@y - \fi - \ifdim\pgf@circ@res@up>0cm - \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\northeastborder} - \else - \southwestborder - \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-\pgf@x}{-\pgf@y}} - \fi - } - - #2 - - \backgroundpath{ - \pgfsetcolor{\ctikzvalof{color}} - - \northeast - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@zero = 0cm - \pgf@circ@res@left = -\pgf@x - \pgf@circ@res@right = \pgf@x - \southwest - \pgf@circ@res@down = \pgf@y - \pgf@circ@scaled@Rlen=\scaledRlen - \pgfstartlinewidth=\pgflinewidth - \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners! - #7 - - \pgfsetlinewidth{\pgfstartlinewidth} - } - } -} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% anchor adjustment macros -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -% Extend the border anchor position by the specified factors on the right-top (north east corner) -% and the left-down (southwest border). Argument must be number (possibly decimal) without sign - -\def\pgfcirc@border@extend@full#1#2#3#4{% right, top, left, down - \anchorborder{% - \ifpgf@circuit@bipole@inverted - \pgf@circ@res@left=-\pgf@x - \pgf@circ@res@up=-\pgf@y - \else - \pgf@circ@res@left=\pgf@x - \pgf@circ@res@up=\pgf@y - \fi - \ifdim\pgf@circ@res@up>0cm - \northeastborder - \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{#1\pgf@x}{#2\pgf@y}} - \else - \southwestborder - \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-#3\pgf@x}{-#4\pgf@y}} - \fi - } -} - -% Just up and down (very common) -\def\pgfcirc@border@extend@updown#1#2{\pgfcirc@border@extend@full{1}{#1}{1}{#2}} - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Standard bipole shapes declarations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%% -% Resistive components +% Resistive components: generics, resistors, wires %%%%%%%%%%%%%%%%%%%%%%%% +%% Definitions for resistive components %<<< + +% Zig Zag resistors +\ctikzset{resistors/zigs/.initial=3} +\ctikzset{resistors/width/.code={% + \ctikzset{bipoles/resistor/width=#1}% + \ctikzset{bipoles/vresistor/width=#1}% + \ctikzset{bipoles/potentiometer/width=#1}% + \ctikzset{bipoles/resistivesens/width=#1}% + \ctikzset{bipoles/photoresistor/width=#1}% + \ctikzset{bipoles/thermistor/width=#1}% + \ctikzset{bipoles/thermistorntc/width=#1}% + \ctikzset{bipoles/thermistorptc/width=#1}% + \ctikzset{bipoles/varistor/width=#1}% + \ctikzset{bipoles/generic/width=#1}% + \ctikzset{bipoles/generic potentiometer/width=#1}% + \ctikzset{bipoles/ageneric/width=#1}% + \ctikzset{bipoles/tgeneric/width=#1}% +}} +\ctikzset{wiper pos/.code={% + \ctikzset{bipoles/potentiometer/wiper pos=#1}% + \ctikzset{bipoles/generic potentiometer/wiper pos=#1}% +}} +% zigzag resistor +\ctikzset{bipoles/resistor/height/.initial=.3} +\ctikzset{bipoles/resistor/width/.initial=.8} +\ctikzset{bipoles/potentiometer/height/.initial=.8} +\ctikzset{bipoles/potentiometer/height 2/.initial=.3} +\ctikzset{bipoles/potentiometer/width/.initial=.8} +\ctikzset{bipoles/potentiometer/wiper pos/.initial=.5} +\ctikzset{bipoles/vresistor/height/.initial=.6} +\ctikzset{bipoles/vresistor/width/.initial=.8} +\ctikzset{bipoles/resistivesens/height/.initial=.6} +\ctikzset{bipoles/resistivesens/width/.initial=.8} +% square resistors +\ctikzset{bipoles/photoresistor/height/.initial=.6} +\ctikzset{bipoles/photoresistor/height 2/.initial=.3} +\ctikzset{bipoles/photoresistor/width/.initial=.8} +\ctikzset{bipoles/thermistor/main/.initial=.7} +\ctikzset{bipoles/thermistor/height/.initial=.428}%.3/.7 +\ctikzset{bipoles/thermistorntc/width/.initial=.8} +\ctikzset{bipoles/thermistorntc/main/.initial=.7} +\ctikzset{bipoles/thermistorntc/height/.initial=.428}%.3/.7 +\ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.3/.7 +\ctikzset{bipoles/thermistorptc/width/.initial=.8} +\ctikzset{bipoles/thermistorptc/main/.initial=.7} +\ctikzset{bipoles/thermistorptc/height/.initial=.428}%.3/.7 +\ctikzset{bipoles/thermistorptc/height 2/.initial=.75}%.3/.7 +\ctikzset{bipoles/thermistor/width/.initial=.8} +\ctikzset{bipoles/varistor/main/.initial=.7} +\ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7 +\ctikzset{bipoles/varistor/width/.initial=.8} +\ctikzset{bipoles/generic/height/.initial=.30} +\ctikzset{bipoles/generic/width/.initial=.80} +\ctikzset{bipoles/generic potentiometer/height/.initial=.80} +\ctikzset{bipoles/generic potentiometer/height 2/.initial=.30} +\ctikzset{bipoles/generic potentiometer/width/.initial=.80} +\ctikzset{bipoles/generic potentiometer/wiper pos/.initial=.5} +\ctikzset{bipoles/ageneric/height/.initial=.30} +\ctikzset{bipoles/tgeneric/height/.initial=.70} +\ctikzset{bipoles/tgeneric/width/.initial=.80} +\ctikzset{bipoles/ageneric/width/.initial=.80} +\ctikzset{bipoles/memristor/height/.initial=.30} +\ctikzset{bipoles/memristor/wave height/.initial=.5} +\ctikzset{bipoles/memristor/width/.initial=.80} + +\newif\ifpgf@circuit@europeanresistor +\ctikzset{resistor/.is choice} +\ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse } +\ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue } +\tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}} +\tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}}% + +% wires (open, shorts, ...) + +\ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages +\ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages +\ctikzset{bipoles/open/voltage/straight label distance/.initial=0} +\ctikzset{bipoles/open/voltage/distance from node/.initial=.2} +\ctikzset{bipoles/short/height/.initial=.1} %dummy height for voltage positioning +\ctikzset{bipoles/short/width/.initial=.1} %dummy width for voltage positioning +% multiwire +\ctikzset{bipoles/multiwire/height/.initial=0.4} +\ctikzset{bipoles/multiwire/width/.initial=0.2} +\ctikzset{bipoles/multiwire/spacing/.initial=0.05} +% crossing wires +\ctikzset{bipoles/crossing/size/.initial=.2} +%%>>> + +%% Shapes for generic, resistives and wires components %<<< %% Short circuit %%% NOTICE that the short is really NOT drawn; we trust the fact that its @@ -336,9 +201,29 @@ \pgfusepath{draw} } +%%%%%%%%%%%%%%%% +%% Crossing +%%%%%%%%%%%%%%%% + +%% crossing bipole (but see also nodes) +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/crossing/size}} +{crossing} +{\ctikzvalof{bipoles/crossing/size}} +{\ctikzvalof{bipoles/crossing/size}}{ + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} + \pgfsetbeveljoin + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \endpgfscope +} % % -%% Generic bipole - used as resistor by some (bleah) +%% Generic bipole - used as resistor by some \pgfcircdeclarebipolescaled{resistors} {} {\ctikzvalof{bipoles/generic/height}} @@ -555,6 +440,30 @@ \pgfusepath{draw} } +%% Varistor +\pgfcircdeclarebipolescaled{resistors} +{ + \pgfcirc@border@extend@updown{1}{1.4} +} +{\ctikzvalof{bipoles/varistor/height}} +{varistor} +{\ctikzvalof{bipoles/varistor/height}} +{\ctikzvalof{bipoles/varistor/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/varistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/varistor/main}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\pgf@circ@font@tiny\textsf{U}}} +} + %% Generic tunable \pgfcircdeclarebipolescaled{resistors} { @@ -715,12 +624,92 @@ \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@other}{\pgf@circ@res@down}} \pgfusepath{draw} \endpgfscope -} +}% %>>> + +%% Paths for resistive components: generic, resistors and wires% %<<< + +%% GENERICS +\def\pgf@circ@empty@path#1{} +\pgfcirc@activate@bipole@simple{l}{generic} +\pgfcirc@activate@bipole@simple{l}{ageneric} +\pgfcirc@activate@bipole@simple{l}{tgeneric} +\pgfcirc@activate@bipole@simple{l}{xgeneric} +\pgfcirc@activate@bipole@simple{l}{fullgeneric} +\pgfcirc@activate@bipole@simple{l}{tfullgeneric} +\pgfcirc@activate@bipole@simple{l}{short} +\pgfcirc@activate@bipole@simple{l}{open} + +%% wires and crossings + +\pgfcirc@activate@bipole@simple{l}{crossing} +\pgfcirc@style@to@style{crossing}{xing} +\pgfcirc@activate@bipole@simple{l}{multiwire} +\pgfcirc@activate@bipole@simple{l}{bmultiwire} +\pgfcirc@activate@bipole@simple{l}{tmultiwire} + +% automatically switching path --- to be defined manually +\def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi} +\pgfcirc@path@to@style{l}{resistor}{resistor}{} +\pgfcirc@node@to@style{l}{resistor}{american resistor}{} +\pgfcirc@node@to@style{l}{generic}{european resistor}{} +\pgfcirc@style@to@style{resistor}{R} + +\def\pgf@circ@vresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{tgeneric}{#1}\else\pgf@circ@bipole@path{vresistor}{#1}\fi} +\pgfcirc@path@to@style{l}{vresistor}{variable resistor}{} +\pgfcirc@node@to@style{l}{vresistor}{variable american resistor}{} +\pgfcirc@node@to@style{l}{tgeneric}{variable european resistor}{} +\pgfcirc@style@to@style{variable resistor}{vR} + +\def\pgf@circ@resistivesens@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{thermistor}{#1}\else\pgf@circ@bipole@path{resistivesens}{#1}\fi} +\pgfcirc@path@to@style{l}{resistivesens}{resistive sensor}{} +\pgfcirc@node@to@style{l}{resistivesens}{american resistive sensor}{} +\pgfcirc@node@to@style{l}{thermistor}{european resistive sensor}{} +\pgfcirc@style@to@style{resistive sensor}{sR} + +\def\pgf@circ@potentiometer@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{genericpotentiometer}{#1}\else\pgf@circ@bipole@path{potentiometer}{#1}\fi} +\pgfcirc@path@to@style{l}{potentiometer}{potentiometer}{} +\pgfcirc@node@to@style{l}{potentiometer}{american potentiometer}{} +\pgfcirc@node@to@style{l}{genericpotentiometer}{european potentiometer}{} +\pgfcirc@style@to@style{potentiometer}{pR} + +\pgfcirc@activate@bipole@simple{l}{thermistor} +\pgfcirc@style@to@style{thermistor}{thR} +\pgfcirc@activate@bipole{l}{thermistorptc}{thermistorptc}{thermistor ptc} +\pgfcirc@style@to@style{thermistor ptc}{thRp} +\pgfcirc@activate@bipole{l}{thermistorntc}{thermistorntc}{thermistor ntc} +\pgfcirc@style@to@style{thermistor ntc}{thRn} +\pgfcirc@activate@bipole@simple{l}{photoresistor} +\pgfcirc@style@to@style{photoresistor}{phR} +\pgfcirc@activate@bipole@simple{l}{varistor} +\pgfcirc@activate@bipole@simple{l}{memristor} +\pgfcirc@style@to@style{memristor}{Mr}% +% %>>> %%%%%%%%%%%%%% %% Capacitors %%%%%%%%%%%%% +%% Definitions for Capacitors%<<<1 +\ctikzset{bipoles/capacitor/height/.initial=.6} +\ctikzset{bipoles/capacitor/width/.initial=.2} +\ctikzset{bipoles/ecapacitor/height/.initial=.5} +\ctikzset{bipoles/ecapacitor/width/.initial=.2} +\ctikzset{bipoles/ecapacitor/font/.initial=\pgf@circ@font@sixbm} +%%% pcapacitor is deprecated +\ctikzset{bipoles/pcapacitor/height/.initial=.6} +\ctikzset{bipoles/pcapacitor/width/.initial=.2} +\ctikzset{bipoles/pcapacitor/bend width/.initial=1.1} +\ctikzset{bipoles/ccapacitor/height/.initial=.6} +\ctikzset{bipoles/ccapacitor/width/.initial=.12} +\ctikzset{bipoles/ccapacitor/bend width/.initial=1.1} +\ctikzset{bipoles/vcapacitor/height/.initial=.6} +\ctikzset{bipoles/vcapacitor/width/.initial=.5} +\ctikzset{bipoles/vcapacitor/capacitor width/.initial=.4} +\ctikzset{bipoles/piezoelectric/height/.initial=.7} +\ctikzset{bipoles/piezoelectric/width/.initial=.5}% +%>>> + +%% Shapes for capacitors%<<< %% Plain Capacitor \pgfcircdeclarebipolescaled{capacitors} {} @@ -914,11 +903,103 @@ \pgf@circ@draworfill \endpgfscope } +% %>>> + +%% Paths for capacitors%<<< +\pgfcirc@activate@bipole@simple{l}{capacitor} +\pgfcirc@style@to@style{capacitor}{C} +\pgfcirc@activate@bipole@simple{l}{ecapacitor} +\pgfcirc@style@to@style{ecapacitor}{eC} +\pgfcirc@style@to@style{ecapacitor}{elko} +\pgfcirc@activate@bipole{l}{polarcapacitor}{polarcapacitor}{polar capacitor} +%% polar capacitor is deprecated, use curved capacitor instead +\pgfcirc@style@to@style{polar capacitor}{pC} +\pgfcirc@activate@bipole{l}{ccapacitor}{ccapacitor}{curved capacitor} +\pgfcirc@style@to@style{curved capacitor}{cC} +\pgfcirc@activate@bipole{l}{vcapacitor}{vcapacitor}{variable capacitor} +\pgfcirc@style@to@style{variable capacitor}{vC} +\pgfcirc@activate@bipole@simple{l}{piezoelectric} +\pgfcirc@style@to@style{piezoelectric}{PZ} +\pgfcirc@activate@bipole{l}{capacitivesens}{capacitivesens}{capacitive sensor} +\pgfcirc@style@to@style{capacitive sensor}{sC} +% %>>> %%%%%%%%%%%%%%% %% Inductors %%%%%%%%%%%%%%% +% Definitions of Inductors%<<<1 + +\ctikzset{inductors/coils/.code={% + \ctikzset{bipoles/cuteinductor/coils=#1}% + \ctikzset{bipoles/cutechoke/coils=#1}% + \ctikzset{bipoles/americaninductor/coils=#1}% + \ctikzset{bipoles/vcuteinductor/coils=#1}% + \ctikzset{bipoles/vamericaninductor/coils=#1}% +}} +\ctikzset{inductors/width/.code={% + \ctikzset{bipoles/cuteinductor/width=#1}% + \ctikzset{bipoles/cutechoke/width=#1}% + \ctikzset{bipoles/americaninductor/width=#1}% + \ctikzset{bipoles/vcuteinductor/width=#1}% + \ctikzset{bipoles/vamericaninductor/width=#1}% + \ctikzset{bipoles/fullgeneric/width=#1}% + \ctikzset{bipoles/tfullgeneric/width=#1}% +}} +\ctikzset{bipoles/cuteinductor/height/.initial=.3} +\ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15} +\ctikzset{bipoles/cuteinductor/width/.initial=.6} +\ctikzset{bipoles/cuteinductor/coils/.initial=5} +\ctikzset{bipoles/cuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil +%% Cute choke settings +\ctikzset{bipoles/cutechoke/height/.initial=.3} +\ctikzset{bipoles/cutechoke/lower coil height/.initial=.15} +\ctikzset{bipoles/cutechoke/width/.initial=.6} +\ctikzset{bipoles/cutechoke/coils/.initial=5} +\ctikzset{bipoles/cutechoke/coil aspect/.initial=.5}%percentage of choke width, which is covered by lower coil +\ctikzset{bipoles/cutechoke/cstep/.initial=.3} +\ctikzset{bipoles/cutechoke/cdist/.initial=1.3} +\ctikzset{bipoles/cutechoke/cthick/.initial=1} +\newif\ifpgf@circuit@bipole@twolineschoke +\pgf@circuit@bipole@twolineschokefalse +\pgfkeys{/tikz/onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}} +\ctikzset{onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}} +\pgfkeys{/tikz/twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}} +\ctikzset{twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}} +% +\ctikzset{bipoles/americaninductor/height/.initial=.3} +\ctikzset{bipoles/americaninductor/height 2/.initial=.1} +\ctikzset{bipoles/americaninductor/width/.initial=.8} +\ctikzset{bipoles/americaninductor/coils/.initial=4} +\ctikzset{bipoles/americaninductor/coil height/.initial=.15} +\ctikzset{bipoles/vcuteinductor/height/.initial=.6} +\ctikzset{bipoles/vcuteinductor/lower coil height/.initial=.3} +\ctikzset{bipoles/vcuteinductor/width/.initial=.6} +\ctikzset{bipoles/vcuteinductor/coils/.initial=5} +\ctikzset{bipoles/vcuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil +\ctikzset{bipoles/vamericaninductor/height/.initial=.6} +\ctikzset{bipoles/vamericaninductor/height 2/.initial=.2} +\ctikzset{bipoles/vamericaninductor/width/.initial=.8} +\ctikzset{bipoles/vamericaninductor/coils/.initial=4} +\ctikzset{bipoles/vamericaninductor/coil height/.initial=.15} +\ctikzset{bipoles/tfullgeneric/height/.initial=.70} +\ctikzset{bipoles/tfullgeneric/width/.initial=.80} +\ctikzset{bipoles/fullgeneric/height/.initial=.30} +\ctikzset{bipoles/fullgeneric/width/.initial=.80} +\ctikzset{inductor/.is choice} +\ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}} +\ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}} +\ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}} + +\tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}} +\tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}} +\tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}} +\tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}} +\tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}} + +%%>>> + +%% Shapes for inductors%<<< %% cute inductor \pgfcircdeclarebipolescaled{inductors} { @@ -1303,11 +1384,183 @@ \pgfusepath{draw} \endpgfscope } +% %>>> + +%% Paths for Inductors%<<< +%% these are complex because of the three-way set +%% should be simplified +\def\pgf@circ@inductor@path#1{% + \pgfextra{ + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + } + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@europeaninductor@path{#1}% + \else% + \pgfextra{ \def\pgf@temp{cute} }% + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@cuteinductor@path{#1}% + \else% + \pgf@circ@americaninductor@path{#1}% + \fi% + \fi% +} +\pgfcirc@path@to@style{l}{inductor}{inductor}{} +\pgfcirc@style@to@style{inductor}{L} +\pgfcirc@activate@bipole{l}{europeaninductor}{fullgeneric}{european inductor} +\pgfcirc@activate@bipole{l}{americaninductor}{americaninductor}{american inductor} +\pgfcirc@activate@bipole{l}{cuteinductor}{cuteinductor}{cute inductor} + +\def\pgf@circ@vinductor@path#1{ + \pgfextra{ + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + } + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@veuropeaninductor@path{#1}% + \else% + \pgfextra{ \def\pgf@temp{cute} }% + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@vcuteinductor@path{#1}% + \else% + \pgf@circ@vamericaninductor@path{#1}% + \fi% + \fi% +} +\pgfcirc@path@to@style{l}{vinductor}{variable inductor}{} +\pgfcirc@style@to@style{variable inductor}{vL} +\pgfcirc@activate@bipole{l}{veuropeaninductor}{tfullgeneric}{variable european inductor} +\pgfcirc@activate@bipole{l}{vamericaninductor}{vamericaninductor}{variable american inductor} +\pgfcirc@activate@bipole{l}{vcuteinductor}{vcuteinductor}{variable cute inductor} + +\def\pgf@circ@inductivesens@path#1{% + \pgfextra{ + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + } + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@europeaninductivesens@path{#1}% + \else% + \pgfextra{ \def\pgf@temp{cute} }% + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@cuteinductivesens@path{#1}% + \else% + \pgf@circ@americaninductivesens@path{#1}% + \fi% + \fi% +} +\pgfcirc@path@to@style{l}{inductivesens}{inductive sensor}{} +\pgfcirc@style@to@style{inductive sensor}{sL} +\pgfcirc@activate@bipole{l}{europeaninductivesens}{sfullgeneric}{european inductive sensor} +\pgfcirc@activate@bipole{l}{americaninductivesens}{samericaninductor}{american inductive sensor} +\pgfcirc@activate@bipole{l}{cuteinductivesens}{scuteinductor}{cute inductive sensor} + +\pgfcirc@activate@bipole{l}{cutechoke}{cutechoke}{cute choke} +% %>>> %%%%%%%%%%% -%% Battery +%% Sources (batteries, independent, dependents and so on %%%%%%%%%%% +% Definitions for Sources%<<<1 + +\ctikzset{bipoles/esource/height/.initial=.60} +\ctikzset{bipoles/esource/width/.initial=.60} +\ctikzset{bipoles/pvsource/height/.initial=.60} +\ctikzset{bipoles/pvsource/width/.initial=.60} +\ctikzset{bipoles/isource/height/.initial=.60} +\ctikzset{bipoles/isource/width/.initial=.60} +\ctikzset{bipoles/oosource/height/.initial=.60} +\ctikzset{bipoles/oosource/width/.initial=.60} +\ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/dcisource/angle/.initial=80} +\ctikzset{bipoles/dcisource/height/.initial=.60} +\ctikzset{bipoles/dcisource/width/.initial=.60} +\ctikzset{bipoles/dcvsource/height/.initial=.60} +\ctikzset{bipoles/dcvsource/width/.initial=.60} +\ctikzset{bipoles/vsourcetri/height/.initial=.60} +\ctikzset{bipoles/vsourcetri/width/.initial=.60} +\ctikzset{bipoles/isourceam/height/.initial=.60} +\ctikzset{bipoles/isourceam/width/.initial=.60} +\ctikzset{bipoles/vsource/height/.initial=.60} +\ctikzset{bipoles/vsource/width/.initial=.60} +\ctikzset{bipoles/vsourceam/height/.initial=.60} +\ctikzset{bipoles/vsourceam/width/.initial=.60} +\ctikzset{bipoles/vsourceam/margin/.initial=.7} +\ctikzset{bipoles/isourcesin/height/.initial=.60} +\ctikzset{bipoles/isourcesin/width/.initial=.60} +\ctikzset{bipoles/vsourcesin/height/.initial=.60} +\ctikzset{bipoles/vsourcesin/width/.initial=.60} +\ctikzset{bipoles/vsourcesquare/height/.initial=.60} +\ctikzset{bipoles/vsourcesquare/width/.initial=.60} +\ctikzset{bipoles/cisource/height/.initial=.7} +\ctikzset{bipoles/cisource/width/.initial=.7} +\ctikzset{bipoles/cisourceam/height/.initial=.7} +\ctikzset{bipoles/cisourceam/width/.initial=.7} +\ctikzset{bipoles/ecsource/height/.initial=.7} +\ctikzset{bipoles/ecsource/width/.initial=.7} +\ctikzset{bipoles/cvsource/height/.initial=.7} +\ctikzset{bipoles/cvsource/width/.initial=.7} +\ctikzset{bipoles/cvsourceam/height/.initial=.7} +\ctikzset{bipoles/cvsourceam/width/.initial=.7} +\ctikzset{bipoles/cvsourceam/margin/.initial=.7} +\ctikzset{bipoles/cvsourceam/text scale/.initial=1} +\ctikzset{bipoles/cisourcesin/width/.initial=.7} +\ctikzset{bipoles/cvsourcesin/height/.initial=.7} +\ctikzset{bipoles/cvsourcesin/width/.initial=.7} +\ctikzset{bipoles/battery/height/.initial=.6} +\ctikzset{bipoles/battery/width/.initial=.3} +\ctikzset{bipoles/battery1/height/.initial=.6} +\ctikzset{bipoles/battery1/width/.initial=.3} +\ctikzset{bipoles/battery2/height/.initial=.6} +\ctikzset{bipoles/battery2/width/.initial=.3} +% noise sources +\ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50} + +% % % ootransformer +\ctikzset{bipoles/oosourcetrans/height/.initial=.6} +\ctikzset{bipoles/oosourcetrans/width/.initial=.6} +\ctikzset{bipoles/oosourcetrans/circlesize/.initial=.6}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/oosourcetrans/circleoffset/.initial=.4}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/oosourcetrans/vectorgroupscale/.initial=1} + +% % % oootransformer +\ctikzset{bipoles/ooosource/height/.initial=.6} +\ctikzset{bipoles/ooosource/circlesize/.initial=.55}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/ooosource/circleoffset/.initial=.45}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/ooosource/vectorgroupscale/.initial=1} + +% % % primary windings +\newif\ifpgf@circ@prim@delta +\newif\ifpgf@circ@prim@wye +\newif\ifpgf@circ@prim@zig +\pgfkeys{tikz/prim/.is choice} +\pgfkeys{tikz/prim/delta/.add code={}{\pgf@circ@prim@deltatrue}} +\pgfkeys{tikz/prim/wye/.add code={}{\pgf@circ@prim@wyetrue}} +\pgfkeys{tikz/prim/zig/.add code={}{\pgf@circ@prim@zigtrue}} + +% % % secondary windings +\newif\ifpgf@circ@sec@delta +\newif\ifpgf@circ@sec@wye +\newif\ifpgf@circ@sec@zig +\pgfkeys{tikz/sec/.is choice} +\pgfkeys{tikz/sec/delta/.add code={}{\pgf@circ@sec@deltatrue}} +\pgfkeys{tikz/sec/wye/.add code={}{\pgf@circ@sec@wyetrue}} +\pgfkeys{tikz/sec/zig/.add code={}{\pgf@circ@sec@zigtrue}} + +% % % tertiary windings (ooosource) +\newif\ifpgf@circ@tert@delta +\newif\ifpgf@circ@tert@wye +\newif\ifpgf@circ@tert@zig +\pgfkeys{tikz/tert/.is choice} +\pgfkeys{tikz/tert/delta/.add code={}{\pgf@circ@tert@deltatrue}} +\pgfkeys{tikz/tert/wye/.add code={}{\pgf@circ@tert@wyetrue}} +\pgfkeys{tikz/tert/zig/.add code={}{\pgf@circ@tert@zigtrue}}% +%%>>> + +%% Nodes definitions for sources%<<< + %% Battery \pgfcircdeclarebipolescaled{batteries} {} @@ -2414,11 +2667,246 @@ \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}} \pgfsetroundcap\pgfusepath{draw} } +% %>>> + +%% Paths definitions for Sources%<<< + +%% Batteries + +\pgfcirc@activate@bipole@simple@opt{v}{battery}{\circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@activate@bipole@opt{v}{batteryone}{battery1}{battery1}{\circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@activate@bipole@opt{v}{batterytwo}{battery2}{battery2}{\circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +%% Sources: voltage + +\pgfcirc@activate@bipole@opt{v}{vsource}{vsource}{european voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@activate@bipole@opt{v}{vsourceam}{vsourceAM}{american voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=false} +\pgfcirc@style@to@style{\ifpgf@circuit@europeanvoltage european \else american \fi voltage source}{voltage source} +\pgfcirc@style@to@style{voltage source}{vsource} +\pgfcirc@style@to@style{voltage source}{V} + +\pgfcirc@activate@bipole@opt{v}{cvsource}{cvsource}{european controlled voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@activate@bipole@opt{v}{cvsourceam}{cvsourceAM}{american controlled voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=false} +\pgfcirc@style@to@style{\ifpgf@circuit@europeanvoltage european \else american \fi controlled voltage source}{controlled voltage source} +\pgfcirc@style@to@style{controlled voltage source}{cvsource} +\pgfcirc@style@to@style{controlled voltage source}{controlled vsource} +\pgfcirc@style@to@style{controlled voltage source}{cV} + +\pgfcirc@activate@bipole@simple@opt{v}{esource}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} + +\pgfcirc@activate@bipole@opt{v}{ecsource}{ecsource}{empty controlled source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@style@to@style{empty controlled source}{ecsource} + +\pgfcirc@activate@bipole@opt{v}{vsourcesin}{vsourcesin}{sinusoidal voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@style@to@style{sinusoidal voltage source}{vsourcesin} +\pgfcirc@style@to@style{sinusoidal voltage source}{sV} + +\pgfcirc@activate@bipole@opt{v}{cvsourcesin}{cvsourcesin}{controlled sinusoidal voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@style@to@style{controlled sinusoidal voltage source}{cvsourcesin} +\pgfcirc@style@to@style{controlled sinusoidal voltage source}{controlled vsourcesin} +\pgfcirc@style@to@style{controlled sinusoidal voltage source}{csV} + +\pgfcirc@activate@bipole@opt{v}{vsourcesquare}{vsourcesquare}{square voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@style@to@style{square voltage source}{vsourcesquare} +\pgfcirc@style@to@style{square voltage source}{sqV} + +\pgfcirc@activate@bipole@opt{v}{vsourcetri}{vsourcetri}{triangle voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@style@to@style{triangle voltage source}{vsourcetri} +\pgfcirc@style@to@style{triangle voltage source}{tV} + +\pgfcirc@activate@bipole@simple@opt{v}{pvsource}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} + +\pgfcirc@activate@bipole@simple@opt{v}{dcvsource}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} + +\pgfcirc@activate@bipole@opt{v}{oosource}{oosource}{voosource}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} + +\pgfcirc@activate@bipole@simple@opt{v}{ooosource}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} + +\pgfcirc@activate@bipole@simple@opt{v}{oosourcetrans}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} + +\pgfcirc@activate@bipole@opt{v}{vsourceC}{vsourceC}{cute european voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@style@to@style{cute european voltage source}{vsourceC} +\pgfcirc@style@to@style{cute european voltage source}{ceV} + +\pgfcirc@activate@bipole@opt{v}{cvsourceC}{cvsourceC}{cute european controlled voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@style@to@style{cute european controlled voltage source}{cvsourceC} +\pgfcirc@style@to@style{cute european controlled voltage source}{cceV} + +\pgfcirc@activate@bipole@opt{v}{vsourceN}{vsourceN}{noise voltage source}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@style@to@style{noise voltage source}{vsourceN} +\pgfcirc@style@to@style{noise voltage source}{nV} + +%% Sources: current + +\pgfcirc@activate@bipole@opt{i}{isource}{isource}{european current source}{% + \circuitikzbasekey/bipole/is current=true} +\pgfcirc@activate@bipole@opt{i}{isourceam}{isourceAM}{american current source}{% + \circuitikzbasekey/bipole/is current=true} +\pgfcirc@style@to@style{\ifpgf@circuit@europeancurrent european \else american \fi current source}{current source} +\pgfcirc@style@to@style{current source}{isource} +\pgfcirc@style@to@style{current source}{I} + +\pgfcirc@activate@bipole@opt{i}{cisource}{cisource}{european controlled current source}{% + \circuitikzbasekey/bipole/is current=true} +\pgfcirc@activate@bipole@opt{i}{cisourceam}{cisourceAM}{american controlled current source}{% + \circuitikzbasekey/bipole/is current=true} +\pgfcirc@style@to@style{\ifpgf@circuit@europeanvoltage european \else american \fi controlled current source}{controlled current source} +\pgfcirc@style@to@style{controlled current source}{cisource} +\pgfcirc@style@to@style{controlled current source}{controlled isource} +\pgfcirc@style@to@style{controlled current source}{cI} + +\pgfcirc@activate@bipole@opt{i}{isourcesin}{isourcesin}{sinusoidal current source}{% + \circuitikzbasekey/bipole/is current=true} +\pgfcirc@style@to@style{sinusoidal current source}{isourcesin} +\pgfcirc@style@to@style{sinusoidal current source}{sI} + +\pgfcirc@activate@bipole@opt{i}{cisourcesin}{cisourcesin}{controlled sinusoidal current source}{% + \circuitikzbasekey/bipole/is current=true} +\pgfcirc@style@to@style{controlled sinusoidal current source}{cisourcesin} +\pgfcirc@style@to@style{controlled sinusoidal current source}{controlled isourcesin} +\pgfcirc@style@to@style{controlled sinusoidal current source}{csI} + +\pgfcirc@activate@bipole@simple@opt{i}{dcisource}{% + \circuitikzbasekey/bipole/is current=true} + +\pgfcirc@activate@bipole@opt{i}{oosource}{oosource}{ioosource}{% + \circuitikzbasekey/bipole/is current=true} + +\pgfcirc@activate@bipole@opt{i}{isourceC}{isourceC}{cute european current source}{% + \circuitikzbasekey/bipole/is current=true} +\pgfcirc@style@to@style{cute european current source}{isourceC} +\pgfcirc@style@to@style{cute european current source}{ceI} + +\pgfcirc@activate@bipole@opt{i}{cisourceC}{cisourceC}{cute european controlled current source}{% + \circuitikzbasekey/bipole/is current=true} +\pgfcirc@style@to@style{cute european controlled current source}{cisourceC} +\pgfcirc@style@to@style{cute european controlled current source}{cceI} + +\pgfcirc@activate@bipole@opt{i}{isourceN}{isourceN}{noise current source}{% + \circuitikzbasekey/bipole/is current=true} +\pgfcirc@style@to@style{noise current source}{isourceN} +\pgfcirc@style@to@style{noise current source}{nI} + +% build alias with voltage and current directions (legacy) + +\def\pgf@temp#1{ + \pgfcirc@style@to@style@label{voltage source}{V#1}{v#1} + \pgfcirc@style@to@style@label{controlled voltage source}{cV#1}{v#1} + \pgfcirc@style@to@style@label{sinusoidal voltage source}{sV#1}{v#1} + \pgfcirc@style@to@style@label{controlled sinusoidal voltage source}{csV#1}{v#1} +} +\pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<} +\pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_} +\def\pgf@temp#1{ + \pgfcirc@style@to@style@label{current source}{I#1}{i#1} + \pgfcirc@style@to@style@label{controlled current source}{cI#1}{i#1} + \pgfcirc@style@to@style@label{sinusoidal current source}{sI#1}{i#1} + \pgfcirc@style@to@style@label{controlled sinusoidal current source}{csI#1}{i#1} +} +\pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<} +\pgf@temp{>_} \pgf@temp{<_} \pgf@temp{>^} \pgf@temp{<^} +\pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_} +% %>>> %%%%%%%%%%%%%% %% Diodes %%%%%%%%%%%%%% +% Definitions for diodes%<<<1 + +\ctikzset{bipoles/diode/height/.initial=.50} +\ctikzset{bipoles/diode/width/.initial=.40} +\ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1} +\ctikzset{bipoles/bidirectionaldiode/width/.initial=1} +\ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3} +\ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3} +\ctikzset{bipoles/varcap/height/.initial=.50} +\ctikzset{bipoles/varcap/width/.initial=.45} +\ctikzset{tripoles/thyristor/height/.initial=1.10} +\ctikzset{tripoles/thyristor/height 2/.initial=.5} +\ctikzset{tripoles/thyristor/width/.initial=1.0} +\ctikzset{tripoles/thyristor/diode height/.initial=.5} +\ctikzset{tripoles/thyristor/diode width left/.initial=.4} +\ctikzset{tripoles/thyristor/diode width right/.initial=.3} + +\ctikzset{tripoles/triac/height/.initial=1.1} +\ctikzset{tripoles/triac/width/.initial=1} +\ctikzset{tripoles/triac/diode width left/.initial=.3} +\ctikzset{tripoles/triac/diode width right/.initial=.3} +% +% Flipping arrows in LED and photodiodes +% +\newif\ifpgf@led@fliparrows +\newif\ifpgf@pd@fliparrows +\pgf@led@fliparrowsfalse +\pgf@pd@fliparrowsfalse +% +% by default the arrows start (LED) and go (PD) to the anode. +% +\ctikzset{led arrows from anode/.code=\pgf@led@fliparrowsfalse} +\ctikzset{pd arrows to anode/.code=\pgf@pd@fliparrowsfalse} +% +% but they can start form the cathode (LED) or go to it (PD) +% +\ctikzset{led arrows from cathode/.code=\pgf@led@fliparrowstrue} +\ctikzset{pd arrows to cathode/.code=\pgf@pd@fliparrowstrue} + +\newif\ifpgf@circuit@strokediode +\newif\ifpgf@circuit@fulldiode +\pgf@circuit@strokediodefalse +\pgf@circuit@fulldiodefalse + +\ctikzset{diode/.is choice} +\ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default +\ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue } +\ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue} + +\tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}} +\tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}} +\tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}} + +%%>>> + +%% Node components for diodes %<<<1 + %% Black generic diode \pgfcircdeclarebipolescaled{diodes} {} @@ -3152,12 +3640,126 @@ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfusepath{draw} -} +}% %>>> + +%% Paths definitions for Diodes%<<< + +\def\pgfcirc@tmp@generatediodes#1#2{ + \pgfcirc@activate@bipole{l}{#1diode}{#1diode}{#1 diode} + \pgfcirc@style@to@style{#1 diode}{D#2} + \pgfcirc@activate@bipole{l}{#1zdiode}{#1zdiode}{#1 Zener diode} + \pgfcirc@style@to@style{#1 Zener diode}{zD#2} + \pgfcirc@activate@bipole{l}{#1zzdiode}{#1zzdiode}{#1 ZZener diode} + \pgfcirc@style@to@style{#1 ZZener diode}{zzD#2} + \pgfcirc@activate@bipole{l}{#1sdiode}{#1sdiode}{#1 Schottky diode} + \pgfcirc@style@to@style{#1 Schottky diode}{sD#2} + \pgfcirc@activate@bipole{l}{#1tdiode}{#1tdiode}{#1 tunnel diode} + \pgfcirc@style@to@style{#1 tunnel diode}{tD#2} + \pgfcirc@activate@bipole{l}{#1lediode}{#1lediode}{#1 led} + \pgfcirc@style@to@style{#1 led}{leD#2} + \pgfcirc@activate@bipole{l}{#1pdiode}{#1pdiode}{#1 photodiode} + \pgfcirc@style@to@style{#1 photodiode}{pD#2} + \pgfcirc@activate@bipole{l}{#1varcap}{#1varcap}{#1 varcap} + \pgfcirc@style@to@style{#1 varcap}{VC#2} + \pgfcirc@activate@bipole{l}{#1bidirectionaldiode}{#1bidirectionaldiode}{#1 bidirectionaldiode} + \pgfcirc@style@to@style{#1 bidirectionaldiode}{biD#2} + \pgfcirc@activate@bipole{l}{#1thyristor}{#1thyristor}{#1 thyristor} + \pgfcirc@style@to@style{#1 thyristor}{Ty#2} + \pgfcirc@activate@bipole{l}{#1triac}{#1triac}{#1 triac} + \pgfcirc@style@to@style{#1 triac}{Tr#2} +} +\pgfcirc@tmp@generatediodes{full}{*} +\pgfcirc@tmp@generatediodes{empty}{o} +\def\pgfcirc@tmp@generatestrokeddiodes#1#2{ + \pgfcirc@node@to@style{l}{emptydiode}{#1 diode}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 diode}{D#2} + \pgfcirc@node@to@style{l}{emptyzdiode}{#1 Zener diode}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 Zener diode}{zD#2} + \pgfcirc@node@to@style{l}{emptyzzdiode}{#1 ZZener diode}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 ZZener diode}{zzD#2} + \pgfcirc@node@to@style{l}{emptysdiode}{#1 Schottky diode}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 Schottky diode}{sD#2} + \pgfcirc@node@to@style{l}{emptytdiode}{#1 tunnel diode}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 tunnel diode}{tD#2} + \pgfcirc@node@to@style{l}{emptylediode}{#1 led}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 led}{leD#2} + \pgfcirc@node@to@style{l}{emptypdiode}{#1 photodiode}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 photodiode}{pD#2} + \pgfcirc@node@to@style{l}{emptyvarcap}{#1 varcap}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 varcap}{VC#2} + \pgfcirc@node@to@style{l}{emptybidirectionaldiode}{#1 bidirectionaldiode}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 bidirectionaldiode}{biD#2} + \pgfcirc@node@to@style{l}{emptythyristor}{#1 thyristor}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 thyristor}{Ty#2} + \pgfcirc@node@to@style{l}{emptytriac}{#1 triac}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 triac}{Tr#2} +} +\pgfcirc@tmp@generatestrokeddiodes{stroke}{-} +\def\pgfcircdiodestylemacro{\ifpgf@circuit@strokediode stroke \else\ifpgf@circuit@fulldiode full \else empty \fi\fi} +% these are auto-switching styles +\pgfcirc@style@to@style{\pgfcircdiodestylemacro diode}{diode} +\pgfcirc@style@to@style{diode}{D} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro Zener diode}{Zener diode} +\pgfcirc@style@to@style{Zener diode}{zD} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro ZZener diode}{ZZener diode} +\pgfcirc@style@to@style{ZZener diode}{zzD} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro Schottky diode}{Schottky diode} +\pgfcirc@style@to@style{Schottky diode}{sD} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro tunnel diode}{tunnel diode} +\pgfcirc@style@to@style{tunnel diode}{tD} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro led}{led} +\pgfcirc@style@to@style{led}{leD} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro photodiode}{photodiode} +\pgfcirc@style@to@style{photodiode}{pD} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro varcap}{varcap} +\pgfcirc@style@to@style{varcap}{VC} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro bidirectionaldiode}{bidirectionaldiode} +\pgfcirc@style@to@style{bidirectionaldiode}{biD} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro thyristor}{thyristor} +\pgfcirc@style@to@style{thyristor}{Ty} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro triac}{triac} +\pgfcirc@style@to@style{triac}{Tr} +% %>>> %%%%%%%%%%%%% -%% switches +%% switches and buttons %%%%%%%%%%%%% +%% Definitions for switches%<<<1 + +\ctikzset{bipoles/spst/height/.initial=.35} +\ctikzset{bipoles/spst/width/.initial=.35} +\ctikzset{bipoles/spst/depth/.initial=.2} +\ctikzset{bipoles/nos/height/.initial=.3} +\ctikzset{bipoles/nos/width/.initial=.35} +\ctikzset{bipoles/nos/depth/.initial=.2} +\ctikzset{bipoles/ncs/height/.initial=.35} +\ctikzset{bipoles/ncs/width/.initial=.35} +\ctikzset{bipoles/ncs/depth/.initial=.2} +\ctikzset{bipoles/pushbutton/height/.initial=.5} +\ctikzset{bipoles/pushbutton/height 2/.initial=.2} +\ctikzset{bipoles/pushbutton/width/.initial=.50} +%%% reed switch +\ctikzset{bipoles/reed/height/.initial=.4} +\ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos +\ctikzset{bipoles/reed/depth/.initial=.4} +%% Cute switches +\ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}} +\ctikzset{bipoles/cuteswitch/height/.initial=.6} +\ctikzset{bipoles/cuteswitch/height 2/.initial=.2} +\ctikzset{bipoles/cuteswitch/width/.initial=.50} +\ctikzset{bipoles/cuteswitch/thickness/.initial=1} + +\ctikzset{tripoles/spdt/width/.initial=.85} +\ctikzset{tripoles/spdt/height/.initial=.45} +\ctikzset{tripoles/spdt/margin/.initial=.45} + +\ctikzset{tripoles/toggleswitch/height/.initial=.8} +\ctikzset{tripoles/toggleswitch/height 2/.initial=.0} +\ctikzset{tripoles/toggleswitch/width/.initial=.80} +%%>>> + +%% Shapes Node for bipoles switches and similar things%<<< %% (Closing) SPST \pgfcircdeclarebipolescaled{switches} {} @@ -3473,95 +4075,477 @@ \pgfusepath{draw} } -%%%%%%%%%%%%%%%%% -%% Instruments -%%%%%%%%%%%%%%%%% +\pgfcircdeclarebipole{ + \anchor{out 1}{ + \northeast + \pgf@y=0cm + } + \anchor{out 2}{ + \northeast + \pgf@y=.8\pgf@y + } +} +{\ctikzvalof{tripoles/toggleswitch/height 2}} +{toggleswitch} +{\ctikzvalof{tripoles/toggleswitch/height}} +{\ctikzvalof{tripoles/toggleswitch/width}} +{ -% % METERINGSHAPE -\long\def\drawmeteringcircle{ - \def\pgf@circ@temp{right} - \ifx\tikz@res@label@pos\pgf@circ@temp - \pgf@circ@res@step=-1.2\pgf@circ@res@up - \else - \def\pgf@circ@temp{below} - \ifx\tikz@res@label@pos\pgf@circ@temp - \pgf@circ@res@step=-1.2\pgf@circ@res@up - \else - \pgf@circ@res@step=1.2\pgf@circ@res@up - \fi - \fi - %draw connections to circle - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} \pgfusepath{draw} - %draw circle \pgfscope + \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up} - \pgf@circ@draworfill - \endpgfscope - %draw arrow - \pgfscope - \pgfsetarrowsend{latex} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}} \pgfusepath{draw} \endpgfscope -} -%AMPEREMETER -\pgfcircdeclarebipolescaled{instruments} -{} -{\ctikzvalof{bipoles/ammeter/height}} -{ammeter} -{\ctikzvalof{bipoles/ammeter/height}} -{\ctikzvalof{bipoles/ammeter/width}} -{ - \drawmeteringcircle - \pgfnode{circle}{center}{\pgf@circ@font@bold{A}}{}{} -} -%OHMMETER -\pgfcircdeclarebipolescaled{instruments} -{} -{\ctikzvalof{bipoles/ohmmeter/height}} -{ohmmeter} -{\ctikzvalof{bipoles/ohmmeter/height}} -{\ctikzvalof{bipoles/ohmmeter/width}} -{ - \drawmeteringcircle - \pgfnode{circle}{center}{\boldmath$\Omega$}{}{} -} -%VOLTMETER -\pgfcircdeclarebipolescaled{instruments} -{} -{\ctikzvalof{bipoles/voltmeter/height}} -{voltmeter} -{\ctikzvalof{bipoles/voltmeter/height}} -{\ctikzvalof{bipoles/voltmeter/width}} -{ - \drawmeteringcircle - \pgfnode{circle}{center}{\pgf@circ@font@bold{V}}{}{} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}} + \pgfusepath{draw} + + + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfsetdash{{.08\pgf@circ@res@up}{.04\pgf@circ@res@up}{.7\pgf@circ@res@up}{.04\pgf@circ@res@up}{.8\pgf@circ@res@up}}{0cm} + \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@left}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfsetdash{}{0cm} } -% oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176 -\pgfcircdeclarebipolescaled{instruments} -{ - \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x} - \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x} - % put the node text above and centered - \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfpoint{-.5\wd\pgfnodeparttextbox}{ - \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax - } +% %>>> + +%% Shape nodes for switches (non-bipoles)%<<< + +%%%%%%%%%%%%% +%% switches +%%%%%%%%%%%%% + +% Legacy spdt +\pgfdeclareshape{spdt}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/spdt/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x } -} -{\ctikzvalof{bipoles/oscope/height}} -{oscope} -{\ctikzvalof{bipoles/oscope/height}} -{\ctikzvalof{bipoles/oscope/width}} + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out 1}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{out 2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@res@other = \ctikzvalof{tripoles/spdt/margin}\pgf@circ@res@left + + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + + \pgfusepath{draw} + + \pgfscope + \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}} + \endpgfscope + + \pgfscope + \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}} + \pgfpathlineto{ + \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}} + {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}} + } + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + } +} + + +% cute switch "node" shapes, matching with cute "to" shapes +% #1 -> name +% #2 -> barposition +% #3 -> arrowcode +\long\def\pgfcircdeclarecutespdt#1#2#3{ + \pgfdeclareshape{#1} + { + \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen + \pgf@x=.25\pgf@x + } + \savedanchor\midlever{ + % these values are calculated when we create the definition of the shape. + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgf@circ@res@down = -.5\pgf@y + \pgf@circ@res@up = .5\pgf@y + \pgfextracty{\pgf@circ@res@other}{#2} + \pgf@x=0pt + \pgf@y=.5\pgf@circ@res@other + } + % radius of the connector + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} + % shapename + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + % shape type + \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}} + % mid of the lever, to stack switches + \anchor{mid}{\midlever} + % center anchors + \anchor{cin}{ \northwest \pgf@y=0pt} + \anchor{cout 1}{ \northwest \pgf@x=-\pgf@x } + \anchor{cout 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + % horizontal angles + \anchor{in}{ \northwest \pgf@y=0pt\advance\pgf@x by -\radius} + \anchor{out 1}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius} + \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius \pgf@y=-\pgf@y } + + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \pgf@circ@res@temp=\radius\relax + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgfsetlinewidth{2\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{#2} + \pgfsetroundcap\pgfusepath{draw} + \endpgfscope + \pgfscope % arrow + #3 + \endpgfscope + % terminals + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}} + \endpgfscope + + } + } +} + +\pgfcircdeclarecutespdt{cute spdt up} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up-1.5\pgf@circ@res@temp}} +{} + +\pgfcircdeclarecutespdt{cute spdt mid} +{\pgfpoint{\pgf@circ@res@right}{0pt}} +{} + +\pgfcircdeclarecutespdt{cute spdt down} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}} +{} + +\pgfcircdeclarecutespdt{cute spdt up arrow} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up-1.5\pgf@circ@res@temp}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}} + \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} +} + +\pgfcircdeclarecutespdt{cute spdt mid arrow} +{\pgfpoint{\pgf@circ@res@right}{0pt}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfsetarrowsstart{latexslim} + \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}} + \pgfpatharc{-60}{60}{1.5\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} +} + +\pgfcircdeclarecutespdt{cute spdt down arrow} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}} + \pgfpatharc{-50}{70}{1.5\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} +} +% %>>> + +%% Paths Switches and buttons%<<< + +\pgfcirc@activate@bipole{l}{cspst}{cspst}{closing switch} +\pgfcirc@style@to@style{closing switch}{switch} +\pgfcirc@style@to@style{closing switch}{cspst} +\pgfcirc@style@to@style{switch}{spst} +\pgfcirc@activate@bipole{l}{ospst}{ospst}{opening switch} +\pgfcirc@style@to@style{opening switch}{ospst} + +\pgfcirc@activate@bipole@simple{l}{nos} +\pgfcirc@style@to@style{nos}{normal open switch} +\pgfcirc@activate@bipole@simple{l}{ncs} +\pgfcirc@style@to@style{ncs}{normal closed switch} + +\pgfcirc@activate@bipole{l}{pushbutton}{pushbutton}{push button} +\pgfcirc@style@to@style{push button}{nopb} +\pgfcirc@style@to@style{push button}{normally open push button} +\pgfcirc@activate@bipole{l}{ncpushbutton}{ncpushbutton}{ncpb} +\pgfcirc@style@to@style{ncpb}{normally closed push button} +\pgfcirc@activate@bipole{l}{pushbuttonc}{pushbuttonc}{nopbc} +\pgfcirc@style@to@style{nopbc}{normally open push button closed} +\pgfcirc@activate@bipole{l}{ncpushbuttono}{ncpushbuttono}{ncpbo} +\pgfcirc@style@to@style{ncpbo}{normally closed push button open} + +\pgfcirc@activate@bipole{l}{toggleswitch}{toggleswitch}{toggle switch} +\pgfcirc@activate@bipole@simple{l}{reed} + +\pgfcirc@activate@bipole{l}{cuteclosedswitch}{cuteclosedswitch}{cute closed switch} +\pgfcirc@style@to@style{cute closed switch}{ccsw} +\pgfcirc@activate@bipole{l}{cuteopenswitch}{cuteopenswitch}{cute open switch} +\pgfcirc@style@to@style{cute open switch}{cosw} +\pgfcirc@activate@bipole{l}{cuteclosingswitch}{cuteclosingswitch}{cute closing switch} +\pgfcirc@style@to@style{cute closing switch}{ccgsw} +\pgfcirc@activate@bipole{l}{cuteopeningswitch}{cuteopeningswitch}{cute opening switch} +\pgfcirc@style@to@style{cute opening switch}{cogsw}% %>>> + +%%%%%%%%%%%%%%%%% +%% Instruments +%%%%%%%%%%%%%%%%% + +%% Definitions for Instruments %<<<1 +\ctikzset{bipoles/ammeter/height/.initial=.60} +\ctikzset{bipoles/ammeter/width/.initial=.60} +\ctikzset{bipoles/ohmmeter/height/.initial=.60} +\ctikzset{bipoles/ohmmeter/width/.initial=.60} +\ctikzset{bipoles/voltmeter/height/.initial=.60} +\ctikzset{bipoles/voltmeter/width/.initial=.60} +\ctikzset{bipoles/smeter/height/.initial=.60} +\ctikzset{bipoles/smeter/width/.initial=.60} +\ctikzset{bipoles/smeter/voltage/additional shift/.initial=1} +\ctikzset{bipoles/qmeter/depth/.initial=.40} +\ctikzset{bipoles/qmeter/height/.initial=.80} +\ctikzset{bipoles/qmeter/width/.initial=.60} +% this must be specified for each one +\ctikzset{bipoles/qvprobe/voltage/additional shift/.initial=.5} +\ctikzset{bipoles/qiprobe/voltage/additional shift/.initial=.5} +\ctikzset{bipoles/qpprobe/voltage/additional shift/.initial=.5} +\ctikzset{bipoles/iloop/width/.initial=.40} +\ctikzset{bipoles/iloop/height/.initial=.60} + +\ctikzset{bipoles/oscope/height/.initial=.60} +\ctikzset{bipoles/oscope/width/.initial=.60} +\ctikzset{bipoles/oscope/voltage/additional shift/.initial=1} + + +% option to not rotate the new (Romano's) instruments +\newif\ifpgf@circuit@straightinstruments\pgf@circuit@straightinstrumentstrue +\pgfkeys{/tikz/straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}} +\ctikzset{straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}} +\pgfkeys{/tikz/rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}} +\ctikzset{rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}} +%%>>> + +%% Node shapes for instruments%<<< + +% % METERINGSHAPE +\long\def\drawmeteringcircle{ + \def\pgf@circ@temp{right} + \ifx\tikz@res@label@pos\pgf@circ@temp + \pgf@circ@res@step=-1.2\pgf@circ@res@up + \else + \def\pgf@circ@temp{below} + \ifx\tikz@res@label@pos\pgf@circ@temp + \pgf@circ@res@step=-1.2\pgf@circ@res@up + \else + \pgf@circ@res@step=1.2\pgf@circ@res@up + \fi + \fi + %draw connections to circle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + %draw circle + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up} + \pgf@circ@draworfill + \endpgfscope + %draw arrow + \pgfscope + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%AMPEREMETER +\pgfcircdeclarebipolescaled{instruments} +{} +{\ctikzvalof{bipoles/ammeter/height}} +{ammeter} +{\ctikzvalof{bipoles/ammeter/height}} +{\ctikzvalof{bipoles/ammeter/width}} +{ + \drawmeteringcircle + \pgfnode{circle}{center}{\pgf@circ@font@bold{A}}{}{} +} +%OHMMETER +\pgfcircdeclarebipolescaled{instruments} +{} +{\ctikzvalof{bipoles/ohmmeter/height}} +{ohmmeter} +{\ctikzvalof{bipoles/ohmmeter/height}} +{\ctikzvalof{bipoles/ohmmeter/width}} +{ + \drawmeteringcircle + \pgfnode{circle}{center}{\boldmath$\Omega$}{}{} +} +%VOLTMETER +\pgfcircdeclarebipolescaled{instruments} +{} +{\ctikzvalof{bipoles/voltmeter/height}} +{voltmeter} +{\ctikzvalof{bipoles/voltmeter/height}} +{\ctikzvalof{bipoles/voltmeter/width}} +{ + \drawmeteringcircle + \pgfnode{circle}{center}{\pgf@circ@font@bold{V}}{}{} + +} + +% oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176 +\pgfcircdeclarebipolescaled{instruments} +{ + \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x} + \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/oscope/height}} +{oscope} +{\ctikzvalof{bipoles/oscope/height}} +{\ctikzvalof{bipoles/oscope/width}} { \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfextracty{\pgf@circ@res@up}{\northeast} @@ -3839,1857 +4823,183 @@ \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+4\pgf@circ@res@other}{-3\pgf@circ@res@other}} \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right-4\pgf@circ@res@other}{-3\pgf@circ@res@other}} \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-3\pgf@circ@res@other}} - \pgfusepath{draw} - \endpgfscope -} - -% current loop for oscope and similar: stylized -\pgfcircdeclarebipolescaled{instruments} -{ - \anchor{i}{\northeast\pgf@x=0pt\relax} - \anchor{text}{ - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@left}{\northeast} - \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ - \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax - } - } -} -{\ctikzvalof{bipoles/iloop/height}} -{iloop} -{\ctikzvalof{bipoles/iloop/height}} -{\ctikzvalof{bipoles/iloop/width}} -{ - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@right}{\northeast} - \pgf@circ@res@down=-\pgf@circ@res@up - \pgf@circ@res@left=-\pgf@circ@res@right - \pgfscope - \pgfstartlinewidth=\pgflinewidth - \pgfsetcolor{\ctikzvalof{color}} - % external ellipse - \pgfscope - \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} - % clipping path: first a rectangle bigger then the shape - % to avoid problems with the line thickness - \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} - {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} - % next the opening to the left - \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} - {\pgfpoint{0pt}{.1\pgf@circ@res@up}} - % do the difference and clip before drawing - \pgfseteorule - \pgfusepath{clip} - \pgfpathellipse{\pgfpointorigin}{ - \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{ - \pgfpoint{0.4\pgf@circ@res@right}{0pt}} - \pgfusepath{draw} - \endpgfscope - % internal wire - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} - \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - % and the contact line up - \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope -} - -% current loop for oscope and similar: real (double connection) -\pgfcircdeclarebipolescaled{instruments} -{ - \anchor{i+}{ - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@right}{\northeast} - \pgf@circ@res@step=0.4\pgf@circ@res@right - \pgf@circ@res@other=0.8\pgf@circ@res@up - \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other} - \pgf@y=\pgf@circ@res@up - } - \anchor{i-}{ - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@right}{\northeast} - \pgf@circ@res@step=0.4\pgf@circ@res@right - \pgf@circ@res@other=0.8\pgf@circ@res@up - \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other} - \pgf@y=\pgf@circ@res@up - } - \anchor{text}{ - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@left}{\northeast} - \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ - \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax - } - } -} -{\ctikzvalof{bipoles/iloop/height}} -{iloop2} -{\ctikzvalof{bipoles/iloop/height}} -{\ctikzvalof{bipoles/iloop/width}} -{ - \pgfextracty{\pgf@circ@res@up}{\northeast} - \pgfextractx{\pgf@circ@res@right}{\northeast} - \pgf@circ@res@down=-\pgf@circ@res@up - \pgf@circ@res@left=-\pgf@circ@res@right - % must be the same than internal i+ and i- anchors definition - \pgf@circ@res@step=0.4\pgf@circ@res@right - \pgf@circ@res@other=0.8\pgf@circ@res@up - \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}} - \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}} - \pgfscope - \pgfstartlinewidth=\pgflinewidth - \pgfsetcolor{\ctikzvalof{color}} - % external ellipse - \pgfscope - \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} - % clipping path: first a rectangle bigger then the shape - % to avoid problems with the line thickness - \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} - {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} - % next the opening to the left - \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} - {\pgfpoint{0pt}{.1\pgf@circ@res@up}} - % do the difference and clip before drawing - \pgfseteorule - \pgfusepath{clip} - \pgfpathmoveto{\@plus} - \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other} - \pgfusepath{draw} - \endpgfscope - % internal wire - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} - \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - % and the contact line up - % I use ...left and ---right as temporal lengths here to avoid defining more - \pgfextractx{\pgf@circ@res@left}{\@plus} - \pgfextractx{\pgf@circ@res@right}{\@minus} - \pgfpathmoveto{\@plus} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathmoveto{\@minus} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope -} - - -%% Varistor -\pgfcircdeclarebipolescaled{resistors} -{ - \pgfcirc@border@extend@updown{1}{1.4} -} -{\ctikzvalof{bipoles/varistor/height}} -{varistor} -{\ctikzvalof{bipoles/varistor/height}} -{\ctikzvalof{bipoles/varistor/width}} -{ - \pgfscope - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/varistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/varistor/main}\pgf@circ@res@up}} - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgf@circ@draworfill - \endpgfscope - - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfusepath{draw} - - \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\pgf@circ@font@tiny\textsf{U}}} -} - -%%%%%%%%%%%%%% -%% RF bipoles -%%%%%%%%%%%%%% - -% transmission line -\pgfcircdeclarebipolescaled{RF} -{} -{\ctikzvalof{bipoles/tline/height}} -{tline} -{\ctikzvalof{bipoles/tline/height}} -{\ctikzvalof{bipoles/tline/width}} -{ - \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis - \begin{pgftransparencygroup} - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}} - \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}} - \pgf@circ@draworfill - \pgfpathellipse{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} - {\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{-\pgf@circ@res@up}} - \pgf@circ@draworfill - \end{pgftransparencygroup} - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfusepath{stroke} -} - -% microstrip transmission line -\pgfcircdeclarebipolescaled{RF} -{} -{\ctikzvalof{bipoles/mstline/height}} -{mstline} -{\ctikzvalof{bipoles/mstline/height}} -{\ctikzvalof{bipoles/mstline/width}} -{ - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgf@circ@draworfill -} - -%%%%%%%%%%%%%%%%%%% -%% Block diagrams -%%%%%%%%%%%%%%%%%%% - -%% Draw the two-port fillable box -\def\pgf@circ@twoportbox{ - \pgfscope - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgf@circ@draworfill - \endpgfscope -} - -%% Generic two port box -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/twoport/height}} -{twoport} -{\ctikzvalof{bipoles/twoport/height}} -{\ctikzvalof{bipoles/twoport/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - % draw outer box - \pgf@circ@twoportbox - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}} - -} - -%% twoport split -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/twoportsplit/width}} -{twoportsplit} -{\ctikzvalof{bipoles/twoportsplit/width}} -{\ctikzvalof{bipoles/twoportsplit/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/twoportsplit/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - %get texts - \def\pgfcirc@tin{\ctikzvalof{bipoles/twoport/text in}} - \def\pgfcirc@tout{\ctikzvalof{bipoles/twoport/text out}} - - % rotate inner symbol - \def\texti{\pgfcirc@tin} - \def\textii{\pgfcirc@tout} - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \def\texti{\pgfcirc@tout} - \def\textii{\pgfcirc@tin} - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \def\texti{\pgfcirc@tout} - \def\textii{\pgfcirc@tin} - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \def\texti{\pgfcirc@tin} - \def\textii{\pgfcirc@tout} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} - - \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\texti} - \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textii} -} - -%% voltage controled oscillator -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/vco/width}} -{vco} -{\ctikzvalof{bipoles/twoport/width}} -{\ctikzvalof{bipoles/vco/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - % draw circle - \pgfscope - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step} - \pgf@circ@draworfill - \endpgfscope - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner sine waves - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} -} - -%% bandpass filter -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/bandpass/width}} -{bandpass} -{\ctikzvalof{bipoles/bandpass/width}} -{\ctikzvalof{bipoles/bandpass/width}} -{ - - \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} - \pgfusepath{draw} -} - -%% bandstop filter -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/bandstop/width}} -{bandstop} -{\ctikzvalof{bipoles/bandstop/width}} -{\ctikzvalof{bipoles/bandstop/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225% 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt}% always draw solid line for inner symbol - \pgfsetarrows{-}%never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} -} - -%% highpass filter -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/highpass/width}} -{highpass} -{\ctikzvalof{bipoles/highpass/width}} -{\ctikzvalof{bipoles/highpass/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} - \pgfusepath{draw} -} - -%% lowpass filter -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/lowpass/width}} -{lowpass} -{\ctikzvalof{bipoles/lowpass/width}} -{\ctikzvalof{bipoles/lowpass/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} -} - -%% allpass filter -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/allpass/width}} -{allpass} -{\ctikzvalof{bipoles/allpass/width}} -{\ctikzvalof{bipoles/allpass/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/allpass/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} - \pgfusepath{draw} -} - -%% ADC -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/adc/width}} -{adc} -{\ctikzvalof{bipoles/adc/width}} -{\ctikzvalof{bipoles/adc/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\texti{A} - \def\textii{D} - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \def\texti{D} - \def\textii{A} - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \def\texti{D} - \def\textii{A} - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \def\texti{A} - \def\textii{D} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} - - \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} - \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} -} - -%% DAC -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/dac/width}} -{dac} -{\ctikzvalof{bipoles/dac/width}} -{\ctikzvalof{bipoles/dac/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\texti{D} - \def\textii{A} - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \def\texti{A} - \def\textii{D} - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \def\texti{A} - \def\textii{D} - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \def\texti{D} - \def\textii{A} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} - - \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} - \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} -} - -%% DSP -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/dsp/width}} -{dsp} -{\ctikzvalof{bipoles/dsp/width}} -{\ctikzvalof{bipoles/dsp/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgftext[center,x=0,y=0]{\textsf{DSP}} -} - -%% FFT -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/fft/width}} -{fft} -{\ctikzvalof{bipoles/fft/width}} -{\ctikzvalof{bipoles/fft/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgftext[center,x=0,y=0]{\textsf{FFT}} -} - -%% Amplifier -\pgfcircdeclarebipolescaled{blocks} -{} -{ - \ifpgf@circuit@boxed - \ctikzvalof{bipoles/twoport/width} - \else - \ctikzvalof{bipoles/amp/width} - \fi -} -{amp} -{ - \ifpgf@circuit@boxed - \ctikzvalof{bipoles/twoport/width} - \else - \ctikzvalof{bipoles/amp/width} - \fi -} -{ - \ifpgf@circuit@boxed - \ctikzvalof{bipoles/twoport/width} - \else - \ctikzvalof{bipoles/amp/width} - \fi -} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \ifpgf@circuit@boxed - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} - \pgf@circ@draworfill - \fi - - % draw input arrow - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - \ifpgf@circuit@boxed - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn - \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box - \else - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \fi - - \pgfsetarrows{-} %never draw arrows - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} - \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} - - \pgfpathclose - \pgf@circ@draworfill - - % draw inner text - \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} -} - - -%% variable amplifier -\pgfcircdeclarebipolescaled{blocks} -{} -{ - \ifpgf@circuit@boxed - \ctikzvalof{bipoles/twoport/width} - \else - \ctikzvalof{bipoles/amp/width} - \fi -} -{vamp} -{ - \ifpgf@circuit@boxed - \ctikzvalof{bipoles/twoport/width} - \else - \ctikzvalof{bipoles/amp/width} - \fi -} -{ - \ifpgf@circuit@boxed - \ctikzvalof{bipoles/twoport/width} - \else - \ctikzvalof{bipoles/amp/width} - \fi -} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \ifpgf@circuit@boxed - \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} - \fi - - % draw input arrow - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - \ifpgf@circuit@boxed - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn - \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box - \else - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \fi - - - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - - \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} - \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} - - \pgfpathclose - \pgf@circ@draworfill - - % draw inner text - \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} - - % draw arrow - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetarrowsend{latex} - \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}} - \pgfusepath{draw} -} - -%% pi attenuator -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/piattenuator/width}} -{piattenuator} -{\ctikzvalof{bipoles/piattenuator/width}} -{\ctikzvalof{bipoles/piattenuator/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} -} - -%% variable pi attenuator -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/vpiattenuator/width}} -{vpiattenuator} -{\ctikzvalof{bipoles/vpiattenuator/width}} -{\ctikzvalof{bipoles/vpiattenuator/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - - \pgfsetarrowsend{latex} - \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} - \pgfusepath{draw} -} - -%% T attenuator -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/tattenuator/width}} -{tattenuator} -{\ctikzvalof{bipoles/tattenuator/width}} -{\ctikzvalof{bipoles/tattenuator/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} -} - -%% variable T attenuator -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/vtattenuator/width}} -{vtattenuator} -{\ctikzvalof{bipoles/vtattenuator/width}} -{\ctikzvalof{bipoles/vtattenuator/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} - \pgfusepath{draw} - - \pgfsetarrowsend{latex} - \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} - \pgfusepath{draw} -} - -%% phase shifter -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/phaseshifter/width}} -{phaseshifter} -{\ctikzvalof{bipoles/phaseshifter/width}} -{\ctikzvalof{bipoles/phaseshifter/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % inner symbol - \pgftext[center,x=0,y=0]{\Large$\varphi$} -} - -%% variable phase shifter -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/phaseshifter/width}} -{vphaseshifter} -{\ctikzvalof{bipoles/vphaseshifter/width}} -{\ctikzvalof{bipoles/vphaseshifter/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % inner symbol - \pgftext[center,x=0,y=0]{\Large$\varphi$} - - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetarrowsend{latex} - \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}} - \pgfusepath{draw} -} - -%% detector -\pgfcircdeclarebipolescaled{blocks} -{} -{\ctikzvalof{bipoles/detector/width}} -{detector} -{\ctikzvalof{bipoles/detector/width}} -{\ctikzvalof{bipoles/detector/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % draw inner stuff - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{0.8\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}} - \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}} - \pgfusepath{draw} - - \ifpgf@circuit@fulldiode - \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width}} - \pgftransformscale{\pgfmathresult} - \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}} - \else - \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width}} - \pgftransformscale{\pgfmathresult} - \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}} - \fi - -} - -%% single phase ac/dc converter -\pgfcircdeclarebipolescaled{blocks} -{ - \anchor{dc1}{ - \northeast - \pgf@y=.4\pgf@y - } - \anchor{dc2}{ - \northeast - \pgf@y=-.4\pgf@y - } -} -{\ctikzvalof{bipoles/sacdc/width}} -{sacdc} -{\ctikzvalof{bipoles/sacdc/width}} -{\ctikzvalof{bipoles/sacdc/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/sacdc/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} - - % draw sin wave - \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfusepath{draw} - - % draw equal sign - \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}} - \pgfusepath{draw} -} - - - -%% single phase dc/ac converter -\pgfcircdeclarebipolescaled{blocks} -{ - \anchor{dc1}{ - \northeast - \pgf@y=.4\pgf@y - \pgf@x=-\pgf@x - } - \anchor{dc2}{ - \northeast - \pgf@y=-.4\pgf@y - \pgf@x=-\pgf@x - } -} -{\ctikzvalof{bipoles/sdcac/width}} -{sdcac} -{\ctikzvalof{bipoles/sdcac/width}} -{\ctikzvalof{bipoles/sdcac/width}} -{ - \pgf@circ@res@step = \ctikzvalof{bipoles/sdcac/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} - - % draw sin wave - \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfusepath{draw} - - % draw equal sign - \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}} - \pgfusepath{draw} + \pgfusepath{draw} + \endpgfscope } - -%% threephase ac/dc converter -\pgfcircdeclarebipolescaled{blocks} +% current loop for oscope and similar: stylized +\pgfcircdeclarebipolescaled{instruments} { - \anchor{dc1}{ - \northeast - \pgf@y=.4\pgf@y - } - \anchor{dc2}{ - \northeast - \pgf@y=-.4\pgf@y - } - \anchor{ac1}{ - \northeast - \pgf@y=.6\pgf@y - \pgf@x=-\pgf@x - } - \anchor{ac2}{ - \northeast - \pgf@y=0\pgf@y - \pgf@x=-\pgf@x - } - \anchor{ac3}{ - \northeast - \pgf@y=-.6\pgf@y - \pgf@x=-\pgf@x + \anchor{i}{\northeast\pgf@x=0pt\relax} + \anchor{text}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } } } -{\ctikzvalof{bipoles/tacdc/width}} -{tacdc} -{\ctikzvalof{bipoles/tacdc/width}} -{\ctikzvalof{bipoles/tacdc/width}} +{\ctikzvalof{bipoles/iloop/height}} +{iloop} +{\ctikzvalof{bipoles/iloop/height}} +{\ctikzvalof{bipoles/iloop/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/tacdc/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} - - % draw sin waves - \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.65\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.35\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfusepath{draw} - - - - - % draw equal sign - \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}} - \pgfusepath{draw} + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@down=-\pgf@circ@res@up + \pgf@circ@res@left=-\pgf@circ@res@right + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgfsetcolor{\ctikzvalof{color}} + % external ellipse + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next the opening to the left + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} + {\pgfpoint{0pt}{.1\pgf@circ@res@up}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfpathellipse{\pgfpointorigin}{ + \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{ + \pgfpoint{0.4\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \endpgfscope + % internal wire + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % and the contact line up + \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope } - -%% threephase dc/ac converter -\pgfcircdeclarebipolescaled{blocks} +% current loop for oscope and similar: real (double connection) +\pgfcircdeclarebipolescaled{instruments} { - \anchor{dc1}{ - \northeast - \pgf@y=.4\pgf@y - \pgf@x=-\pgf@x - } - \anchor{dc2}{ - \northeast - \pgf@y=-.4\pgf@y - \pgf@x=-\pgf@x - } - \anchor{ac1}{ - \northeast - \pgf@y=.6\pgf@y + \anchor{i+}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgf@y=\pgf@circ@res@up } - \anchor{ac2}{ - \northeast - \pgf@y=0\pgf@y + \anchor{i-}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgf@y=\pgf@circ@res@up } - \anchor{ac3}{ - \northeast - \pgf@y=-.6\pgf@y + \anchor{text}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } } } -{\ctikzvalof{bipoles/tdcac/width}} -{tdcac} -{\ctikzvalof{bipoles/tdcac/width}} -{\ctikzvalof{bipoles/tdcac/width}} +{\ctikzvalof{bipoles/iloop/height}} +{iloop2} +{\ctikzvalof{bipoles/iloop/height}} +{\ctikzvalof{bipoles/iloop/width}} { - \pgf@circ@res@step = \ctikzvalof{bipoles/tdcac/width}\pgf@circ@scaled@Rlen - \divide \pgf@circ@res@step by 2 - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgf@circ@res@other = \pgf@circ@res@left - \advance\pgf@circ@res@other by \pgf@circ@res@step - - \ifpgf@circuit@dashed - \pgfsetdash{{0.1cm}{0.1cm}}{0cm} - \fi - - % draw outer box - \pgf@circ@twoportbox - - \ifpgf@circuit@inputarrow - { - \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} - } - \fi - - % rotate inner symbol - \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} - \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 - \pgftransformrotate{270} - \fi\fi - \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible - \pgftransformrotate{180} - \fi\fi - \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 - \pgftransformrotate{90} - \fi\fi - - % draw inner symbol - \pgfsetdash{}{0pt} % always draw solid line for inner symbol - \pgfsetarrows{-} %never draw arrows - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} - - % draw sin waves - \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.65\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.35\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} - \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} - \pgfusepath{draw} - - - - - % draw equal sign - \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}} - \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}} - \pgfusepath{draw} + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@down=-\pgf@circ@res@up + \pgf@circ@res@left=-\pgf@circ@res@right + % must be the same than internal i+ and i- anchors definition + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}} + \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}} + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgfsetcolor{\ctikzvalof{color}} + % external ellipse + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next the opening to the left + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} + {\pgfpoint{0pt}{.1\pgf@circ@res@up}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfpathmoveto{\@plus} + \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgfusepath{draw} + \endpgfscope + % internal wire + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % and the contact line up + % I use ...left and ---right as temporal lengths here to avoid defining more + \pgfextractx{\pgf@circ@res@left}{\@plus} + \pgfextractx{\pgf@circ@res@right}{\@minus} + \pgfpathmoveto{\@plus} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathmoveto{\@minus} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope } - +% %>>> + +% Path definitions for Instruments%<<< + +\pgfcirc@activate@bipole@simple{l}{ammeter} +\pgfcirc@activate@bipole@simple{l}{ohmmeter} +\pgfcirc@activate@bipole@simple{l}{voltmeter} +\pgfcirc@activate@bipole@simple{l}{oscope} +\pgfcirc@activate@bipole@simple{l}{rmeter} +\pgfcirc@activate@bipole@simple{l}{rmeterwa} +\pgfcirc@activate@bipole@simple{l}{smeter} +\pgfcirc@activate@bipole@simple{l}{iloop} +% \pgfcirc@activate@bipole@simple{l}{iloop2} that was wrong +\pgfcirc@activate@bipole{l}{ilooptwo}{iloop2}{iloop2} +\pgfcirc@activate@bipole@simple{l}{qvprobe} +\pgfcirc@activate@bipole@simple{l}{qiprobe} +\pgfcirc@activate@bipole@simple{l}{qpprobe} +% %>>> %%%%%%%%%%%%%%%%%%%%%%% %% MECHANICAL SYMBOLS %%%%%%%%%%%%%%%%%%%%%%% +%% Settings for Mechanical section%<<<1 +\ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8} +\ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6} +\ctikzset{bipoles/spring/height/.initial=.5} +\ctikzset{bipoles/spring/width/.initial=.5} +\ctikzset{bipoles/inerter/height/.initial=.7} +\ctikzset{bipoles/inerter/width/.initial=.175} +\ctikzset{bipoles/mass/height/.initial=.55} +\ctikzset{bipoles/mass/box height/.initial=.4} +\ctikzset{bipoles/mass/width/.initial=.5} + +\ctikzset{bipoles/damper/height/.initial=.35} +\ctikzset{bipoles/damper/length/.initial=.3} +\ctikzset{bipoles/damper/width/.initial=.4} +%%>>> + +%% Node shapes Mechanical analog system%<<< %% mechanical capacitance - stiffness/spring \pgfcircdeclarebipolescaled{mechanicals} @@ -5847,32 +5157,216 @@ \pgfusepath{stroke} } +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% electromechanical device (motor/generator) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%% -%% Crossing -%%%%%%%%%%%%%%%% - -%% crossing bipole (but see also nodes) -\pgfcircdeclarebipole -{} -{\ctikzvalof{bipoles/crossing/size}} -{crossing} -{\ctikzvalof{bipoles/crossing/size}} -{\ctikzvalof{bipoles/crossing/size}}{ - \pgfscope - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} - \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} - \pgfsetbeveljoin - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} - \pgfusepath{draw} - \endpgfscope +\pgfdeclareshape{elmech} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{electromechanicals}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{text}{ + \pgfpointorigin + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \advance \pgf@y by -.5\ht\pgfnodeparttextbox + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{right}{% + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{top}{ + \northwest + \pgf@x=0pt + } + \anchor{pathstart}{ + \northwest + \pgf@x=0pt + } + \anchor{pathend}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{bottom}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{% + \@tempdima=\pgf@x\@tempdimb=\pgf@y + \northwest\pgf@circ@res@other=-\pgf@x + \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}{\pgfqpoint{\pgf@circ@res@other}{\pgf@circ@res@other}} + } + \anchor{block north west}{\northwest\pgf@x=0.5\pgf@x} + \anchor{block south west}{\northwest\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y} + \anchor{block north east}{\northwest\pgf@x=-0.5\pgf@x} + \anchor{block south east}{\northwest\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y} + \anchor{block up right}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@x=-0.5\pgf@x + } + \anchor{block up left}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@x=0.5\pgf@x + } + \anchor{block down right}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@y=-\pgf@y + \pgf@x=-0.5\pgf@x + } + \anchor{block down left}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@y=-\pgf@y + \pgf@x=0.5\pgf@x + } + \behindbackgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope % clip the bar: whole size minus the circle + \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgfseteorule + \pgfusepath{clip} + \pgfpathrectangle{\pgfpoint{-.25\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfsetfillcolor{\ctikzvalof{color}} + \pgfusepath{fill, draw} + \endpgfscope + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white + \pgfsetfillcolor{white} + % ...but override it if the class is defined! + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \pgfusepath{draw, fill} + \fi + \endpgfscope + } } +% %>>> + +%% Path definitions for Mechanical%<<< + +\pgf@circ@definetranspath{elmech} +\pgfcirc@activate@bipole@simple{l}{spring} +\pgfcirc@activate@bipole@simple{l}{inerter} +\pgfcirc@activate@bipole@simple{l}{mass} +\pgfcirc@activate@bipole@simple{l}{damper} +\pgfcirc@activate@bipole@simple{l}{viscoe} +% %>>> + %%%%%%%%%%%%%%%%%%%%%%%%% %% Miscellaneous bipoles %%%%%%%%%%%%%%%%%%%%%%%%% +% settings for microphone, loudspeaker, fuses and misc%<<<1 + +\ctikzset{bipoles/loudspeaker/height/.initial=.8} +\ctikzset{bipoles/loudspeaker/depth/.initial=.3} +\ctikzset{bipoles/loudspeaker/width/.initial=.8} +\ctikzset{bipoles/mic/height/.initial=1.2} +\ctikzset{bipoles/mic/depth/.initial=.1} +\ctikzset{bipoles/mic/width/.initial=.8}% + +% arresters, fuses, lamps, etc + +\ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30} +\ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80} +\ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30} +\ctikzset{bipoles/american gas filled surge arrester/height/.initial=.60} +\ctikzset{bipoles/american gas filled surge arrester/width/.initial=.60} +\ctikzset{bipoles/american gas filled surge arrester/inside/.initial=.15} +\ctikzset{bipoles/american gas filled surge arrester/dot x/.initial=.25} +\ctikzset{bipoles/american gas filled surge arrester/dot y/.initial=.45} +\ctikzset{bipoles/american gas filled surge arrester/size/.initial=.1} +\ctikzset{bipoles/fuse/height/.initial=.20} +\ctikzset{bipoles/fuse/width/.initial=.50} +\ctikzset{bipoles/afuse/height/.initial=.20} +\ctikzset{bipoles/afuse/width/.initial=.50} +\ctikzset{bipoles/lamp/height/.initial=.60} +\ctikzset{bipoles/lamp/width/.initial=.60} +\ctikzset{bipoles/bulb/height/.initial=.8} +\ctikzset{bipoles/bulb/width/.initial=.8} +\ctikzset{bipoles/tline/height/.initial=.3} +\ctikzset{bipoles/tline/width/.initial=.6} +\ctikzset{bipoles/squid/height/.initial=.60} +\ctikzset{bipoles/squid/width/.initial=.60} +\ctikzset{bipoles/barrier/height/.initial=.60} +\ctikzset{bipoles/barrier/width/.initial=.60} +\ctikzset{bipoles/openbarrier/gap/.initial=0.5} +\ctikzset{bipoles/thermocouple/height/.initial=.250} +\ctikzset{bipoles/thermocouple/height 2/.initial=.60} +\ctikzset{bipoles/thermocouple/width/.initial=.140} +\newif\ifpgf@circuit@europeangfsurgearrester +\ctikzset{gas filled surge arrester choice/.is choice} +\ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue}} +\ctikzset{gas filled surge arrester choice/american/.code= {\pgf@circuit@europeangfsurgearresterfalse}} + +\tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}} +\tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}} +%%>>> + +%% Node shapes for miscellaneous symbols %<<< %% loudspeaker and microphone \pgfcircdeclarebipolescaled{misc} @@ -6154,7 +5648,27 @@ \pgfsetbeveljoin \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} \pgfusepath{draw} -} - +}% %>>> + +%% Path definitions for Miscellaneous%<<< + +\pgfcirc@activate@bipole@simple{l}{lamp} +\pgfcirc@activate@bipole@simple{l}{bulb} +\pgfcirc@activate@bipole@simple{l}{squid} +\pgfcirc@activate@bipole@simple{l}{barrier} +\pgfcirc@activate@bipole@simple{l}{openbarrier} +\pgfcirc@activate@bipole@simple{l}{thermocouple} +\pgfcirc@activate@bipole@simple{l}{fuse} +\pgfcirc@activate@bipole{l}{afuse}{afuse}{asymmetric fuse} +\pgfcirc@style@to@style{asymmetric fuse}{afuse} +\def\pgf@circ@gfsurgearrester@path#1{\ifpgf@circuit@europeangfsurgearrester\pgf@circ@europeangfsurgearrester@path{#1}\else\pgf@circ@americangfsurgearrester@path{#1}\fi} +\pgfcirc@activate@bipole{l}{europeangfsurgearrester}{european gas filled surge arrester}{european gas filled surge arrester} +\pgfcirc@activate@bipole{l}{americangfsurgearrester}{american gas filled surge arrester}{american gas filled surge arrester} +\pgfcirc@path@to@style{l}{gfsurgearrester}{gas filled surge arrester}{} +\pgfcirc@path@to@style{l}{gfsurgearrester}{gf surge arrester}{} +\pgfcirc@activate@bipole@simple{l}{mic} +\pgfcirc@activate@bipole@simple{l}{loudspeaker} +% %>>> % end of pgfcircbipoles.tex +% vim: set fdm=marker fmr=%<<<,%>>>: diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcirccurrent.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcirccurrent.tex index 3899a1df12..49378d367b 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcirccurrent.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcirccurrent.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -24,7 +24,7 @@ %% Options \ctikzset{i^>/.style = { - i = #1, + i={#1}, \circuitikzbasekey/bipole/current/direction = forward, \circuitikzbasekey/bipole/current/x position = after, \circuitikzbasekey/bipole/current/y position = above @@ -32,7 +32,7 @@ } \ctikzset{i_>/.style = { - i = #1, + i={#1}, \circuitikzbasekey/bipole/current/direction = forward, \circuitikzbasekey/bipole/current/x position = after, \circuitikzbasekey/bipole/current/y position = below @@ -40,7 +40,7 @@ } \ctikzset{i>^/.style = { - i = #1, + i={#1}, \circuitikzbasekey/bipole/current/direction = forward, \circuitikzbasekey/bipole/current/x position = before, \circuitikzbasekey/bipole/current/y position = above @@ -48,7 +48,7 @@ } \ctikzset{i>_/.style = { - i = #1, + i={#1}, \circuitikzbasekey/bipole/current/direction = forward, \circuitikzbasekey/bipole/current/x position = before, \circuitikzbasekey/bipole/current/y position = below @@ -56,7 +56,7 @@ } \ctikzset{i^/.style = {i = #1, \circuitikzbasekey/bipole/current/direction = forward } } -\ctikzset{i^/.style = { i= #1, \circuitikzbasekey/bipole/current/y position = above } } +\ctikzset{i_/.style = { i={#1}, \circuitikzbasekey/bipole/current/y position = below } } +\ctikzset{i>/.style = {i={#1}, \circuitikzbasekey/bipole/current/direction = forward } } +\ctikzset{i^/.style = { i={#1}, \circuitikzbasekey/bipole/current/y position = above } } %% Output routine \def\pgf@circ@drawcurrent{ diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircflow.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircflow.tex index 9d72e87d7d..77d240cef7 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircflow.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircflow.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -25,7 +25,7 @@ %% Options \ctikzset{f^>/.style = { - f = #1, + f={#1}, \circuitikzbasekey/bipole/flow/direction = forward, \circuitikzbasekey/bipole/flow/x position = after, \circuitikzbasekey/bipole/flow/y position = above @@ -33,7 +33,7 @@ } \ctikzset{f_>/.style = { - f = #1, + f={#1}, \circuitikzbasekey/bipole/flow/direction = forward, \circuitikzbasekey/bipole/flow/x position = after, \circuitikzbasekey/bipole/flow/y position = below @@ -41,7 +41,7 @@ } \ctikzset{f>^/.style = { - f = #1, + f={#1}, \circuitikzbasekey/bipole/flow/direction = forward, \circuitikzbasekey/bipole/flow/x position = before, \circuitikzbasekey/bipole/flow/y position = above @@ -49,7 +49,7 @@ } \ctikzset{f>_/.style = { - f = #1, + f={#1}, \circuitikzbasekey/bipole/flow/direction = forward, \circuitikzbasekey/bipole/flow/x position = before, \circuitikzbasekey/bipole/flow/y position = below @@ -57,7 +57,7 @@ } \ctikzset{f^/.style = { f = #1, \circuitikzbasekey/bipole/flow/direction = forward } } -\ctikzset{f^/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = above } } +\ctikzset{f/.style = { f={#1}, \circuitikzbasekey/bipole/flow/direction = forward } } +\ctikzset{f^/.style = { f={#1}, \circuitikzbasekey/bipole/flow/y position = above } } \ctikzset{f/.code = { \pgfcirc@has@ftrue \pgfkeys{\circuitikzbasekey/bipole/flow/direction = forward, \circuitikzbasekey/bipole/flow/x position = after, \circuitikzbasekey/bipole/flow/y position = above } - \pgfkeys{/tikz/circuitikz/bipole/flow/label/name=#1} + \pgfkeys{/tikz/circuitikz/bipole/flow/label/name={#1}} \ctikzsetvalof{bipole/flow/label/unit}{} \ifpgf@circ@siunitx \pgf@circ@handleSI{#1} diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcirclabel.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcirclabel.tex index 5f65d77079..465f704ded 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcirclabel.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcirclabel.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -31,9 +31,9 @@ }} %% Options -\ctikzset{label/.style = { l=#1 } } +\ctikzset{label/.style = { l={#1} } } \ctikzset{l/.code = { - \pgfkeys{/tikz/circuitikz/bipole/label/name=#1} + \pgfkeys{/tikz/circuitikz/bipole/label/name={#1}} \ctikzsetvalof{bipole/label/unit}{} \ifpgf@circ@siunitx \pgf@circ@handleSI{#1} @@ -49,28 +49,28 @@ }} \ctikzset{label above/.code = { - l=#1, + l={#1}, \circuitikzbasekey/bipole/label/position=90 } } \ctikzset{l^/.style = { - l=#1, + l={#1}, \circuitikzbasekey/bipole/label/position=90 } } \ctikzset{label below/.code = { - l=#1, + l={#1}, \circuitikzbasekey/bipole/label/position=-90 } } \ctikzset{l_/.style = { - l=#1, + l={#1}, \circuitikzbasekey/bipole/label/position=-90 } } -\ctikzset{annotation/.style = { a=#1 } } +\ctikzset{annotation/.style = { a={#1} } } \ctikzset{a/.code = { - \pgfkeys{/tikz/circuitikz/bipole/annotation/name=#1} + \pgfkeys{/tikz/circuitikz/bipole/annotation/name={#1}} \ctikzsetvalof{bipole/annotation/unit}{} \ifpgf@circ@siunitx \pgf@circ@handleSI{#1} @@ -86,21 +86,21 @@ }} \ctikzset{annotation above/.code = { - a=#1, + a={#1}, \circuitikzbasekey/bipole/annotation/position=90 } } \ctikzset{a^/.style = { - a=#1, + a={#1}, \circuitikzbasekey/bipole/annotation/position=90 } } \ctikzset{annotation below/.code = { - a=#1, + a={#1}, \circuitikzbasekey/bipole/annotation/position=-90 } } \ctikzset{a_/.style = { - a=#1, + a={#1}, \circuitikzbasekey/bipole/annotation/position=-90 } } diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircmonopoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircmonopoles.tex index 5087f69678..08f58c1b70 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircmonopoles.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircmonopoles.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -19,6 +19,38 @@ %%%%%%%%%%%%% +% grounds and power supplies%<<<1 + +\ctikzset{monopoles/.is family} +\ctikzset{monopoles/ground/width/.initial=.25} +\ctikzset{monopoles/ground/connectionthickness/.initial=1} +\ctikzset{monopoles/ground/thickness/.initial=2} +\ctikzset{monopoles/rground/thickness/.initial=2} +\ctikzset{monopoles/tground/thickness/.initial=3} +\ctikzset{monopoles/vcc/width/.initial=.2} +\ctikzset{monopoles/vcc/arrow/.initial=legacy} +\ctikzset{monopoles/vee/arrow/.initial=legacy} +\ctikzset{monopoles/match/width/.initial=.4} +\ctikzset{monopoles/chassis/width/.initial=.25} +\ctikzset{monopoles/alternative chassis/width/.initial=.25} +\ctikzset{monopoles/equipotentiality/width/.initial=.25} +\ctikzset{monopoles/antenna/width/.initial=.25} +\ctikzset{monopoles/antenna/label/xanchor/.initial=.4} +\ctikzset{monopoles/antenna/label/yanchor/.initial=.75} +\ctikzset{monopoles/txantenna/label/xanchor/.initial=.4} +\ctikzset{monopoles/txantenna/label/yanchor/.initial=.75} +\ctikzset{monopoles/txantenna/width/.initial=.25} +\ctikzset{monopoles/rxantenna/label/xanchor/.initial=.4} +\ctikzset{monopoles/rxantenna/label/yanchor/.initial=.75} +\ctikzset{monopoles/rxantenna/width/.initial=.25} +\ctikzset{monopoles/bareantenna/width/.initial=.25} +\ctikzset{monopoles/bareantenna/label/xanchor/.initial=1} +\ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5} +\ctikzset{monopoles/waves/width/.initial=0.5}% +%>>> + +%% Node shapes for grounds and power supply%<<< + %% Ground symbol % #1 -> name % #2 -> width @@ -352,11 +384,77 @@ \pgfusepath{draw} \endpgfscope } +}% %>>> + + +%% This are strange, and probably wrong FIXME +% \compattikzset{vdd/.style = {\comnpatname vcc = #1}} +% \compattikzset{vss/.style = {\comnpatname vee = #1}} +\pgfcirc@style@to@style{vcc}{vdd} +\pgfcirc@style@to@style{vee}{vss} + + +%%%%%%%%%%%%%% +%% RF bipoles and monopoles +%%%%%%%%%%%%%% + +%% RF bipoles and monopoles settings %<<<1 +\ctikzset{bipoles/mstline/height/.initial=0.3} +\ctikzset{bipoles/mstline/width/.initial=1.2} +\pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}} +\ctikzset{monopoles/msport/width/.initial=.5} +\ctikzset{monopoles/msrstub/height/.initial=1.0} +\ctikzset{monopoles/msrstub/width/.initial=0.6}% +%>>> + +%% Node shapes for RF bipoles%<<< + +\pgfcircdeclarebipolescaled{RF} +{} +{\ctikzvalof{bipoles/tline/height}} +{tline} +{\ctikzvalof{bipoles/tline/height}} +{\ctikzvalof{bipoles/tline/width}} +{ + \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis + \begin{pgftransparencygroup} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \pgfpathellipse{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} + {\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{-\pgf@circ@res@up}} + \pgf@circ@draworfill + \end{pgftransparencygroup} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{stroke} } -%%%%%%%%%%%%%%%% -%% RF elements -%%%%%%%%%%%%%%%% +% microstrip transmission line +\pgfcircdeclarebipolescaled{RF} +{} +{\ctikzvalof{bipoles/mstline/height}} +{mstline} +{\ctikzvalof{bipoles/mstline/height}} +{\ctikzvalof{bipoles/mstline/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill +}% %>>> + +%% Path definitions for RF path objects%<<< +\pgfcirc@activate@bipole@simple{l}{mstline} +\pgfcirc@activate@bipole@simple{l}{tline} +\pgfcirc@style@to@style{tline}{transmission line} +\pgfcirc@style@to@style{tline}{TL} +% %>>> + +%% Node shapes for RF monopoles%<<< % Legacy tlinestub % Contributed by Leonardo Azzinnari @@ -1096,5 +1194,7 @@ \endpgfscope } } +% %>>> \endinput +% vim: set fdm=marker fmr=%<<<,%>>>: diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex index 315ba32e4e..3454f6dd34 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -11,9 +11,95 @@ % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% Multipoles by Romano Giannetti +%% Chips and Rotary Switches %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Definitions for Chips and Rotary switches (multipoles) %<<<1 +% +\ctikzset{multipoles/thickness/.initial=2} +\ctikzset{multipoles/font/.initial=\pgf@circ@font@tiny} +% DIP (dual in line package) chips +\ctikzset{multipoles/dipchip/width/.initial=1.2} +\ctikzset{multipoles/dipchip/num pins/.initial=8} +\ctikzset{multipoles/dipchip/pin spacing/.initial=0.4} +\pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/dipchip/num pins=#1}}} +% QFP (quad flat package) chips +\ctikzset{multipoles/qfpchip/num pins/.initial=8} +\ctikzset{multipoles/qfpchip/pin spacing/.initial=0.4} +\pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/qfpchip/num pins=#1}}} +% chip numbers +\newif\ifpgf@circuit@chip@shownumbers\pgf@circuit@chip@shownumberstrue +\pgfkeys{/tikz/show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}} +\ctikzset{show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}} +\pgfkeys{/tikz/hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}} +\ctikzset{hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}} +\newif\ifpgf@circuit@chip@straightnumbers\pgf@circuit@chip@straightnumberstrue +\pgfkeys{/tikz/straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}} +\ctikzset{straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}} +\pgfkeys{/tikz/rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}} +\ctikzset{rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}} +% external chip pins +\ctikzset{multipoles/external pins thickness/.initial=1} +\ctikzset{multipoles/external pins width/.initial=0.2} +\ctikzset{multipoles/external pad fraction/.initial=0} +\pgfkeys{/tikz/external pins width/.add code={}{\ctikzset{multipoles/external pins width=#1}}} +\pgfkeys{/tikz/external pad fraction/.add code={}{\ctikzset{multipoles/external pad fraction=#1}}} +% topmarks +\newif\ifpgf@circuit@chip@topmark\pgf@circuit@chip@topmarktrue +\pgfkeys{/tikz/topmark/.add code={}{\pgf@circuit@chip@topmarktrue}} +\ctikzset{topmark/.add code={}{\pgf@circuit@chip@topmarktrue}} +\pgfkeys{/tikz/no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}} +\ctikzset{no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}} + +% rotary switch by Romano +\ctikzset{multipoles/rotary/thickness/.initial=1} +\ctikzset{multipoles/rotary/shape/.initial=ocirc} +\ctikzset{multipoles/rotary/channels/.initial=5} +\ctikzset{multipoles/rotary/angle/.initial=60} +\ctikzset{multipoles/rotary/wiper/.initial=20} +\ctikzset{multipoles/rotary/arrow/.is choice} +\newif\ifpgf@circ@rotaryarrow\pgf@circ@rotaryarrowfalse +\newif\ifpgf@circ@rotaryarrow@cw\pgf@circ@rotaryarrow@cwfalse +\newif\ifpgf@circ@rotaryarrow@ccw\pgf@circ@rotaryarrow@ccwfalse +\ctikzset{multipoles/rotary/arrow/none/.code={\pgf@circ@rotaryarrowfalse\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwfalse}} +\ctikzset{multipoles/rotary/arrow/both/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwtrue}} +\ctikzset{multipoles/rotary/arrow/cw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwfalse}} +\ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwtrue}} + +\tikzset{% + rotary switch/.style args={#1in#2wiper#3}{% + shape=rotaryswitch, + /tikz/circuitikz/multipoles/rotary/channels=#1, + /tikz/circuitikz/multipoles/rotary/angle=#2, + /tikz/circuitikz/multipoles/rotary/wiper=#3, + }, + rotary switch -/.style args={#1in#2wiper#3}{ + rotary switch=#1 in #2 wiper #3, + /tikz/circuitikz/multipoles/rotary/arrow=none, + }, + rotary switch <-/.style args={#1in#2wiper#3}{ + rotary switch=#1 in #2 wiper #3, + /tikz/circuitikz/multipoles/rotary/arrow=ccw, + }, + rotary switch ->/.style args={#1in#2wiper#3}{ + rotary switch=#1 in #2 wiper #3, + /tikz/circuitikz/multipoles/rotary/arrow=cw, + }, + rotary switch <->/.style args={#1in#2wiper#3}{ + rotary switch=#1 in #2 wiper #3, + /tikz/circuitikz/multipoles/rotary/arrow=both, + }, + % Notice that these should be the same as the initial values of the keys + rotary switch/.default={5 in 60 wiper 20}, + rotary switch -/.default={5 in 60 wiper 20}, + rotary switch <-/.default={5 in 60 wiper 20}, + rotary switch ->/.default={5 in 60 wiper 20}, + rotary switch <->/.default={5 in 60 wiper 20}, +} +%%>>> + +%% Nodes definitions for chips%<<< + %%%%%%%%% %% Chips %%%%%%%%% @@ -523,7 +609,9 @@ % <= npins/4, left side \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}% \fi -} +}% %>>> + +%% Nodes definition for rotaryswitch%<<< %%%%%%%%%%%%%%%%% %% Rotary Switch @@ -713,12 +801,87 @@ \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa} \pgfpointborderrectangle{\pgfpointpolar{\myangle}{1pt}}{\pgfpoint{2.5\pgf@circ@res@temp}{2.5\pgf@circ@res@temp}} \advance\pgf@x by -\pgf@circ@res@temp -} +}% %>>> %%%%%%%%%%%%%%%%%%%%%%%%%% % Seven segments displays %%%%%%%%%%%%%%%%%%%%%%%%%% +% Definitions for seven segment displays by RGtti%<<<1 + +\newif\ifpgf@circ@sevenseg@dot +\newif\ifpgf@circ@sevenseg@box +\def\pgf@circ@sevenseg@dotstate{empty} +\ctikzset{seven seg/.is family} +\ctikzset{seven seg/dot/.is choice} +% none means no dot, not space for it. Empty means no dot, but space +\ctikzset{seven seg/dot/none/.code={\pgf@circ@sevenseg@dotfalse}} +\ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}} +\ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}} +\ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}} +% +\ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen +\ctikzset{seven seg/thickness/.initial=4pt}% segment thickness +\ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments +\ctikzset{seven seg/box sep/.initial=1pt}% external box gap +\ctikzset{seven seg/color on/.initial=red}% color for segment "on" +\ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off" +\ctikzset{seven seg/box/.is choice} +\ctikzset{seven seg/box/off/.code={\pgf@circ@sevenseg@boxfalse}} +\ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@boxtrue}} + +\ctikzset{seven seg/bits/.initial=0000000} + +\ctikzset{seven seg/value/.code={% + \edef\@@tmp{#1}% + \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi + \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi + \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi + \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi + \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi + \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi + \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi + \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi + \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi + \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi + \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi + \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi + \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi + \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi + \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi + \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi + \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi + \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi + \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi + \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi + \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi + \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi + \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi + \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi + \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi + \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi + \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi + \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi + \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi +}} + +\tikzset{% + seven segment val/.style args={#1dot#2box#3}{% + shape=bare7seg, + /tikz/circuitikz/seven seg/value=#1, + /tikz/circuitikz/seven seg/dot=#2, + /tikz/circuitikz/seven seg/box=#3, + }, + seven segment bits/.style args={#1dot#2box#3}{% + shape=bare7seg, + /tikz/circuitikz/seven seg/bits=#1, + /tikz/circuitikz/seven seg/dot=#2, + /tikz/circuitikz/seven seg/box=#3, + }, +} +%%>>> + +%% Nodes definitions for 7-segment display%<<< \pgfdeclareshape{bare7seg}{ \savedmacro{\ctikzclass}{\edef\ctikzclass{displays}} \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} @@ -857,11 +1020,39 @@ \pgfusepath{draw,fill} \fi } +% %>>> + +%%%%%%%%%%%%%%%%%%%%%%%% +%% Flip-flops and muxdemuxes +%%%%%%%%%%%%%%%%%%%%%%%% +% Settings for flip flops and muxdemxes%<<<1 -%%%%%% -%%%%%% Flip-flops -%%%%%% +%% flip-flop specific keys (most others are the same as chips) + +\ctikzset{multipoles/flipflop/font/.initial=\pgf@circ@font@small} +\ctikzset{multipoles/flipflop/fontud/.initial=\pgf@circ@font@tiny} +\ctikzset{multipoles/flipflop/width/.initial=1.2} +\ctikzset{multipoles/flipflop/pin spacing/.initial=0.6} +\ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2} + +%% muxdemuxes keys + +\ctikzset{multipoles/muxdemux/base len/.initial=0.4} +\ctikzset{multipoles/muxdemux/Lh/.initial=8.0} +\ctikzset{multipoles/muxdemux/Rh/.initial=6.0} +\ctikzset{multipoles/muxdemux/w/.initial=3.0} +\ctikzset{multipoles/muxdemux/inset w/.initial=0.0} +\ctikzset{multipoles/muxdemux/inset Lh/.initial=0.0} +\ctikzset{multipoles/muxdemux/inset Rh/.initial=0.0} +\ctikzset{multipoles/muxdemux/NL/.initial=8} +\ctikzset{multipoles/muxdemux/NR/.initial=1} +\ctikzset{multipoles/muxdemux/NB/.initial=3} +\ctikzset{multipoles/muxdemux/NT/.initial=0} +\ctikzset{multipoles/muxdemux/square pins/.initial=0}% +%>>> + +%% Node shapes definitions for flip flops%<<< % Flip flops are a specialized kind of dipchip. % they have a class by themselves @@ -1293,6 +1484,9 @@ \repeatpgfmathloop% }% } +% %>>> + +%% Node shapes for mux-demuxes%<<< % % MUX-DEMUXES @@ -1781,1247 +1975,6 @@ \fi \fi } +% %>>> -%% IEEE standard logic ports module -%% -%% Original multi-input code from John Kormylo at tex.stackexchange.com -%% Help by TheTeXnician <38565529+TheTeXnician@users.noreply.github.com> -%% Suggested idea and example code by Jason Sachs -%% Please see https://github.com/circuitikz/circuitikz/issues/383 for a lot of details -%% Most of the code, all errors and bugs by Romano Giannetti -%% Everything is in the same place here --- more or less; first step to move towards -%% a module interface for circutikz -%% - -% base parameters for ieeestd ports. - -\ctikzset{ieeestd ports/.is family} -% baselen is relative to pgfcirc@Rlen as ever; scaled if the class says so. -% the value of 0.4 is the standard pin distance for a port with height=num pins -% and matches the chip distance -\ctikzset{ieeestd ports/baselen/.initial=0.4} -% these are in term of baselen; width depends on height (fixed proportions) -\ctikzset{ieeestd ports/height/.initial=2} -\ctikzset{ieeestd ports/pin length/.initial=0.7} -% the standard "not" circle should be 1/6.5 of height (diameter); -% so radius/baselen=1/3.25/2 --- using 0.1 and no scaling is as a pole -\ctikzset{ieeestd ports/not radius/.initial=0.154} -\ctikzset{ieeestd ports/not radius fill/.initial=1}% change ony if you know why -% the suggested xnor distance is is 1.24, so 1.25/3.25/2 -% xor/xnor leads go full in in IEEE; let this be optional -\ctikzset{ieeestd ports/xor bar distance/.initial=0.192}% -\ctikzset{ieeestd ports/xor leads in/.initial=1}% -% -% base size of a small external schmitt symbol -% -\ctikzset{ieeestd ports/schmitt symbol size/.initial=0.3}% -% -% input management -% we are using the same /tikz/number inputs than the legacy ports -% -\tikzset{/tikz/inner inputs/.initial=0} % using 0 means that all inputs are inner -% -% integrate with the other logic ports -% -% -\newif\ifpgf@circuit@ieeelogicport\pgf@circuit@ieeelogicportfalse -\ctikzset{logic ports/ieee/.code= {% - \pgf@circuit@ieeelogicporttrue - \pgf@circuit@europeanlogicportfalse - \tikzset{and port/.style={shape=ieeestd and port}}% - \tikzset{or port/.style={shape=ieeestd or port}}% - \tikzset{xor port/.style={shape=ieeestd xor port}}% - \tikzset{buffer port/.style={shape=ieeestd buffer port}}% - \tikzset{not port/.style={shape=ieeestd not port}}% - \tikzset{nand port/.style={shape=ieeestd nand port}}% - \tikzset{nor port/.style={shape=ieeestd nor port}}% - \tikzset{xnor port/.style={shape=ieeestd xnor port}}% - \tikzset{schmitt port/.style={shape=ieeestd schmitt port}}% - \tikzset{invschmitt port/.style={shape=ieeestd invschmitt port}}% -}} -% add code to be compatible with the other ports -\ctikzset{logic ports/european/.add code={\pgf@circuit@ieeelogicportfalse}} -\ctikzset{logic ports/american/.add code={\pgf@circuit@ieeelogicportfalse}} -\tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}} -% -% the base angle for the or port. See the drawings. This will not change with height -% -\pgfmathsetmacro{\pgf@circ@orangle}{atan(3.25/6.5)} -% \typeout{ANGLE-IS\space\pgf@circ@orangle} -\def\pgf@circ@ieeeport@input#1% #1 = \pgfmathcounter -{% - \ifnum#1>\inputs - \PackageError{circuitikz}{% - You requested input pin #1 for logic port shape \thisshape\space \MessageBreak - which has been defined with \inputs\space pins% - }{Please check the manual about logic ports; if you press return I'll try to continue} - \fi - \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port - \pgfextractx{\pgf@circ@res@left}{\bodyleft} - \pgf@circ@res@step=\pind - \pgf@y=\pgf@circ@res@up\advance\pgf@y by -#1\pgf@circ@res@step\relax - \pgf@x=\pgf@circ@res@left\advance\pgf@x by -\pinlen -}% - -% #1 = \pgfmathcounter #2=type -% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor -\def\pgf@circ@ieeeport@baseinput#1#2% -{% - \ifnum#1>\inputs - \PackageError{circuitikz}{% - You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak - which has been defined with \inputs\space pins% - }{Please check the manual about logic ports; if you press return I'll try to continue} - \fi - % Find the vertical position (this is the same for any port) - \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port - \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax - % rack (extended) pins; they are the same for all the ports - % call K = (inputs-inner)/2, rounded up; pins on the rack are: - % above: 1..K (included) - % below: inputs-K..inputs - % Find the pins on the rack; they are 1... - \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! - \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1 - % border anchors for rack should be ok - \pgfextractx{\pgf@circ@res@left}{\topleft} - \pgfextractx{\pgf@circ@res@right}{\bodyleft} - \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left - % we have finished if we are in the rack - \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b - % we are on the inner ports; we have to do the hard work here - % and and nand - \ifnum #2=1 - \relax % It's an and/nand, all border ports are on the rack line - \fi - % or and nor - \ifnum #2=2 - \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} - \fi - % xor and xnor - \ifnum #2=3\relax - \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-\xorbar-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} - \fi - \fi\fi -}% -% inner base ports for xor types port -% #1 = \pgfmathcounter #2=type -% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor -\def\pgf@circ@ieeeport@innerbaseinput#1% -{% - \ifnum#1>\inputs - \PackageError{circuitikz}{% - You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak - which has been defined with \inputs\space pins% - }{Please check the manual about logic ports; if you press return I'll try to continue} - \fi - % Find the vertical position (this is the same for any port) - \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port - \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax - % rack (extended) pins; they are the same for all the ports - % call K = (inputs-inner)/2, rounded up; pins on the rack are: - % above: 1..K (included) - % below: inputs-K..inputs - % Find the pins on the rack; they are 1... - \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! - \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1 - % border anchors for rack should be ok - \pgfextractx{\pgf@circ@res@left}{\topleft} - \pgfextractx{\pgf@circ@res@right}{\bodyleft} - \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left - % we have finished if we are in the rack - \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b - % we are on the inner ports; we have to do the hard work here - \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} - \fi\fi -}% - -%%% macro to find basic lenghts --- they leave it in \pgf@circ@res@temp -\def\pgf@circ@ieeestd@baselen{% - \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} - \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*\pgf@circ@scaled@Rlen} -} -\def\pgf@circ@ieeestd@stdH{% - \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} - \pgfmathsetlength{\pgf@circ@res@temp}{0.5*\ctikzvalof{ieeestd ports/baselen}* - \ctikzvalof{ieeestd ports/height}*\pgf@circ@scaled@Rlen} -} -\def\pgf@circ@ieeestd@pinlen{% - \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} - \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}* - \ctikzvalof{ieeestd ports/pin length}*\pgf@circ@scaled@Rlen} -} -\def\pgf@circ@ieeestd@xorbar{% - \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} - \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}* - \ctikzvalof{ieeestd ports/xor bar distance}*\pgf@circ@scaled@Rlen} -} -%% Not circle -\def\pgf@circ@notradius{ - \pgf@circ@ieeestd@stdH % got the standard length. Notice that his is 3.25H for IEEE - \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/not radius}*\pgf@circ@res@temp} - % \typeout{NOTRADIUS\space\the\pgf@circ@res@temp} -} -%% Find (in ...@other) the height of the rack -\def\pgf@circ@findrackH{% - \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax% - \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax% - \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins - \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % - \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi% - \pgf@circ@ieeestd@stdH - \multiply\pgf@circ@res@temp by 2\relax% full height - \divide\pgf@circ@res@temp by \pgf@circ@count@b % the pin spacing - \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@count@a/2)*\pgf@circ@res@temp} %top of the rack/port - % \typeout{RACK-\thisshape\space\the\pgf@circ@res@other} -} -%% -\def\pgf@circ@find@ieeeport@up{% leave it in up - % Normal port limits - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@circ@res@up}{\pgf@circ@res@temp} - % rack top size - \pgf@circ@findrackH - \ifdim\pgf@circ@res@other > \pgf@circ@res@up - \pgf@circ@res@up=\pgf@circ@res@other - \else - \fi -} -\def\pgf@circ@find@ieeeport@left#1{% leave it in left; #1 is type - % Normal port limits - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@circ@res@left}{8*\pgf@circ@res@temp/6.5} - \pgf@circ@res@right=\pgf@circ@res@left % save the border value - \pgf@circ@res@step=\pgf@circ@res@temp % save the stdH value - \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@left by \pgf@circ@res@temp - % \typeout{LEFT1-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} - % this is the normal left border - % For the or or xor port, the limit can be the pointy thing (in case the - % pinlen is zero or too small) - % add to the body margin the or/nor peak: - \ifnum #1 > 1\relax% "or", "nor", "xor", "xnor" gates. - \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@step*(1-cos(\pgf@circ@orangle))} - \advance\pgf@circ@res@right by \pgf@circ@res@other - % \typeout{LEFT2-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} - \fi - % add to the body margin the xor/xnor distance - \ifnum #1 = 3\relax% "xor" or "xnor" gates. - \pgf@circ@ieeestd@xorbar - \advance\pgf@circ@res@right by \pgf@circ@res@temp - % \typeout{LEFT3-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} - \fi - % and if this exceeds the normal margin, this is it - % \typeout{LEFT4-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} - \ifdim \pgf@circ@res@right > \pgf@circ@res@left - \pgf@circ@res@left=\pgf@circ@res@right - \fi - % \typeout{LEFT5-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} - \pgf@circ@res@left=-\pgf@circ@res@left -} -\def\pgf@circ@find@ieeeport@right#1{% leave it in right; #1 is plain or negated - % Normal port limits - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@circ@res@right}{8*\pgf@circ@res@temp/6.5} - \pgf@circ@notradius - \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp} - \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp - \ifdim\pgf@circ@res@other > \pgf@circ@res@right - \pgf@circ@res@right=\pgf@circ@res@other - \fi -} -\def\pgf@circ@find@ieeeport@not@right#1{% leave it in right; #1 is plain or negated - % Normal port limits - \pgf@circ@ieeestd@stdH - % notice 0.8660254 is cos(30) - \pgfmathsetlength{\pgf@circ@res@right}{0.8660254*\pgf@circ@res@temp} - \pgf@circ@notradius - \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp} - \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp - \ifdim\pgf@circ@res@other > \pgf@circ@res@right - \pgf@circ@res@right=\pgf@circ@res@other - \fi -} - - -%%% ieeestd multi-input ports -%%% #1: name -%%% #2: type: 1 for and,nand; 2 for or,nor; 3 for xor,xnor -%%% #3: polarity: 0 for direct, 1 for inverted (not at the output) -%%% #4: drawing for the port -\long\def\pgfcircdeclareieeeport#1#2#3#4{% - \pgfdeclareshape{ieeestd #1 port}% - {% - \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} - \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} - \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} - \saveddimen{\baselen}{% - \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp - } - \saveddimen{\stdH}{% This is HALF the height of the inner port - \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp - } - \saveddimen{\notdiameter}{ - \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp - } - \saveddimen{\pind}{% pin distance; - \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax% - \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax% - \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins - \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % - \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi% - \pgf@circ@ieeestd@stdH\pgf@x=2\pgf@circ@res@temp % full height - \divide\pgf@x by \pgf@circ@count@b - } - \saveddimen{\pinlen}{% - \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp - } - \saveddimen{\xorbar}{% - \pgf@circ@ieeestd@xorbar\pgf@x=\pgf@circ@res@temp - } - % anchors for the body (no pins included here) - \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5} - \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} - } - \savedanchor{\topleft}{% - \pgf@circ@ieeestd@xorbar\pgf@circ@res@right=\pgf@circ@res@temp % save \xorbar - \pgf@circ@ieeestd@stdH - \pgf@circ@res@other=0pt\relax - \ifnum #2 = 2\relax% "or" or "nor" gates. - \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))} - \fi - \ifnum #2 = 3\relax% "xor" or "xnor" gates. - \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle)) - +\pgf@circ@res@right} - \fi - \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5-\pgf@circ@res@other} - \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} - } - \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5} - \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} - } - \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle - \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp - \pgf@circ@ieeestd@stdH - % #3 is =1 if the port is a negated output one - \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5+#3*2*\pgf@circ@res@other} - \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} - } - % geographical anchors --- must be rectangulars! - \savedanchor{\northwest}{% - \pgf@circ@find@ieeeport@up - \pgf@circ@find@ieeeport@left{#2} - % \typeout{ANCH5-\thisshape\space L\space\the\pgf@circ@res@left\space U\space\the\pgf@circ@res@up} - \pgf@x=\pgf@circ@res@left - \pgf@y=\pgf@circ@res@up - } - \savedanchor{\southwest}{% - \pgf@circ@find@ieeeport@up - \pgf@circ@find@ieeeport@left{#2} - \pgf@x=\pgf@circ@res@left - \pgf@y=-\pgf@circ@res@up - } - \savedanchor{\southeast}{% - \pgf@circ@find@ieeeport@up - \pgf@circ@find@ieeeport@right{#3} - \pgf@x=\pgf@circ@res@right - \pgf@y=-\pgf@circ@res@up - } - \savedanchor{\northeast}{% - \pgf@circ@find@ieeeport@up - \pgf@circ@find@ieeeport@right{#3} - \pgf@x=\pgf@circ@res@right - \pgf@y=\pgf@circ@res@up - } - \savedmacro\inputs{% get number of inputs - \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax - \ifnum\pgf@circ@count@a=0\pgf@circ@count@a=2\fi % default - \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins - % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi - \def\inputs{\the\pgf@circ@count@a}% - }% - \savedmacro\inners{% get number of "inner" inputs (for racks) - \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax - \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax - \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins - \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins - \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi - % \typeout{INNER is \the\pgf@circ@count@b}% - % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi - \def\inners{\the\pgf@circ@count@b}% - }% - \anchor{center}{\pgfpointorigin} - \anchor{text}{ - \ifpgf@circ@center@text - \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} - \else - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@circ@res@left}{-8*\pgf@circ@res@temp/6.5} % left border - \pgfpoint{\pgf@circ@res@left + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} - \fi - } - % create input anchors - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@ieeestd #1 port\endcsname{% - \pgf@circ@count@a=\inputs - \pgfmathloop% - \ifnum\pgfmathcounter>\pgf@circ@count@a% - \else% - %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{% - \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@in \pgfmathcounter\endcsname{% - \noexpand\pgf@circ@ieeeport@input{\pgfmathcounter}% defined above - }% - \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@bin \pgfmathcounter\endcsname{% - \noexpand\pgf@circ@ieeeport@baseinput{\pgfmathcounter}{#2}% defined above - }% - \ifnum #2 = 3\relax % xor/xnor inner border pins - \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@ibin \pgfmathcounter\endcsname{% - \noexpand\pgf@circ@ieeeport@innerbaseinput{\pgfmathcounter}% defined above - }% - \fi - %}{}% - \repeatpgfmathloop% - } - % output anchor - \anchor{out}{% - \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball - \advance\pgf@circ@res@other by\pinlen - \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border - \ifdim \pgf@circ@res@temp > \pgf@circ@res@other - \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... - \fi - \pgf@x=\pgf@circ@res@other\pgf@y=0pt - } - \anchor{bout}{\bottomright\pgf@y=0pt} - - \anchor{body right}{\bodyright\pgf@y=0pt} - \anchor{right}{\bottomright\pgf@y=0pt} - \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body - \anchor{left}{% central edge of the component - \bodyleft\pgf@y=0pt - \ifnum #2=3\relax - \advance\pgf@x by -\xorbar - \fi - } - \anchor{up}{% - \bodyleft - \ifnum #2 > 1 % pointy shapes - \pgf@circ@ieeestd@stdH - % horizontal coordinate where the right semicircle starts - \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)} - % vertical drop of the circle at the above coordinate - \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))} - \advance \pgf@y by -\pgf@circ@res@step - \fi - \pgf@x=0pt - } - \anchor{down}{% - \bodyleft - \ifnum #2 > 1 % pointy shapes - \pgf@circ@ieeestd@stdH - % horizontal coordinate where the right semicircle starts - \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)} - % vertical drop of the circle at the above coordinate - \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))} - \advance \pgf@y by -\pgf@circ@res@step - \fi - \pgf@y=-\pgf@y\pgf@x=0pt - } - - % geographical anchors - \anchor{nw}{\northwest} - \anchor{ne}{\northeast} - \anchor{se}{\southeast} - \anchor{sw}{\southwest} - \anchor{north west}{\northwest} - \anchor{north east}{\northeast} - \anchor{south east}{\southeast} - \anchor{south west}{\southwest} - % over 0,0 even if asymmetric - % will break if the geocoords are not rectangular - \anchor{n}{\northwest\pgf@x=0pt\relax} - \anchor{e}{\northeast\pgf@y=0pt\relax} - \anchor{s}{\southwest\pgf@x=0pt\relax} - \anchor{w}{\northwest\pgf@y=0pt\relax} - \anchor{north}{\northwest\pgf@x=0pt\relax} - \anchor{east}{\northeast\pgf@y=0pt\relax} - \anchor{south}{\southwest\pgf@x=0pt\relax} - \anchor{west}{\northwest\pgf@y=0pt\relax} - - \backgroundpath{ - \pgfscope - \pgfsetcolor{\ctikzvalof{color}} - #4 - \endpgfscope - % output lead: - \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border - \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball - \advance\pgf@circ@res@other by \pinlen\relax - \ifdim \pgf@circ@res@other > \pgf@circ@res@right - \ifpgfcirc@draw@output@leads - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfusepath{draw} - \fi - \fi - \ifnum #3=1\relax\pgfscope - \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}} - \endpgfscope\fi - } - } -} - -%%% #1 direct name #2 negated name #3 type #4 drawing (without output) -\long\def\pgfcircdeclareieeeportpair#1#2#3#4{% - \pgfcircdeclareieeeport{#1}{#3}{0}{#4}% direct - \pgfcircdeclareieeeport{#2}{#3}{1}{#4}% negated -} -% -% ieeestd "and" and "nand" -% -\pgfcircdeclareieeeportpair{and}{nand}{1}{% - \pgf@circ@count@a = \inputs\relax - \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port - \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind} - \pgfextractx{\pgf@circ@res@left}{\bodyleft} - \pgfextracty{\pgf@circ@res@down}{\bodyleft} - \ifpgfcirc@draw@input@leads - %input leads --- all the same for AND ports - \loop\ifnum\pgf@circ@count@a>0 - \advance\pgf@circ@res@temp by -\pind - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}% - \advance\pgf@circ@count@a by -1 - \repeat - \fi - \pgfusepath{draw} - %% Body. let's start from the top left - \pgfscope - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}} - \pgfpathlineto{\pgfpoint{1.5*\stdH/6.5}{\stdH}} - \pgfpatharc{90}{-90}{\stdH} - \pgfpathlineto{\pgfpoint{-8*\stdH/6.5}{-\stdH}} - \pgfpathclose - \pgf@circ@draworfill - % rack now; skip if not needed. - % \typeout{WHAT\space \inputs\space \inners} - \ifnum\inputs>\inners - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfusepath{draw} - \fi - \endpgfscope -} -% -% or/nor and xor/xnor are practically the same. Let factor out everything -% the argument #1 is put just before the drawing of the inner pins -% the argument #2 is put after the drawing of the body -% -\long\def\pgf@circ@ieeeport@orxor#1#2{% - \pgf@circ@count@a = \inputs\relax - \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port - \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind} - \pgfextractx{\pgf@circ@res@left}{\bodyleft} - \pgfextracty{\pgf@circ@res@down}{\bodyleft} - % rack (extended) pins; they are the same for all the ports - % call K = (inputs-inner)/2, rounded up; pins on the rack are: - % above: 1..K (included) - % below: inputs-K..inputs - % Find the pins on the rack; they are 1... - \pgf@circ@count@b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! - \pgf@circ@count@c=\numexpr \inputs - \pgf@circ@count@b +1 \relax % =inputs - K +1 - \ifpgfcirc@draw@input@leads - %input leads --- for or ports - \loop\ifnum\pgf@circ@count@a>0 - \pgfextractx{\pgf@circ@res@right}{\topleft} - \advance\pgf@circ@res@temp by -\pind - % this is the height; let's find the "right" position - \ifnum \pgf@circ@count@a > \pgf@circ@count@b \ifnum \pgf@circ@count@a < \pgf@circ@count@c - % inner pins - % \typeout{INNER\space\pgf@circ@count@a} - \pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@left-2*\stdH*(1-cos(atan(\pgf@circ@res@temp/(2*\stdH))))} - % hook for xor/xnor - #1 - \fi\fi - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}% - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}% - \pgfusepath{draw} - \advance\pgf@circ@count@a by -1 - \repeat - \fi - %% Body. let's start from the top left - \pgfscope - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - % it should start here, but with this trick the close comes out better. - % \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} - \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}} - \pgfpathlineto{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{\stdH}} % - \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5}{0pt}} - \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{-\stdH}} - \pgfpathlineto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}} - %% this should be 2 and 2; but the round part is not a perfect circle that way - %% so the 2.15 is ajusted "by taste" to touch the anchors exactly. - \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} - \pgfpathclose - \pgf@circ@draworfill - % hook for xor/xnor - #2 - % rack now; skip if not needed. - % \typeout{WHAT\space \inputs\space \inners} - \ifnum\inputs>\inners - \pgfextractx{\pgf@circ@res@left}{\topleft} - \pgfextracty{\pgf@circ@res@down}{\topleft} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfusepath{draw} - \fi - \endpgfscope -} -% -% ieeestd "or" and "nor" -% -\pgfcircdeclareieeeportpair{or}{nor}{2}{% - \pgf@circ@ieeeport@orxor{}{} -} -\pgfcircdeclareieeeportpair{xor}{xnor}{3}{% - \pgf@circ@ieeeport@orxor{ - \edef\@@tmp{\ctikzvalof{ieeestd ports/xor leads in}} - \ifnum\@@tmp=0\relax - % move pin start to the left to leave the xor gap free (not standard) - \advance\pgf@circ@res@right by -\xorbar - \fi - }{% - % add the xor/xnor bar - \pgfpathmoveto{\pgfpoint{-\xorbar-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}} - % see the comment on the main body about the 2.2 - \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-\xorbar -8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} - \pgfusepath{draw} - } -} -% -% Buffer and inverters -% -% #1: name -% #2: polarity -% #3: content -\long\def\pgfcircdeclareieeebufferport#1#2#3{% - \pgfdeclareshape{ieeestd #1 port}% - {% - \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} - \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} - \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} - \saveddimen{\baselen}{% - \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp - } - \saveddimen{\stdH}{% This is HALF the height of the inner port - \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp - } - \saveddimen{\notdiameter}{ - \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp - } - \saveddimen{\pinlen}{% - \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp - } - % anchors for the body (no pins included here) - % Notice that 0.8660254 is cos(30) - \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} - \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} - } - \savedanchor{\topleft}{% - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} - \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} - } - \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp} - \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} - } - \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle - \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp - \pgf@circ@ieeestd@stdH - % #2 is =1 if the port is a negated output one - \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp+#2*2*\pgf@circ@res@other} - \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} - } - % geographical anchors --- must be rectangulars! - \savedanchor{\northwest}{% - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} - \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} - } - \savedanchor{\southwest}{% - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} - \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} - } - \savedanchor{\southeast}{% - \pgf@circ@ieeestd@stdH - \pgf@circ@res@up=\pgf@circ@res@temp - \pgf@circ@find@ieeeport@not@right{#2} - \pgf@x=\pgf@circ@res@right - \pgf@y=-\pgf@circ@res@up - } - \savedanchor{\northeast}{% - \pgf@circ@ieeestd@stdH - \pgf@circ@res@up=\pgf@circ@res@temp - \pgf@circ@find@ieeeport@not@right{#2} - \pgf@x=\pgf@circ@res@right - \pgf@y=\pgf@circ@res@up - } - \anchor{center}{\pgfpointorigin} - \anchor{text}{ - \ifpgf@circ@center@text - \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} - \else - \pgf@circ@ieeestd@stdH - \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} - \fi - } - % input anchors - \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} - \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} - \anchor{bin}{\bodyleft\pgf@y=0pt\relax} - \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax} - % output anchors - \anchor{out}{% - \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball - \advance\pgf@circ@res@other by\pinlen - \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border - \ifdim \pgf@circ@res@temp > \pgf@circ@res@other - \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... - \fi - \pgf@x=\pgf@circ@res@other\pgf@y=0pt - } - \anchor{bout}{\bottomright\pgf@y=0pt} - - \anchor{body right}{\bodyright\pgf@y=0pt} - \anchor{right}{\bottomright\pgf@y=0pt} - \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body - \anchor{left}{\bodyleft\pgf@y=0pt} - \anchor{up}{% - \bodyleft - \pgf@y=+0.5\pgf@y\pgf@x=0pt - } - \anchor{down}{% - \bodyleft - \pgf@y=-0.5\pgf@y\pgf@x=0pt - } - % this is for when it's used as a bipole - % we use the enclosing rectangle (see below) - \anchorborder{% - %% This (commented out) is the correct border anchor. But if we use the correct - %% border anchor there is no horizontal space for the label ;-) because - %% the triangle is too steep. So we will use a simple square border - %% - %% find the border anchor of a triangle (like a not port or an - %% amplifier) --- - %% - %% -----^ up - %% I --- | - %% I -|-- - %%left I | --- right - %% ----I-----|-------I----- - %% - %% - %\pgf@xa=\pgf@x - %% it's simmetrical w/ vertical side, use only positive y - %\pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)} - %\pgfmathsetlength{\pgf@ya}{abs(\pgf@y)} - %\pgfextracty{\pgf@circ@res@up}{\bodyleft} - %\pgfextractx{\pgf@circ@res@left}{\bodyleft} - %\pgfextractx{\pgf@circ@res@right}{\bodyright} - %% limit angle for the left (vertical) side - %\pgfmathsetmacro{\@@phimax}{atan2(\pgf@circ@res@up,\pgf@circ@res@left)} - %\pgfmathsetmacro{\@@phi}{atan2(\pgf@ya,\pgf@xa)} - %\pgfmathsetmacro{\@@leftside}{ifthenelse(\@@phi>\@@phimax,1,0)} - %% find the border - %\ifnum\@@leftside>0 - % % vertical side - % \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} - % {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} - %\else - % % triangle upper line - % \pgfpointintersectionoflines - % {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}} - % {\pgfqpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@right}{0pt}} - %\fi - %% readjust y sign - %\pgf@y=\@@switchy\pgf@y - % - % this is the square border to position the path label with a bit of horizontal space - % - \pgf@xa=\pgf@x - \pgf@ya=\pgf@y - \pgfextracty{\pgf@circ@res@up}{\bodyleft} - \pgfextractx{\pgf@circ@res@left}{\bodyleft} - \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} - {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} - } - % geographical anchors - \anchor{nw}{\northwest} - \anchor{ne}{\northeast} - \anchor{se}{\southeast} - \anchor{sw}{\southwest} - \anchor{north west}{\northwest} - \anchor{north east}{\northeast} - \anchor{south east}{\southeast} - \anchor{south west}{\southwest} - % over 0,0 even if asymmetric - % will break if the geocoords are not rectangular - \anchor{n}{\northwest\pgf@x=0pt\relax} - \anchor{e}{\northeast\pgf@y=0pt\relax} - \anchor{s}{\southwest\pgf@x=0pt\relax} - \anchor{w}{\northwest\pgf@y=0pt\relax} - \anchor{north}{\northwest\pgf@x=0pt\relax} - \anchor{east}{\northeast\pgf@y=0pt\relax} - \anchor{south}{\southwest\pgf@x=0pt\relax} - \anchor{west}{\northwest\pgf@y=0pt\relax} - - \backgroundpath{ - \pgfscope - \pgfsetcolor{\ctikzvalof{color}} - #3 - \endpgfscope - % output lead: - \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border - \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball - \advance\pgf@circ@res@other by \pinlen\relax - \ifdim \pgf@circ@res@other > \pgf@circ@res@right - \ifpgfcirc@draw@output@leads - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfusepath{draw} - \fi - \fi - \ifnum #2=1\relax\pgfscope - \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}} - \endpgfscope\fi - } - } -} - -%%% #1 direct name #2 negated name #3 drawing (without output) -\long\def\pgfcircdeclareieeebufferportpair#1#2#3{% - \pgfcircdeclareieeebufferport{#1}{0}{#3}% direct - \pgfcircdeclareieeebufferport{#2}{1}{#3}% negated -} - -\pgfcircdeclareieeebufferportpair{buffer}{not}{% - \pgfextractx{\pgf@circ@res@left}{\bodyleft} - \pgfextracty{\pgf@circ@res@up}{\bodyleft} - \pgfextractx{\pgf@circ@res@right}{\bodyright} - % \draw input pin - \ifpgfcirc@draw@input@leads - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} - \pgfusepath{draw} - \fi - \pgfscope - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfpathclose - \pgf@circ@draworfill - \endpgfscope -} - -\pgfcircdeclareieeebufferportpair{schmitt}{invschmitt}{% - \pgfextractx{\pgf@circ@res@left}{\bodyleft} - \pgfextracty{\pgf@circ@res@up}{\bodyleft} - \pgfextractx{\pgf@circ@res@right}{\bodyright} - % \draw input pin - \ifpgfcirc@draw@input@leads - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} - \pgfusepath{draw} - \fi - \pgfscope - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfpathclose - \pgf@circ@draworfill - \endpgfscope - % draw schmitt symbol in normal line thickness - \pgfpathmoveto{\pgfpoint{0.75*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.00*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpoint{0.25*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.25*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.5*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} - \pgfusepath{draw} -} - - -\pgfdeclareshape{schmitt symbol}{ - \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} - \anchor{center}{\pgfpointorigin} - \savedanchor\northwest{% - \pgf@circ@ieeestd@stdH - \pgf@y=\ctikzvalof{ieeestd ports/schmitt symbol size}\pgf@circ@res@temp - \pgf@x=-1.5\pgf@y - } - \anchor{center}{\pgf@y=0pt \pgf@x=0pt} - \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} - \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x} - \anchor{west}{\northwest\pgf@y=0pt} - \anchor{w}{\northwest \pgf@y=0pt} - \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y} - \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} - \anchor{north}{\northwest\pgf@x=0pt} - \anchor{n}{\northwest\pgf@x=0pt} - \anchor{south west}{\northwest\pgf@y=-\pgf@y} - \anchor{north east}{\northwest\pgf@x=-\pgf@x} - \anchor{north west}{\northwest} - \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} - \backgroundpath{ - \pgfscope - \pgfsetcolor{\ctikzvalof{color}} - \pgfextractx{\pgf@circ@res@left}{\northwest} - \pgfextracty{\pgf@circ@res@up}{\northwest} - \pgf@circ@res@left=0.7\pgf@circ@res@left - \pgf@circ@res@up=0.7\pgf@circ@res@up - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{-\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left/3}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left/3}{-\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope - } -} - -\pgfdeclareshape{notcirc}{ - \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} - \anchor{center}{\pgfpointorigin} - \savedanchor\northwest{% - \pgf@circ@notradius - \pgf@y=\pgf@circ@res@temp - \pgf@x=-\pgf@y - } - \anchor{center}{\pgf@y=0pt \pgf@x=0pt} - \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} - \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} - \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x} - \anchor{left}{\northwest\pgf@y=0pt} - \anchor{west}{\northwest\pgf@y=0pt} - \anchor{w}{\northwest \pgf@y=0pt} - \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y} - \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} - \anchor{north}{\northwest\pgf@x=0pt} - \anchor{n}{\northwest\pgf@x=0pt} - \anchor{south west}{\northwest\pgf@y=-\pgf@y} - \anchor{north east}{\northwest\pgf@x=-\pgf@x} - \anchor{north west}{\northwest} - \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} - \anchorborder{ - \pgf@circ@res@left=\pgf@x - \pgf@circ@res@up=\pgf@y - \northwest\pgf@circ@res@temp=\pgf@y - \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}% - {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} - } - \behindforegroundpath{ - \pgfscope - \northwest\pgf@circ@res@temp=\pgf@y - \pgfsetcolor{\ctikzvalof{color}} - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@temp} - \ifx\tikz@fillcolor\pgfutil@empty - % set the default fill color to white - \pgfsetfillcolor{white} - % ...but override it if the class is defined! - \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} - \else - \pgfsetfillcolor{\tikz@fillcolor} - \fi - \pgfsetfillopacity{\ctikzvalof{ieeestd ports/not radius fill}}% normally 1.0 - \pgfusepath{draw,fill} - \endpgfscope - } -} - -%%%% Transmission gates -% tgates are only ieee style for now -\tikzset{% - tgate/.style ={shape=ieee tgate}, - double tgate/.style ={shape=ieee double tgate}, -} -\ctikzset{tgate scale/.initial=0.7} -% Buffer and inverters -% -% #1: name -% #2: 1: one-not, 2:double-not -% #3: content -\long\def\pgfcircdeclareieeetgate#1#2#3{% - \pgfdeclareshape{ieee #1}% - {% - \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} - \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} - \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} - \saveddimen{\baselen}{% - \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp - } - \saveddimen{\stdH}{% This is HALF the height of the inner port - \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp - } - \saveddimen{\notdiameter}{ - \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp - } - \saveddimen{\notradius}{ - \pgf@circ@notradius\pgf@x=\pgf@circ@res@temp - } - \saveddimen{\pinlen}{% - \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp - } - % anchors for the body (no pins included here) - % Notice that 0.8660254 is cos(30) - \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - } - \savedanchor{\topleft}{% - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - } - \savedanchor{\bodyright}{% - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - } - \savedanchor{\bottomright}{% Here it is the same as \bodyright - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - } - % geographical anchors --- must be rectangulars! - \savedanchor{\northwest}{% - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - } - \savedanchor{\southwest}{% - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - } - \savedanchor{\southeast}{% - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - } - \savedanchor{\northeast}{% - \pgf@circ@ieeestd@stdH - \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} - } - \anchor{center}{\pgfpointorigin} - \anchor{text}{ - \ifpgf@circ@center@text - \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} - \else - \pgf@circ@ieeestd@stdH - \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} - \fi - } - % input anchors - \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} - \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} - \anchor{bin}{\bodyleft\pgf@y=0pt\relax} - \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax} - % gates - \anchor{gate}{\bodyleft\pgf@circ@res@up=\pgf@y - \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}} - \anchor{bgate}{\bodyleft\pgf@circ@res@up=\pgf@y - \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up}} - % gate (up) (2.1547 = 1+1/cos(30) - \anchor{notgate}{\bodyleft\pgf@circ@res@up=\pgf@y - \pgf@x=0pt\relax - \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius} - \ifdim\pinlen>\pgf@circ@res@temp - \pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen} - \else - \pgf@y=\pgf@circ@res@temp - \fi - } - \anchor{bnotgate}{\bodyleft\pgf@circ@res@up=\pgf@y - \pgf@x=0pt\pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+2.1547*\notradius}} - - % output anchors - \anchor{out}{% - \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball - \advance\pgf@circ@res@other by\pinlen - \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border - \ifdim \pgf@circ@res@temp > \pgf@circ@res@other - \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... - \fi - \pgf@x=\pgf@circ@res@other\pgf@y=0pt - } - \anchor{bout}{\bottomright\pgf@y=0pt} - - \anchor{body right}{\bodyright\pgf@y=0pt} - \anchor{right}{\bottomright\pgf@y=0pt} - \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body - \anchor{left}{\bodyleft\pgf@y=0pt} - \anchor{up}{% - \bodyleft - \pgf@x=0pt - \ifnum#2=1\relax - \pgf@y=0pt - \else - \pgf@y=.5\pgf@y - \fi - \advance\pgf@y by \notdiameter - } - \anchor{down}{% - \bodyleft - \pgf@x=0pt - \ifnum#2=1\relax - \pgf@y=0pt - \else - \pgf@y=-.5\pgf@y - \fi - } - % this is for when it's used as a bipole - % we use the enclosing rectangle (see below) - \anchorborder{% - % - % this is the square border to position the path label with a bit of horizontal space - % - \pgf@xa=\pgf@x - \pgf@ya=\pgf@y - \pgfextracty{\pgf@circ@res@up}{\bodyleft} - \pgfextractx{\pgf@circ@res@left}{\bodyleft} - \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} - {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} - } - % geographical anchors - \anchor{nw}{\northwest} - \anchor{ne}{\northeast} - \anchor{se}{\southeast} - \anchor{sw}{\southwest} - \anchor{north west}{\northwest} - \anchor{north east}{\northeast} - \anchor{south east}{\southeast} - \anchor{south west}{\southwest} - % over 0,0 even if asymmetric - % will break if the geocoords are not rectangular - \anchor{n}{\northwest\pgf@x=0pt\relax} - \anchor{e}{\northeast\pgf@y=0pt\relax} - \anchor{s}{\southwest\pgf@x=0pt\relax} - \anchor{w}{\northwest\pgf@y=0pt\relax} - \anchor{north}{\northwest\pgf@x=0pt\relax} - \anchor{east}{\northeast\pgf@y=0pt\relax} - \anchor{south}{\southwest\pgf@x=0pt\relax} - \anchor{west}{\northwest\pgf@y=0pt\relax} - - \backgroundpath{ - \pgfscope - \pgfsetcolor{\ctikzvalof{color}} - \pgfextractx{\pgf@circ@res@left}{\bodyleft} - \pgfextracty{\pgf@circ@res@up}{\bodyleft} - \pgfextractx{\pgf@circ@res@right}{\bodyright} - % \draw input pins - \ifpgfcirc@draw@input@leads - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} - % gate (down) - \pgfpathmoveto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}} - % gate (up) (2.1547 = 1+1/cos(30) - \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius} - \ifdim\pinlen>\pgf@circ@res@temp - \pgfpathmoveto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pgf@circ@res@temp}} - \pgfpathlineto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}} - \fi - \pgfusepath{draw} - \fi - #3 - \endpgfscope - % output lead: - \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border - \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball - \advance\pgf@circ@res@other by \pinlen\relax - \ifdim \pgf@circ@res@other > \pgf@circ@res@right - \ifpgfcirc@draw@output@leads - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfusepath{draw} - \fi - \fi - } - } -} - -\pgfcircdeclareieeetgate{tgate}{1}{% - \pgfscope - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfpathclose - \pgf@circ@draworfill - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}} - \pgfpathclose - \pgf@circ@draworfill - \endpgfscope - \pgfscope - % 1.1547 is 1/cos(30) - \pgftransformshift{\pgfpoint{0pt}{1.1547*\notradius}} - \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}} - \endpgfscope -} - -\pgfcircdeclareieeetgate{double tgate}{2}{% - \pgfscope - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathclose - \pgf@circ@draworfill - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathclose - \pgf@circ@draworfill - % bottom triangles - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathclose - \pgf@circ@draworfill - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathclose - \pgf@circ@draworfill - \endpgfscope - \pgfscope - % 1.1547 is 1/cos(30) - \pgftransformshift{\pgfpoint{0pt}{.5*\pgf@circ@res@up+1.1547*\notradius}} - \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}} - \endpgfscope -} - +% vim: set fdm=marker fmr=%<<<,%>>>: diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex index 0c2df7cd70..eadf5fd117 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -21,9 +21,9 @@ } % Names -\ctikzset{name/.style = { n=#1 } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@ +\ctikzset{name/.style = { n={#1} } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@ \ctikzset{n/.code = { - \pgfkeys{/tikz/circuitikz/bipole/name=#1} + \pgfkeys{/tikz/circuitikz/bipole/name={#1}} }} % Reflect the node along @@ -97,22 +97,6 @@ % \pgf@circ@bipole@path@base{shape}{}{#1}{#2} } -% -% this is used for components that are mainly node-style but have a path-style form -% -\def\pgfcirc@node@to@path#1#2#3{% - % add a path-style component based on a node-style one without mangling the name - % of the shape. - % #1: node-type shape name (existing) - % #2: path-type name (to be created) - % #3: additional options to add to the path style - % - \expandafter\def\csname pgf@circ@#1@path\endcsname##1{\pgf@circ@bipole@path@base{}{##1}{#1}{}}% - \compattikzset{#2/.style = {\circuitikzbasekey, - /tikz/to path=\csname pgf@circ@#1@path\endcsname{##1}, - #3}}% - \ctikzset{bipoles/#1/height/.initial=1}% -} %% %% ultra-generic bipole path %% I am not sure what the last argument is needed for, but don't touch it or everything explodes @@ -202,8 +186,75 @@ \tikztonodes } -%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% Handling of terminals +%% Macros for path and style activation for bipoles or path-style + +\def\comnpatname{\ifpgf@circuit@compat *\else\fi} +\def\compattikzset#1{% + % \typeout{BIPOLEDEF:\space \detokenize{#1}}% + \tikzset{\comnpatname#1}} +% +% this is used for components that are mainly node-style but have a path-style form +% +\def\pgfcirc@node@to@path#1#2#3{% + % add a path-style component based on a node-style one without mangling the name + % of the shape. + % #1: node-type shape name (existing) + % #2: path-type name (to be created) + % #3: additional options to add to the path style + % + \expandafter\def\csname pgf@circ@#1@path\endcsname##1{\pgf@circ@bipole@path@base{}{##1}{#1}{}}% + \compattikzset{#2/.style = {\circuitikzbasekey, + /tikz/to path=\csname pgf@circ@#1@path\endcsname{##1}, + #3}}% + \ctikzset{bipoles/#1/height/.initial=1}% +} +% +% this one is for normal definition: path to style, directly +% the first parameter (#1) here is l,v,i (l=..., v=..., i=...) +% the last parameter are options to be inserted in the "to path" definition +% +\def\pgfcirc@path@to@style#1#2#3#4{% using #1 as label, assign \pgf@circ@#2@path to style #3 + \compattikzset{#3/.style={\circuitikzbasekey, #4, /tikz/to path=\csname pgf@circ@#2@path\endcsname, #1={##1}}}% +} +% this one create a alias style from a node definition +\def\pgfcirc@node@to@style#1#2#3#4{% using #1 as label, assign \pgf@circ@bipole@path{#2} to style #3 + \compattikzset{#3/.style={\circuitikzbasekey, #4, /tikz/to path=\pgf@circ@bipole@path{#2}, #1={##1}}}% +} +% this create an alias style +\def\pgfcirc@style@to@style#1#2{% alias style #1 to style #2 + \compattikzset{#2/.style={\comnpatname #1={##1}}}% +} +% this create an alias style, changing the labelling +\def\pgfcirc@style@to@style@label#1#2#3{% alias style #1 to style #2 + \compattikzset{#2/.style={\comnpatname #1, #3={##1}}}% +} +% create a bipole +\def\pgfcirc@activate@bipole#1#2#3#4{% path name, base node name, style name + \expandafter\def\csname pgf@circ@#2@path\endcsname##1{\pgf@circ@bipole@path{#3}{##1}}% + \pgfcirc@path@to@style{#1}{#2}{#4}{}% no options here, let's see +} +\def\pgfcirc@activate@bipole@simple#1#2{\pgfcirc@activate@bipole{#1}{#2}{#2}{#2}} +% create a bipole with options +\def\pgfcirc@activate@bipole@opt#1#2#3#4#5{% path name, base node name, style name + \expandafter\def\csname pgf@circ@#2@path\endcsname##1{\pgf@circ@bipole@path{#3}{##1}}% + \pgfcirc@path@to@style{#1}{#2}{#4}{#5}% no options here, let's see +} +\def\pgfcirc@activate@bipole@simple@opt#1#2#3{\pgfcirc@activate@bipole@opt{#1}{#2}{#2}{#2}{#3}} + + +%% New system, for simple object +%% \pgfcirc@activate@bipole@simple{l}{mass} +%% New system, different names +%% The old system is the following +%% 1 - define just the pgf@circ@path@whatever#1 +%% (see for example the variable one) +%% 2 - set the style +%% \compattikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l={#1}}} + +%% Path definition with the new mechanism have been moved to where the nodes +%% are defined. + +%% Handling of terminals%<<< \ctikzset{bipole/nodes/.is family} \ctikzset{bipole/nodes/left/.initial=none} @@ -252,662 +303,11 @@ \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} } \ifx\pgf@temp\pgf@circ@temp\else(\tikztotarget) node[\pgf@circ@temp] {}\fi } +% %>>> -%% Path definitions -\def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi} -\def\pgf@circ@vresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{tgeneric}{#1}\else\pgf@circ@bipole@path{vresistor}{#1}\fi} -\def\pgf@circ@sresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{thermistor}{#1}\else\pgf@circ@bipole@path{resistivesens}{#1}\fi} -\def\pgf@circ@potentiometer@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{genericpotentiometer}{#1}\else\pgf@circ@bipole@path{potentiometer}{#1}\fi} -\def\pgf@circ@thermistor@path#1{\pgf@circ@bipole@path{thermistor}{#1}} -\def\pgf@circ@thermistorptc@path#1{\pgf@circ@bipole@path{thermistorptc}{#1}} -\def\pgf@circ@thermistorntc@path#1{\pgf@circ@bipole@path{thermistorntc}{#1}} -\def\pgf@circ@varistor@path#1{\pgf@circ@bipole@path{varistor}{#1}} -\def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}} -\def\pgf@circ@capacitivesens@path#1{\pgf@circ@bipole@path{capacitivesens}{#1}} -\def\pgf@circ@ecapacitor@path#1{\pgf@circ@bipole@path{ecapacitor}{#1}} -%% polar capacitor is deprectaed, use curved capacitor instead -\def\pgf@circ@polarcapacitor@path#1{\pgf@circ@bipole@path{polarcapacitor}{#1}} -\def\pgf@circ@ccapacitor@path#1{\pgf@circ@bipole@path{ccapacitor}{#1}} -\def\pgf@circ@vcapacitor@path#1{\pgf@circ@bipole@path{vcapacitor}{#1}} -\def\pgf@circ@piezoelectric@path#1{\pgf@circ@bipole@path{piezoelectric}{#1}} -\def\pgf@circ@battery@path#1{\pgf@circ@bipole@path{battery}{#1}} -\def\pgf@circ@batteryone@path#1{\pgf@circ@bipole@path{battery1}{#1}} -\def\pgf@circ@batterytwo@path#1{\pgf@circ@bipole@path{battery2}{#1}} -\def\pgf@circ@europeaninductor@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}} -\def\pgf@circ@americaninductor@path#1{\pgf@circ@bipole@path{americaninductor}{#1}} -\def\pgf@circ@cuteinductor@path#1{\pgf@circ@bipole@path{cuteinductor}{#1}} -\def\pgf@circ@cutechoke@path#1{\pgf@circ@bipole@path{cutechoke}{#1}} -\def\pgf@circ@inductor@path#1{% - \pgfextra{ - \edef\pgf@circ@temp{\ctikzvalof{inductor}}% - \def\pgf@temp{european}% - } - \ifx\pgf@temp\pgf@circ@temp% - \pgf@circ@europeaninductor@path{#1}% - \else% - \pgfextra{ \def\pgf@temp{cute} }% - \ifx\pgf@temp\pgf@circ@temp% - \pgf@circ@cuteinductor@path{#1}% - \else% - \pgf@circ@americaninductor@path{#1}% - \fi% - \fi% -} -\def\pgf@circ@vinductor@path#1{ - \pgfextra{ - \edef\pgf@circ@temp{\ctikzvalof{inductor}}% - \def\pgf@temp{european}% - } - \ifx\pgf@temp\pgf@circ@temp% - \pgf@circ@veuropeaninductor@path{#1}% - \else% - \pgfextra{ \def\pgf@temp{cute} }% - \ifx\pgf@temp\pgf@circ@temp% - \pgf@circ@vcuteinductor@path{#1}% - \else% - \pgf@circ@vamericaninductor@path{#1}% - \fi% - \fi% -} -\def\pgf@circ@inductivesens@path#1{% - \pgfextra{ - \edef\pgf@circ@temp{\ctikzvalof{inductor}}% - \def\pgf@temp{european}% - } - \ifx\pgf@temp\pgf@circ@temp% - \pgf@circ@europeaninductivesens@path{#1}% - \else% - \pgfextra{ \def\pgf@temp{cute} }% - \ifx\pgf@temp\pgf@circ@temp% - \pgf@circ@cuteinductivesens@path{#1}% - \else% - \pgf@circ@americaninductivesens@path{#1}% - \fi% - \fi% -} -\def\pgf@circ@veuropeaninductor@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}} -\def\pgf@circ@vamericaninductor@path#1{\pgf@circ@bipole@path{vamericaninductor}{#1}} -\def\pgf@circ@vcuteinductor@path#1{\pgf@circ@bipole@path{vcuteinductor}{#1}} -\def\pgf@circ@europeaninductivesens@path#1{\pgf@circ@bipole@path{sfullgeneric}{#1}} -\def\pgf@circ@americaninductivesens@path#1{\pgf@circ@bipole@path{samericaninductor}{#1}} -\def\pgf@circ@cuteinductivesens@path#1{\pgf@circ@bipole@path{scuteinductor}{#1}} -\def\pgf@circ@lamp@path#1{\pgf@circ@bipole@path{lamp}{#1}} -\def\pgf@circ@bulb@path#1{\pgf@circ@bipole@path{bulb}{#1}} -\def\pgf@circ@esource@path#1{\pgf@circ@bipole@path{esource}{#1}} -\def\pgf@circ@pvsource@path#1{\pgf@circ@bipole@path{pvsource}{#1}} -\def\pgf@circ@vsource@path#1{\pgf@circ@bipole@path{vsource}{#1}} -\def\pgf@circ@dcvsource@path#1{\pgf@circ@bipole@path{dcvsource}{#1}} -\def\pgf@circ@vsourceam@path#1{\pgf@circ@bipole@path{vsourceAM}{#1}} -\def\pgf@circ@vsourcesin@path#1{\pgf@circ@bipole@path{vsourcesin}{#1}} -\def\pgf@circ@isource@path#1{\pgf@circ@bipole@path{isource}{#1}} -\def\pgf@circ@oosource@path#1{\pgf@circ@bipole@path{oosource}{#1}} -\def\pgf@circ@oosourcetrans@path#1{\pgf@circ@bipole@path{oosourcetrans}{#1}} -\def\pgf@circ@ooosource@path#1{\pgf@circ@bipole@path{ooosource}{#1}} -\def\pgf@circ@dcisource@path#1{\pgf@circ@bipole@path{dcisource}{#1}} -\def\pgf@circ@isourcesin@path#1{\pgf@circ@bipole@path{isourcesin}{#1}} -\def\pgf@circ@vsourcesquare@path#1{\pgf@circ@bipole@path{vsourcesquare}{#1}} -\def\pgf@circ@vsourcetri@path#1{\pgf@circ@bipole@path{vsourcetri}{#1}} -\def\pgf@circ@isourceam@path#1{\pgf@circ@bipole@path{isourceAM}{#1}} -\def\pgf@circ@ecsource@path#1{\pgf@circ@bipole@path{ecsource}{#1}} -\def\pgf@circ@cvsource@path#1{\pgf@circ@bipole@path{cvsource}{#1}} -\def\pgf@circ@cvsourceam@path#1{\pgf@circ@bipole@path{cvsourceAM}{#1}} -\def\pgf@circ@cvsourcesin@path#1{\pgf@circ@bipole@path{cvsourcesin}{#1}} -\def\pgf@circ@cisource@path#1{\pgf@circ@bipole@path{cisource}{#1}} -\def\pgf@circ@cisourceam@path#1{\pgf@circ@bipole@path{cisourceAM}{#1}} -\def\pgf@circ@cisourcesin@path#1{\pgf@circ@bipole@path{cisourcesin}{#1}} -\def\pgf@circ@short@path#1{\pgf@circ@bipole@path{short}{#1}} -\def\pgf@circ@cspst@path#1{\pgf@circ@bipole@path{cspst}{#1}} -\def\pgf@circ@ospst@path#1{\pgf@circ@bipole@path{ospst}{#1}} -\def\pgf@circ@nos@path#1{\pgf@circ@bipole@path{nos}{#1}} -\def\pgf@circ@ncs@path#1{\pgf@circ@bipole@path{ncs}{#1}} -\def\pgf@circ@pushbutton@path#1{\pgf@circ@bipole@path{pushbutton}{#1}} -\def\pgf@circ@ncpushbutton@path#1{\pgf@circ@bipole@path{ncpushbutton}{#1}} -\def\pgf@circ@pushbuttonc@path#1{\pgf@circ@bipole@path{pushbuttonc}{#1}} -\def\pgf@circ@ncpushbuttono@path#1{\pgf@circ@bipole@path{ncpushbuttono}{#1}} -\def\pgf@circ@open@path#1{\pgf@circ@bipole@path{open}{#1}} -\def\pgf@circ@generic@path#1{\pgf@circ@bipole@path{generic}{#1}} -\def\pgf@circ@ageneric@path#1{\pgf@circ@bipole@path{ageneric}{#1}} -\def\pgf@circ@tgeneric@path#1{\pgf@circ@bipole@path{tgeneric}{#1}} -\def\pgf@circ@xgeneric@path#1{\pgf@circ@bipole@path{xgeneric}{#1}} -\def\pgf@circ@fullgeneric@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}} -\def\pgf@circ@tfullgeneric@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}} -\def\pgf@circ@ammeter@path#1{\pgf@circ@bipole@path{ammeter}{#1}} -\def\pgf@circ@ohmmeter@path#1{\pgf@circ@bipole@path{ohmmeter}{#1}} -\def\pgf@circ@voltmeter@path#1{\pgf@circ@bipole@path{voltmeter}{#1}} -\def\pgf@circ@oscope@path#1{\pgf@circ@bipole@path{oscope}{#1}} -\def\pgf@circ@empty@path#1{} -\def\pgf@circ@photoresistor@path#1{\pgf@circ@bipole@path{photoresistor}{#1}} -\def\pgf@circ@emptythyristor@path#1{\pgf@circ@bipole@path{emptythyristor}{#1}} -\def\pgf@circ@fullthyristor@path#1{\pgf@circ@bipole@path{fullthyristor}{#1}} -\def\pgf@circ@toggleswitch@path#1{\pgf@circ@bipole@path{toggleswitch}{#1}} -\def\pgf@circ@memristor@path#1{\pgf@circ@bipole@path{memristor}{#1}} -\def\pgf@circ@emptytriac@path#1{\pgf@circ@bipole@path{emptytriac}{#1}} -\def\pgf@circ@fulltriac@path#1{\pgf@circ@bipole@path{fulltriac}{#1}} -\def\pgf@circ@tline@path#1{\pgf@circ@bipole@path{tline}{#1}} -\def\pgf@circ@mstline@path#1{\pgf@circ@bipole@path{mstline}{#1}} -\def\pgf@circ@squid@path#1{\pgf@circ@bipole@path{squid}{#1}} -\def\pgf@circ@barrier@path#1{\pgf@circ@bipole@path{barrier}{#1}} -\def\pgf@circ@openbarrier@path#1{\pgf@circ@bipole@path{openbarrier}{#1}} -\def\pgf@circ@thermocouple@path#1{\pgf@circ@bipole@path{thermocouple}{#1}} -\def\pgf@circ@fuse@path#1{\pgf@circ@bipole@path{fuse}{#1}} -\def\pgf@circ@afuse@path#1{\pgf@circ@bipole@path{afuse}{#1}} - -\def\pgf@circ@gfsurgearrester@path#1{\ifpgf@circuit@europeangfsurgearrester\pgf@circ@europeangfsurgearrester@path{#1}\else\pgf@circ@americangfsurgearrester@path{#1}\fi} -\def\pgf@circ@europeangfsurgearrester@path#1{\pgf@circ@bipole@path{european gas filled surge arrester}{#1}} -\def\pgf@circ@americangfsurgearrester@path#1{\pgf@circ@bipole@path{american gas filled surge arrester}{#1}} - -\def\pgf@circ@twoport@path#1{\pgf@circ@bipole@path{twoport}{#1}} -\def\pgf@circ@twoportsplit@path#1{\pgf@circ@bipole@path{twoportsplit}{#1}} -\def\pgf@circ@vco@path#1{\pgf@circ@bipole@path{vco}{#1}} -\def\pgf@circ@bandpass@path#1{\pgf@circ@bipole@path{bandpass}{#1}} -\def\pgf@circ@bandstop@path#1{\pgf@circ@bipole@path{bandstop}{#1}} -\def\pgf@circ@highpass@path#1{\pgf@circ@bipole@path{highpass}{#1}} -\def\pgf@circ@lowpass@path#1{\pgf@circ@bipole@path{lowpass}{#1}} -\def\pgf@circ@allpass@path#1{\pgf@circ@bipole@path{allpass}{#1}} -\def\pgf@circ@adc@path#1{\pgf@circ@bipole@path{adc}{#1}} -\def\pgf@circ@dac@path#1{\pgf@circ@bipole@path{dac}{#1}} -\def\pgf@circ@dsp@path#1{\pgf@circ@bipole@path{dsp}{#1}} -\def\pgf@circ@fft@path#1{\pgf@circ@bipole@path{fft}{#1}} -\def\pgf@circ@amp@path#1{\pgf@circ@bipole@path{amp}{#1}} -\def\pgf@circ@vamp@path#1{\pgf@circ@bipole@path{vamp}{#1}} -\def\pgf@circ@piattenuator@path#1{\pgf@circ@bipole@path{piattenuator}{#1}} -\def\pgf@circ@vpiattenuator@path#1{\pgf@circ@bipole@path{vpiattenuator}{#1}} -\def\pgf@circ@tattenuator@path#1{\pgf@circ@bipole@path{tattenuator}{#1}} -\def\pgf@circ@vtattenuator@path#1{\pgf@circ@bipole@path{vtattenuator}{#1}} -\def\pgf@circ@phaseshifter@path#1{\pgf@circ@bipole@path{phaseshifter}{#1}} -\def\pgf@circ@vphaseshifter@path#1{\pgf@circ@bipole@path{vphaseshifter}{#1}} -\def\pgf@circ@detector@path#1{\pgf@circ@bipole@path{detector}{#1}} -% -\def\pgf@circ@sacdc@path#1{\pgf@circ@bipole@path{sacdc}{#1}} -\def\pgf@circ@sdcac@path#1{\pgf@circ@bipole@path{sdcac}{#1}} -\def\pgf@circ@tacdc@path#1{\pgf@circ@bipole@path{tacdc}{#1}} -\def\pgf@circ@tdcac@path#1{\pgf@circ@bipole@path{tdcac}{#1}} - -%%Mechanical -\def\pgf@circ@spring@path#1{\pgf@circ@bipole@path{spring}{#1}} -\def\pgf@circ@inerter@path#1{\pgf@circ@bipole@path{inerter}{#1}} -\def\pgf@circ@mass@path#1{\pgf@circ@bipole@path{mass}{#1}} -\def\pgf@circ@damper@path#1{\pgf@circ@bipole@path{damper}{#1}} -\def\pgf@circ@viscoe@path#1{\pgf@circ@bipole@path{viscoe}{#1}} - -%% Styles - -\def\comnpatname{\ifpgf@circuit@compat *\else\fi} -\def\compattikzset#1{% - % \typeout{BIPOLEDEF:\space \detokenize{#1}}% - \tikzset{\comnpatname#1}} - -%\def\ctikzsetbipole#1#2{% -% \tikzset{#1/.style= {to path=#2, \circuitikzbasekey, l=##1}}% -%} - -\compattikzset{spring/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@spring@path, l=#1}} -\compattikzset{inerter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inerter@path, l=#1}} -\compattikzset{mass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mass@path, l=#1}} -\compattikzset{damper/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@damper@path, l=#1}} -\compattikzset{viscoe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@viscoe@path, l=#1}} -\compattikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l=#1}} -\compattikzset{american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{resistor}{#1}, l=#1}} -\compattikzset{european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{generic}{#1}, l=#1}} -\compattikzset{potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@potentiometer@path, l=#1}} -\compattikzset{varistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@varistor@path, l=#1}} -\compattikzset{photoresistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@photoresistor@path, l=#1}} -\compattikzset{thermistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistor@path, l=#1}} -\compattikzset{thermistor ptc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorptc@path, l=#1}} -\compattikzset{thermistor ntc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}} -\compattikzset{american potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{potentiometer}{#1}, l=#1}} -\compattikzset{european potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{genericpotentiometer}{#1}, l=#1}} -\compattikzset{variable resistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vresistor@path, l=#1}} -\compattikzset{variable american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{vresistor}{#1}, l=#1}} -\compattikzset{variable european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{tgeneric}{#1}, l=#1}} -\compattikzset{capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitor@path, l=#1}} -\compattikzset{elko/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}} -\compattikzset{ecapacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}} -% polar capacitor is deprecated, use curved capacitor instead -\compattikzset{polar capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@polarcapacitor@path, l=#1}} -\compattikzset{curved capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ccapacitor@path, l=#1}} -\compattikzset{variable capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcapacitor@path, l=#1}} -\compattikzset{piezoelectric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piezoelectric@path, l=#1}} -\compattikzset{battery/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@battery@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{battery1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batteryone@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{battery2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batterytwo@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductor@path, l=#1}} -\compattikzset{gf surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}} -\compattikzset{american gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americangfsurgearrester@path, l=#1}} -\compattikzset{european gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeangfsurgearrester@path, l=#1}} -\compattikzset{gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}} -\compattikzset{american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductor@path, l=#1}} -\compattikzset{cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductor@path, l=#1}} -\compattikzset{cute choke/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cutechoke@path, l=#1}} -\compattikzset{european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductor@path, l=#1}} -\compattikzset{variable inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vinductor@path, l=#1}} -\compattikzset{variable european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@veuropeaninductor@path, l=#1}} -\compattikzset{variable american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamericaninductor@path, l=#1}} -\compattikzset{variable cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcuteinductor@path, l=#1}} -\compattikzset{tline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tline@path, l=#1}} -\compattikzset{transmission line/.style = {tline = #1}} -\compattikzset{TL/.style = {tline = #1}} -\compattikzset{mstline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mstline@path, l=#1}} -\compattikzset{european voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{american voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} -\compattikzset{european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isource@path, \circuitikzbasekey/bipole/is current=true, i=#1}} -\compattikzset{american current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}} -\compattikzset{empty controlled source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{american controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} -\compattikzset{european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisource@path, \circuitikzbasekey/bipole/is current=true, i=#1}} -\compattikzset{american controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}} -\compattikzset{sinusoidal voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcesin@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }} -\compattikzset{square voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcesquare@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }} -\compattikzset{triangle voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcetri@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }} -\compattikzset{sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}} -\compattikzset{controlled sinusoidal voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourcesin@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{controlled sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}} - -\compattikzset{voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}} -\compattikzset{current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi current source = #1, \circuitikzbasekey/bipole/is current=true}} -\compattikzset{controlled voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi controlled voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}} -\compattikzset{controlled current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi controlled current source = #1, \circuitikzbasekey/bipole/is current=true}} - - -\compattikzset{generic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@generic@path, l=#1}} -\compattikzset{xgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@xgeneric@path, l=#1}} -\compattikzset{ageneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ageneric@path, l=#1}} -\compattikzset{tgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tgeneric@path, l=#1}} -\compattikzset{fullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullgeneric@path, l=#1}} -\compattikzset{tfullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tfullgeneric@path, l=#1}} -\compattikzset{short/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@short@path}} -\compattikzset{open/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@open@path}} - -\compattikzset{lamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lamp@path}} -\compattikzset{bulb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bulb@path, l=#1}} - -\compattikzset{squid/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@squid@path}} -\compattikzset{barrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@barrier@path}} -\compattikzset{openbarrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@openbarrier@path}} -\compattikzset{thermocouple/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermocouple@path}} -\compattikzset{fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fuse@path}} -\compattikzset{asymmetric fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@afuse@path}} - -\compattikzset{twoport/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@twoport@path}} -\compattikzset{twoportsplit/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@twoportsplit@path}} -\compattikzset{vco/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vco@path}} -\compattikzset{bandpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandpass@path}} -\compattikzset{bandstop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandstop@path}} -\compattikzset{highpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@highpass@path}} -\compattikzset{lowpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lowpass@path}} -\compattikzset{allpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@allpass@path}} -\compattikzset{adc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@adc@path}} -\compattikzset{dac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dac@path}} -\compattikzset{dsp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dsp@path}} -\compattikzset{fft/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fft@path}} -\compattikzset{amp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@amp@path}} -\compattikzset{vamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamp@path}} -\compattikzset{piattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piattenuator@path}} -\compattikzset{vpiattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vpiattenuator@path}} -\compattikzset{tattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tattenuator@path}} -\compattikzset{vtattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vtattenuator@path}} -\compattikzset{phaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@phaseshifter@path}} -\compattikzset{vphaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vphaseshifter@path}} -\compattikzset{detector/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@detector@path}} -% -\compattikzset{sacdc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@sacdc@path, l=#1}} -\compattikzset{sdcac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@sdcac@path, l=#1}} -\compattikzset{tacdc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tacdc@path, l=#1}} -\compattikzset{tdcac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tdcac@path, l=#1}} - -% % % % % % -% % Begin of Diodes -% % % % % % - -\def\pgf@circ@fulldiode@path#1{\pgf@circ@bipole@path{fulldiode}{#1}} -\def\pgf@circ@fullzdiode@path#1{\pgf@circ@bipole@path{fullzdiode}{#1}} -\def\pgf@circ@fullzzdiode@path#1{\pgf@circ@bipole@path{fullzzdiode}{#1}} -\def\pgf@circ@fullsdiode@path#1{\pgf@circ@bipole@path{fullsdiode}{#1}} -\def\pgf@circ@fulltdiode@path#1{\pgf@circ@bipole@path{fulltdiode}{#1}} -\def\pgf@circ@fulllediode@path#1{\pgf@circ@bipole@path{fulllediode}{#1}} -\def\pgf@circ@fullpdiode@path#1{\pgf@circ@bipole@path{fullpdiode}{#1}} -\def\pgf@circ@fullvarcap@path#1{\pgf@circ@bipole@path{fullvarcap}{#1}} -\def\pgf@circ@fullbidirectionaldiode@path#1{\pgf@circ@bipole@path{fullbidirectionaldiode}{#1}} -\def\pgf@circ@emptydiode@path#1{\pgf@circ@bipole@path{emptydiode}{#1}} -\def\pgf@circ@emptyzdiode@path#1{\pgf@circ@bipole@path{emptyzdiode}{#1}} -\def\pgf@circ@emptyzzdiode@path#1{\pgf@circ@bipole@path{emptyzzdiode}{#1}} -\def\pgf@circ@emptysdiode@path#1{\pgf@circ@bipole@path{emptysdiode}{#1}} -\def\pgf@circ@emptytdiode@path#1{\pgf@circ@bipole@path{emptytdiode}{#1}} -\def\pgf@circ@emptylediode@path#1{\pgf@circ@bipole@path{emptylediode}{#1}} -\def\pgf@circ@emptypdiode@path#1{\pgf@circ@bipole@path{emptypdiode}{#1}} -\def\pgf@circ@emptyvarcap@path#1{\pgf@circ@bipole@path{emptyvarcap}{#1}} -\def\pgf@circ@emptybidirectionaldiode@path#1{\pgf@circ@bipole@path{emptybidirectionaldiode}{#1}} - -\compattikzset{full diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulldiode@path}} -\compattikzset{full Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullsdiode@path}} -\compattikzset{full Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzdiode@path}} -\compattikzset{full ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzzdiode@path}} -\compattikzset{full tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltdiode@path}} -\compattikzset{full photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullpdiode@path}} -\compattikzset{full led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulllediode@path}} -\compattikzset{full varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullvarcap@path}} -\compattikzset{full bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullbidirectionaldiode@path}} -\compattikzset{full thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullthyristor@path}} -\compattikzset{full triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltriac@path}} - -\compattikzset{empty diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptydiode@path}} -\compattikzset{empty Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptysdiode@path}} -\compattikzset{empty Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzdiode@path}} -\compattikzset{empty ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzzdiode@path}} -\compattikzset{empty tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytdiode@path}} -\compattikzset{empty photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptypdiode@path}} -\compattikzset{empty led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptylediode@path}} -\compattikzset{empty varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyvarcap@path}} -\compattikzset{empty bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptybidirectionaldiode@path}} -\compattikzset{empty thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptythyristor@path}} -\compattikzset{empty triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytriac@path}} - -\compattikzset{stroke diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptydiode@path}} -\compattikzset{stroke Schottky diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptysdiode@path}} -\compattikzset{stroke Zener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzdiode@path}} -\compattikzset{stroke ZZener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzzdiode@path}} -\compattikzset{stroke tunnel diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytdiode@path}} -\compattikzset{stroke photodiode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptypdiode@path}} -\compattikzset{stroke led/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptylediode@path}} -\compattikzset{stroke varcap/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyvarcap@path}} -\compattikzset{stroke thyristor/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptythyristor@path}} -%\compattikzset{stroke triac/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytriac@path}} - -\def\pgfcircdiodestylemacro{\ifpgf@circuit@strokediode stroke \else\ifpgf@circuit@fulldiode full \else empty \fi\fi} - -\compattikzset{Schottky diode/.style = {\comnpatname \pgfcircdiodestylemacro Schottky diode}} -\compattikzset{Zener diode/.style = {\comnpatname \pgfcircdiodestylemacro Zener diode}} -\compattikzset{ZZener diode/.style = {\comnpatname \pgfcircdiodestylemacro ZZener diode}} -\compattikzset{tunnel diode/.style = {\comnpatname \pgfcircdiodestylemacro tunnel diode}} -\compattikzset{photodiode/.style = {\comnpatname \pgfcircdiodestylemacro photodiode}} -\compattikzset{led/.style = {\comnpatname \pgfcircdiodestylemacro led}} -\compattikzset{varcap/.style = {\comnpatname \pgfcircdiodestylemacro varcap}} -\compattikzset{diode/.style = {\comnpatname \pgfcircdiodestylemacro diode}} -\compattikzset{thyristor/.style = {\comnpatname \pgfcircdiodestylemacro thyristor}} -\compattikzset{triac/.style = {\comnpatname \ifpgf@circuit@fulldiode full \else empty \fi triac}}%no stroke triac! -\compattikzset{bidirectionaldiode/.style = {\comnpatname \ifpgf@circuit@fulldiode full \else empty \fi bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac) - -%% Define Shortcuts -\compattikzset{Do/.style = {\comnpatname empty diode}} -\compattikzset{tDo/.style = {\comnpatname empty tunnel diode}} -\compattikzset{zDo/.style = {\comnpatname empty Zener diode}} -\compattikzset{zzDo/.style = {\comnpatname empty ZZener diode}} -\compattikzset{sDo/.style = {\comnpatname empty Schottky diode}} -\compattikzset{pDo/.style = {\comnpatname empty photodiode}} -\compattikzset{leDo/.style = {\comnpatname empty led}} -\compattikzset{VCo/.style = {\comnpatname empty varcap}} -\compattikzset{biDo/.style = {\comnpatname empty bidirectionaldiode}} -\compattikzset{Tyo/.style = {\comnpatname empty thyristor}} -\compattikzset{Tro/.style = {\comnpatname empty triac}} - -\compattikzset{D*/.style = {\comnpatname full diode}} -\compattikzset{tD*/.style = {\comnpatname full tunnel diode}} -\compattikzset{zD*/.style = {\comnpatname full Zener diode}} -\compattikzset{zzD*/.style = {\comnpatname full ZZener diode}} -\compattikzset{sD*/.style = {\comnpatname full Schottky diode}} -\compattikzset{pD*/.style = {\comnpatname full photodiode}} -\compattikzset{leD*/.style = {\comnpatname full led}} -\compattikzset{VC*/.style = {\comnpatname full varcap}} -\compattikzset{biD*/.style = {\comnpatname full bidirectionaldiode}} -\compattikzset{Ty*/.style = {\comnpatname full thyristor}} -\compattikzset{Tr*/.style = {\comnpatname full triac}} - -\compattikzset{D/.style = {\comnpatname diode}} -\compattikzset{tD/.style = {\comnpatname tunnel diode}} -\compattikzset{zD/.style = {\comnpatname Zener diode}} -\compattikzset{zzD/.style = {\comnpatname ZZener diode}} -\compattikzset{sD/.style = {\comnpatname Schottky diode}} -\compattikzset{pD/.style = {\comnpatname photodiode}} -\compattikzset{leD/.style = {\comnpatname led}} -\compattikzset{VC/.style = {\comnpatname varcap}} -\compattikzset{biD/.style = {\comnpatname bidirectionaldiode}} -\compattikzset{Ty/.style = {\comnpatname thyristor}} -\compattikzset{Tr/.style = {\comnpatname triac}} - -\compattikzset{D-/.style = {\comnpatname stroke diode}} -\compattikzset{tD-/.style = {\comnpatname stroke tunnel diode}} -\compattikzset{zD-/.style = {\comnpatname stroke Zener diode}} -\compattikzset{zzD-/.style = {\comnpatname stroke ZZener diode}} -\compattikzset{sD-/.style = {\comnpatname stroke Schottky diode}} -\compattikzset{pD-/.style = {\comnpatname stroke photodiode}} -\compattikzset{leD-/.style = {\comnpatname stroke led}} -\compattikzset{VC-/.style = {\comnpatname stroke varcap}} -\compattikzset{Ty-/.style = {\comnpatname stroke thyristor}} -\compattikzset{Tr-/.style = {\comnpatname empty triac}}%no stroke triac! -\compattikzset{biD-/.style = {\comnpatname empty bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac) - -% % % % % % -% % End of Diodes -% % % % % % - - -\compattikzset{memristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@memristor@path}} -\compattikzset{closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}} -\compattikzset{opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ospst@path, l=#1}} -\compattikzset{ncs/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}} -\compattikzset{nos/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}} -\compattikzset{normal closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}} -\compattikzset{normal open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}} -\compattikzset{switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}} -\compattikzset{push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}} -\compattikzset{nopb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}} -\compattikzset{normally open push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}} -\compattikzset{ncpb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}} -\compattikzset{normally closed push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}} -\compattikzset{nopbc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbuttonc@path, l=#1}} -\compattikzset{normally open push button closed/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbuttonc@path, l=#1}} -\compattikzset{ncpbo/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbuttono@path, l=#1}} -\compattikzset{normally closed push button open/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbuttono@path, l=#1}} -\compattikzset{toggle switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@toggleswitch@path}} - -\compattikzset{ammeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ammeter@path}} -\compattikzset{voltmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@voltmeter@path}} -\compattikzset{ohmmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ohmmeter@path}} -\tikzset{oscope/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@oscope@path, l=#1}} - -% cute switches -%% closed cute switch -\def\pgf@circ@cuteclosedswitch@path#1{\pgf@circ@bipole@path{cuteclosedswitch}{#1}} -\compattikzset{cute closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosedswitch@path, l=#1}} -\compattikzset{ccsw/.style= {\comnpatname cute closed switch= #1}} - -%% open cute switch -\def\pgf@circ@cuteopenswitch@path#1{\pgf@circ@bipole@path{cuteopenswitch}{#1}} -\compattikzset{cute open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopenswitch@path, l=#1}} -\compattikzset{cosw/.style= {\comnpatname cute open switch= #1}} - -%% closing cute switch -\def\pgf@circ@cuteclosingswitch@path#1{\pgf@circ@bipole@path{cuteclosingswitch}{#1}} -\compattikzset{cute closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosingswitch@path, l=#1}} -\compattikzset{ccgsw/.style= {\comnpatname cute closing switch= #1}} - -%% opening cute switch -\def\pgf@circ@cuteopeningswitch@path#1{\pgf@circ@bipole@path{cuteopeningswitch}{#1}} -\compattikzset{cute opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopeningswitch@path, l=#1}} -\compattikzset{cogsw/.style= {\comnpatname cute opening switch= #1}} - - -% short forms -\compattikzset{esource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@esource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{pvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{dcvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{dcisource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcisource@path, \circuitikzbasekey/bipole/is current=true, l=#1}} - -\compattikzset{ioosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is current=true,/tikz/to path=\pgf@circ@oosource@path, i=#1}} -\compattikzset{voosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@oosource@path, v=#1}} -\compattikzset{oosourcetrans/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@oosourcetrans@path, v=#1}} -\compattikzset{ooosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@ooosource@path, v=#1}} - -\compattikzset{vsource/.style = {\comnpatname voltage source = #1}} -\compattikzset{isource/.style = {\comnpatname current source = #1}} -\compattikzset{cisource/.style = {\comnpatname controlled current source = #1}} -\compattikzset{ecsource/.style = {\comnpatname empty controlled source = #1}} -\compattikzset{cvsource/.style = {\comnpatname controlled voltage source = #1}} -\compattikzset{vsourcesin/.style = {\comnpatname sinusoidal voltage source = #1}} -\compattikzset{vsourcesquare/.style = {\comnpatname square voltage source = #1}} -\compattikzset{vsourcetri/.style = {triangle voltage source = #1}} -\compattikzset{isourcesin/.style = {\comnpatname sinusoidal current source = #1}} -\compattikzset{cisourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}} -\compattikzset{cvsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}} - -\compattikzset{controlled vsource/.style = {\comnpatname controlled voltage source = #1}} -\compattikzset{controlled isource/.style = {\comnpatname controlled current source = #1}} -\compattikzset{controlled vsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}} -\compattikzset{controlled isourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}} - -\compattikzset{R/.style= {\comnpatname resistor = #1}} -\compattikzset{vR/.style= {\comnpatname variable resistor = #1}} -\compattikzset{phR/.style= {\comnpatname photoresistor = #1}} -\compattikzset{thR/.style= {\comnpatname thermistor = #1}} -\compattikzset{thRp/.style= {\comnpatname thermistor ptc= #1}} -\compattikzset{thRn/.style= {\comnpatname thermistor ntc= #1}} -\compattikzset{pR/.style= {\comnpatname potentiometer = #1}} -\compattikzset{C/.style = {\comnpatname capacitor = #1}} -\compattikzset{eC/.style = {\comnpatname ecapacitor = #1}} -%% pC is deprecated, use cC instead -\compattikzset{pC/.style = {\comnpatname polar capacitor = #1}} -\compattikzset{cC/.style = {\comnpatname curved capacitor = #1}} -\compattikzset{vC/.style = {\comnpatname variable capacitor = #1}} -\compattikzset{PZ/.style = {\comnpatname piezoelectric = #1}} -\compattikzset{L/.style = {\comnpatname inductor = #1}} -\compattikzset{vL/.style = {\comnpatname variable inductor = #1}} -\compattikzset{V/.style = {\comnpatname voltage source = #1}} -\compattikzset{cV/.style = {\comnpatname controlled voltage source = #1}} -\compattikzset{sV/.style = {\comnpatname sinusoidal voltage source = #1}} -\compattikzset{sqV/.style = {\comnpatname square voltage source = #1}} -\compattikzset{tV/.style = {\comnpatname triangle voltage source = #1}} -\compattikzset{csV/.style = {\comnpatname controlled sinusoidal voltage source = #1}} -\def\pgf@temp#1{ - \compattikzset{V#1/.style = {\comnpatname voltage source, v#1=##1} } - \compattikzset{cV#1/.style = {\comnpatname controlled voltage source, v#1=##1} } - \compattikzset{sV#1/.style = {\comnpatname sinusoidal voltage source, v#1=##1} } - \compattikzset{csV#1/.style = {\comnpatname controlled sinusoidal voltage source, v#1=##1} } -} -\pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<} -\pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_} - -%current sources -\compattikzset{I/.style = {\comnpatname current source = #1}} -\compattikzset{cI/.style = {\comnpatname controlled current source = #1}} -\compattikzset{sI/.style = {\comnpatname sinusoidal current source = #1}} -\compattikzset{csI/.style = {\comnpatname controlled sinusoidal current source = #1}} -\def\pgf@temp#1{ - \compattikzset{I#1/.style = {\comnpatname current source, i#1=##1} } - \compattikzset{cI#1/.style = {\comnpatname controlled current source, i#1=##1} } - \compattikzset{sI#1/.style = {\comnpatname sinusoidal current source, i#1=##1} } - \compattikzset{csI#1/.style = {\comnpatname controlled sinusoidal current source, i#1=##1} } -} -\pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<} -\pgf@temp{>_} \pgf@temp{<_} \pgf@temp{>^} \pgf@temp{<^} -\pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_} - -% cute sources -\def\pgf@circ@vsourceC@path#1{\pgf@circ@bipole@path{vsourceC}{#1}} -\compattikzset{cute european voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceC@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{vsourceC/.style= {\comnpatname cute european voltage source= #1}} -\compattikzset{ceV/.style= {\comnpatname cute european voltage source= #1}} - -\def\pgf@circ@isourceC@path#1{\pgf@circ@bipole@path{isourceC}{#1}} -\compattikzset{cute european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceC@path, \circuitikzbasekey/bipole/is current=true, i=#1}} -\compattikzset{isourceC/.style= {\comnpatname cute european current source= #1}} -\compattikzset{ceI/.style= {\comnpatname cute european current source= #1}} - -\def\pgf@circ@cvsourceC@path#1{\pgf@circ@bipole@path{cvsourceC}{#1}} -\compattikzset{cute european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceC@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{cvsourceC/.style= {\comnpatname cute european controlled voltage source= #1}} -\compattikzset{cceV/.style= {\comnpatname cute european controlled voltage source= #1}} - -\def\pgf@circ@cisourceC@path#1{\pgf@circ@bipole@path{cisourceC}{#1}} -\compattikzset{cute european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceC@path, \circuitikzbasekey/bipole/is current=true, i=#1}} -\compattikzset{cisourceC/.style= {\comnpatname cute european controlled current source= #1}} -\compattikzset{cceI/.style= {\comnpatname cute european controlled current source= #1}} - -% noise sources -\def\pgf@circ@vsourceN@path#1{\pgf@circ@bipole@path{vsourceN}{#1}} -\compattikzset{noise voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceN@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{vsourceN/.style= {\comnpatname noise voltage source= #1}} -\compattikzset{nV/.style= {\comnpatname noise voltage source= #1}} - -\def\pgf@circ@isourceN@path#1{\pgf@circ@bipole@path{isourceN}{#1}} -\compattikzset{noise current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceN@path, \circuitikzbasekey/bipole/is current=true, i=#1}} -\compattikzset{isourceN/.style= {\comnpatname noise current source= #1}} -\compattikzset{nI/.style= {\comnpatname noise current source= #1}} - -% resistive sensor american style -\def\pgf@circ@resistivesens@path#1{\pgf@circ@bipole@path{resistivesens}{#1}} -\compattikzset{american resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistivesens@path, l=#1}} -\compattikzset{european resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}} -\compattikzset{resistive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@sresistor@path, l=#1}} -\compattikzset{sR/.style= {\comnpatname resistive sensor= #1}} - -\compattikzset{capacitive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitivesens@path, l=#1}} -\compattikzset{sC/.style= {\comnpatname capacitive sensor= #1}} - -\compattikzset{cute inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductivesens@path, l=#1}} -\compattikzset{european inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductivesens@path, l=#1}} -\compattikzset{american inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductivesens@path, l=#1}} -\compattikzset{inductive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductivesens@path, l=#1}} -\compattikzset{sL/.style= {\comnpatname inductive sensor= #1}} - -\compattikzset{Mr/.style = {\comnpatname memristor}} - -\compattikzset{cspst/.style = {\comnpatname closing switch = #1}} -\compattikzset{ospst/.style = {\comnpatname opening switch = #1}} -\compattikzset{spst/.style = {\comnpatname switch = #1}} - -\compattikzset{afuse/.style = {\comnpatname asymmetric fuse=#1}} - -\compattikzset{vdd/.style = {\comnpatname vcc = #1}} -\compattikzset{vss/.style = {\comnpatname vee = #1}} - -% activate the to-style crossing -\def\pgf@circ@crossing@path#1{\pgf@circ@bipole@path{crossing}{#1}} -\compattikzset{crossing/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@crossing@path, l=#1}} -\compattikzset{xing/.style= {\comnpatname crossing= #1}} - -%% loudspeaker and microphone - -\def\pgf@circ@loudspeaker@path#1{\pgf@circ@bipole@path{loudspeaker}{#1}} -\compattikzset{loudspeaker/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@loudspeaker@path, l=#1}} - -\def\pgf@circ@mic@path#1{\pgf@circ@bipole@path{mic}{#1}} -\compattikzset{mic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mic@path, l=#1}} - -% more instrument -\def\pgf@circ@rmeter@path#1{\pgf@circ@bipole@path{rmeter}{#1}} -\compattikzset{rmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeter@path, l=#1}} -\def\pgf@circ@rmeterwa@path#1{\pgf@circ@bipole@path{rmeterwa}{#1}} -\compattikzset{rmeterwa/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeterwa@path, l=#1}} -\def\pgf@circ@smeter@path#1{\pgf@circ@bipole@path{smeter}{#1}} -\compattikzset{smeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@smeter@path, l=#1}} -% current loop probes -\def\pgf@circ@iloop@path#1{\pgf@circ@bipole@path{iloop}{#1}} -\compattikzset{iloop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop@path, l=#1}} -\def\pgf@circ@iloop2@path#1{\pgf@circ@bipole@path{iloop2}{#1}} -\compattikzset{iloop2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop2@path, l=#1}} -% qucs-style probes -\def\pgf@circ@qiprobe@path#1{\pgf@circ@bipole@path{qiprobe}{#1}} -\compattikzset{qiprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qiprobe@path, l=#1}} -\def\pgf@circ@qvprobe@path#1{\pgf@circ@bipole@path{qvprobe}{#1}} -\compattikzset{qvprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qvprobe@path, l=#1}} -\def\pgf@circ@qpprobe@path#1{\pgf@circ@bipole@path{qpprobe}{#1}} -\compattikzset{qpprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qpprobe@path, l=#1}} -% multiwire(s) -\def\pgf@circ@bmultiwire@path#1{\pgf@circ@bipole@path{bmultiwire}{#1}} -\compattikzset{bmultiwire/.style = {\circuitikzbasekey, -/tikz/to path=\pgf@circ@bmultiwire@path, l=#1}} -\def\pgf@circ@multiwire@path#1{\pgf@circ@bipole@path{multiwire}{#1}} -\compattikzset{multiwire/.style = {\circuitikzbasekey, -/tikz/to path=\pgf@circ@multiwire@path, l=#1}} -\def\pgf@circ@tmultiwire@path#1{\pgf@circ@bipole@path{tmultiwire}{#1}} -\compattikzset{tmultiwire/.style = {\circuitikzbasekey, -/tikz/to path=\pgf@circ@tmultiwire@path, l=#1}} - -% reed switches -\def\pgf@circ@reed@path#1{\pgf@circ@bipole@path{reed}{#1}} -\compattikzset{reed/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@reed@path, l=#1}} - +%% +%% Definition of path for transistors +%% % Transistor like bipoles \def\pgf@circ@trans@path#1#2{ @@ -948,53 +348,12 @@ \pgfextra{ \pgfcircresetpath } - (\tikztotarget) \tikztonodes % e si continua + (\tikztotarget) \tikztonodes % and go on! } - \def\pgf@circ@definetranspath#1{ \compattikzset{T#1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@trans@path{#1}{}, l=##1}} } -\pgf@circ@definetranspath{elmech} -\pgf@circ@definetranspath{nmos} -\pgf@circ@definetranspath{pmos} -\pgf@circ@definetranspath{nmosd} -\pgf@circ@definetranspath{pmosd} -\pgf@circ@definetranspath{hemt} -\pgf@circ@definetranspath{npn} -\pgf@circ@definetranspath{pnp} -\pgf@circ@definetranspath{nfet} -\pgf@circ@definetranspath{nigfete} -\pgf@circ@definetranspath{nigfetd} -\pgf@circ@definetranspath{nigfetebulk} -\pgf@circ@definetranspath{pfet} -\pgf@circ@definetranspath{pigfete} -\pgf@circ@definetranspath{pigfetd} -\pgf@circ@definetranspath{pigfetebulk} -\pgf@circ@definetranspath{njfet} -\pgf@circ@definetranspath{pjfet} -\pgf@circ@definetranspath{pigbt} -\pgf@circ@definetranspath{nigbt} -\pgf@circ@definetranspath{Lpigbt} -\pgf@circ@definetranspath{Lnigbt} -% -% Path-style logical ports % -% create path-style element for one input --- one output logical ports -% -\def\pgfcirc@port@node@to@path#1#2{% - % - % add a logic port path style component --- we need to suppress leads - % and use the correct center - % - \pgfcirc@node@to@path{#1}{#2}{/tikz/no leads, \circuitikzbasekey/logic ports origin=center}% -} -\pgfcirc@port@node@to@path{not port}{inline not} -\pgfcirc@port@node@to@path{buffer port}{inline buffer} -\pgfcirc@port@node@to@path{schmitt port}{inline schmitt} -\pgfcirc@port@node@to@path{invschmitt port}{inline invschmitt} - -\pgfcirc@port@node@to@path{tgate}{inline tgate} -\pgfcirc@port@node@to@path{double tgate}{inline double tgate} - +% vim: set fdm=marker fmr=%<<<,%>>>: diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircquadpoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircquadpoles.tex index 469f7aa8e4..e00b33ad59 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircquadpoles.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircquadpoles.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -12,6 +12,54 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Quadripoles +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +% Setting for Transformers and similar quadpoles%<<<1 + +\ctikzset{quadpoles/transformer/inner/.initial=0.4} +\ctikzset{quadpoles/transformer/width/.initial=1.5} +\ctikzset{quadpoles/transformer/width1/.initial=.4} +\ctikzset{quadpoles/transformer/height/.initial=1.5} +\ctikzset{quadpoles/transformer/height1/.initial=.8} +\ctikzset{quadpoles/transformer core/inner/.initial=0.4} +\ctikzset{quadpoles/transformer core/width/.initial=1.5} +\ctikzset{quadpoles/transformer core/height/.initial=1.5} +\ctikzset{quadpoles/transformer core/core height/.initial=.5} +\ctikzset{quadpoles/transformer core/core width/.initial=.05} +\ctikzset{quadpoles/gyrator/inner/.initial=0.4} +\ctikzset{quadpoles/gyrator/width/.initial=1.5} +\ctikzset{quadpoles/gyrator/height/.initial=1.5} +\ctikzset{quadpoles/fourport/width/.initial=1.3} +\ctikzset{quadpoles/fourport/height/.initial=1.3} +\ctikzset{quadpoles/coupler/width/.initial=1.3} +\ctikzset{quadpoles/coupler/height/.initial=1.3} +\ctikzset{quadpoles/coupler2/width/.initial=1.3} +\ctikzset{quadpoles/coupler2/height/.initial=1.3} + + +\ctikzset{quadpoles style/.is choice} +\ctikzset{quadpoles style/inward/.code={% default value + \ctikzset{quadpoles/transformer/inner=0.4}% + \ctikzset{quadpoles/transformer/width=1.5}% + \ctikzset{quadpoles/transformer core/inner=0.4}% + \ctikzset{quadpoles/transformer core/width=1.5}% + \ctikzset{quadpoles/gyrator/inner=0.4}% + \ctikzset{quadpoles/gyrator/width=1.5}% + }% +} +\ctikzset{quadpoles style/inline/.code={% now horizontal baffle + \ctikzset{quadpoles/transformer/inner=1}% + \ctikzset{quadpoles/transformer/width=0.6}% + \ctikzset{quadpoles/transformer core/inner=1}% + \ctikzset{quadpoles/transformer core/width=0.6}% + \ctikzset{quadpoles/gyrator/inner=1} % FIXME + \ctikzset{quadpoles/gyrator/width=0.6}% + }% +} +%%>>> + +%% Node shapes for quadpoles (basically transformers)%<<< \long\def\pgfcircdeclarequadpole#1#2#3{ \pgfdeclareshape{#1} @@ -151,198 +199,1950 @@ } -\def\pgf@circ@drawtransformerbasicanchor{ - \ctikzvalof{quadpoles/trans/height} - \anchor{AA2}{ - \northwest - \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x - \pgf@x=.7\pgf@x - \pgf@y=-\pgf@y - \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y - } - \anchor{BB1}{ - \northwest +\def\pgf@circ@drawtransformerbasicanchor{ + \ctikzvalof{quadpoles/trans/height} + \anchor{AA2}{ + \northwest + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=-\pgf@y + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y + } + \anchor{BB1}{ + \northwest + \pgf@x=-\pgf@x + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y + } + \anchor{AA1}{ + \northwest + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y + } + \anchor{BB2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=-\pgf@y + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y + } +} + +%% Null styles that can be used to change individually the L1 and L2 +%% inductors of the transformer. + +\ctikzset{transformer L1/.style={}} +\ctikzset{transformer L2/.style={}} + +\def\pgf@circ@drawtransformerbasicbody{ + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgftransformlineattime{.5}{% + \pgfpoint% + {\stretto\pgf@circ@res@left}% + {\pgf@circ@res@up}% + }{% + \pgfpoint + {\stretto\pgf@circ@res@left}% + {\pgf@circ@res@down}% + } + + \pgfkeys{\circuitikzbasekey/.cd, transformer L1} + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{fullgenericshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}} + \else% + \def\pgf@temp{cute} + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{cuteinductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}} + \else% + \pgfnode{americaninductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}} + \fi% + \fi% + + + \endpgfscope + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgftransformlineattime{.5}{% + \pgfpoint% + {\stretto\pgf@circ@res@right}% + {\pgf@circ@res@down}% + }{% + \pgfpoint + {\stretto\pgf@circ@res@right}% + {\pgf@circ@res@up}% + } + + \pgfkeys{\circuitikzbasekey/.cd, transformer L2} + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{fullgenericshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}} + \else% + \def\pgf@temp{cute} + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{cuteinductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}} + \else% + \pgfnode{americaninductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}} + \fi% + \fi% + + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{\thisshape-L1}{b}} + + \pgfpathmoveto{\pgfpointanchor{\thisshape-L1}{a}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{\thisshape-L2}{a}} + + \pgfpathmoveto{\pgfpointanchor{\thisshape-L2}{b}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfusepath{draw} + +} + + +\pgfcircdeclarequadpole{transformer}{ + \pgf@circ@drawtransformerbasicbody +}{\pgf@circ@drawtransformerbasicanchor} + +\pgfcircdeclarequadpole{transformer core}{ + + \pgf@circ@drawtransformerbasicbody + + % use the chocke line thickness + \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth} + + % Find the distance from center for the lines representing the core + % the 2.5 is for backward compatibility --- the distance was calculated as a fraction + % of the whole component, now as a fraction of the distance between coils, to be + % compatible with the quadpoles "inner" style. + \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@right} + + \pgfmoveto{\pgfpoint% + {\pgf@circ@res@other}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}% + } + \pgflineto{ + \pgfpoint% + {\pgf@circ@res@other}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}% + } + + %% this should be just -\pgf@circ@res@other, but in case someone define an asymmetric trafo someday... + \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@left} + \pgfmoveto{\pgfpoint% + {\pgf@circ@res@other}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}% + } + \pgflineto{ + \pgfpoint% + {\pgf@circ@res@other}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}% + } + + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgfusepath{draw} +}{\pgf@circ@drawtransformerbasicanchor} + + +\pgfcircdeclarequadpole{gyrator}{ + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth} + \pgfmathsetlength{\pgf@circ@res@other}{min(.7*\stretto*\pgf@circ@res@up, .8*\pgf@circ@res@right)} % radius + \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{-\pgf@circ@res@other}} + \pgfpatharc{-90}{90}{\pgf@circ@res@other} + \pgfpathclose + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@other}} + \pgfpatharc{90}{270}{\pgf@circ@res@other} + \pgfpathclose + \pgf@circ@draworfill +}{} +% %>>> + +%%%%%%%%%%%%%%%%%%% +%% Block diagrams +%%%%%%%%%%%%%%%%%%% + +% Definitions and options for blocks (twoports and so)%<<<1 + +\ctikzset{bipoles/twoport/width/.initial=.7} +\ctikzset{bipoles/twoport/height/.initial=.7} +\ctikzset{bipoles/twoport/text/.initial=} +\ctikzset{bipoles/twoportsplit/width/.initial=.7} +\ctikzset{bipoles/twoport/text in/.initial=} +\ctikzset{bipoles/twoport/text out/.initial=} +\ctikzset{text/.style={t=#1}} +\ctikzset{t/.code={% + \ctikzsetvalof{bipoles/twoport/text}{#1}% +}} +\ctikzset{text in/.style={t1=#1}} +\ctikzset{t1/.code={% + \ctikzsetvalof{bipoles/twoport/text in}{#1}% +}} +\ctikzset{text out/.style={t2=#1}} +\ctikzset{t2/.code={% + \ctikzsetvalof{bipoles/twoport/text out}{#1}% +}} +\ctikzset{bipoles/vco/width/.initial=.7} +\ctikzset{bipoles/bandpass/width/.initial=.7} +\ctikzset{bipoles/bandstop/width/.initial=.7} +\ctikzset{bipoles/highpass/width/.initial=.7} +\ctikzset{bipoles/lowpass/width/.initial=.7} +\ctikzset{bipoles/allpass/width/.initial=.7} +\ctikzset{bipoles/adc/width/.initial=.7} +\ctikzset{bipoles/dac/width/.initial=.7} +\ctikzset{bipoles/dsp/width/.initial=.7} +\ctikzset{bipoles/fft/width/.initial=.7} +\ctikzset{bipoles/amp/width/.initial=.7} +\ctikzset{bipoles/vamp/width/.initial=.7} +\ctikzset{bipoles/piattenuator/width/.initial=.7} +\ctikzset{bipoles/vpiattenuator/width/.initial=.7} +\ctikzset{bipoles/tattenuator/width/.initial=.7} +\ctikzset{bipoles/vtattenuator/width/.initial=.7} +\ctikzset{bipoles/phaseshifter/width/.initial=.7} +\ctikzset{bipoles/vphaseshifter/width/.initial=.7} +\ctikzset{bipoles/detector/width/.initial=.7} +\ctikzset{tripoles/mixer/width/.initial=0.7} +\ctikzset{tripoles/adder/width/.initial=0.7} +\ctikzset{tripoles/circulator/width/.initial=.7} +\ctikzset{tripoles/oscillator/width/.initial=.7} + +\ctikzset{tripoles/wilkinson/height/.initial=1.3} +\ctikzset{tripoles/wilkinson/width/.initial=1.3} + +\ctikzset{tripoles/splitter/height/.initial=1.3} +\ctikzset{tripoles/splitter/width/.initial=1.3} + +\ctikzset{tripoles/mzm/height/.initial=1.3} +\ctikzset{tripoles/mzm/width/.initial=1.3} + +% Option ">" for twoports +\newif\ifpgf@circuit@inputarrow +\ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}} +\ctikzset{inputarrow/.is choice} +\ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}} +\ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}} + +% Option "boxed" for nodes and twoports +\newif\ifpgf@circuit@boxed +\pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue}} +\ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue}} +\pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue}} +\ctikzset{box/.add code={}{\pgf@circuit@boxedtrue}} + +% Option "dashed" for nodes and twoports +\newif\ifpgf@circuit@dashed +\pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}} +\ctikzset{dashed/.add code={}{\pgf@circuit@dashedtrue}}% + +% powerelectronic blocks +\ctikzset{bipoles/sacdc/width/.initial=.7} +\ctikzset{bipoles/sdcac/width/.initial=.7} +\ctikzset{bipoles/tacdc/width/.initial=.7} +\ctikzset{bipoles/tdcac/width/.initial=.7} +\ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole? + +%>>> + +%% Node shapes definition for path-style block diagrams%<<< + +%% Draw the two-port fillable box +\def\pgf@circ@twoportbox{ + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \endpgfscope +} + +%% Generic two port box +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/twoport/height}} +{twoport} +{\ctikzvalof{bipoles/twoport/height}} +{\ctikzvalof{bipoles/twoport/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + % draw outer box + \pgf@circ@twoportbox + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}} + +} + +%% twoport split +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/twoportsplit/width}} +{twoportsplit} +{\ctikzvalof{bipoles/twoportsplit/width}} +{\ctikzvalof{bipoles/twoportsplit/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/twoportsplit/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + %get texts + \def\pgfcirc@tin{\ctikzvalof{bipoles/twoport/text in}} + \def\pgfcirc@tout{\ctikzvalof{bipoles/twoport/text out}} + + % rotate inner symbol + \def\texti{\pgfcirc@tin} + \def\textii{\pgfcirc@tout} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \def\texti{\pgfcirc@tout} + \def\textii{\pgfcirc@tin} + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \def\texti{\pgfcirc@tout} + \def\textii{\pgfcirc@tin} + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \def\texti{\pgfcirc@tin} + \def\textii{\pgfcirc@tout} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\texti} + \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textii} +} + +%% voltage controled oscillator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/vco/width}} +{vco} +{\ctikzvalof{bipoles/twoport/width}} +{\ctikzvalof{bipoles/vco/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + % draw circle + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step} + \pgf@circ@draworfill + \endpgfscope + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner sine waves + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% bandpass filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/bandpass/width}} +{bandpass} +{\ctikzvalof{bipoles/bandpass/width}} +{\ctikzvalof{bipoles/bandpass/width}} +{ + + \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% bandstop filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/bandstop/width}} +{bandstop} +{\ctikzvalof{bipoles/bandstop/width}} +{\ctikzvalof{bipoles/bandstop/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225% 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt}% always draw solid line for inner symbol + \pgfsetarrows{-}%never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% highpass filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/highpass/width}} +{highpass} +{\ctikzvalof{bipoles/highpass/width}} +{\ctikzvalof{bipoles/highpass/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% lowpass filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/lowpass/width}} +{lowpass} +{\ctikzvalof{bipoles/lowpass/width}} +{\ctikzvalof{bipoles/lowpass/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% allpass filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/allpass/width}} +{allpass} +{\ctikzvalof{bipoles/allpass/width}} +{\ctikzvalof{bipoles/allpass/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/allpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% ADC +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/adc/width}} +{adc} +{\ctikzvalof{bipoles/adc/width}} +{\ctikzvalof{bipoles/adc/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\texti{A} + \def\textii{D} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \def\texti{D} + \def\textii{A} + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \def\texti{D} + \def\textii{A} + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \def\texti{A} + \def\textii{D} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} + \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} +} + +%% DAC +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/dac/width}} +{dac} +{\ctikzvalof{bipoles/dac/width}} +{\ctikzvalof{bipoles/dac/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\texti{D} + \def\textii{A} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \def\texti{A} + \def\textii{D} + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \def\texti{A} + \def\textii{D} + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \def\texti{D} + \def\textii{A} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} + \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} +} + +%% DSP +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/dsp/width}} +{dsp} +{\ctikzvalof{bipoles/dsp/width}} +{\ctikzvalof{bipoles/dsp/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgftext[center,x=0,y=0]{\textsf{DSP}} +} + +%% FFT +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/fft/width}} +{fft} +{\ctikzvalof{bipoles/fft/width}} +{\ctikzvalof{bipoles/fft/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgftext[center,x=0,y=0]{\textsf{FFT}} +} + +%% Amplifier +\pgfcircdeclarebipolescaled{blocks} +{} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{amp} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \ifpgf@circuit@boxed + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \pgf@circ@draworfill + \fi + + % draw input arrow + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + \ifpgf@circuit@boxed + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn + \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + + \pgfsetarrows{-} %never draw arrows + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} + \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} + + \pgfpathclose + \pgf@circ@draworfill + + % draw inner text + \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} +} + + +%% variable amplifier +\pgfcircdeclarebipolescaled{blocks} +{} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{vamp} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw input arrow + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + \ifpgf@circuit@boxed + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn + \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + + + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} + \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} + + \pgfpathclose + \pgf@circ@draworfill + + % draw inner text + \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} + + % draw arrow + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% pi attenuator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/piattenuator/width}} +{piattenuator} +{\ctikzvalof{bipoles/piattenuator/width}} +{\ctikzvalof{bipoles/piattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% variable pi attenuator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{vpiattenuator} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% T attenuator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/tattenuator/width}} +{tattenuator} +{\ctikzvalof{bipoles/tattenuator/width}} +{\ctikzvalof{bipoles/tattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% variable T attenuator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/vtattenuator/width}} +{vtattenuator} +{\ctikzvalof{bipoles/vtattenuator/width}} +{\ctikzvalof{bipoles/vtattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% phase shifter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/phaseshifter/width}} +{phaseshifter} +{\ctikzvalof{bipoles/phaseshifter/width}} +{\ctikzvalof{bipoles/phaseshifter/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % inner symbol + \pgftext[center,x=0,y=0]{\Large$\varphi$} +} + +%% variable phase shifter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/phaseshifter/width}} +{vphaseshifter} +{\ctikzvalof{bipoles/vphaseshifter/width}} +{\ctikzvalof{bipoles/vphaseshifter/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % inner symbol + \pgftext[center,x=0,y=0]{\Large$\varphi$} + + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% detector +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/detector/width}} +{detector} +{\ctikzvalof{bipoles/detector/width}} +{\ctikzvalof{bipoles/detector/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{0.8\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}} + \pgfusepath{draw} + + \ifpgf@circuit@fulldiode + \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width}} + \pgftransformscale{\pgfmathresult} + \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}} + \else + \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width}} + \pgftransformscale{\pgfmathresult} + \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}} + \fi + +} + +%% single phase ac/dc converter +\pgfcircdeclarebipolescaled{blocks} +{ + \anchor{dc1}{ + \northeast + \pgf@y=.4\pgf@y + } + \anchor{dc2}{ + \northeast + \pgf@y=-.4\pgf@y + } +} +{\ctikzvalof{bipoles/sacdc/width}} +{sacdc} +{\ctikzvalof{bipoles/sacdc/width}} +{\ctikzvalof{bipoles/sacdc/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/sacdc/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + % draw sin wave + \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + + % draw equal sign + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}} + \pgfusepath{draw} +} + + + +%% single phase dc/ac converter +\pgfcircdeclarebipolescaled{blocks} +{ + \anchor{dc1}{ + \northeast + \pgf@y=.4\pgf@y \pgf@x=-\pgf@x - \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x - \pgf@x=.7\pgf@x - \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y } - \anchor{AA1}{ - \northwest - \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x - \pgf@x=.7\pgf@x - \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y - } - \anchor{BB2}{ - \northwest + \anchor{dc2}{ + \northeast + \pgf@y=-.4\pgf@y \pgf@x=-\pgf@x - \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x - \pgf@x=.7\pgf@x - \pgf@y=-\pgf@y - \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y } } +{\ctikzvalof{bipoles/sdcac/width}} +{sdcac} +{\ctikzvalof{bipoles/sdcac/width}} +{\ctikzvalof{bipoles/sdcac/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/sdcac/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 -%% Null styles that can be used to change individually the L1 and L2 -%% inductors of the transformer. + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step -\ctikzset{transformer L1/.style={}} -\ctikzset{transformer L2/.style={}} + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi -\def\pgf@circ@drawtransformerbasicbody{ - \pgfscope - \pgfslopedattimetrue - \pgfallowupsidedownattimetrue - \pgftransformlineattime{.5}{% - \pgfpoint% - {\stretto\pgf@circ@res@left}% - {\pgf@circ@res@up}% - }{% - \pgfpoint - {\stretto\pgf@circ@res@left}% - {\pgf@circ@res@down}% + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } + \fi - \pgfkeys{\circuitikzbasekey/.cd, transformer L1} - \edef\pgf@circ@temp{\ctikzvalof{inductor}}% - \def\pgf@temp{european}% - \ifx\pgf@temp\pgf@circ@temp% - \pgfnode{fullgenericshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}} - \else% - \def\pgf@temp{cute} - \ifx\pgf@temp\pgf@circ@temp% - \pgfnode{cuteinductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}} - \else% - \pgfnode{americaninductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}} - \fi% - \fi% + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} - \endpgfscope - \pgfscope - \pgfslopedattimetrue - \pgfallowupsidedownattimetrue - \pgftransformlineattime{.5}{% - \pgfpoint% - {\stretto\pgf@circ@res@right}% - {\pgf@circ@res@down}% - }{% - \pgfpoint - {\stretto\pgf@circ@res@right}% - {\pgf@circ@res@up}% - } + % draw sin wave + \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} - \pgfkeys{\circuitikzbasekey/.cd, transformer L2} - \edef\pgf@circ@temp{\ctikzvalof{inductor}}% - \def\pgf@temp{european}% - \ifx\pgf@temp\pgf@circ@temp% - \pgfnode{fullgenericshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}} - \else% - \def\pgf@temp{cute} - \ifx\pgf@temp\pgf@circ@temp% - \pgfnode{cuteinductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}} - \else% - \pgfnode{americaninductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}} - \fi% - \fi% + % draw equal sign + \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}} + \pgfusepath{draw} +} - \endpgfscope - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpointanchor{\thisshape-L1}{b}} +%% threephase ac/dc converter +\pgfcircdeclarebipolescaled{blocks} +{ + \anchor{dc1}{ + \northeast + \pgf@y=.4\pgf@y + } + \anchor{dc2}{ + \northeast + \pgf@y=-.4\pgf@y + } + \anchor{ac1}{ + \northeast + \pgf@y=.6\pgf@y + \pgf@x=-\pgf@x + } + \anchor{ac2}{ + \northeast + \pgf@y=0\pgf@y + \pgf@x=-\pgf@x + } + \anchor{ac3}{ + \northeast + \pgf@y=-.6\pgf@y + \pgf@x=-\pgf@x + } +} +{\ctikzvalof{bipoles/tacdc/width}} +{tacdc} +{\ctikzvalof{bipoles/tacdc/width}} +{\ctikzvalof{bipoles/tacdc/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/tacdc/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 - \pgfpathmoveto{\pgfpointanchor{\thisshape-L1}{a}} - \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpointanchor{\thisshape-L2}{a}} + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi - \pgfpathmoveto{\pgfpointanchor{\thisshape-L2}{b}} - \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + % draw outer box + \pgf@circ@twoportbox - \pgfusepath{draw} + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi -} + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} -\pgfcircdeclarequadpole{transformer}{ - \pgf@circ@drawtransformerbasicbody -}{\pgf@circ@drawtransformerbasicanchor} + % draw sin waves + \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.65\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.35\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} -\pgfcircdeclarequadpole{transformer core}{ - \pgf@circ@drawtransformerbasicbody - % use the chocke line thickness - \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth} - % Find the distance from center for the lines representing the core - % the 2.5 is for backward compatibility --- the distance was calculated as a fraction - % of the whole component, now as a fraction of the distance between coils, to be - % compatible with the quadpoles "inner" style. - \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@right} + % draw equal sign + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}} + \pgfusepath{draw} +} - \pgfmoveto{\pgfpoint% - {\pgf@circ@res@other}% - {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}% + +%% threephase dc/ac converter +\pgfcircdeclarebipolescaled{blocks} +{ + \anchor{dc1}{ + \northeast + \pgf@y=.4\pgf@y + \pgf@x=-\pgf@x } - \pgflineto{ - \pgfpoint% - {\pgf@circ@res@other}% - {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}% + \anchor{dc2}{ + \northeast + \pgf@y=-.4\pgf@y + \pgf@x=-\pgf@x } - - %% this should be just -\pgf@circ@res@other, but in case someone define an asymmetric trafo someday... - \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@left} - \pgfmoveto{\pgfpoint% - {\pgf@circ@res@other}% - {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}% + \anchor{ac1}{ + \northeast + \pgf@y=.6\pgf@y } - \pgflineto{ - \pgfpoint% - {\pgf@circ@res@other}% - {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}% + \anchor{ac2}{ + \northeast + \pgf@y=0\pgf@y + } + \anchor{ac3}{ + \northeast + \pgf@y=-.6\pgf@y } +} +{\ctikzvalof{bipoles/tdcac/width}} +{tdcac} +{\ctikzvalof{bipoles/tdcac/width}} +{\ctikzvalof{bipoles/tdcac/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/tdcac/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 - \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} - \pgfusepath{draw} -}{\pgf@circ@drawtransformerbasicanchor} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi -\pgfcircdeclarequadpole{gyrator}{ + % draw outer box + \pgf@circ@twoportbox - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + % draw sin waves + \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.65\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.35\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} \pgfusepath{draw} - \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth} - \pgfmathsetlength{\pgf@circ@res@other}{min(.7*\stretto*\pgf@circ@res@up, .8*\pgf@circ@res@right)} % radius - \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{-\pgf@circ@res@other}} - \pgfpatharc{-90}{90}{\pgf@circ@res@other} - \pgfpathclose - \pgf@circ@draworfill - \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@other}} - \pgfpatharc{90}{270}{\pgf@circ@res@other} - \pgfpathclose - \pgf@circ@draworfill -}{} -%%%%%%%%%%%%%%%%%%%% -%% Block elements -%%%%%%%%%%%%%%%%%%%% + + % draw equal sign + \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}} + \pgfusepath{draw} +} +% %>>> + +%% Path definitions for Blocks%<<< + +\pgfcirc@activate@bipole@simple{l}{twoport} +\pgfcirc@activate@bipole@simple{l}{twoportsplit} +\pgfcirc@activate@bipole@simple{l}{vco} +\pgfcirc@activate@bipole@simple{l}{bandpass} +\pgfcirc@activate@bipole@simple{l}{bandstop} +\pgfcirc@activate@bipole@simple{l}{highpass} +\pgfcirc@activate@bipole@simple{l}{lowpass} +\pgfcirc@activate@bipole@simple{l}{allpass} +\pgfcirc@activate@bipole@simple{l}{adc} +\pgfcirc@activate@bipole@simple{l}{dac} +\pgfcirc@activate@bipole@simple{l}{dsp} +\pgfcirc@activate@bipole@simple{l}{fft} +\pgfcirc@activate@bipole@simple{l}{amp} +\pgfcirc@activate@bipole@simple{l}{vamp} +\pgfcirc@activate@bipole@simple{l}{piattenuator} +\pgfcirc@activate@bipole@simple{l}{vpiattenuator} +\pgfcirc@activate@bipole@simple{l}{tattenuator} +\pgfcirc@activate@bipole@simple{l}{vtattenuator} +\pgfcirc@activate@bipole@simple{l}{phaseshifter} +\pgfcirc@activate@bipole@simple{l}{vphaseshifter} +\pgfcirc@activate@bipole@simple{l}{detector} +\pgfcirc@activate@bipole@simple{l}{sacdc} +\pgfcirc@activate@bipole@simple{l}{sdcac} +\pgfcirc@activate@bipole@simple{l}{tacdc} +\pgfcirc@activate@bipole@simple{l}{tdcac} +% %>>> + +%% Node shapes for Block elements%<<< \pgfdeclareshape{mixer} { @@ -1054,25 +2854,25 @@ \anchor{west}{ \northwest \pgf@y=0pt - } + } \anchor{left}{ \northwest \pgf@y=0pt } - \anchor{south west}{ - \northwest + \anchor{south west}{ + \northwest \pgf@y=-\pgf@y } \anchor{north east}{ - \northwest + \northwest \pgf@x=-\pgf@x \relax } - \anchor{north west}{ - \northwest + \anchor{north west}{ + \northwest } - \anchor{south east}{ - \northwest + \anchor{south east}{ + \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } @@ -1086,13 +2886,13 @@ \pgf@circ@scaled@Rlen=\scaledRlen \pgf@circ@res@step=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen - + \northwest \pgf@circ@res@up = \pgf@y \pgf@circ@res@down = -\pgf@y \pgf@circ@res@right = -\pgf@x \pgf@circ@res@left = \pgf@x - + \pgf@circ@res@step = \ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen \divide \pgf@circ@res@step by 2 @@ -1106,8 +2906,8 @@ % draw outer box \pgf@circ@twoportbox - - + + \ifpgf@circuit@inputarrow { \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth @@ -1115,34 +2915,34 @@ \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} } \fi - + \pgfsetdash{}{0pt} % always draw solid line for inner symbol \pgfsetarrows{-} %never draw arrows \pgfsetlinewidth{0.05mm} - + % draw grid \foreach \line in {-1,-.5,...,1} { \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@up}} - + \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@down}} } - + %prevent from draw the inner cross twice \foreach \line in {-.5,0,...,.5} { \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@up}} - + \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@down}} } \pgfusepath{draw} } } - + % Wilkinson divider \pgfdeclareshape{wilkinson}{ @@ -1733,7 +3533,7 @@ \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}} \pgfusepath{draw} - + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{0.35\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{0.25\pgf@circ@res@right}{0.1\pgf@circ@res@up}} @@ -1741,3 +3541,6 @@ } } +% %>>> + +% vim: set fdm=marker fmr=%<<<,%>>>: diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircshapes.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircshapes.tex index 45497d7e61..cea4b71922 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircshapes.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircshapes.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex index 8fb072ae71..f6ebcf61a3 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -12,268 +12,262 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Tripoles +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%% -%% switches -%%%%%%%%%%%%% - -% Legacy spdt -\pgfdeclareshape{spdt}{ - \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} - \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} - \savedanchor\northwest{% - \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} - \pgf@y=\ctikzvalof{tripoles/spdt/height}\pgf@circ@scaled@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen - \pgf@x=.5\pgf@x - } - \anchor{left}{% - \northwest - \pgf@y=0pt - } - \anchor{in}{ - \northwest - \pgf@y=0pt - } - \anchor{out 1}{ - \northwest - \pgf@x=-\pgf@x - } - \anchor{out 2}{ - \northwest - \pgf@x=-\pgf@x - \pgf@y=-\pgf@y - } - \anchor{center}{ - \pgf@y=0pt - \pgf@x=0pt - } - \anchor{east}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x - } - \anchor{west}{ - \northwest - \pgf@y=0pt - } - \anchor{south}{ - \northwest - \pgf@x=0pt - \pgf@y=-\pgf@y - } - \anchor{north}{ - \northwest - \pgf@x=0pt - } - \anchor{south west}{ - \northwest - \pgf@y=-\pgf@y - } - \anchor{north east}{ - \northwest - \pgf@x=-\pgf@x - } - \anchor{north west}{ - \northwest - } - \anchor{south east}{ - \northwest - \pgf@x=-\pgf@x - \pgf@y=-\pgf@y - } - \backgroundpath{ - \pgfsetcolor{\ctikzvalof{color}} - - \northwest - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@down = -\pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - \pgf@circ@res@other = \ctikzvalof{tripoles/spdt/margin}\pgf@circ@res@left - - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} - - \pgfusepath{draw} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Logic Ports +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - \pgfscope - \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} - \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}} - \endpgfscope - \pgfscope - \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} - \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}} - \endpgfscope - \pgfscope - \pgftransformshift{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}} - \endpgfscope +%% Settings for Logic ports%<<<1 +%% beware that the third option is in IEEE ports in pgfcircmultipoles.tex - \pgfscope - \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}} - \pgfpathlineto{ - \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}} - {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}} - } - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \pgfusepath{draw} - \endpgfscope - } +% switches for logic gates +% +\pgfkeys{/tikz/number inputs/.initial=0} +\pgfkeys{/tikz/number inputs/.default=0} + +\newif\ifpgf@circuit@europeanlogicport +\ctikzset{logic ports/.is choice} +\ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue + \tikzset{and port/.style={shape=european and port}}% + \tikzset{or port/.style={shape=european or port}}% + \tikzset{xor port/.style={shape=european xor port}}% + \tikzset{buffer port/.style={shape=european buffer port}}% + \tikzset{not port/.style={shape=european not port}}% + \tikzset{nand port/.style={shape=european nand port}}% + \tikzset{nor port/.style={shape=european nor port}}% + \tikzset{xnor port/.style={shape=european xnor port}}% + % there is no Schmitt ports in european style (yet) + \tikzset{schmitt port/.style={shape=schmitt}}% + \tikzset{invschmitt port/.style={shape=invschmitt}}% +}} +\ctikzset{logic ports/american/.code= {\pgf@circuit@europeanlogicportfalse + \tikzset{and port/.style={shape=american and port}}% + \tikzset{or port/.style={shape=american or port}}% + \tikzset{xor port/.style={shape=american xor port}}% + \tikzset{buffer port/.style={shape=american buffer port}}% + \tikzset{not port/.style={shape=american not port}}% + \tikzset{nand port/.style={shape=american nand port}}% + \tikzset{nor port/.style={shape=american nor port}}% + \tikzset{xnor port/.style={shape=american xnor port}}% + \tikzset{schmitt port/.style={shape=schmitt}}% + \tikzset{invschmitt port/.style={shape=invschmitt}}% +}} + +\ctikzset{logic ports origin/.is choice} +\ctikzset{logic ports origin/legacy/.code={ + \ctikzset{tripoles/american and port/origin/.initial=0.8}% + \ctikzset{tripoles/american nand port/origin/.initial=0.8}% + \ctikzset{tripoles/american nor port/origin/.initial=0.8}% + \ctikzset{tripoles/american or port/origin/.initial=0.8}% + \ctikzset{tripoles/american xor port/origin/.initial=0.8}% + \ctikzset{tripoles/american xnor port/origin/.initial=0.8}% + \ctikzset{tripoles/european and port/origin/.initial=0.8}% + \ctikzset{tripoles/european nand port/origin/.initial=0.8}% + \ctikzset{tripoles/european or port/origin/.initial=0.8}% + \ctikzset{tripoles/european nor port/origin/.initial=0.8}% + \ctikzset{tripoles/european xor port/origin/.initial=0.8}% + \ctikzset{tripoles/european xnor port/origin/.initial=0.8}% + \ctikzset{tripoles/european buffer port/origin/.initial=0.8}% + \ctikzset{tripoles/european not port/origin/.initial=0.8}% + }% } - - -% cute switch "node" shapes, matching with cute "to" shapes -% #1 -> name -% #2 -> barposition -% #3 -> arrowcode -\long\def\pgfcircdeclarecutespdt#1#2#3{ - \pgfdeclareshape{#1} - { - \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} - \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} - \savedanchor\northwest{% - \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} - \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen - \pgf@x=.25\pgf@x - } - \savedanchor\midlever{ - % these values are calculated when we create the definition of the shape. - \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} - \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen - \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen - \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp - \pgf@circ@res@down = -.5\pgf@y - \pgf@circ@res@up = .5\pgf@y - \pgfextracty{\pgf@circ@res@other}{#2} - \pgf@x=0pt - \pgf@y=.5\pgf@circ@res@other - } - % radius of the connector - % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) - \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} - % shapename - \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} - % shape type - \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}} - % mid of the lever, to stack switches - \anchor{mid}{\midlever} - % center anchors - \anchor{cin}{ \northwest \pgf@y=0pt} - \anchor{cout 1}{ \northwest \pgf@x=-\pgf@x } - \anchor{cout 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - % horizontal angles - \anchor{in}{ \northwest \pgf@y=0pt\advance\pgf@x by -\radius} - \anchor{out 1}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius} - \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius \pgf@y=-\pgf@y } - - \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } - \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } - \anchor{west}{ \northwest \pgf@y=0pt } - \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } - \anchor{north}{ \northwest \pgf@x=0pt } - \anchor{south west}{ \northwest \pgf@y=-\pgf@y } - \anchor{north east}{ \northwest \pgf@x=-\pgf@x } - \anchor{north west}{ \northwest } - \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - - \backgroundpath{ - \pgfsetcolor{\ctikzvalof{color}} - \northwest - \pgf@circ@res@up = \pgf@y - \pgf@circ@res@down = -\pgf@y - \pgf@circ@res@right = -\pgf@x - \pgf@circ@res@left = \pgf@x - - \pgfscope - % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) - \pgf@circ@res@temp=\radius\relax - \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp - \pgfsetlinewidth{2\pgf@circ@res@temp} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{#2} - \pgfsetroundcap\pgfusepath{draw} - \endpgfscope - \pgfscope % arrow - #3 - \endpgfscope - % terminals - \pgfscope - \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}} - \endpgfscope - \pgfscope - \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} - \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}} - \endpgfscope - \pgfscope - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}} - \endpgfscope - - } - } +\ctikzset{logic ports origin/center/.code={% + \ctikzset{tripoles/american and port/origin/.initial=0}% + \ctikzset{tripoles/american nand port/origin/.initial=0}% + \ctikzset{tripoles/american nor port/origin/.initial=0}% + \ctikzset{tripoles/american or port/origin/.initial=0}% + \ctikzset{tripoles/american xor port/origin/.initial=0}% + \ctikzset{tripoles/american xnor port/origin/.initial=0}% + \ctikzset{tripoles/european and port/origin/.initial=0}% + \ctikzset{tripoles/european nand port/origin/.initial=0}% + \ctikzset{tripoles/european or port/origin/.initial=0}% + \ctikzset{tripoles/european nor port/origin/.initial=0}% + \ctikzset{tripoles/european xor port/origin/.initial=0}% + \ctikzset{tripoles/european xnor port/origin/.initial=0}% + \ctikzset{tripoles/european buffer port/origin/.initial=0}% + \ctikzset{tripoles/european not port/origin/.initial=0}% + }% } -\pgfcircdeclarecutespdt{cute spdt up} -{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up-1.5\pgf@circ@res@temp}} -{} - -\pgfcircdeclarecutespdt{cute spdt mid} -{\pgfpoint{\pgf@circ@res@right}{0pt}} -{} - -\pgfcircdeclarecutespdt{cute spdt down} -{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}} -{} - -\pgfcircdeclarecutespdt{cute spdt up arrow} -{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up-1.5\pgf@circ@res@temp}} -{ - \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node - \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}} - \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right} - \pgfsetarrowsend{latexslim} - \pgfusepath{draw} +\newif\ifpgfcirc@roundy@or@shapes\pgfcirc@roundy@or@shapesfalse +\ctikzset{american or shape/.is choice} +\ctikzset{american or shape/roundy/.code={\pgfcirc@roundy@or@shapestrue}} +\ctikzset{american or shape/pointy/.code={\pgfcirc@roundy@or@shapesfalse}} + +\newif\ifpgfcirc@draw@input@leads\pgfcirc@draw@input@leadstrue +\ctikzset{logic ports draw input leads/.is choice} +\ctikzset{logic ports draw input leads/true/.code={\pgfcirc@draw@input@leadstrue}} +\ctikzset{logic ports draw input leads/false/.code={\pgfcirc@draw@input@leadsfalse}} +\tikzset{input leads/.code={\pgfcirc@draw@input@leadstrue}} +\tikzset{no input leads/.code={\pgfcirc@draw@input@leadsfalse}} + +\newif\ifpgfcirc@draw@output@leads\pgfcirc@draw@output@leadstrue +\ctikzset{logic ports draw output leads/.is choice} +\ctikzset{logic ports draw output leads/true/.code={\pgfcirc@draw@output@leadstrue}} +\ctikzset{logic ports draw output leads/false/.code={\pgfcirc@draw@output@leadsfalse}} +\tikzset{output leads/.code={\pgfcirc@draw@output@leadstrue}} +\tikzset{no output leads/.code={\pgfcirc@draw@output@leadsfalse}} + +\ctikzset{logic ports draw leads/.is choice} +\ctikzset{logic ports draw leads/true/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}} +\ctikzset{logic ports draw leads/false/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}} +\tikzset{all leads/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}} +\tikzset{no leads/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}} + +% adding a different style of xnor port +% see https://github.com/circuitikz/circuitikz/issues/467 +\ctikzset{european xnor style/.is choice} +\ctikzset{european xnor style/default/.code={% + \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}}% } - -\pgfcircdeclarecutespdt{cute spdt mid arrow} -{\pgfpoint{\pgf@circ@res@right}{0pt}} -{ - \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node - \pgfsetarrowsstart{latexslim} - \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}} - \pgfpatharc{-60}{60}{1.5\pgf@circ@res@right} - \pgfsetarrowsend{latexslim} - \pgfusepath{draw} +\ctikzset{european xnor style/direct/.code={% + \pgfcircdeclareeurologicport{xnor}{$=$}{\pgf@circ@res@count}{}}% } -\pgfcircdeclarecutespdt{cute spdt down arrow} -{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}} -{ - \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} - \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node - \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}} - \pgfpatharc{-50}{70}{1.5\pgf@circ@res@right} - \pgfsetarrowsend{latexslim} - \pgfusepath{draw} -} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% -%% Logic ports +% old, legacy keys that should be killed over +\ctikzset{bipoles/buffer/height/.initial=1} +\ctikzset{bipoles/buffer/width/.initial=1} +\ctikzset{bipoles/not port/width/.initial=1} +\ctikzset{bipoles/not port/height/.initial=.8} +\ctikzset{bipoles/not port/circle width/.initial=.15} + +\ctikzset{tripoles/american and port/width/.initial=1.1} +\ctikzset{tripoles/american and port/height/.initial=.8} +\ctikzset{tripoles/american and port/port width/.initial=.7} +\ctikzset{tripoles/american and port/input height/.initial=.5} +\ctikzset{tripoles/american nand port/width/.initial=1.1} +\ctikzset{tripoles/american nand port/height/.initial=.8} +\ctikzset{tripoles/american nand port/port width/.initial=.7} +\ctikzset{tripoles/american nand port/circle width/.initial=.15} +\ctikzset{tripoles/american nand port/input height/.initial=.5} +\ctikzset{tripoles/american or port/width/.initial=1.1} +\ctikzset{tripoles/american or port/height/.initial=.8} +\ctikzset{tripoles/american or port/port width/.initial=.7} +\ctikzset{tripoles/american or port/input height/.initial=.5} +\ctikzset{tripoles/american or port/input skip/.initial=.25} +\ctikzset{tripoles/american or port/aaa/.initial=.6} +\ctikzset{tripoles/american or port/bbb/.initial=.4} +\ctikzset{tripoles/american or port/ccc/.initial=.5} +\ctikzset{tripoles/american or port/ddd/.initial=.0} +\ctikzset{tripoles/american nor port/width/.initial=1.1} +\ctikzset{tripoles/american nor port/height/.initial=.8} +\ctikzset{tripoles/american nor port/port width/.initial=.7} +\ctikzset{tripoles/american nor port/input height/.initial=.5} +\ctikzset{tripoles/american nor port/input skip/.initial=.25} +\ctikzset{tripoles/american nor port/circle width/.initial=.15} +\ctikzset{tripoles/american nor port/aaa/.initial=.6} +\ctikzset{tripoles/american nor port/bbb/.initial=.4} +\ctikzset{tripoles/american nor port/ccc/.initial=.5} +\ctikzset{tripoles/american nor port/ddd/.initial=.0} +\ctikzset{tripoles/american xor port/width/.initial=1.1} +\ctikzset{tripoles/american xor port/height/.initial=.8} +\ctikzset{tripoles/american xor port/port width/.initial=.7} +\ctikzset{tripoles/american xor port/input height/.initial=.5} +\ctikzset{tripoles/american xor port/input skip/.initial=.15} +\ctikzset{tripoles/american xor port/distance/.initial=.1} +\ctikzset{tripoles/american xnor port/width/.initial=1.1} +\ctikzset{tripoles/american xnor port/height/.initial=.8} +\ctikzset{tripoles/american xnor port/port width/.initial=.7} +\ctikzset{tripoles/american xnor port/input height/.initial=.5} +\ctikzset{tripoles/american xnor port/input skip/.initial=.15} +\ctikzset{tripoles/american xnor port/distance/.initial=.1} +\ctikzset{tripoles/american xnor port/circle width/.initial=.15} +\ctikzset{tripoles/american and port/origin/.initial=0.8} +\ctikzset{tripoles/american and port/inputs/.initial=2} +% variable number of inputs +\ctikzset{tripoles/american nand port/origin/.initial=0.8} +\ctikzset{tripoles/american nand port/inputs/.initial=2} +\ctikzset{tripoles/american nor port/origin/.initial=0.8} +\ctikzset{tripoles/american nor port/inputs/.initial=2} +\ctikzset{tripoles/american nor port/angle/.initial=70} +\ctikzset{tripoles/american nor port/inner/.initial=0.3} +\ctikzset{tripoles/american or port/origin/.initial=0.8} +\ctikzset{tripoles/american or port/inputs/.initial=2} +\ctikzset{tripoles/american or port/angle/.initial=70} +\ctikzset{tripoles/american or port/inner/.initial=0.3} +\ctikzset{tripoles/american xor port/origin/.initial=0.8} +\ctikzset{tripoles/american xor port/inputs/.initial=2} +\ctikzset{tripoles/american xor port/angle/.initial=70} +\ctikzset{tripoles/american xor port/inner/.initial=0.3} +\ctikzset{tripoles/american xnor port/origin/.initial=0.8} +\ctikzset{tripoles/american xnor port/inputs/.initial=2} +\ctikzset{tripoles/american xnor port/angle/.initial=70} +\ctikzset{tripoles/american xnor port/inner/.initial=0.3} + +\ctikzset{tripoles/european and port/width/.initial=1.4} +\ctikzset{tripoles/european and port/height/.initial=.65} +\ctikzset{tripoles/european and port/reserved/.initial=.6} +\ctikzset{tripoles/european and port/input height/.initial=.6} +\ctikzset{tripoles/european or port/width/.initial=1.4} +\ctikzset{tripoles/european or port/height/.initial=.65} +\ctikzset{tripoles/european or port/reserved/.initial=.6} +\ctikzset{tripoles/european or port/input height/.initial=.6} +\ctikzset{tripoles/european xor port/width/.initial=1.4} +\ctikzset{tripoles/european xor port/height/.initial=.65} +\ctikzset{tripoles/european xor port/reserved/.initial=.6} +\ctikzset{tripoles/european xor port/input height/.initial=.6} +\ctikzset{tripoles/european nand port/width/.initial=1.4} +\ctikzset{tripoles/european nand port/not height/.initial=.3} +\ctikzset{tripoles/european nand port/not width/.initial=.8} +\ctikzset{tripoles/european nand port/height/.initial=.65} +\ctikzset{tripoles/european nand port/reserved/.initial=.6} +\ctikzset{tripoles/european nand port/input height/.initial=.6} +\ctikzset{tripoles/european buffer port/width/.initial=1.4} +\ctikzset{tripoles/european buffer port/not height/.initial=.3} +\ctikzset{tripoles/european buffer port/not width/.initial=.8} +\ctikzset{tripoles/european buffer port/height/.initial=.65} +\ctikzset{tripoles/european buffer port/reserved/.initial=.6} +\ctikzset{tripoles/european buffer port/input height/.initial=0} +\ctikzset{tripoles/european not port/width/.initial=1.4} +\ctikzset{tripoles/european not port/not height/.initial=.3} +\ctikzset{tripoles/european not port/not width/.initial=.8} +\ctikzset{tripoles/european not port/height/.initial=.65} +\ctikzset{tripoles/european not port/reserved/.initial=.6} +\ctikzset{tripoles/european not port/input height/.initial=0} +\ctikzset{tripoles/european xnor port/width/.initial=1.4} +\ctikzset{tripoles/european xnor port/not height/.initial=.3} +\ctikzset{tripoles/european xnor port/not width/.initial=.8} +\ctikzset{tripoles/european xnor port/height/.initial=.65} +\ctikzset{tripoles/european xnor port/reserved/.initial=.6} +\ctikzset{tripoles/european xnor port/input height/.initial=.6} +\ctikzset{tripoles/european nor port/width/.initial=1.4} +\ctikzset{tripoles/european nor port/not height/.initial=.3} +\ctikzset{tripoles/european nor port/not width/.initial=.8} +\ctikzset{tripoles/european nor port/height/.initial=.65} +\ctikzset{tripoles/european nor port/reserved/.initial=.6} +\ctikzset{tripoles/european nor port/input height/.initial=.6} +% variable number of inputs +\ctikzset{tripoles/european and port/origin/.initial=0.8} +\ctikzset{tripoles/european and port/inputs/.initial=2} +\ctikzset{tripoles/european nand port/origin/.initial=0.8} +\ctikzset{tripoles/european nand port/inputs/.initial=2} +\ctikzset{tripoles/european or port/origin/.initial=0.8} +\ctikzset{tripoles/european or port/inputs/.initial=2} +\ctikzset{tripoles/european nor port/origin/.initial=0.8} +\ctikzset{tripoles/european nor port/inputs/.initial=2} +\ctikzset{tripoles/european xor port/origin/.initial=0.8} +\ctikzset{tripoles/european xor port/inputs/.initial=2} +\ctikzset{tripoles/european xnor port/origin/.initial=0.8} +\ctikzset{tripoles/european xnor port/inputs/.initial=2} +\ctikzset{tripoles/european buffer port/origin/.initial=0.8} +\ctikzset{tripoles/european buffer port/inputs/.initial=1}% +\ctikzset{tripoles/european not port/origin/.initial=0.8} +\ctikzset{tripoles/european not port/inputs/.initial=1}% +%%% parameters that are not used anymore after multi-input +%%% gates --- left for compatibility of source code. +\ctikzset{tripoles/american xor port/aaa/.initial=.6} +\ctikzset{tripoles/american xor port/bbb/.initial=.4} +\ctikzset{tripoles/american xor port/ccc/.initial=.5} +\ctikzset{tripoles/american xor port/ddd/.initial=.0} +\ctikzset{tripoles/american xnor port/aaa/.initial=.6} +\ctikzset{tripoles/american xnor port/bbb/.initial=.4} +\ctikzset{tripoles/american xnor port/ccc/.initial=.5} +\ctikzset{tripoles/american xnor port/ddd/.initial=.0} +%%>>> + +%% Node shapes for Logic ports%<<< %% %% Code from John Kormylo at tex.stackexchange.com %% See https://tex.stackexchange.com/questions/372993/is-it-possible-to-implement-multiple-input-logic-ports-with-circuitikz @@ -1511,66 +1505,1778 @@ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}% \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% \else - \pgfextracty{\pgf@circ@res@temp}{\step}% - \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax - %\pgf@circ@res@count = #3\relax% redundant - \loop\ifnum\pgf@circ@res@count>0 - \advance\pgf@circ@res@temp by -\pgf@circ@res@step - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% - \pgfpathlineto{\pgfpoint - {\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left} - {\pgf@circ@res@temp}} - \advance\pgf@circ@res@count by -1 - \repeat + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + %\pgf@circ@res@count = #3\relax% redundant + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left} + {\pgf@circ@res@temp}} + \advance\pgf@circ@res@count by -1 + \repeat + \fi + \pgfusepath{draw} + \fi + % + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{ \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \fi + % + \edef\pgf@temp{not} + \edef\pgf@circ@temp{#4} + \ifx\pgf@temp\pgf@circ@temp % is a not + \ifpgf@circ@european@port@circle + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right} + % reset linewidth for IEEE ports, otherwise they will multiply... + \ifpgf@circ@european@port@circle@ieee\pgfsetlinewidth{\pgfstartlinewidth}\fi + \pgfnode{\ctikzvalof{tripoles/european not shape}}{west}{}{NOT}{\pgfusepath{stroke}} + \endpgfscope + \else + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}% + {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}} + \pgfusepath{draw} + \fi + \fi + % + \pgfpathmoveto{\pgfpointorigin} + \pgftext{#2} + } + } +} +\pgfcircdeclareeurologicport{and}{\&}{\pgf@circ@res@count}{} +\pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf@circ@res@count}{} +\pgfcircdeclareeurologicport{xor}{$=1$}{\pgf@circ@res@count}{} +\pgfcircdeclareeurologicport{not}{$1$}{1}{not} +\pgfcircdeclareeurologicport{buffer}{$1$}{1}{} +\pgfcircdeclareeurologicport{nand}{\&}{\pgf@circ@res@count}{not} +\pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf@circ@res@count}{not} +\pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not} + +%% end european logic ports +% %>>> + +%% IEEE standard logic ports module%<<< + +%% +%% Original multi-input code from John Kormylo at tex.stackexchange.com +%% Help by TheTeXnician <38565529+TheTeXnician@users.noreply.github.com> +%% Suggested idea and example code by Jason Sachs +%% Please see https://github.com/circuitikz/circuitikz/issues/383 for a lot of details +%% Most of the code, all errors and bugs by Romano Giannetti +%% Everything is in the same place here --- more or less; first step to move towards +%% a module interface for circutikz +%% + +% base settings for ieeestd ports. + +\ctikzset{ieeestd ports/.is family} +% baselen is relative to pgfcirc@Rlen as ever; scaled if the class says so. +% the value of 0.4 is the standard pin distance for a port with height=num pins +% and matches the chip distance +\ctikzset{ieeestd ports/baselen/.initial=0.4} +% these are in term of baselen; width depends on height (fixed proportions) +\ctikzset{ieeestd ports/height/.initial=2} +\ctikzset{ieeestd ports/pin length/.initial=0.7} +% the standard "not" circle should be 1/6.5 of height (diameter); +% so radius/baselen=1/3.25/2 --- using 0.1 and no scaling is as a pole +\ctikzset{ieeestd ports/not radius/.initial=0.154} +\ctikzset{ieeestd ports/not radius fill/.initial=1}% change ony if you know why +% the suggested xnor distance is is 1.24, so 1.25/3.25/2 +% xor/xnor leads go full in in IEEE; let this be optional +\ctikzset{ieeestd ports/xor bar distance/.initial=0.192}% +\ctikzset{ieeestd ports/xor leads in/.initial=1}% +% +% base size of a small external schmitt symbol +% +\ctikzset{ieeestd ports/schmitt symbol size/.initial=0.3}% +% +% input management +% we are using the same /tikz/number inputs than the legacy ports +% +\tikzset{/tikz/inner inputs/.initial=0} % using 0 means that all inputs are inner +% +% integrate with the other logic ports +% +% +\newif\ifpgf@circuit@ieeelogicport\pgf@circuit@ieeelogicportfalse +\ctikzset{logic ports/ieee/.code= {% + \pgf@circuit@ieeelogicporttrue + \pgf@circuit@europeanlogicportfalse + \tikzset{and port/.style={shape=ieeestd and port}}% + \tikzset{or port/.style={shape=ieeestd or port}}% + \tikzset{xor port/.style={shape=ieeestd xor port}}% + \tikzset{buffer port/.style={shape=ieeestd buffer port}}% + \tikzset{not port/.style={shape=ieeestd not port}}% + \tikzset{nand port/.style={shape=ieeestd nand port}}% + \tikzset{nor port/.style={shape=ieeestd nor port}}% + \tikzset{xnor port/.style={shape=ieeestd xnor port}}% + \tikzset{schmitt port/.style={shape=ieeestd schmitt port}}% + \tikzset{invschmitt port/.style={shape=ieeestd invschmitt port}}% +}} +% add code to be compatible with the other ports +\ctikzset{logic ports/european/.add code={\pgf@circuit@ieeelogicportfalse}} +\ctikzset{logic ports/american/.add code={\pgf@circuit@ieeelogicportfalse}} +\tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}} +% +% the base angle for the or port. See the drawings. This will not change with height +% +\pgfmathsetmacro{\pgf@circ@orangle}{atan(3.25/6.5)} +% \typeout{ANGLE-IS\space\pgf@circ@orangle} +\def\pgf@circ@ieeeport@input#1% #1 = \pgfmathcounter +{% + \ifnum#1>\inputs + \PackageError{circuitikz}{% + You requested input pin #1 for logic port shape \thisshape\space \MessageBreak + which has been defined with \inputs\space pins% + }{Please check the manual about logic ports; if you press return I'll try to continue} + \fi + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgf@circ@res@step=\pind + \pgf@y=\pgf@circ@res@up\advance\pgf@y by -#1\pgf@circ@res@step\relax + \pgf@x=\pgf@circ@res@left\advance\pgf@x by -\pinlen +}% + +% #1 = \pgfmathcounter #2=type +% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor +\def\pgf@circ@ieeeport@baseinput#1#2% +{% + \ifnum#1>\inputs + \PackageError{circuitikz}{% + You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak + which has been defined with \inputs\space pins% + }{Please check the manual about logic ports; if you press return I'll try to continue} + \fi + % Find the vertical position (this is the same for any port) + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port + \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax + % rack (extended) pins; they are the same for all the ports + % call K = (inputs-inner)/2, rounded up; pins on the rack are: + % above: 1..K (included) + % below: inputs-K..inputs + % Find the pins on the rack; they are 1... + \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! + \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1 + % border anchors for rack should be ok + \pgfextractx{\pgf@circ@res@left}{\topleft} + \pgfextractx{\pgf@circ@res@right}{\bodyleft} + \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left + % we have finished if we are in the rack + \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b + % we are on the inner ports; we have to do the hard work here + % and and nand + \ifnum #2=1 + \relax % It's an and/nand, all border ports are on the rack line + \fi + % or and nor + \ifnum #2=2 + \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} + \fi + % xor and xnor + \ifnum #2=3\relax + \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-\xorbar-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} + \fi + \fi\fi +}% +% inner base ports for xor types port +% #1 = \pgfmathcounter #2=type +% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor +\def\pgf@circ@ieeeport@innerbaseinput#1% +{% + \ifnum#1>\inputs + \PackageError{circuitikz}{% + You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak + which has been defined with \inputs\space pins% + }{Please check the manual about logic ports; if you press return I'll try to continue} + \fi + % Find the vertical position (this is the same for any port) + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port + \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax + % rack (extended) pins; they are the same for all the ports + % call K = (inputs-inner)/2, rounded up; pins on the rack are: + % above: 1..K (included) + % below: inputs-K..inputs + % Find the pins on the rack; they are 1... + \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! + \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1 + % border anchors for rack should be ok + \pgfextractx{\pgf@circ@res@left}{\topleft} + \pgfextractx{\pgf@circ@res@right}{\bodyleft} + \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left + % we have finished if we are in the rack + \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b + % we are on the inner ports; we have to do the hard work here + \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} + \fi\fi +}% + +%%% macro to find basic lenghts --- they leave it in \pgf@circ@res@temp +\def\pgf@circ@ieeestd@baselen{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*\pgf@circ@scaled@Rlen} +} +\def\pgf@circ@ieeestd@stdH{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@temp}{0.5*\ctikzvalof{ieeestd ports/baselen}* + \ctikzvalof{ieeestd ports/height}*\pgf@circ@scaled@Rlen} +} +\def\pgf@circ@ieeestd@pinlen{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}* + \ctikzvalof{ieeestd ports/pin length}*\pgf@circ@scaled@Rlen} +} +\def\pgf@circ@ieeestd@xorbar{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}* + \ctikzvalof{ieeestd ports/xor bar distance}*\pgf@circ@scaled@Rlen} +} +%% Not circle +\def\pgf@circ@notradius{ + \pgf@circ@ieeestd@stdH % got the standard length. Notice that his is 3.25H for IEEE + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/not radius}*\pgf@circ@res@temp} + % \typeout{NOTRADIUS\space\the\pgf@circ@res@temp} +} +%% Find (in ...@other) the height of the rack +\def\pgf@circ@findrackH{% + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax% + \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax% + \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins + \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % + \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi% + \pgf@circ@ieeestd@stdH + \multiply\pgf@circ@res@temp by 2\relax% full height + \divide\pgf@circ@res@temp by \pgf@circ@count@b % the pin spacing + \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@count@a/2)*\pgf@circ@res@temp} %top of the rack/port + % \typeout{RACK-\thisshape\space\the\pgf@circ@res@other} +} +%% +\def\pgf@circ@find@ieeeport@up{% leave it in up + % Normal port limits + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@circ@res@up}{\pgf@circ@res@temp} + % rack top size + \pgf@circ@findrackH + \ifdim\pgf@circ@res@other > \pgf@circ@res@up + \pgf@circ@res@up=\pgf@circ@res@other + \else + \fi +} +\def\pgf@circ@find@ieeeport@left#1{% leave it in left; #1 is type + % Normal port limits + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@circ@res@left}{8*\pgf@circ@res@temp/6.5} + \pgf@circ@res@right=\pgf@circ@res@left % save the border value + \pgf@circ@res@step=\pgf@circ@res@temp % save the stdH value + \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@left by \pgf@circ@res@temp + % \typeout{LEFT1-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + % this is the normal left border + % For the or or xor port, the limit can be the pointy thing (in case the + % pinlen is zero or too small) + % add to the body margin the or/nor peak: + \ifnum #1 > 1\relax% "or", "nor", "xor", "xnor" gates. + \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@step*(1-cos(\pgf@circ@orangle))} + \advance\pgf@circ@res@right by \pgf@circ@res@other + % \typeout{LEFT2-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + \fi + % add to the body margin the xor/xnor distance + \ifnum #1 = 3\relax% "xor" or "xnor" gates. + \pgf@circ@ieeestd@xorbar + \advance\pgf@circ@res@right by \pgf@circ@res@temp + % \typeout{LEFT3-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + \fi + % and if this exceeds the normal margin, this is it + % \typeout{LEFT4-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + \ifdim \pgf@circ@res@right > \pgf@circ@res@left + \pgf@circ@res@left=\pgf@circ@res@right + \fi + % \typeout{LEFT5-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + \pgf@circ@res@left=-\pgf@circ@res@left +} +\def\pgf@circ@find@ieeeport@right#1{% leave it in right; #1 is plain or negated + % Normal port limits + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@circ@res@right}{8*\pgf@circ@res@temp/6.5} + \pgf@circ@notradius + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp} + \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp + \ifdim\pgf@circ@res@other > \pgf@circ@res@right + \pgf@circ@res@right=\pgf@circ@res@other + \fi +} +\def\pgf@circ@find@ieeeport@not@right#1{% leave it in right; #1 is plain or negated + % Normal port limits + \pgf@circ@ieeestd@stdH + % notice 0.8660254 is cos(30) + \pgfmathsetlength{\pgf@circ@res@right}{0.8660254*\pgf@circ@res@temp} + \pgf@circ@notradius + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp} + \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp + \ifdim\pgf@circ@res@other > \pgf@circ@res@right + \pgf@circ@res@right=\pgf@circ@res@other + \fi +} + + +%%% ieeestd multi-input ports +%%% #1: name +%%% #2: type: 1 for and,nand; 2 for or,nor; 3 for xor,xnor +%%% #3: polarity: 0 for direct, 1 for inverted (not at the output) +%%% #4: drawing for the port +\long\def\pgfcircdeclareieeeport#1#2#3#4{% + \pgfdeclareshape{ieeestd #1 port}% + {% + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + \saveddimen{\baselen}{% + \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\stdH}{% This is HALF the height of the inner port + \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\notdiameter}{ + \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp + } + \saveddimen{\pind}{% pin distance; + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax% + \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax% + \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins + \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % + \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi% + \pgf@circ@ieeestd@stdH\pgf@x=2\pgf@circ@res@temp % full height + \divide\pgf@x by \pgf@circ@count@b + } + \saveddimen{\pinlen}{% + \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\xorbar}{% + \pgf@circ@ieeestd@xorbar\pgf@x=\pgf@circ@res@temp + } + % anchors for the body (no pins included here) + \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\topleft}{% + \pgf@circ@ieeestd@xorbar\pgf@circ@res@right=\pgf@circ@res@temp % save \xorbar + \pgf@circ@ieeestd@stdH + \pgf@circ@res@other=0pt\relax + \ifnum #2 = 2\relax% "or" or "nor" gates. + \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))} + \fi + \ifnum #2 = 3\relax% "xor" or "xnor" gates. + \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle)) + +\pgf@circ@res@right} + \fi + \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5-\pgf@circ@res@other} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5} + \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} + } + \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle + \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp + \pgf@circ@ieeestd@stdH + % #3 is =1 if the port is a negated output one + \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5+#3*2*\pgf@circ@res@other} + \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} + } + % geographical anchors --- must be rectangulars! + \savedanchor{\northwest}{% + \pgf@circ@find@ieeeport@up + \pgf@circ@find@ieeeport@left{#2} + % \typeout{ANCH5-\thisshape\space L\space\the\pgf@circ@res@left\space U\space\the\pgf@circ@res@up} + \pgf@x=\pgf@circ@res@left + \pgf@y=\pgf@circ@res@up + } + \savedanchor{\southwest}{% + \pgf@circ@find@ieeeport@up + \pgf@circ@find@ieeeport@left{#2} + \pgf@x=\pgf@circ@res@left + \pgf@y=-\pgf@circ@res@up + } + \savedanchor{\southeast}{% + \pgf@circ@find@ieeeport@up + \pgf@circ@find@ieeeport@right{#3} + \pgf@x=\pgf@circ@res@right + \pgf@y=-\pgf@circ@res@up + } + \savedanchor{\northeast}{% + \pgf@circ@find@ieeeport@up + \pgf@circ@find@ieeeport@right{#3} + \pgf@x=\pgf@circ@res@right + \pgf@y=\pgf@circ@res@up + } + \savedmacro\inputs{% get number of inputs + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax + \ifnum\pgf@circ@count@a=0\pgf@circ@count@a=2\fi % default + \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins + % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi + \def\inputs{\the\pgf@circ@count@a}% + }% + \savedmacro\inners{% get number of "inner" inputs (for racks) + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax + \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax + \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins + \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins + \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi + % \typeout{INNER is \the\pgf@circ@count@b}% + % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi + \def\inners{\the\pgf@circ@count@b}% + }% + \anchor{center}{\pgfpointorigin} + \anchor{text}{ + \ifpgf@circ@center@text + \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \else + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@circ@res@left}{-8*\pgf@circ@res@temp/6.5} % left border + \pgfpoint{\pgf@circ@res@left + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \fi + } + % create input anchors + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@ieeestd #1 port\endcsname{% + \pgf@circ@count@a=\inputs + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@circ@count@a% + \else% + %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@in \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@ieeeport@input{\pgfmathcounter}% defined above + }% + \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@bin \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@ieeeport@baseinput{\pgfmathcounter}{#2}% defined above + }% + \ifnum #2 = 3\relax % xor/xnor inner border pins + \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@ibin \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@ieeeport@innerbaseinput{\pgfmathcounter}% defined above + }% + \fi + %}{}% + \repeatpgfmathloop% + } + % output anchor + \anchor{out}{% + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball + \advance\pgf@circ@res@other by\pinlen + \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border + \ifdim \pgf@circ@res@temp > \pgf@circ@res@other + \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... + \fi + \pgf@x=\pgf@circ@res@other\pgf@y=0pt + } + \anchor{bout}{\bottomright\pgf@y=0pt} + + \anchor{body right}{\bodyright\pgf@y=0pt} + \anchor{right}{\bottomright\pgf@y=0pt} + \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body + \anchor{left}{% central edge of the component + \bodyleft\pgf@y=0pt + \ifnum #2=3\relax + \advance\pgf@x by -\xorbar + \fi + } + \anchor{up}{% + \bodyleft + \ifnum #2 > 1 % pointy shapes + \pgf@circ@ieeestd@stdH + % horizontal coordinate where the right semicircle starts + \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)} + % vertical drop of the circle at the above coordinate + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))} + \advance \pgf@y by -\pgf@circ@res@step + \fi + \pgf@x=0pt + } + \anchor{down}{% + \bodyleft + \ifnum #2 > 1 % pointy shapes + \pgf@circ@ieeestd@stdH + % horizontal coordinate where the right semicircle starts + \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)} + % vertical drop of the circle at the above coordinate + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))} + \advance \pgf@y by -\pgf@circ@res@step + \fi + \pgf@y=-\pgf@y\pgf@x=0pt + } + + % geographical anchors + \anchor{nw}{\northwest} + \anchor{ne}{\northeast} + \anchor{se}{\southeast} + \anchor{sw}{\southwest} + \anchor{north west}{\northwest} + \anchor{north east}{\northeast} + \anchor{south east}{\southeast} + \anchor{south west}{\southwest} + % over 0,0 even if asymmetric + % will break if the geocoords are not rectangular + \anchor{n}{\northwest\pgf@x=0pt\relax} + \anchor{e}{\northeast\pgf@y=0pt\relax} + \anchor{s}{\southwest\pgf@x=0pt\relax} + \anchor{w}{\northwest\pgf@y=0pt\relax} + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{east}{\northeast\pgf@y=0pt\relax} + \anchor{south}{\southwest\pgf@x=0pt\relax} + \anchor{west}{\northwest\pgf@y=0pt\relax} + + \backgroundpath{ + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + #4 + \endpgfscope + % output lead: + \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball + \advance\pgf@circ@res@other by \pinlen\relax + \ifdim \pgf@circ@res@other > \pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + \fi + \ifnum #3=1\relax\pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}} + \endpgfscope\fi + } + } +} + +%%% #1 direct name #2 negated name #3 type #4 drawing (without output) +\long\def\pgfcircdeclareieeeportpair#1#2#3#4{% + \pgfcircdeclareieeeport{#1}{#3}{0}{#4}% direct + \pgfcircdeclareieeeport{#2}{#3}{1}{#4}% negated +} +% +% ieeestd "and" and "nand" +% +\pgfcircdeclareieeeportpair{and}{nand}{1}{% + \pgf@circ@count@a = \inputs\relax + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@down}{\bodyleft} + \ifpgfcirc@draw@input@leads + %input leads --- all the same for AND ports + \loop\ifnum\pgf@circ@count@a>0 + \advance\pgf@circ@res@temp by -\pind + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}% + \advance\pgf@circ@count@a by -1 + \repeat + \fi + \pgfusepath{draw} + %% Body. let's start from the top left + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}} + \pgfpathlineto{\pgfpoint{1.5*\stdH/6.5}{\stdH}} + \pgfpatharc{90}{-90}{\stdH} + \pgfpathlineto{\pgfpoint{-8*\stdH/6.5}{-\stdH}} + \pgfpathclose + \pgf@circ@draworfill + % rack now; skip if not needed. + % \typeout{WHAT\space \inputs\space \inners} + \ifnum\inputs>\inners + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + \fi + \endpgfscope +} +% +% or/nor and xor/xnor are practically the same. Let factor out everything +% the argument #1 is put just before the drawing of the inner pins +% the argument #2 is put after the drawing of the body +% +\long\def\pgf@circ@ieeeport@orxor#1#2{% + \pgf@circ@count@a = \inputs\relax + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@down}{\bodyleft} + % rack (extended) pins; they are the same for all the ports + % call K = (inputs-inner)/2, rounded up; pins on the rack are: + % above: 1..K (included) + % below: inputs-K..inputs + % Find the pins on the rack; they are 1... + \pgf@circ@count@b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! + \pgf@circ@count@c=\numexpr \inputs - \pgf@circ@count@b +1 \relax % =inputs - K +1 + \ifpgfcirc@draw@input@leads + %input leads --- for or ports + \loop\ifnum\pgf@circ@count@a>0 + \pgfextractx{\pgf@circ@res@right}{\topleft} + \advance\pgf@circ@res@temp by -\pind + % this is the height; let's find the "right" position + \ifnum \pgf@circ@count@a > \pgf@circ@count@b \ifnum \pgf@circ@count@a < \pgf@circ@count@c + % inner pins + % \typeout{INNER\space\pgf@circ@count@a} + \pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@left-2*\stdH*(1-cos(atan(\pgf@circ@res@temp/(2*\stdH))))} + % hook for xor/xnor + #1 + \fi\fi + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}% + \pgfusepath{draw} + \advance\pgf@circ@count@a by -1 + \repeat + \fi + %% Body. let's start from the top left + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + % it should start here, but with this trick the close comes out better. + % \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} + \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}} + \pgfpathlineto{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{\stdH}} % + \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5}{0pt}} + \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{-\stdH}} + \pgfpathlineto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}} + %% this should be 2 and 2; but the round part is not a perfect circle that way + %% so the 2.15 is ajusted "by taste" to touch the anchors exactly. + \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} + \pgfpathclose + \pgf@circ@draworfill + % hook for xor/xnor + #2 + % rack now; skip if not needed. + % \typeout{WHAT\space \inputs\space \inners} + \ifnum\inputs>\inners + \pgfextractx{\pgf@circ@res@left}{\topleft} + \pgfextracty{\pgf@circ@res@down}{\topleft} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + \fi + \endpgfscope +} +% +% ieeestd "or" and "nor" +% +\pgfcircdeclareieeeportpair{or}{nor}{2}{% + \pgf@circ@ieeeport@orxor{}{} +} +\pgfcircdeclareieeeportpair{xor}{xnor}{3}{% + \pgf@circ@ieeeport@orxor{ + \edef\@@tmp{\ctikzvalof{ieeestd ports/xor leads in}} + \ifnum\@@tmp=0\relax + % move pin start to the left to leave the xor gap free (not standard) + \advance\pgf@circ@res@right by -\xorbar + \fi + }{% + % add the xor/xnor bar + \pgfpathmoveto{\pgfpoint{-\xorbar-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}} + % see the comment on the main body about the 2.2 + \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-\xorbar -8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} + \pgfusepath{draw} + } +} +% +% Buffer and inverters +% +% #1: name +% #2: polarity +% #3: content +\long\def\pgfcircdeclareieeebufferport#1#2#3{% + \pgfdeclareshape{ieeestd #1 port}% + {% + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + \saveddimen{\baselen}{% + \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\stdH}{% This is HALF the height of the inner port + \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\notdiameter}{ + \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp + } + \saveddimen{\pinlen}{% + \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp + } + % anchors for the body (no pins included here) + % Notice that 0.8660254 is cos(30) + \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\topleft}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle + \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp + \pgf@circ@ieeestd@stdH + % #2 is =1 if the port is a negated output one + \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp+#2*2*\pgf@circ@res@other} + \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} + } + % geographical anchors --- must be rectangulars! + \savedanchor{\northwest}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\southwest}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} + } + \savedanchor{\southeast}{% + \pgf@circ@ieeestd@stdH + \pgf@circ@res@up=\pgf@circ@res@temp + \pgf@circ@find@ieeeport@not@right{#2} + \pgf@x=\pgf@circ@res@right + \pgf@y=-\pgf@circ@res@up + } + \savedanchor{\northeast}{% + \pgf@circ@ieeestd@stdH + \pgf@circ@res@up=\pgf@circ@res@temp + \pgf@circ@find@ieeeport@not@right{#2} + \pgf@x=\pgf@circ@res@right + \pgf@y=\pgf@circ@res@up + } + \anchor{center}{\pgfpointorigin} + \anchor{text}{ + \ifpgf@circ@center@text + \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \else + \pgf@circ@ieeestd@stdH + \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \fi + } + % input anchors + \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} + \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} + \anchor{bin}{\bodyleft\pgf@y=0pt\relax} + \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax} + % output anchors + \anchor{out}{% + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball + \advance\pgf@circ@res@other by\pinlen + \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border + \ifdim \pgf@circ@res@temp > \pgf@circ@res@other + \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... + \fi + \pgf@x=\pgf@circ@res@other\pgf@y=0pt + } + \anchor{bout}{\bottomright\pgf@y=0pt} + + \anchor{body right}{\bodyright\pgf@y=0pt} + \anchor{right}{\bottomright\pgf@y=0pt} + \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body + \anchor{left}{\bodyleft\pgf@y=0pt} + \anchor{up}{% + \bodyleft + \pgf@y=+0.5\pgf@y\pgf@x=0pt + } + \anchor{down}{% + \bodyleft + \pgf@y=-0.5\pgf@y\pgf@x=0pt + } + % this is for when it's used as a bipole + % we use the enclosing rectangle (see below) + \anchorborder{% + %% This (commented out) is the correct border anchor. But if we use the correct + %% border anchor there is no horizontal space for the label ;-) because + %% the triangle is too steep. So we will use a simple square border + %% + %% find the border anchor of a triangle (like a not port or an + %% amplifier) --- + %% + %% -----^ up + %% I --- | + %% I -|-- + %%left I | --- right + %% ----I-----|-------I----- + %% + %% + %\pgf@xa=\pgf@x + %% it's simmetrical w/ vertical side, use only positive y + %\pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)} + %\pgfmathsetlength{\pgf@ya}{abs(\pgf@y)} + %\pgfextracty{\pgf@circ@res@up}{\bodyleft} + %\pgfextractx{\pgf@circ@res@left}{\bodyleft} + %\pgfextractx{\pgf@circ@res@right}{\bodyright} + %% limit angle for the left (vertical) side + %\pgfmathsetmacro{\@@phimax}{atan2(\pgf@circ@res@up,\pgf@circ@res@left)} + %\pgfmathsetmacro{\@@phi}{atan2(\pgf@ya,\pgf@xa)} + %\pgfmathsetmacro{\@@leftside}{ifthenelse(\@@phi>\@@phimax,1,0)} + %% find the border + %\ifnum\@@leftside>0 + % % vertical side + % \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + % {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + %\else + % % triangle upper line + % \pgfpointintersectionoflines + % {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}} + % {\pgfqpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@right}{0pt}} + %\fi + %% readjust y sign + %\pgf@y=\@@switchy\pgf@y + % + % this is the square border to position the path label with a bit of horizontal space + % + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + } + % geographical anchors + \anchor{nw}{\northwest} + \anchor{ne}{\northeast} + \anchor{se}{\southeast} + \anchor{sw}{\southwest} + \anchor{north west}{\northwest} + \anchor{north east}{\northeast} + \anchor{south east}{\southeast} + \anchor{south west}{\southwest} + % over 0,0 even if asymmetric + % will break if the geocoords are not rectangular + \anchor{n}{\northwest\pgf@x=0pt\relax} + \anchor{e}{\northeast\pgf@y=0pt\relax} + \anchor{s}{\southwest\pgf@x=0pt\relax} + \anchor{w}{\northwest\pgf@y=0pt\relax} + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{east}{\northeast\pgf@y=0pt\relax} + \anchor{south}{\southwest\pgf@x=0pt\relax} + \anchor{west}{\northwest\pgf@y=0pt\relax} + + \backgroundpath{ + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + #3 + \endpgfscope + % output lead: + \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball + \advance\pgf@circ@res@other by \pinlen\relax + \ifdim \pgf@circ@res@other > \pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + \fi + \ifnum #2=1\relax\pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}} + \endpgfscope\fi + } + } +} + +%%% #1 direct name #2 negated name #3 drawing (without output) +\long\def\pgfcircdeclareieeebufferportpair#1#2#3{% + \pgfcircdeclareieeebufferport{#1}{0}{#3}% direct + \pgfcircdeclareieeebufferport{#2}{1}{#3}% negated +} + +\pgfcircdeclareieeebufferportpair{buffer}{not}{% + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@right}{\bodyright} + % \draw input pin + \ifpgfcirc@draw@input@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} + \pgfusepath{draw} + \fi + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope +} + +\pgfcircdeclareieeebufferportpair{schmitt}{invschmitt}{% + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@right}{\bodyright} + % \draw input pin + \ifpgfcirc@draw@input@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} + \pgfusepath{draw} + \fi + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + % draw schmitt symbol in normal line thickness + \pgfpathmoveto{\pgfpoint{0.75*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.00*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0.25*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.25*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} + \pgfusepath{draw} +} + + +\pgfdeclareshape{schmitt symbol}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@circ@ieeestd@stdH + \pgf@y=\ctikzvalof{ieeestd ports/schmitt symbol size}\pgf@circ@res@temp + \pgf@x=-1.5\pgf@y + } + \anchor{center}{\pgf@y=0pt \pgf@x=0pt} + \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x} + \anchor{west}{\northwest\pgf@y=0pt} + \anchor{w}{\northwest \pgf@y=0pt} + \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{north}{\northwest\pgf@x=0pt} + \anchor{n}{\northwest\pgf@x=0pt} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{north west}{\northwest} + \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \backgroundpath{ + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgf@circ@res@left=0.7\pgf@circ@res@left + \pgf@circ@res@up=0.7\pgf@circ@res@up + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left/3}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left/3}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + } +} + +\pgfdeclareshape{notcirc}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@circ@notradius + \pgf@y=\pgf@circ@res@temp + \pgf@x=-\pgf@y + } + \anchor{center}{\pgf@y=0pt \pgf@x=0pt} + \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x} + \anchor{left}{\northwest\pgf@y=0pt} + \anchor{west}{\northwest\pgf@y=0pt} + \anchor{w}{\northwest \pgf@y=0pt} + \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{north}{\northwest\pgf@x=0pt} + \anchor{n}{\northwest\pgf@x=0pt} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{north west}{\northwest} + \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \northwest\pgf@circ@res@temp=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}% + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + } + \behindforegroundpath{ + \pgfscope + \northwest\pgf@circ@res@temp=\pgf@y + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@temp} + \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white + \pgfsetfillcolor{white} + % ...but override it if the class is defined! + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \fi + \pgfsetfillopacity{\ctikzvalof{ieeestd ports/not radius fill}}% normally 1.0 + \pgfusepath{draw,fill} + \endpgfscope + } +} + +%%%% Transmission gates +% tgates are only ieee style for now +\tikzset{% + tgate/.style ={shape=ieee tgate}, + double tgate/.style ={shape=ieee double tgate}, +} +\ctikzset{tgate scale/.initial=0.7} +% Buffer and inverters +% +% #1: name +% #2: 1: one-not, 2:double-not +% #3: content +\long\def\pgfcircdeclareieeetgate#1#2#3{% + \pgfdeclareshape{ieee #1}% + {% + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + \saveddimen{\baselen}{% + \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\stdH}{% This is HALF the height of the inner port + \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\notdiameter}{ + \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp + } + \saveddimen{\notradius}{ + \pgf@circ@notradius\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\pinlen}{% + \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp + } + % anchors for the body (no pins included here) + % Notice that 0.8660254 is cos(30) + \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\topleft}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\bodyright}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\bottomright}{% Here it is the same as \bodyright + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + % geographical anchors --- must be rectangulars! + \savedanchor{\northwest}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\southwest}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\southeast}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\northeast}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \anchor{center}{\pgfpointorigin} + \anchor{text}{ + \ifpgf@circ@center@text + \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \else + \pgf@circ@ieeestd@stdH + \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} \fi - \pgfusepath{draw} - \fi - % - \ifpgfcirc@draw@output@leads - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{ \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}} - \pgfusepath{draw} - \fi - % - \edef\pgf@temp{not} - \edef\pgf@circ@temp{#4} - \ifx\pgf@temp\pgf@circ@temp % is a not - \ifpgf@circ@european@port@circle - \pgfscope - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \pgftransformxshift{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right} - % reset linewidth for IEEE ports, otherwise they will multiply... - \ifpgf@circ@european@port@circle@ieee\pgfsetlinewidth{\pgfstartlinewidth}\fi - \pgfnode{\ctikzvalof{tripoles/european not shape}}{west}{}{NOT}{\pgfusepath{stroke}} - \endpgfscope + } + % input anchors + \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} + \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} + \anchor{bin}{\bodyleft\pgf@y=0pt\relax} + \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax} + % gates + \anchor{gate}{\bodyleft\pgf@circ@res@up=\pgf@y + \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}} + \anchor{bgate}{\bodyleft\pgf@circ@res@up=\pgf@y + \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up}} + % gate (up) (2.1547 = 1+1/cos(30) + \anchor{notgate}{\bodyleft\pgf@circ@res@up=\pgf@y + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius} + \ifdim\pinlen>\pgf@circ@res@temp + \pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen} \else - \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}% - {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}} - \pgfusepath{draw} + \pgf@y=\pgf@circ@res@temp + \fi + } + \anchor{bnotgate}{\bodyleft\pgf@circ@res@up=\pgf@y + \pgf@x=0pt\pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+2.1547*\notradius}} + + % output anchors + \anchor{out}{% + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball + \advance\pgf@circ@res@other by\pinlen + \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border + \ifdim \pgf@circ@res@temp > \pgf@circ@res@other + \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... + \fi + \pgf@x=\pgf@circ@res@other\pgf@y=0pt + } + \anchor{bout}{\bottomright\pgf@y=0pt} + + \anchor{body right}{\bodyright\pgf@y=0pt} + \anchor{right}{\bottomright\pgf@y=0pt} + \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body + \anchor{left}{\bodyleft\pgf@y=0pt} + \anchor{up}{% + \bodyleft + \pgf@x=0pt + \ifnum#2=1\relax + \pgf@y=0pt + \else + \pgf@y=.5\pgf@y + \fi + \advance\pgf@y by \notdiameter + } + \anchor{down}{% + \bodyleft + \pgf@x=0pt + \ifnum#2=1\relax + \pgf@y=0pt + \else + \pgf@y=-.5\pgf@y + \fi + } + % this is for when it's used as a bipole + % we use the enclosing rectangle (see below) + \anchorborder{% + % + % this is the square border to position the path label with a bit of horizontal space + % + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + } + % geographical anchors + \anchor{nw}{\northwest} + \anchor{ne}{\northeast} + \anchor{se}{\southeast} + \anchor{sw}{\southwest} + \anchor{north west}{\northwest} + \anchor{north east}{\northeast} + \anchor{south east}{\southeast} + \anchor{south west}{\southwest} + % over 0,0 even if asymmetric + % will break if the geocoords are not rectangular + \anchor{n}{\northwest\pgf@x=0pt\relax} + \anchor{e}{\northeast\pgf@y=0pt\relax} + \anchor{s}{\southwest\pgf@x=0pt\relax} + \anchor{w}{\northwest\pgf@y=0pt\relax} + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{east}{\northeast\pgf@y=0pt\relax} + \anchor{south}{\southwest\pgf@x=0pt\relax} + \anchor{west}{\northwest\pgf@y=0pt\relax} + + \backgroundpath{ + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@right}{\bodyright} + % \draw input pins + \ifpgfcirc@draw@input@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} + % gate (down) + \pgfpathmoveto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}} + % gate (up) (2.1547 = 1+1/cos(30) + \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius} + \ifdim\pinlen>\pgf@circ@res@temp + \pgfpathmoveto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}} + \fi + \pgfusepath{draw} + \fi + #3 + \endpgfscope + % output lead: + \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball + \advance\pgf@circ@res@other by \pinlen\relax + \ifdim \pgf@circ@res@other > \pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi \fi - \fi - % - \pgfpathmoveto{\pgfpointorigin} - \pgftext{#2} } } } -\pgfcircdeclareeurologicport{and}{\&}{\pgf@circ@res@count}{} -\pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf@circ@res@count}{} -\pgfcircdeclareeurologicport{xor}{$=1$}{\pgf@circ@res@count}{} -\pgfcircdeclareeurologicport{not}{$1$}{1}{not} -\pgfcircdeclareeurologicport{buffer}{$1$}{1}{} -\pgfcircdeclareeurologicport{nand}{\&}{\pgf@circ@res@count}{not} -\pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf@circ@res@count}{not} -\pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not} -%% end european logic ports +\pgfcircdeclareieeetgate{tgate}{1}{% + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfscope + % 1.1547 is 1/cos(30) + \pgftransformshift{\pgfpoint{0pt}{1.1547*\notradius}} + \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}} + \endpgfscope +} + +\pgfcircdeclareieeetgate{double tgate}{2}{% + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + % bottom triangles + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfscope + % 1.1547 is 1/cos(30) + \pgftransformshift{\pgfpoint{0pt}{.5*\pgf@circ@res@up+1.1547*\notradius}} + \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}} + \endpgfscope +}% %>>> + +%% Path-style definitions for logical ports%<<< +% +% create path-style element for one input --- one output logical ports +% +\def\pgfcirc@port@node@to@path#1#2{% + % + % add a logic port path style component --- we need to suppress leads + % and use the correct center + % + \pgfcirc@node@to@path{#1}{#2}{/tikz/no leads, \circuitikzbasekey/logic ports origin=center}% +} +\pgfcirc@port@node@to@path{not port}{inline not} +\pgfcirc@port@node@to@path{buffer port}{inline buffer} +\pgfcirc@port@node@to@path{schmitt port}{inline schmitt} +\pgfcirc@port@node@to@path{invschmitt port}{inline invschmitt} + +\pgfcirc@port@node@to@path{tgate}{inline tgate} +\pgfcirc@port@node@to@path{double tgate}{inline double tgate} +% %>>> %%%%%%%%%%%%%%%%%%%%%%%% %% Transistors %%%%%%%%%%%%%%%%%%%%%%%% +% Settings for Transistors %<<<1 + +\newif\ifpgf@circuit@trans@depletiontype +\pgf@circuit@trans@depletiontypefalse + +\newif\ifpgf@circuit@mos@arrows +\ctikzset{tripoles/mos style/.is choice} +\ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}} +\ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}} +\pgfkeys{/tikz/arrowmos/.add code={}{\pgf@circuit@mos@arrowstrue}} +\pgfkeys{/tikz/noarrowmos/.add code={}{\pgf@circuit@mos@arrowsfalse}} + +% Fixed label positions +\newif\ifpgf@circuit@transisors@fixlabels +\pgf@circuit@transisors@fixlabelstrue +\pgfkeys{/tikz/center transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}} +\ctikzset{fix transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}} +\pgfkeys{/tikz/legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}} +\ctikzset{legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}} + +% Option solderdot for fet +\newif\ifpgf@circuit@fet@solderdot +\pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}} +\ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}} +\pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}} +\ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}} + +% Option bodydiode for fet +\newif\ifpgf@circuit@fet@bodydiode +\pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}} +\ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}} +\pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}} +\ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}} + +% Option draw fet without gate connection +\newif\ifpgf@circuit@bpt@drawgate +\pgf@circuit@bpt@drawgatetrue +\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}} +\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}} +\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}} +\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}} + +% Option draw bpt with schottky base +\newif\ifpgf@circuit@bpt@schottky +\pgf@circuit@bpt@schottkyfalse +\pgfkeys{/tikz/schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}} +\ctikzset{schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}} +\pgfkeys{/tikz/no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}} +\ctikzset{no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}} +\ctikzset{tripoles/schottky base size/.initial=0.05} + +% Option draw bpt without base connection +\newif\ifpgf@circuit@bpt@drawbase +\pgf@circuit@bpt@drawbasetrue +\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}} +\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}} +\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}} +\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}} + +% Option draw bpt with optical input +\newif\ifpgf@circuit@bpt@drawphoto +\pgf@circuit@bpt@drawphotofalse +\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} +\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} +\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} +\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} + +% Option draw fet without bulk connection -- Added by Burak Kelleci +\newif\ifpgf@circuit@bpt@drawbulk +\pgfkeys{/tikz/bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}} +\ctikzset{bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}} +\pgfkeys{/tikz/nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}} +\ctikzset{nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}} + +% Option draw pmos with empty circle +\newif\ifpgf@circuit@pmos@emptycircle +\pgf@circuit@pmos@emptycirclefalse +\ctikzset{tripoles/pmos style/.is choice} +\pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} +\ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} +% Option draw pmos with no circle +\newif\ifpgf@circuit@pmos@nocircle +\pgf@circuit@pmos@nocirclefalse +\pgfkeys{/tikz/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}} +\ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}} +% back to normal +\pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} +\ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} +% arrows at the end, the correct way +\newif\ifpgf@circuit@trans@arrowatend +\pgf@circuit@trans@arrowatendfalse +\ctikzset{transistors/arrow pos/.is choice} +\ctikzset{transistors/arrow pos/legacy/.code={\pgf@circuit@trans@arrowatendfalse}} +\ctikzset{transistors/arrow pos/end/.code={\pgf@circuit@trans@arrowatendtrue}} + +\newif\ifpgf@circuit@trans@ntype +\pgf@circuit@trans@ntypetrue %default true +%\newif\ifpgf@circuit@trans@ptype +%\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@ntypetrue}} +\ctikzset{tripoles/nmos/width/.initial=.7} +\ctikzset{tripoles/nmos/gate height/.initial=.35} +\ctikzset{tripoles/nmos/base height/.initial=.5} +\ctikzset{tripoles/nmos/conn height/.initial=0} +\ctikzset{tripoles/nmos/height/.initial=1.1} +\ctikzset{tripoles/nmos/base width/.initial=.5} +\ctikzset{tripoles/nmos/gate width/.initial=.62} +\ctikzset{tripoles/nmos/arrow pos/.initial=.6} +\ctikzset{tripoles/nmos/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nmos/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nmos/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nmos/curr direction/.initial=1} + +\ctikzset{tripoles/pmos/width/.initial=.7} +\ctikzset{tripoles/pmos/gate height/.initial=.35} +\ctikzset{tripoles/pmos/base height/.initial=.5} +\ctikzset{tripoles/pmos/conn height/.initial=0} +\ctikzset{tripoles/pmos/height/.initial=1.1} +\ctikzset{tripoles/pmos/base width/.initial=.5} +\ctikzset{tripoles/pmos/gate width/.initial=.62} +\ctikzset{tripoles/pmos/arrow pos/.initial=.4} +\ctikzset{tripoles/pmos/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pmos/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pmos/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pmos/curr direction/.initial=-1} + +\ctikzset{tripoles/nmosd/width/.initial=.7} +\ctikzset{tripoles/nmosd/gate height/.initial=.35} +\ctikzset{tripoles/nmosd/base height/.initial=.5} +\ctikzset{tripoles/nmosd/conn height/.initial=0} +\ctikzset{tripoles/nmosd/height/.initial=1.1} +\ctikzset{tripoles/nmosd/base width/.initial=.5} +\ctikzset{tripoles/nmosd/gate width/.initial=.62} +\ctikzset{tripoles/nmosd/arrow pos/.initial=.6} +\ctikzset{tripoles/nmosd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nmosd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nmosd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nmosd/curr direction/.initial=1} +\ctikzset{tripoles/nmosd/depletion width/.initial=.1} +\ctikzset{tripoles/nmosd/depletion color/.initial=default} + +\ctikzset{tripoles/pmosd/width/.initial=.7} +\ctikzset{tripoles/pmosd/gate height/.initial=.35} +\ctikzset{tripoles/pmosd/base height/.initial=.5} +\ctikzset{tripoles/pmosd/conn height/.initial=0} +\ctikzset{tripoles/pmosd/height/.initial=1.1} +\ctikzset{tripoles/pmosd/base width/.initial=.5} +\ctikzset{tripoles/pmosd/gate width/.initial=.62} +\ctikzset{tripoles/pmosd/arrow pos/.initial=.4} +\ctikzset{tripoles/pmosd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pmosd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pmosd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pmosd/curr direction/.initial=-1} +\ctikzset{tripoles/pmosd/depletion width/.initial=.1} +\ctikzset{tripoles/pmosd/depletion color/.initial=default} +\ctikzset{tripoles/hemt/width/.initial=.7} +\ctikzset{tripoles/hemt/gate height/.initial=.35} +\ctikzset{tripoles/hemt/base height/.initial=.5} +\ctikzset{tripoles/hemt/conn height/.initial=0} +\ctikzset{tripoles/hemt/height/.initial=1.1} +\ctikzset{tripoles/hemt/base width/.initial=.5} +\ctikzset{tripoles/hemt/gate width/.initial=.62} +\ctikzset{tripoles/hemt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/hemt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/hemt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/hemt/curr direction/.initial=1} + +\ctikzset{tripoles/nfet/width/.initial=.7} +\ctikzset{tripoles/nfet/gate height/.initial=.35} +\ctikzset{tripoles/nfet/base height/.initial=.5} +\ctikzset{tripoles/nfet/conn height/.initial=0} +\ctikzset{tripoles/nfet/height/.initial=1.1} +\ctikzset{tripoles/nfet/base width/.initial=.5} +\ctikzset{tripoles/nfet/gate width/.initial=.62} +\ctikzset{tripoles/nfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nfet/curr direction/.initial=1} + +\ctikzset{tripoles/pfet/width/.initial=.7} +\ctikzset{tripoles/pfet/gate height/.initial=.35} +\ctikzset{tripoles/pfet/base height/.initial=.5} +\ctikzset{tripoles/pfet/conn height/.initial=0} +\ctikzset{tripoles/pfet/height/.initial=1.1} +\ctikzset{tripoles/pfet/base width/.initial=.5} +\ctikzset{tripoles/pfet/gate width/.initial=.62} +\ctikzset{tripoles/pfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pfet/curr direction/.initial=-1} + +\ctikzset{tripoles/nfetd/width/.initial=.7} +\ctikzset{tripoles/nfetd/gate height/.initial=.35} +\ctikzset{tripoles/nfetd/base height/.initial=.5} +\ctikzset{tripoles/nfetd/conn height/.initial=0} +\ctikzset{tripoles/nfetd/height/.initial=1.1} +\ctikzset{tripoles/nfetd/base width/.initial=.5} +\ctikzset{tripoles/nfetd/gate width/.initial=.62} +\ctikzset{tripoles/nfetd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nfetd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nfetd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nfetd/curr direction/.initial=1} + +\ctikzset{tripoles/pfetd/width/.initial=.7} +\ctikzset{tripoles/pfetd/gate height/.initial=.35} +\ctikzset{tripoles/pfetd/base height/.initial=.5} +\ctikzset{tripoles/pfetd/conn height/.initial=0} +\ctikzset{tripoles/pfetd/height/.initial=1.1} +\ctikzset{tripoles/pfetd/base width/.initial=.5} +\ctikzset{tripoles/pfetd/gate width/.initial=.62} +\ctikzset{tripoles/pfetd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pfetd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pfetd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pfetd/curr direction/.initial=-1} + +\ctikzset{tripoles/nigfete/width/.initial=.7} +\ctikzset{tripoles/nigfete/gate height/.initial=.35} +\ctikzset{tripoles/nigfete/base height/.initial=.5} +\ctikzset{tripoles/nigfete/conn height/.initial=.35} +\ctikzset{tripoles/nigfete/height/.initial=1.1} +\ctikzset{tripoles/nigfete/base width/.initial=.5} +\ctikzset{tripoles/nigfete/gate width/.initial=.62} +\ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nigfete/curr direction/.initial=1} + +\ctikzset{tripoles/nigfetd/width/.initial=.7} +\ctikzset{tripoles/nigfetd/gate height/.initial=.35} +\ctikzset{tripoles/nigfetd/base height/.initial=.5} +\ctikzset{tripoles/nigfetd/conn height/.initial=.35} +\ctikzset{tripoles/nigfetd/height/.initial=1.1} +\ctikzset{tripoles/nigfetd/base width/.initial=.5} +\ctikzset{tripoles/nigfetd/gate width/.initial=.62} +\ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nigfetd/curr direction/.initial=1} + +\ctikzset{tripoles/nigfetebulk/width/.initial=.7} +\ctikzset{tripoles/nigfetebulk/gate height/.initial=.35} +\ctikzset{tripoles/nigfetebulk/base height/.initial=.5} +\ctikzset{tripoles/nigfetebulk/conn height/.initial=.35} +\ctikzset{tripoles/nigfetebulk/height/.initial=1.1} +\ctikzset{tripoles/nigfetebulk/base width/.initial=.5} +\ctikzset{tripoles/nigfetebulk/gate width/.initial=.62} +\ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nigfetebulk/curr direction/.initial=1} + +\ctikzset{tripoles/pigfete/width/.initial=.7} +\ctikzset{tripoles/pigfete/gate height/.initial=.35} +\ctikzset{tripoles/pigfete/base height/.initial=.5} +\ctikzset{tripoles/pigfete/conn height/.initial=.35} +\ctikzset{tripoles/pigfete/height/.initial=1.1} +\ctikzset{tripoles/pigfete/base width/.initial=.5} +\ctikzset{tripoles/pigfete/gate width/.initial=.62} +\ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pigfete/curr direction/.initial=-1} + +\ctikzset{tripoles/pigfetd/width/.initial=.7} +\ctikzset{tripoles/pigfetd/gate height/.initial=.35} +\ctikzset{tripoles/pigfetd/base height/.initial=.5} +\ctikzset{tripoles/pigfetd/conn height/.initial=.35} +\ctikzset{tripoles/pigfetd/height/.initial=1.1} +\ctikzset{tripoles/pigfetd/base width/.initial=.5} +\ctikzset{tripoles/pigfetd/gate width/.initial=.62} +\ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pigfetd/curr direction/.initial=-1} + +\ctikzset{tripoles/pigfetebulk/width/.initial=.7} +\ctikzset{tripoles/pigfetebulk/gate height/.initial=.35} +\ctikzset{tripoles/pigfetebulk/conn height/.initial=.35} +\ctikzset{tripoles/pigfetebulk/base height/.initial=.5} +\ctikzset{tripoles/pigfetebulk/height/.initial=1.1} +\ctikzset{tripoles/pigfetebulk/base width/.initial=.5} +\ctikzset{tripoles/pigfetebulk/gate width/.initial=.62} +\ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1} + +\ctikzset{tripoles/npn/width/.initial=.6} +\ctikzset{tripoles/npn/base height/.initial=.45} +\ctikzset{tripoles/npn/base height 2/.initial=.15} +\ctikzset{tripoles/npn/base height/.initial=.4} +\ctikzset{tripoles/npn/conn height/.initial=0} +\ctikzset{tripoles/npn/height/.initial=1.1} +\ctikzset{tripoles/npn/base width/.initial=.5} +\ctikzset{tripoles/npn/arrow pos/.initial=.5} +\ctikzset{tripoles/npn/bodydiode scale/.initial=.3} +\ctikzset{tripoles/npn/bodydiode distance/.initial=.3} +\ctikzset{tripoles/npn/bodydiode conn/.initial=.6} +\ctikzset{tripoles/npn/curr direction/.initial=1} + +\ctikzset{tripoles/pnp/width/.initial=.6} +\ctikzset{tripoles/pnp/base height/.initial=.45} +\ctikzset{tripoles/pnp/base height 2/.initial=.15} +\ctikzset{tripoles/pnp/base height/.initial=.4} +\ctikzset{tripoles/pnp/conn height/.initial=0} +\ctikzset{tripoles/pnp/height/.initial=1.1} +\ctikzset{tripoles/pnp/base width/.initial=.5} +\ctikzset{tripoles/pnp/arrow pos/.initial=.5} +\ctikzset{tripoles/pnp/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pnp/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pnp/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pnp/curr direction/.initial=-1} + +\ctikzset{tripoles/pigbt/width/.initial=.6} +\ctikzset{tripoles/pigbt/gate height/.initial=.45} +\ctikzset{tripoles/pigbt/gate height 2/.initial=.15} +\ctikzset{tripoles/pigbt/base height/.initial=.4} +\ctikzset{tripoles/pigbt/outer base height/.initial=.4} +\ctikzset{tripoles/pigbt/outer base thickness/.initial=1} +\ctikzset{tripoles/pigbt/conn height/.initial=0} +\ctikzset{tripoles/pigbt/height/.initial=1.1} +\ctikzset{tripoles/pigbt/gate width/.initial=.62} +\ctikzset{tripoles/pigbt/base width/.initial=.5} +\ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pigbt/curr direction/.initial=-1} + +\ctikzset{tripoles/nigbt/width/.initial=.6} +\ctikzset{tripoles/nigbt/gate height/.initial=.45} +\ctikzset{tripoles/nigbt/gate height 2/.initial=.15} +\ctikzset{tripoles/nigbt/base height/.initial=.4} +\ctikzset{tripoles/nigbt/outer base height/.initial=.4} +\ctikzset{tripoles/nigbt/outer base thickness/.initial=1} +\ctikzset{tripoles/nigbt/conn height/.initial=0} +\ctikzset{tripoles/nigbt/height/.initial=1.1} +\ctikzset{tripoles/nigbt/gate width/.initial=.62} +\ctikzset{tripoles/nigbt/base width/.initial=.5} +\ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nigbt/curr direction/.initial=1} + +\ctikzset{tripoles/Lpigbt/width/.initial=.6} +\ctikzset{tripoles/Lpigbt/gate height/.initial=.45} +\ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15} +\ctikzset{tripoles/Lpigbt/base height/.initial=.4} +\ctikzset{tripoles/Lpigbt/outer base height/.initial=.4} +\ctikzset{tripoles/Lpigbt/outer base thickness/.initial=1} +\ctikzset{tripoles/Lpigbt/conn height/.initial=.4} +\ctikzset{tripoles/Lpigbt/height/.initial=1.1} +\ctikzset{tripoles/Lpigbt/gate width/.initial=.62} +\ctikzset{tripoles/Lpigbt/base width/.initial=.5} +\ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/Lpigbt/curr direction/.initial=-1} + +\ctikzset{tripoles/Lnigbt/width/.initial=.6} +\ctikzset{tripoles/Lnigbt/gate height/.initial=.45} +\ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15} +\ctikzset{tripoles/Lnigbt/base height/.initial=.4} +\ctikzset{tripoles/Lnigbt/outer base height/.initial=.4} +\ctikzset{tripoles/Lnigbt/outer base thickness/.initial=1} +\ctikzset{tripoles/Lnigbt/conn height/.initial=.4} +\ctikzset{tripoles/Lnigbt/height/.initial=1.1} +\ctikzset{tripoles/Lnigbt/gate width/.initial=.62} +\ctikzset{tripoles/Lnigbt/base width/.initial=.5} +\ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/Lnigbt/curr direction/.initial=1} + +\ctikzset{tripoles/igbt/outer base height/.code={ + \ctikzset{tripoles/nigbt/outer base height/.initial=#1} + \ctikzset{tripoles/pigbt/outer base height/.initial=#1} + \ctikzset{tripoles/Lnigbt/outer base height/.initial=#1} + \ctikzset{tripoles/Lpigbt/outer base height/.initial=#1} + \ctikzset{tripoles/Lnigbt/conn height/.initial=#1} + \ctikzset{tripoles/Lpigbt/conn height/.initial=#1} +}} +\ctikzset{tripoles/igbt/outer base thickness/.code={ + \ctikzset{tripoles/nigbt/outer base thickness=#1} + \ctikzset{tripoles/pigbt/outer base thickness=#1} + \ctikzset{tripoles/Lnigbt/outer base thickness=#1} + \ctikzset{tripoles/Lpigbt/outer base thickness=#1} +}} + +\ctikzset{tripoles/njfet/width/.initial=.7} +\ctikzset{tripoles/njfet/gate height/.initial=.5} +\ctikzset{tripoles/njfet/gate height 2/.initial=.35} +\ctikzset{tripoles/njfet/gate width/.initial=.5} +\ctikzset{tripoles/njfet/conn height/.initial=.35} +\ctikzset{tripoles/njfet/height/.initial=1.1} +\ctikzset{tripoles/njfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/njfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/njfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/njfet/curr direction/.initial=1} + +\ctikzset{tripoles/pjfet/width/.initial=.7} +\ctikzset{tripoles/pjfet/gate height/.initial=.5} +\ctikzset{tripoles/pjfet/gate height 2/.initial=.35} +\ctikzset{tripoles/pjfet/gate width/.initial=.5} +\ctikzset{tripoles/pjfet/conn height/.initial=.35} +\ctikzset{tripoles/pjfet/height/.initial=1.1} +\ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pjfet/curr direction/.initial=-1} + +\ctikzset{tripoles/isfet/width/.initial=1} +\ctikzset{tripoles/isfet/gate height/.initial=.35} +\ctikzset{tripoles/isfet/base height/.initial=.5} +\ctikzset{tripoles/isfet/height/.initial=1.1} +\ctikzset{tripoles/isfet/base width/.initial=.3} +\ctikzset{tripoles/isfet/gate width/.initial=.5} +\ctikzset{tripoles/isfet/conn height/.initial=0} +\ctikzset{tripoles/isfet/wave width/.initial=.16} +\ctikzset{tripoles/isfet/wave amp/.initial=.06} +\ctikzset{tripoles/isfet/waves y sep/.initial=.22} +\ctikzset{tripoles/isfet/waves x sep/.initial=.8} +\ctikzset{tripoles/isfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/isfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/isfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/isfet/curr direction/.initial=1} +% +% multi-emitter and multi-collector BJTs by Romano Giannetti +% +\ctikzset{tripoles/bjt/emitters/.initial=1} +\ctikzset{tripoles/bjt/collectors/.initial=1} +\pgfkeys{/tikz/emitters/.add code={}{\ctikzset{tripoles/bjt/emitters=#1}}} +\pgfkeys{/tikz/collectors/.add code={}{\ctikzset{tripoles/bjt/collectors=#1}}} +\ctikzset{tripoles/bjt/pins width/.initial=0.3} +\pgfkeys{/tikz/bjt pins width/.add code={}{\ctikzset{tripoles/bjt/pins width=#1}}} +\ctikzset{tripoles/bjt/multi height/.initial=.5} +\pgfkeys{/tikz/bjt multi height/.add code={}{\ctikzset{tripoles/bjt/multi height/.initial=#1}}} +% +\ctikzset{tripoles/bjt/width/.initial=.3} +\ctikzset{tripoles/bjt/base height 2/.initial=.4} +\ctikzset{tripoles/bjt/base height/.initial=1.1} +\ctikzset{tripoles/bjt/height/.initial=.4} +\ctikzset{tripoles/bjt/base width/.initial=1} +\ctikzset{tripoles/bjt/arrow pos/.initial=.5} +% do NOT touch these two! +\ctikzset{tripoles/bjt/npn/curr direction/.initial=1} +\ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1} + + % % definitions for transistor circles % @@ -1587,6 +3293,9 @@ \newif\ifpgf@circ@trcircle\pgf@circ@trcirclefalse \ctikzset{tr circle/.is if=pgf@circ@trcircle} \tikzset{tr circle/.is if=pgf@circ@trcircle} +%%>>> + +%% definitions of transistor shapes%<<< % % add a circle to the transistor: % @@ -3565,63 +5274,161 @@ } % end of transistors +% %>>> + +%% Transistor's path definitions%<<< + +\pgf@circ@definetranspath{nmos} +\pgf@circ@definetranspath{pmos} +\pgf@circ@definetranspath{nmosd} +\pgf@circ@definetranspath{pmosd} +\pgf@circ@definetranspath{hemt} +\pgf@circ@definetranspath{npn} +\pgf@circ@definetranspath{pnp} +\pgf@circ@definetranspath{nfet} +\pgf@circ@definetranspath{nigfete} +\pgf@circ@definetranspath{nigfetd} +\pgf@circ@definetranspath{nigfetebulk} +\pgf@circ@definetranspath{pfet} +\pgf@circ@definetranspath{pigfete} +\pgf@circ@definetranspath{pigfetd} +\pgf@circ@definetranspath{pigfetebulk} +\pgf@circ@definetranspath{njfet} +\pgf@circ@definetranspath{pjfet} +\pgf@circ@definetranspath{pigbt} +\pgf@circ@definetranspath{nigbt} +\pgf@circ@definetranspath{Lpigbt} +\pgf@circ@definetranspath{Lnigbt}% %>>> -%%%%%%%%%%%%% -%% Switches -%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Amplifiers +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\pgfcircdeclarebipole{ - \anchor{out 1}{ - \northeast - \pgf@y=0cm - } - \anchor{out 2}{ - \northeast - \pgf@y=.8\pgf@y - } +% Settings for Amplifiers%<<<1 +% +% switches for op amps +% changing input polarity +% +\newif\ifpgf@circuit@oa@iplusup\pgf@circuit@oa@iplusupfalse +\pgfkeys{/tikz/noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}} +\ctikzset{noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}} +\pgfkeys{/tikz/noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}} +\ctikzset{noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}} +% +% changing output polarity (for fully diff objects) +% +\newif\ifpgf@circuit@oa@oplusup\pgf@circuit@oa@oplusuptrue +\pgfkeys{/tikz/noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} +\ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} +\pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} +\ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} + +% Operational amplifier +\ctikzset{tripoles/op amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/op amp/height/.initial=1.4} % Total height +\ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation +\ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position +\ctikzset{tripoles/op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +% Fully differential operational amplifier +\ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height +\ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation +\ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation +\ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position +\ctikzset{tripoles/fd op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +\ctikzset{tripoles/en amp/width/.initial=1.7} +\ctikzset{tripoles/en amp/port width/.initial=.7} +\ctikzset{tripoles/en amp/height/.initial=1.6} +\ctikzset{tripoles/en amp/input height/.initial=.3} +\ctikzset{tripoles/en amp/up pos/.initial=.45} +\ctikzset{tripoles/en amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! +\ctikzset{tripoles/en amp/font2/.initial=\pgf@circ@font@twelve} % Absolute font size needed! +\ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}} +\tikzset{ + en amp text/.code = {% + \ctikzsetvalof{tripoles/en amp/text}{#1}% + }, + en amp text A/.code = {% + \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}% + }, } -{\ctikzvalof{tripoles/toggleswitch/height 2}} -{toggleswitch} -{\ctikzvalof{tripoles/toggleswitch/height}} -{\ctikzvalof{tripoles/toggleswitch/width}} -{ - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} - \pgfusepath{draw} - \pgfscope - \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}} - \pgfusepath{draw} +% Transconductance amplifier +\ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid +\ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid +\ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation +\ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position +\ctikzset{tripoles/gm amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! - \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfusepath{draw} +% Instrumentation amplifier +\ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid +\ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid +\ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation +\ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position +\ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position +\ctikzset{tripoles/inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! - \pgfsetdash{{.08\pgf@circ@res@up}{.04\pgf@circ@res@up}{.7\pgf@circ@res@up}{.04\pgf@circ@res@up}{.8\pgf@circ@res@up}}{0cm} - \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0}{.8\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@left}{.6\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0}{.4\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0}{.2\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfsetdash{}{0cm} +% Instrumentation amplifier with differential output +\ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid +\ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid +\ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation +\ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation +\ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position +\ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position +\ctikzset{tripoles/fd inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +% Instrumentation amplifier with gain resistor terminals +\ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width +\ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid +\ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid +\ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation +\ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position +\ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position +\ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation +\ctikzset{tripoles/inst amp ra/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +% Plain amplifier +\ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height +\ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation +\ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position + +% changing fonts and symbols of amplifiers +\ctikzset{amplifiers/symbol font/.code={% + \ctikzset{tripoles/inst amp ra/font=#1}% + \ctikzset{tripoles/fd inst amp/font=#1}% + \ctikzset{tripoles/inst amp/font=#1}% + \ctikzset{tripoles/gm amp/font=#1}% + \ctikzset{tripoles/en amp/font=#1}% + \ctikzset{tripoles/fd op amp/font=#1}% + \ctikzset{tripoles/op amp/font=#1}% +}} +\ctikzset{amplifiers/plus/.initial={$+$}} +\ctikzset{amplifiers/minus/.initial={$-$}} +\tikzset{amp symbol font/.code={% + \ctikzset{amplifiers/symbol font={#1}}% + } } +\tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}} +\tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}} +\def\pgf@circ@ampli@plus{\ctikzvalof{amplifiers/plus}} +\def\pgf@circ@ampli@minus{\ctikzvalof{amplifiers/minus}} +%%>>> -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Nodes for amplifiers%<<< %% operational and instrumentation amplifiers -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \pgfdeclareshape{op amp} { @@ -5706,152 +7513,43 @@ \pgfusepath{draw} } -} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% electromechanical device (motor/generator) -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +}% %>>> -\pgfdeclareshape{elmech} -{ - \savedmacro{\ctikzclass}{\edef\ctikzclass{electromechanicals}} - \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} - \savedanchor\northwest{ - \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} - \pgf@y=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen - \pgf@y=.5\pgf@y - \pgf@x=-\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen - \pgf@x=.5\pgf@x - } - \anchor{center}{ - \pgfpointorigin - } - \anchor{text}{ - \pgfpointorigin - \advance \pgf@x by -.5\wd\pgfnodeparttextbox - \advance \pgf@y by -.5\ht\pgfnodeparttextbox - } - \anchor{left}{% - \northwest - \pgf@y=0pt - } - \anchor{right}{% - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x - } - \anchor{top}{ - \northwest - \pgf@x=0pt - } - \anchor{pathstart}{ - \northwest - \pgf@x=0pt - } - \anchor{pathend}{ - \northwest - \pgf@x=0pt - \pgf@y=-\pgf@y - } - \anchor{bottom}{ - \northwest - \pgf@x=0pt - \pgf@y=-\pgf@y - } - \anchor{center}{ - \pgf@y=0pt - \pgf@x=0pt - } - \anchor{east}{ - \northwest - \pgf@y=0pt - \pgf@x=-\pgf@x - } - \anchor{west}{ - \northwest - \pgf@y=0pt - } - \anchor{south}{ - \northwest - \pgf@x=0pt - \pgf@y=-\pgf@y - } - \anchor{north}{ - \northwest - \pgf@x=0pt - } - \anchor{south west}{ \northwest \pgf@y=-\pgf@y } - \anchor{north east}{ \northwest \pgf@x=-\pgf@x } - \anchor{north west}{ \northwest } - \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \anchorborder{% - \@tempdima=\pgf@x\@tempdimb=\pgf@y - \northwest\pgf@circ@res@other=-\pgf@x - \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}{\pgfqpoint{\pgf@circ@res@other}{\pgf@circ@res@other}} - } - \anchor{block north west}{\northwest\pgf@x=0.5\pgf@x} - \anchor{block south west}{\northwest\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y} - \anchor{block north east}{\northwest\pgf@x=-0.5\pgf@x} - \anchor{block south east}{\northwest\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y} - \anchor{block up right}{ - \northwest - % remember that pgf@x is negative - % center of the block is at 0.5*H+W*cos(30)/2 - \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax - \pgf@x=-0.5\pgf@x - } - \anchor{block up left}{ - \northwest - % remember that pgf@x is negative - % center of the block is at 0.5*H+W*cos(30)/2 - \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax - \pgf@x=0.5\pgf@x - } - \anchor{block down right}{ - \northwest - % remember that pgf@x is negative - % center of the block is at 0.5*H+W*cos(30)/2 - \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax - \pgf@y=-\pgf@y - \pgf@x=-0.5\pgf@x - } - \anchor{block down left}{ - \northwest - % remember that pgf@x is negative - % center of the block is at 0.5*H+W*cos(30)/2 - \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax - \pgf@y=-\pgf@y - \pgf@x=0.5\pgf@x - } - \behindbackgroundpath{ - \pgfsetcolor{\ctikzvalof{color}} - \pgf@circ@scaled@Rlen=\scaledRlen - \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen - \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen - \pgfscope - \pgfstartlinewidth=\pgflinewidth - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgfscope % clip the bar: whole size minus the circle - \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}} - \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} - \pgfseteorule - \pgfusepath{clip} - \pgfpathrectangle{\pgfpoint{-.25\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{\pgf@circ@res@up}} - \pgfsetfillcolor{\ctikzvalof{color}} - \pgfusepath{fill, draw} - \endpgfscope - \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} - \ifx\tikz@fillcolor\pgfutil@empty - % set the default fill color to white - \pgfsetfillcolor{white} - % ...but override it if the class is defined! - \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} - \else - \pgfsetfillcolor{\tikz@fillcolor} - \pgfusepath{draw, fill} - \fi - \endpgfscope - } -} +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Tubes and magnetron +%%%%%%%%%%%%%%%%%%%%%%%% + +% Settings Electronic tubes: diodetube, triode, tetrode and pentode%<<<1 +\ctikzset{tubes/width/.initial=1} % relative width +\ctikzset{tubes/height/.initial=1.4} % relative height +\ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle +\ctikzset{tubes/anode distance/.initial=0.40} % distance from center +\ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate +\ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center +\ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes +\ctikzset{tubes/grid separation/.initial=0.2} % separation between grids +\ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center +\ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid +\ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode +\ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire +\ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side +\ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode +\ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint + +\ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1} + +\newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse +\pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} +\ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} +\newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse +\pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} +\ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} +\newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse +\pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}} +\ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}% +%>>> + +%% Node shapes for tubes & co%<<< %%%%%%%%%%%%%%%%%%% %% Magnetron @@ -6427,6 +8125,7 @@ \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima-2*\ctikzvalof{tubes/grid separation}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right-0.4142136*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-0.4142136*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} -} +}% %>>> \endinput +% vim: set fdm=marker fmr=%<<<,%>>>: diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircutils.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircutils.tex index 58420725ad..9400b0c701 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircutils.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircutils.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircvoltage.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircvoltage.tex index d6c11db040..9a393d7d09 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircvoltage.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircvoltage.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -13,7 +13,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Voltage management -%% styles +%% styles%<<< \ctikzset{bipole voltage style/.style={}} \tikzset{bipole voltage style/.code={ \ctikzset{bipole voltage style/.style={#1}} @@ -23,37 +23,37 @@ }} \ctikzset{v^>/.style = { - v = #1, + v={#1}, \circuitikzbasekey/bipole/voltage/direction = forward, \circuitikzbasekey/bipole/voltage/position = above } } \ctikzset{v^/.style = { - v = #1, + v={#1}, \circuitikzbasekey/bipole/voltage/direction = forward, \circuitikzbasekey/bipole/voltage/position = below } } \ctikzset{v_/.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = forward} } -\ctikzset{v/.style = {v={#1}, \circuitikzbasekey/bipole/voltage/direction = forward} } +\ctikzset{v>> % american voltage font selection and symbol definition % the default font command is {} --- nothing @@ -123,7 +124,7 @@ \fi } -%% Output routine for generic bipoles +%% Output routine for generic bipoles%<<< % put this to true to see the voltage label coordinate anchors \newif\ifpgf@circ@debugv\pgf@circ@debugvfalse @@ -342,8 +343,9 @@ \fi \fi % Closing the ...ifempty } +% %>>> -%% Output routine for voltage sources +%% Output routine for voltage sources%<<< \def\pgf@circ@drawvoltagegenerator{ % the following is affected indirectly by voltage/shift, you can move the arrow with voltage/bump a. % it's not perfect, but I can't find the way to do it correctly... @@ -414,8 +416,9 @@ \fi \fi % closes ...ifempty } +% %>>> -%% Output routine +%% Output routine (main entry point) %<<< %% this is the entry point %% %% locally used dimensions @@ -626,4 +629,65 @@ \fi }%end drawvoltages + +% %>>> + +%% these should be arguably moved to every component definition... + +% special cases for voltage positions%<<<1 +% the KIND is the node name without SHAPE +% See the definition above for meaning +% if bipoles/KIND/voltage/straight label distance is not defined, it uses the height +% if bipoles/KIND/voltage/additional shift is not defined, it is 0 (extra distance) +% +\ctikzset{bipoles/generic/voltage/distance from node/.initial=0.4} +\ctikzset{bipoles/generic/voltage/bump b/.initial=2} +% +\ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4} +\ctikzset{bipoles/ageneric/voltage/bump b/.initial=2} +% +\ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4} +\ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2} +% +\ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4} +\ctikzset{bipoles/memristor/voltage/bump b/.initial=2} +% +\ctikzset{bipoles/tline/voltage/bump b/.initial=2.4} +% +\ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4} +\ctikzset{bipoles/varistor/voltage/american label distance/.initial=1.8} +% +\ctikzset{bipoles/photoresistor/voltage/bump b/.initial=1.6} +% +\ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4} +\ctikzset{bipoles/thermistor/voltage/european label distance/.initial=0.8} +\ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6} +\ctikzset{bipoles/thermistorntc/voltage/european label distance/.initial=0.8} +\ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6} +\ctikzset{bipoles/thermistorptc/voltage/european label distance/.initial=0.8} +% +\ctikzset{bipoles/ccapacitor/voltage/bump b/.initial=2.2} +% +\ctikzset{bipoles/emptyzzdiode/voltage/bump b/.initial=2.5} +\ctikzset{bipoles/emptyzzdiode/voltage/european label distance/.initial=1.0} +\ctikzset{bipoles/fullzzdiode/voltage/bump b/.initial=2.5} +\ctikzset{bipoles/fullzzdiode/voltage/european label distance/.initial=1.0} +\ctikzset{bipoles/emptythyristor/voltage/bump b/.initial=2.0} +\ctikzset{bipoles/emptythyristor/voltage/european label distance/.initial=1.2} +\ctikzset{bipoles/fullthyristor/voltage/bump b/.initial=2.0} +\ctikzset{bipoles/fullthyristor/voltage/european label distance/.initial=1.2} +\ctikzset{bipoles/emptytriac/voltage/bump b/.initial=1.8} +\ctikzset{bipoles/emptytriac/voltage/european label distance/.initial=0.8} +\ctikzset{bipoles/fulltriac/voltage/bump b/.initial=1.8} +\ctikzset{bipoles/fulltriac/voltage/european label distance/.initial=0.8} +% +\ctikzset{bipoles/short/voltage/american label distance/.initial=2.8} +\ctikzset{bipoles/open/voltage/distance from node/.initial=0.3} +% +\ctikzset{bipoles/battery/voltage/bump a/.initial=1.4} +\ctikzset{bipoles/vsourceAM/voltage/american label distance/.initial=1.2} +\ctikzset{bipoles/cvsourceAM/voltage/american label distance/.initial=1.2} +%%>>> + \endinput +% vim: set fdm=marker fmr=%<<<,%>>>: diff --git a/graphics/pgf/contrib/circuitikz/tex/t-circuitikz-1.2.7.tex b/graphics/pgf/contrib/circuitikz/tex/t-circuitikz-1.2.7.tex new file mode 100644 index 0000000000..3d251be436 --- /dev/null +++ b/graphics/pgf/contrib/circuitikz/tex/t-circuitikz-1.2.7.tex @@ -0,0 +1,24308 @@ +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +\def\pgfcircversion{1.2.7} +\def\pgfcircversiondate{2020/12/27} +\writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion} + +\usemodule[tikz] + +\startmodule[circuitikzgit-1.2.7] +\usetikzlibrary[calc] +\usetikzlibrary[arrows.meta, bending] +\usetikzlibrary[fpu] % may be needed for use fpu reciprocal (v1.0.1) + +\unprotect + +\edef\tikzatcode{\the\catcode`\@} +\edef\tikzbarcode{\the\catcode`\|} +\edef\tikzexclaimcode{\the\catcode`\!} +\catcode`\@=11 +\catcode`\|=12 +\catcode`\!=12 + +%%%%%%%%%%% Springe nach tex/pgfcirc.defines +%%%---------- open: tex/pgfcirc.defines.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. +% +% This file has folding marks for vim (See last line). +% +%% Key managements%<<<1 + +\long\def\pgf@circ@comment#1{} + +\def\circuitikzbasekey{/tikz/circuitikz} + +\pgfkeys{\circuitikzbasekey/.is family} + +\def\circuitikzset#1{\pgfkeys{\circuitikzbasekey,#1}} +\let\ctikzset\circuitikzset +\def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}} +\def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}} + +\pgfkeys{\circuitikzbasekey/.search also={/tikz}} +%%>>> + +%% Temporary Counters and dimensions%<<<1 +%% Temporary Counters +\newcount\pgf@circ@count@a +\newcount\pgf@circ@count@b +\newcount\pgf@circ@count@c +%%%%%%%%%%%% +%% Dimensions +% coordinate +\newdimen\pgf@circ@res@up +\newdimen\pgf@circ@res@down +\newdimen\pgf@circ@res@zero +\newdimen\pgf@circ@res@left +\newdimen\pgf@circ@res@right +\newdimen\pgf@circ@res@other +\newdimen\pgf@circ@res@step +\newdimen\pgf@circ@res@temp +% Base len for all circuitikz +\newdimen\pgf@circ@Rlen +% scaled length for internal use in scalable shapes +\newdimen\pgf@circ@scaled@Rlen +\ctikzset{bipoles/length/.code={\pgf@circ@Rlen = #1\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}} +\pgf@circ@Rlen = 1.4cm +% by default scale is 1.0 +\pgf@circ@scaled@Rlen=\pgf@circ@Rlen +% inital thickness +\newdimen \pgfstartlinewidth +%%>>> + +% arrow tips, ported over old arrows library (deprecated)%<<<1 +% see https://tex.stackexchange.com/questions/234084/latex-arrow-tip-with-arrows-meta-library +% this was the original definition of latex' tips, renamed to avoid clashes +% +\pgfarrowsdeclare{latexslim}{latexslim} +{ + \pgfutil@tempdima=0.28pt% + \advance\pgfutil@tempdima by.3\pgflinewidth% + \pgfarrowsleftextend{+-4\pgfutil@tempdima} + \pgfarrowsrightextend{+6\pgfutil@tempdima} +} +{ + \pgfutil@tempdima=0.28pt% + \advance\pgfutil@tempdima by.3\pgflinewidth% + \pgfpathmoveto{\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}} + \pgfpathcurveto + {\pgfqpoint{3.5\pgfutil@tempdima}{.5\pgfutil@tempdima}} + {\pgfqpoint{-1\pgfutil@tempdima}{1.5\pgfutil@tempdima}} + {\pgfqpoint{-4\pgfutil@tempdima}{3.75\pgfutil@tempdima}} + \pgfpathcurveto + {\pgfqpoint{-1.5\pgfutil@tempdima}{1\pgfutil@tempdima}} + {\pgfqpoint{-1.5\pgfutil@tempdima}{-1\pgfutil@tempdima}} + {\pgfqpoint{-4\pgfutil@tempdima}{-3.75\pgfutil@tempdima}} + \pgfpathcurveto + {\pgfqpoint{-1\pgfutil@tempdima}{-1.5\pgfutil@tempdima}} + {\pgfqpoint{3.5\pgfutil@tempdima}{-.5\pgfutil@tempdima}} + {\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}} + \pgfpathclose + \pgfusepathqfill +} + +\pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim} +%%>>> + +%% Macros to do things depending on the class%<<<1 + +\def\pgf@circ@setifdefinedfill#1#2{% + % if \ctikzclass is defined and \ctikzclass/fill is defined and is not none: + % set the fill color and execute \pgfusepath{#1}, else execute \pgfusepath{#2} + \ifdefined\ctikzclass + \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/fill}% + {% yes, it's defined + \edef\@@tmp{\ctikzvalof{\ctikzclass/fill}}\edef\@@none{none}% + \ifx\@@tmp\@@none % but it's none + \pgfusepath{#2}% + \else + \pgfsetfillcolor{\@@tmp}% + \pgfusepath{#1}% + \fi + }{% the class is defined but the fill key not; use #2 + \pgfusepath{#2}% + } + \else + \pgfusepath{#2}% + \fi +} + +%% Macro to fill or draw + +\def\pgf@circ@draworfill{% + \ifx\tikz@fillcolor\pgfutil@empty + \pgf@circ@setifdefinedfill{draw,fill}{draw} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \pgfusepath{draw, fill} + \fi +} + +\def\pgf@circ@draworfillandclip{% + \ifx\tikz@fillcolor\pgfutil@empty + \pgf@circ@setifdefinedfill{draw, clip, fill}{draw, clip} + \pgfusepath{draw, clip} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \pgfusepath{draw, clip, fill} + \fi +} + +\def\pgf@circ@maybefill{% + \ifx\tikz@fillcolor\pgfutil@empty + \pgf@circ@setifdefinedfill{fill}{discard} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \pgfusepath{fill} + \fi +} + +%% Macros for setting linewidth +% #1 is the legacy class (bipoles, tripoles) etc +% #2 is the reference linewidth +\def\pgf@circ@setlinewidth#1#2{% + \ifdefined\ctikzclass + \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/thickness}% + {% yes, it's defined + \edef\@@tmp{\ctikzvalof{\ctikzclass/thickness}}\edef\@@none{none}% + \ifx\@@tmp\@@none % but it's none + \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% passthrough legacy class + \else + \pgfsetlinewidth{\@@tmp #2}% + \fi + }{ % key not defined, do the legacy thing + \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% + }% Ok, do nothing + \else % no class + \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% + \fi +} +% use \pgf@circ@setlinewidth{none}{\pgflinewidth} if there is no legacy case +\ctikzset{none/thickness/.initial=1.0} % do not touch +%%>>> + +%% font changes compatible with plain/LaTeX/ConTeXt%<<<1 +%% thanks to Henri Menke https://github.com/circuitikz/circuitikz/issues/285#issuecomment-537224605 + +\ifpgfutil@format@is@latex + \long\def\pgf@circ@font@tiny{\tiny} + \long\def\pgf@circ@font@small{\small} + \long\def\pgf@circ@font@bold{\textbf} + \long\def\pgf@circ@font@boldmath{\boldmath} + \long\def\pgf@circ@font@sixbm{\fontsize{6}{7}\selectfont\boldmath} + \long\def\pgf@circ@font@tenbm{\fontsize{10}{12}\selectfont\boldmath} + \long\def\pgf@circ@font@twelve{\fontsize{12}{14}\selectfont} +\else\ifpgfutil@format@is@plain + \long\def\pgf@circ@font@tiny{\fiverm} + \long\def\pgf@circ@font@small{\sevenrm} + \long\def\pgf@circ@font@bold#1{{\bf#1}} + \long\def\pgf@circ@font@boldmath{\bf} % to be tested + \long\def\pgf@circ@font@sixbm{\sevenrm\bf} % + \long\def\pgf@circ@font@tenbm{\tenrm\bf} % + \long\def\pgf@circ@font@twelve{\twelverm} % +\else\ifpgfutil@format@is@context + \long\def\pgf@circ@font@tiny{\tfxx} + \long\def\pgf@circ@font@small{\tfx} + \long\def\pgf@circ@font@bold{\bold} + \long\def\pgf@circ@font@boldmath{\bold} % to be tested + \long\def\pgf@circ@font@sixbm{\tfx\bold} % + \long\def\pgf@circ@font@tenbm{\normal\bold}% + \long\def\pgf@circ@font@twelve{\tfa} % +\fi\fi\fi + + +% +% Thanks to Phelype Oleinik https://tex.stackexchange.com/a/520806/38080 +% +% this is needed to avoid problems with \ConTeXt +\ifcsname normalunexpanded\endcsname + \let\pgfcircutil@unexpanded\normalunexpanded +\else + \let\pgfcircutil@unexpanded\unexpanded +\fi +% minimally expand a pgfkey to check if it's {}/undefined or filled. +\def\unexpandedvalueof#1{% + \pgfcircutil@unexpanded\expandafter\expandafter + \expandafter\pgf@circ@valueof@chk\pgfkeysvalueof{#1}} +\def\pgf@circ@valueof@chk#1{% + \ifx\relax#1% + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {{}}% #1 is \relax, so consider empty + {\expandafter{#1}}% otherwise, leave the key after one more expansion +}% +%>>> + +% text position in some component.%<<<1 +% (added with ieeestd logic ports. Maybe to be extended to other components, +% like amplifiers) +% +\newif\ifpgf@circ@center@text\pgf@circ@center@texttrue +\tikzset{component text/.is choice}% +\tikzset{component text/center/.code={\pgf@circ@center@texttrue}}% +\tikzset{component text/left/.code={\pgf@circ@center@textfalse}}% +\ctikzset{component text/.is choice}% +\ctikzset{component text/center/.code={\pgf@circ@center@texttrue}}% +\ctikzset{component text/left/.code={\pgf@circ@center@textfalse}}% +\ctikzset{left text distance/.initial=0.3em}% +%>>> + +% voltage direction options%<<<1 + +\newif\ifpgf@circ@siunitx +\newif\ifpgf@circuit@compat +\newif\ifpgf@circ@oldvoltagedirection % default false +\newif\ifpgf@circ@explicitvdir +\newif\ifpgf@circ@fixbatteries + +\ctikzset{voltage dir/.is choice} +\ctikzset{voltage dir/old/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriesfalse}} +\ctikzset{voltage dir/noold/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriesfalse}} +\ctikzset{voltage dir/RP/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriestrue}} +\ctikzset{voltage dir/EF/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriestrue}} +\tikzset{voltage dir/.style={circuitikz/voltage dir=#1}}% +%>>> + +% bipole definitions for path component and text decorations%%<<<1 +% +% Option "t=*" for nodes +\pgfkeys{/tikz/t/.add code={}{\ctikzset{text=#1}}} +% +\ctikzset{bipole/.is family} +\ctikzset{bipole/kind/.initial=} +\ctikzset{bipole/name/.initial=} +\newif\ifpgf@circuit@bipole@isvoltage +\ctikzset{bipole/is voltage/.is if=pgf@circuit@bipole@isvoltage} +\newif\ifpgf@circuit@bipole@voltageoutsideofsymbol +\ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf@circuit@bipole@voltageoutsideofsymbol} +\newif\ifpgf@circuit@bipole@strokedsymbol +\ctikzset{bipole/is strokedsymbol/.is if=pgf@circuit@bipole@strokedsymbol} +\newif\ifpgf@circuit@bipole@iscurrent +\ctikzset{bipole/is current/.is if=pgf@circuit@bipole@iscurrent} + +\ctikzset{bipole/voltage/.is family} +\newif\ifpgf@circuit@bipole@voltage@backward +\ctikzset{bipole/voltage/direction/.is choice} +\ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}} +\ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}} +\newif\ifpgf@circuit@bipole@voltage@below +\ctikzset{bipole/voltage/position/.is choice} +\ctikzset{bipole/voltage/position/above/.code={\pgf@circuit@bipole@voltage@belowfalse}} +\ctikzset{bipole/voltage/position/below/.code={\pgf@circuit@bipole@voltage@belowtrue}} + +\ctikzset{bipole/voltage/label/unit/.initial=} +\ctikzset{bipole/voltage/label/name/.initial=} + +\ctikzset{bipole/current/.is family} +\newif\ifpgf@circuit@bipole@current@backward +\ctikzset{bipole/current/direction/.is choice} +\ctikzset{bipole/current/direction/forward/.code={\pgf@circuit@bipole@current@backwardfalse}} +\ctikzset{bipole/current/direction/backward/.code={\pgf@circuit@bipole@current@backwardtrue}} +\newif\ifpgf@circuit@bipole@current@before +\ctikzset{bipole/current/x position/.is choice} +\ctikzset{bipole/current/x position/after/.code={\pgf@circuit@bipole@current@beforefalse}} +\ctikzset{bipole/current/x position/before/.code={\pgf@circuit@bipole@current@beforetrue}} +\newif\ifpgf@circuit@bipole@current@below +\ctikzset{bipole/current/y position/.is choice} +\ctikzset{bipole/current/y position/above/.code={\pgf@circuit@bipole@current@belowfalse}} +\ctikzset{bipole/current/y position/below/.code={\pgf@circuit@bipole@current@belowtrue}} +\ctikzset{bipole/current/label/unit/.initial=} +\ctikzset{bipole/current/label/name/.initial=} + +\ctikzset{bipole/flow/.is family} +\newif\ifpgf@circuit@bipole@flow@backward +\ctikzset{bipole/flow/direction/.is choice} +\ctikzset{bipole/flow/direction/forward/.code={\pgf@circuit@bipole@flow@backwardfalse}} +\ctikzset{bipole/flow/direction/backward/.code={\pgf@circuit@bipole@flow@backwardtrue}} +\newif\ifpgf@circuit@bipole@flow@before +\ctikzset{bipole/flow/x position/.is choice} +\ctikzset{bipole/flow/x position/after/.code={\pgf@circuit@bipole@flow@beforefalse}} +\ctikzset{bipole/flow/x position/before/.code={\pgf@circuit@bipole@flow@beforetrue}} +\newif\ifpgf@circuit@bipole@flow@below +\ctikzset{bipole/flow/y position/.is choice} +\ctikzset{bipole/flow/y position/above/.code={\pgf@circuit@bipole@flow@belowfalse}} +\ctikzset{bipole/flow/y position/below/.code={\pgf@circuit@bipole@flow@belowtrue}} +\ctikzset{bipole/flow/label/unit/.initial=} +\ctikzset{bipole/flow/label/name/.initial=} +\ctikzset{flow/distance/.initial = .5} +\ctikzset{flow/offset/.initial = .2}%distance between flow-arrow and conductor + +\ctikzset{bipole/label/.is family} +\ctikzset{bipole/label/position/.initial=90} +\ctikzset{bipole/label/unit/.initial=} +\ctikzset{bipole/label/name/.initial=} +\ctikzset{bipole/annotation/.is family} +\ctikzset{bipole/annotation/position/.initial=-90} +\ctikzset{bipole/annotation/unit/.initial=} +\ctikzset{bipole/annotation/name/.initial=} + +\newif\ifpgf@circ@siunitx +\newif\ifpgf@circ@siunitx@res + +\ctikzset{label/align/.is choice} +\ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}} +\ctikzset{label/align/rotate/.code={\ctikzsetvalof{label/align}{rotate}}} +\ctikzset{label/align/smart/.code={\ctikzsetvalof{label/align}{smart}}} +%%>>> + +% traditional styles %<<<1 +% +\ctikzset{thickness/.initial=2} +\ctikzset{color/.initial=black} +\pgfkeys{/tikz/color/.add code={}{\ctikzset{color={#1}}}} +\ctikzset{bipoles/border margin/.initial=1.1} +\ctikzset{bipoles/thickness/.initial=2} +\ctikzset{tripoles/thickness/.initial=2} +\ctikzset{quadpoles/thickness/.initial=2} +\ctikzset{nodes width/.initial=.04} +%%>>> + +% Styles definitions and macros%<<<1 + +%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% main style definitions +%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% load a style file: search ctikzstyle-NAME.tex in path +\def\ctikzloadstyle#1{% + \pgfutil@InputIfFileExists{ctikzstyle-#1}{}{% + \tikzerror{I did not find the circuitikz style #1}}% +} + +% load and enact a style +\def\ctikzsetstyle#1{% + \ctikzloadstyle{#1}% + \tikzset{#1 circuit style}% +} + +% global style parameters +\ctikzset{default/scale/.initial=1.0} % do not touch +\ctikzset{default/fill/.initial=none} % do not touch +\ctikzset{default/thickness/.initial=none} % do not touch +% default is use as the generic default style for bipoles + +% mostly bipoles: + +\ctikzset{resistors/scale/.initial=1.0} +\ctikzset{resistors/fill/.initial=none} +\ctikzset{resistors/thickness/.initial=none} + +\ctikzset{capacitors/scale/.initial=1.0} +\ctikzset{capacitors/fill/.initial=none} +\ctikzset{capacitors/thickness/.initial=none} + +\ctikzset{inductors/scale/.initial=1.0} +\ctikzset{inductors/fill/.initial=none} +\ctikzset{inductors/thickness/.initial=none} + +\ctikzset{diodes/scale/.initial=1.0} +\ctikzset{diodes/fill/.initial=none} +\ctikzset{diodes/thickness/.initial=none} + +\ctikzset{batteries/scale/.initial=1.0} +\ctikzset{batteries/fill/.initial=none} +\ctikzset{batteries/thickness/.initial=none} + +\ctikzset{sources/scale/.initial=1.0} +\ctikzset{sources/fill/.initial=none} +\ctikzset{sources/thickness/.initial=none} + +\ctikzset{csources/scale/.initial=1.0} +\ctikzset{csources/fill/.initial=none} +\ctikzset{csources/thickness/.initial=none} + +\ctikzset{instruments/scale/.initial=1.0} +\ctikzset{instruments/fill/.initial=none} +\ctikzset{instruments/thickness/.initial=none} + +\ctikzset{mechanicals/scale/.initial=1.0} +\ctikzset{mechanicals/fill/.initial=none} +\ctikzset{mechanicals/thickness/.initial=none} + +\ctikzset{misc/scale/.initial=1.0} +\ctikzset{misc/fill/.initial=none} +\ctikzset{misc/thickness/.initial=none} + +\ctikzset{blocks/scale/.initial=1.0} +\ctikzset{blocks/fill/.initial=none} +\ctikzset{blocks/thickness/.initial=none} + +% mostly nodes + +\ctikzset{grounds/scale/.initial=1.0} +\ctikzset{grounds/fill/.initial=none} +\ctikzset{grounds/thickness/.initial=none} + +\ctikzset{power supplies/scale/.initial=1.0} +\ctikzset{power supplies/fill/.initial=none} +\ctikzset{power supplies/thickness/.initial=none} + +\ctikzset{transistors/scale/.initial=1.0} +\ctikzset{transistors/fill/.initial=none} +\ctikzset{transistors/thickness/.initial=none} + +\ctikzset{tubes/scale/.initial=1.0} +\ctikzset{tubes/fill/.initial=none} +\ctikzset{tubes/thickness/.initial=none} + +\ctikzset{RF/scale/.initial=1.0} +\ctikzset{RF/fill/.initial=none} +\ctikzset{RF/thickness/.initial=none} + +\ctikzset{electromechanicals/scale/.initial=1.0} +\ctikzset{electromechanicals/fill/.initial=none} +\ctikzset{electromechanicals/thickness/.initial=none} + +% transformers go with inductors +\ctikzset{amplifiers/scale/.initial=1.0} +\ctikzset{amplifiers/fill/.initial=none} +\ctikzset{amplifiers/thickness/.initial=none} + +\ctikzset{switches/scale/.initial=1.0} +\ctikzset{switches/fill/.initial=none} +\ctikzset{switches/thickness/.initial=none} + +\ctikzset{logic ports/scale/.initial=1.0} +\ctikzset{logic ports/fill/.initial=none} +\ctikzset{logic ports/thickness/.initial=none} + +\ctikzset{flipflops/scale/.initial=1.0} +\ctikzset{flipflops/fill/.initial=none} +\ctikzset{flipflops/thickness/.initial=none} + +\ctikzset{muxdemuxes/scale/.initial=1.0} +\ctikzset{muxdemuxes/fill/.initial=none} +\ctikzset{muxdemuxes/thickness/.initial=none} + +\ctikzset{chips/scale/.initial=1.0} +\ctikzset{chips/fill/.initial=none} +\ctikzset{chips/thickness/.initial=none} + +\ctikzset{displays/scale/.initial=1.0} +\ctikzset{displays/fill/.initial=none} +\ctikzset{displays/thickness/.initial=none} +% +% general styles +% +\tikzset{european/.style = {european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set}} +\tikzset{american/.style = {american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set}} +\tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}} +%%>>> + +% grounds and power supplies%<<<1 + +\ctikzset{monopoles/.is family} +\ctikzset{monopoles/ground/width/.initial=.25} +\ctikzset{monopoles/ground/connectionthickness/.initial=1} +\ctikzset{monopoles/ground/thickness/.initial=2} +\ctikzset{monopoles/rground/thickness/.initial=2} +\ctikzset{monopoles/tground/thickness/.initial=3} +\ctikzset{monopoles/vcc/width/.initial=.2} +\ctikzset{monopoles/vcc/arrow/.initial=legacy} +\ctikzset{monopoles/vee/arrow/.initial=legacy} +\ctikzset{monopoles/match/width/.initial=.4} +\ctikzset{monopoles/chassis/width/.initial=.25} +\ctikzset{monopoles/alternative chassis/width/.initial=.25} +\ctikzset{monopoles/equipotentiality/width/.initial=.25} +\ctikzset{monopoles/antenna/width/.initial=.25} +\ctikzset{monopoles/antenna/label/xanchor/.initial=.4} +\ctikzset{monopoles/antenna/label/yanchor/.initial=.75} +\ctikzset{monopoles/txantenna/label/xanchor/.initial=.4} +\ctikzset{monopoles/txantenna/label/yanchor/.initial=.75} +\ctikzset{monopoles/txantenna/width/.initial=.25} +\ctikzset{monopoles/rxantenna/label/xanchor/.initial=.4} +\ctikzset{monopoles/rxantenna/label/yanchor/.initial=.75} +\ctikzset{monopoles/rxantenna/width/.initial=.25} +\ctikzset{monopoles/bareantenna/width/.initial=.25} +\ctikzset{monopoles/bareantenna/label/xanchor/.initial=1} +\ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5} +\ctikzset{monopoles/waves/width/.initial=0.5}% +%>>> + +% microstrips %<<<1 +\ctikzset{bipoles/mstline/height/.initial=0.3} +\ctikzset{bipoles/mstline/width/.initial=1.2} +\pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}} +\ctikzset{monopoles/msport/width/.initial=.5} +\ctikzset{monopoles/msrstub/height/.initial=1.0} +\ctikzset{monopoles/msrstub/width/.initial=0.6}% +%>>> + +% microphone and loudspeaker%<<<1 +\ctikzset{bipoles/loudspeaker/height/.initial=.8} +\ctikzset{bipoles/loudspeaker/depth/.initial=.3} +\ctikzset{bipoles/loudspeaker/width/.initial=.8} +\ctikzset{bipoles/mic/height/.initial=1.2} +\ctikzset{bipoles/mic/depth/.initial=.1} +\ctikzset{bipoles/mic/width/.initial=.8}% +%>>> + +% resistors%<<<1 +% Zig Zag resistors +\ctikzset{resistors/zigs/.initial=3} +\ctikzset{resistors/width/.code={% + \ctikzset{bipoles/resistor/width=#1}% + \ctikzset{bipoles/vresistor/width=#1}% + \ctikzset{bipoles/potentiometer/width=#1}% + \ctikzset{bipoles/resistivesens/width=#1}% + \ctikzset{bipoles/photoresistor/width=#1}% + \ctikzset{bipoles/thermistor/width=#1}% + \ctikzset{bipoles/thermistorntc/width=#1}% + \ctikzset{bipoles/thermistorptc/width=#1}% + \ctikzset{bipoles/varistor/width=#1}% + \ctikzset{bipoles/generic/width=#1}% + \ctikzset{bipoles/generic potentiometer/width=#1}% + \ctikzset{bipoles/ageneric/width=#1}% + \ctikzset{bipoles/tgeneric/width=#1}% +}} +\ctikzset{wiper pos/.code={% + \ctikzset{bipoles/potentiometer/wiper pos=#1}% + \ctikzset{bipoles/generic potentiometer/wiper pos=#1}% +}} +% zigzag resistor +\ctikzset{bipoles/resistor/height/.initial=.3} +\ctikzset{bipoles/resistor/width/.initial=.8} +\ctikzset{bipoles/potentiometer/height/.initial=.8} +\ctikzset{bipoles/potentiometer/height 2/.initial=.3} +\ctikzset{bipoles/potentiometer/width/.initial=.8} +\ctikzset{bipoles/potentiometer/wiper pos/.initial=.5} +\ctikzset{bipoles/vresistor/height/.initial=.6} +\ctikzset{bipoles/vresistor/width/.initial=.8} +\ctikzset{bipoles/resistivesens/height/.initial=.6} +\ctikzset{bipoles/resistivesens/width/.initial=.8} +% square resistors +\ctikzset{bipoles/photoresistor/height/.initial=.6} +\ctikzset{bipoles/photoresistor/height 2/.initial=.3} +\ctikzset{bipoles/photoresistor/width/.initial=.8} +\ctikzset{bipoles/thermistor/main/.initial=.7} +\ctikzset{bipoles/thermistor/height/.initial=.428}%.3/.7 +\ctikzset{bipoles/thermistorntc/width/.initial=.8} +\ctikzset{bipoles/thermistorntc/main/.initial=.7} +\ctikzset{bipoles/thermistorntc/height/.initial=.428}%.3/.7 +\ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.3/.7 +\ctikzset{bipoles/thermistorptc/width/.initial=.8} +\ctikzset{bipoles/thermistorptc/main/.initial=.7} +\ctikzset{bipoles/thermistorptc/height/.initial=.428}%.3/.7 +\ctikzset{bipoles/thermistorptc/height 2/.initial=.75}%.3/.7 +\ctikzset{bipoles/thermistor/width/.initial=.8} +\ctikzset{bipoles/varistor/main/.initial=.7} +\ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7 +\ctikzset{bipoles/varistor/width/.initial=.8} +\ctikzset{bipoles/generic/height/.initial=.30} +\ctikzset{bipoles/generic/width/.initial=.80} +\ctikzset{bipoles/generic potentiometer/height/.initial=.80} +\ctikzset{bipoles/generic potentiometer/height 2/.initial=.30} +\ctikzset{bipoles/generic potentiometer/width/.initial=.80} +\ctikzset{bipoles/generic potentiometer/wiper pos/.initial=.5} +\ctikzset{bipoles/ageneric/height/.initial=.30} +\ctikzset{bipoles/tgeneric/height/.initial=.70} +\ctikzset{bipoles/tgeneric/width/.initial=.80} +\ctikzset{bipoles/ageneric/width/.initial=.80} +\ctikzset{bipoles/memristor/height/.initial=.30} +\ctikzset{bipoles/memristor/wave height/.initial=.5} +\ctikzset{bipoles/memristor/width/.initial=.80} + +\newif\ifpgf@circuit@europeanresistor +\ctikzset{resistor/.is choice} +\ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse } +\ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue } +\tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}} +\tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}} +%%>>> + +%% Capacitors%<<<1 +\ctikzset{bipoles/capacitor/height/.initial=.6} +\ctikzset{bipoles/capacitor/width/.initial=.2} +\ctikzset{bipoles/ecapacitor/height/.initial=.5} +\ctikzset{bipoles/ecapacitor/width/.initial=.2} +\ctikzset{bipoles/ecapacitor/font/.initial=\pgf@circ@font@sixbm} +%%% pcapacitor is deprecated +\ctikzset{bipoles/pcapacitor/height/.initial=.6} +\ctikzset{bipoles/pcapacitor/width/.initial=.2} +\ctikzset{bipoles/pcapacitor/bend width/.initial=1.1} +\ctikzset{bipoles/ccapacitor/height/.initial=.6} +\ctikzset{bipoles/ccapacitor/width/.initial=.12} +\ctikzset{bipoles/ccapacitor/bend width/.initial=1.1} +\ctikzset{bipoles/vcapacitor/height/.initial=.6} +\ctikzset{bipoles/vcapacitor/width/.initial=.5} +\ctikzset{bipoles/vcapacitor/capacitor width/.initial=.4} +\ctikzset{bipoles/piezoelectric/height/.initial=.7} +\ctikzset{bipoles/piezoelectric/width/.initial=.5}% +%>>> + +% Inductors%<<<1 +\ctikzset{inductors/coils/.code={% + \ctikzset{bipoles/cuteinductor/coils=#1}% + \ctikzset{bipoles/cutechoke/coils=#1}% + \ctikzset{bipoles/americaninductor/coils=#1}% + \ctikzset{bipoles/vcuteinductor/coils=#1}% + \ctikzset{bipoles/vamericaninductor/coils=#1}% +}} +\ctikzset{inductors/width/.code={% + \ctikzset{bipoles/cuteinductor/width=#1}% + \ctikzset{bipoles/cutechoke/width=#1}% + \ctikzset{bipoles/americaninductor/width=#1}% + \ctikzset{bipoles/vcuteinductor/width=#1}% + \ctikzset{bipoles/vamericaninductor/width=#1}% + \ctikzset{bipoles/fullgeneric/width=#1}% + \ctikzset{bipoles/tfullgeneric/width=#1}% +}} +\ctikzset{bipoles/cuteinductor/height/.initial=.3} +\ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15} +\ctikzset{bipoles/cuteinductor/width/.initial=.6} +\ctikzset{bipoles/cuteinductor/coils/.initial=5} +\ctikzset{bipoles/cuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil +%% Cute choke settings +\ctikzset{bipoles/cutechoke/height/.initial=.3} +\ctikzset{bipoles/cutechoke/lower coil height/.initial=.15} +\ctikzset{bipoles/cutechoke/width/.initial=.6} +\ctikzset{bipoles/cutechoke/coils/.initial=5} +\ctikzset{bipoles/cutechoke/coil aspect/.initial=.5}%percentage of choke width, which is covered by lower coil +\ctikzset{bipoles/cutechoke/cstep/.initial=.3} +\ctikzset{bipoles/cutechoke/cdist/.initial=1.3} +\ctikzset{bipoles/cutechoke/cthick/.initial=1} +\newif\ifpgf@circuit@bipole@twolineschoke +\pgf@circuit@bipole@twolineschokefalse +\pgfkeys{/tikz/onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}} +\ctikzset{onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}} +\pgfkeys{/tikz/twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}} +\ctikzset{twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}} +% +\ctikzset{bipoles/americaninductor/height/.initial=.3} +\ctikzset{bipoles/americaninductor/height 2/.initial=.1} +\ctikzset{bipoles/americaninductor/width/.initial=.8} +\ctikzset{bipoles/americaninductor/coils/.initial=4} +\ctikzset{bipoles/americaninductor/coil height/.initial=.15} +\ctikzset{bipoles/vcuteinductor/height/.initial=.6} +\ctikzset{bipoles/vcuteinductor/lower coil height/.initial=.3} +\ctikzset{bipoles/vcuteinductor/width/.initial=.6} +\ctikzset{bipoles/vcuteinductor/coils/.initial=5} +\ctikzset{bipoles/vcuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil +\ctikzset{bipoles/vamericaninductor/height/.initial=.6} +\ctikzset{bipoles/vamericaninductor/height 2/.initial=.2} +\ctikzset{bipoles/vamericaninductor/width/.initial=.8} +\ctikzset{bipoles/vamericaninductor/coils/.initial=4} +\ctikzset{bipoles/vamericaninductor/coil height/.initial=.15} +\ctikzset{bipoles/tfullgeneric/height/.initial=.70} +\ctikzset{bipoles/tfullgeneric/width/.initial=.80} +\ctikzset{bipoles/fullgeneric/height/.initial=.30} +\ctikzset{bipoles/fullgeneric/width/.initial=.80} +\ctikzset{inductor/.is choice} +\ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}} +\ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}} +\ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}} + +\tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}} +\tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}} +\tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}} +\tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}} +\tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}} + +%%>>> + +% Sources%<<<1 + +\ctikzset{bipoles/esource/height/.initial=.60} +\ctikzset{bipoles/esource/width/.initial=.60} +\ctikzset{bipoles/pvsource/height/.initial=.60} +\ctikzset{bipoles/pvsource/width/.initial=.60} +\ctikzset{bipoles/isource/height/.initial=.60} +\ctikzset{bipoles/isource/width/.initial=.60} +\ctikzset{bipoles/oosource/height/.initial=.60} +\ctikzset{bipoles/oosource/width/.initial=.60} +\ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/dcisource/angle/.initial=80} +\ctikzset{bipoles/dcisource/height/.initial=.60} +\ctikzset{bipoles/dcisource/width/.initial=.60} +\ctikzset{bipoles/dcvsource/height/.initial=.60} +\ctikzset{bipoles/dcvsource/width/.initial=.60} +\ctikzset{bipoles/vsourcetri/height/.initial=.60} +\ctikzset{bipoles/vsourcetri/width/.initial=.60} +\ctikzset{bipoles/isourceam/height/.initial=.60} +\ctikzset{bipoles/isourceam/width/.initial=.60} +\ctikzset{bipoles/vsource/height/.initial=.60} +\ctikzset{bipoles/vsource/width/.initial=.60} +\ctikzset{bipoles/vsourceam/height/.initial=.60} +\ctikzset{bipoles/vsourceam/width/.initial=.60} +\ctikzset{bipoles/vsourceam/margin/.initial=.7} +\ctikzset{bipoles/isourcesin/height/.initial=.60} +\ctikzset{bipoles/isourcesin/width/.initial=.60} +\ctikzset{bipoles/vsourcesin/height/.initial=.60} +\ctikzset{bipoles/vsourcesin/width/.initial=.60} +\ctikzset{bipoles/vsourcesquare/height/.initial=.60} +\ctikzset{bipoles/vsourcesquare/width/.initial=.60} +\ctikzset{bipoles/cisource/height/.initial=.7} +\ctikzset{bipoles/cisource/width/.initial=.7} +\ctikzset{bipoles/cisourceam/height/.initial=.7} +\ctikzset{bipoles/cisourceam/width/.initial=.7} +\ctikzset{bipoles/ecsource/height/.initial=.7} +\ctikzset{bipoles/ecsource/width/.initial=.7} +\ctikzset{bipoles/cvsource/height/.initial=.7} +\ctikzset{bipoles/cvsource/width/.initial=.7} +\ctikzset{bipoles/cvsourceam/height/.initial=.7} +\ctikzset{bipoles/cvsourceam/width/.initial=.7} +\ctikzset{bipoles/cvsourceam/margin/.initial=.7} +\ctikzset{bipoles/cvsourceam/text scale/.initial=1} +\ctikzset{bipoles/cisourcesin/width/.initial=.7} +\ctikzset{bipoles/cvsourcesin/height/.initial=.7} +\ctikzset{bipoles/cvsourcesin/width/.initial=.7} +\ctikzset{bipoles/battery/height/.initial=.6} +\ctikzset{bipoles/battery/width/.initial=.3} +\ctikzset{bipoles/battery1/height/.initial=.6} +\ctikzset{bipoles/battery1/width/.initial=.3} +\ctikzset{bipoles/battery2/height/.initial=.6} +\ctikzset{bipoles/battery2/width/.initial=.3} +% noise sources +\ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50} + +%%>>> + +% "oo" style transformers and power grid diagrams%<<<1 +% % % ootransformer +\ctikzset{bipoles/oosourcetrans/height/.initial=.6} +\ctikzset{bipoles/oosourcetrans/width/.initial=.6} +\ctikzset{bipoles/oosourcetrans/circlesize/.initial=.6}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/oosourcetrans/circleoffset/.initial=.4}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/oosourcetrans/vectorgroupscale/.initial=1} + +% % % oootransformer +\ctikzset{bipoles/ooosource/height/.initial=.6} +\ctikzset{bipoles/ooosource/circlesize/.initial=.55}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/ooosource/circleoffset/.initial=.45}%circlesize+circleoffset should be =1 +\ctikzset{bipoles/ooosource/vectorgroupscale/.initial=1} + +% % % primary windings +\newif\ifpgf@circ@prim@delta +\newif\ifpgf@circ@prim@wye +\newif\ifpgf@circ@prim@zig +\pgfkeys{tikz/prim/.is choice} +\pgfkeys{tikz/prim/delta/.add code={}{\pgf@circ@prim@deltatrue}} +\pgfkeys{tikz/prim/wye/.add code={}{\pgf@circ@prim@wyetrue}} +\pgfkeys{tikz/prim/zig/.add code={}{\pgf@circ@prim@zigtrue}} + +% % % secondary windings +\newif\ifpgf@circ@sec@delta +\newif\ifpgf@circ@sec@wye +\newif\ifpgf@circ@sec@zig +\pgfkeys{tikz/sec/.is choice} +\pgfkeys{tikz/sec/delta/.add code={}{\pgf@circ@sec@deltatrue}} +\pgfkeys{tikz/sec/wye/.add code={}{\pgf@circ@sec@wyetrue}} +\pgfkeys{tikz/sec/zig/.add code={}{\pgf@circ@sec@zigtrue}} + +% % % tertiary windings (ooosource) +\newif\ifpgf@circ@tert@delta +\newif\ifpgf@circ@tert@wye +\newif\ifpgf@circ@tert@zig +\pgfkeys{tikz/tert/.is choice} +\pgfkeys{tikz/tert/delta/.add code={}{\pgf@circ@tert@deltatrue}} +\pgfkeys{tikz/tert/wye/.add code={}{\pgf@circ@tert@wyetrue}} +\pgfkeys{tikz/tert/zig/.add code={}{\pgf@circ@tert@zigtrue}}% +%>>> + +% diodes%<<<1 + +\ctikzset{bipoles/diode/height/.initial=.50} +\ctikzset{bipoles/diode/width/.initial=.40} +\ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1} +\ctikzset{bipoles/bidirectionaldiode/width/.initial=1} +\ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3} +\ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3} +\ctikzset{bipoles/varcap/height/.initial=.50} +\ctikzset{bipoles/varcap/width/.initial=.45} +\ctikzset{tripoles/thyristor/height/.initial=1.10} +\ctikzset{tripoles/thyristor/height 2/.initial=.5} +\ctikzset{tripoles/thyristor/width/.initial=1.0} +\ctikzset{tripoles/thyristor/diode height/.initial=.5} +\ctikzset{tripoles/thyristor/diode width left/.initial=.4} +\ctikzset{tripoles/thyristor/diode width right/.initial=.3} + +\ctikzset{tripoles/triac/height/.initial=1.1} +\ctikzset{tripoles/triac/width/.initial=1} +\ctikzset{tripoles/triac/diode width left/.initial=.3} +\ctikzset{tripoles/triac/diode width right/.initial=.3} +% +% Flipping arrows in LED and photodiodes +% +\newif\ifpgf@led@fliparrows +\newif\ifpgf@pd@fliparrows +\pgf@led@fliparrowsfalse +\pgf@pd@fliparrowsfalse +% +% by default the arrows start (LED) and go (PD) to the anode. +% +\ctikzset{led arrows from anode/.code=\pgf@led@fliparrowsfalse} +\ctikzset{pd arrows to anode/.code=\pgf@pd@fliparrowsfalse} +% +% but they can start form the cathode (LED) or go to it (PD) +% +\ctikzset{led arrows from cathode/.code=\pgf@led@fliparrowstrue} +\ctikzset{pd arrows to cathode/.code=\pgf@pd@fliparrowstrue} + +\newif\ifpgf@circuit@strokediode +\newif\ifpgf@circuit@fulldiode +\pgf@circuit@strokediodefalse +\pgf@circuit@fulldiodefalse + +\ctikzset{diode/.is choice} +\ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default +\ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue } +\ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue} + +\tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}} +\tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}} +\tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}} + +%%>>> + +% switches%<<<1 + +\ctikzset{bipoles/spst/height/.initial=.35} +\ctikzset{bipoles/spst/width/.initial=.35} +\ctikzset{bipoles/spst/depth/.initial=.2} +\ctikzset{bipoles/nos/height/.initial=.3} +\ctikzset{bipoles/nos/width/.initial=.35} +\ctikzset{bipoles/nos/depth/.initial=.2} +\ctikzset{bipoles/ncs/height/.initial=.35} +\ctikzset{bipoles/ncs/width/.initial=.35} +\ctikzset{bipoles/ncs/depth/.initial=.2} +\ctikzset{bipoles/pushbutton/height/.initial=.5} +\ctikzset{bipoles/pushbutton/height 2/.initial=.2} +\ctikzset{bipoles/pushbutton/width/.initial=.50} +%%% reed switch +\ctikzset{bipoles/reed/height/.initial=.4} +\ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos +\ctikzset{bipoles/reed/depth/.initial=.4} +%% Cute switches +\ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}} +\ctikzset{bipoles/cuteswitch/height/.initial=.6} +\ctikzset{bipoles/cuteswitch/height 2/.initial=.2} +\ctikzset{bipoles/cuteswitch/width/.initial=.50} +\ctikzset{bipoles/cuteswitch/thickness/.initial=1} + +\ctikzset{tripoles/spdt/width/.initial=.85} +\ctikzset{tripoles/spdt/height/.initial=.45} +\ctikzset{tripoles/spdt/margin/.initial=.45} + +\ctikzset{tripoles/toggleswitch/height/.initial=.8} +\ctikzset{tripoles/toggleswitch/height 2/.initial=.0} +\ctikzset{tripoles/toggleswitch/width/.initial=.80} +%%>>> + +% arresters, fuses, lamps, etc%<<<1 + +\ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30} +\ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80} +\ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30} +\ctikzset{bipoles/american gas filled surge arrester/height/.initial=.60} +\ctikzset{bipoles/american gas filled surge arrester/width/.initial=.60} +\ctikzset{bipoles/american gas filled surge arrester/inside/.initial=.15} +\ctikzset{bipoles/american gas filled surge arrester/dot x/.initial=.25} +\ctikzset{bipoles/american gas filled surge arrester/dot y/.initial=.45} +\ctikzset{bipoles/american gas filled surge arrester/size/.initial=.1} +\ctikzset{bipoles/fuse/height/.initial=.20} +\ctikzset{bipoles/fuse/width/.initial=.50} +\ctikzset{bipoles/afuse/height/.initial=.20} +\ctikzset{bipoles/afuse/width/.initial=.50} +\ctikzset{bipoles/lamp/height/.initial=.60} +\ctikzset{bipoles/lamp/width/.initial=.60} +\ctikzset{bipoles/bulb/height/.initial=.8} +\ctikzset{bipoles/bulb/width/.initial=.8} +\ctikzset{bipoles/tline/height/.initial=.3} +\ctikzset{bipoles/tline/width/.initial=.6} +\ctikzset{bipoles/squid/height/.initial=.60} +\ctikzset{bipoles/squid/width/.initial=.60} +\ctikzset{bipoles/barrier/height/.initial=.60} +\ctikzset{bipoles/barrier/width/.initial=.60} +\ctikzset{bipoles/openbarrier/gap/.initial=0.5} +\ctikzset{bipoles/thermocouple/height/.initial=.250} +\ctikzset{bipoles/thermocouple/height 2/.initial=.60} +\ctikzset{bipoles/thermocouple/width/.initial=.140} +\newif\ifpgf@circuit@europeangfsurgearrester +\ctikzset{gas filled surge arrester choice/.is choice} +\ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue}} +\ctikzset{gas filled surge arrester choice/american/.code= {\pgf@circuit@europeangfsurgearresterfalse}} + +\tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}} +\tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}} +%%>>> + +% wires (open, shorts, ...)%<<<1 + +\ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages +\ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages +\ctikzset{bipoles/open/voltage/straight label distance/.initial=0} +\ctikzset{bipoles/open/voltage/distance from node/.initial=.2} +\ctikzset{bipoles/short/height/.initial=.1} %dummy height for voltage positioning +\ctikzset{bipoles/short/width/.initial=.1} %dummy width for voltage positioning +% multiwire +\ctikzset{bipoles/multiwire/height/.initial=0.4} +\ctikzset{bipoles/multiwire/width/.initial=0.2} +\ctikzset{bipoles/multiwire/spacing/.initial=0.05} +% crossing wires +\ctikzset{bipoles/crossing/size/.initial=.2} +%%>>> + +% Instruments %<<<1 +\ctikzset{bipoles/ammeter/height/.initial=.60} +\ctikzset{bipoles/ammeter/width/.initial=.60} +\ctikzset{bipoles/ohmmeter/height/.initial=.60} +\ctikzset{bipoles/ohmmeter/width/.initial=.60} +\ctikzset{bipoles/voltmeter/height/.initial=.60} +\ctikzset{bipoles/voltmeter/width/.initial=.60} +\ctikzset{bipoles/smeter/height/.initial=.60} +\ctikzset{bipoles/smeter/width/.initial=.60} +\ctikzset{bipoles/smeter/voltage/additional shift/.initial=1} +\ctikzset{bipoles/qmeter/depth/.initial=.40} +\ctikzset{bipoles/qmeter/height/.initial=.80} +\ctikzset{bipoles/qmeter/width/.initial=.60} +% this must be specified for each one +\ctikzset{bipoles/qvprobe/voltage/additional shift/.initial=.5} +\ctikzset{bipoles/qiprobe/voltage/additional shift/.initial=.5} +\ctikzset{bipoles/qpprobe/voltage/additional shift/.initial=.5} +\ctikzset{bipoles/iloop/width/.initial=.40} +\ctikzset{bipoles/iloop/height/.initial=.60} + +\ctikzset{bipoles/oscope/height/.initial=.60} +\ctikzset{bipoles/oscope/width/.initial=.60} +\ctikzset{bipoles/oscope/voltage/additional shift/.initial=1} + + +% option to not rotate the new (Romano's) instruments +\newif\ifpgf@circuit@straightinstruments\pgf@circuit@straightinstrumentstrue +\pgfkeys{/tikz/straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}} +\ctikzset{straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}} +\pgfkeys{/tikz/rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}} +\ctikzset{rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}} +%%>>> + +% blocks (twoports and so)%<<<1 + +\ctikzset{bipoles/twoport/width/.initial=.7} +\ctikzset{bipoles/twoport/height/.initial=.7} +\ctikzset{bipoles/twoport/text/.initial=} +\ctikzset{bipoles/twoportsplit/width/.initial=.7} +\ctikzset{bipoles/twoport/text in/.initial=} +\ctikzset{bipoles/twoport/text out/.initial=} +\ctikzset{text/.style={t=#1}} +\ctikzset{t/.code={% + \ctikzsetvalof{bipoles/twoport/text}{#1}% +}} +\ctikzset{text in/.style={t1=#1}} +\ctikzset{t1/.code={% + \ctikzsetvalof{bipoles/twoport/text in}{#1}% +}} +\ctikzset{text out/.style={t2=#1}} +\ctikzset{t2/.code={% + \ctikzsetvalof{bipoles/twoport/text out}{#1}% +}} +\ctikzset{bipoles/vco/width/.initial=.7} +\ctikzset{bipoles/bandpass/width/.initial=.7} +\ctikzset{bipoles/bandstop/width/.initial=.7} +\ctikzset{bipoles/highpass/width/.initial=.7} +\ctikzset{bipoles/lowpass/width/.initial=.7} +\ctikzset{bipoles/allpass/width/.initial=.7} +\ctikzset{bipoles/adc/width/.initial=.7} +\ctikzset{bipoles/dac/width/.initial=.7} +\ctikzset{bipoles/dsp/width/.initial=.7} +\ctikzset{bipoles/fft/width/.initial=.7} +\ctikzset{bipoles/amp/width/.initial=.7} +\ctikzset{bipoles/vamp/width/.initial=.7} +\ctikzset{bipoles/piattenuator/width/.initial=.7} +\ctikzset{bipoles/vpiattenuator/width/.initial=.7} +\ctikzset{bipoles/tattenuator/width/.initial=.7} +\ctikzset{bipoles/vtattenuator/width/.initial=.7} +\ctikzset{bipoles/phaseshifter/width/.initial=.7} +\ctikzset{bipoles/vphaseshifter/width/.initial=.7} +\ctikzset{bipoles/detector/width/.initial=.7} +\ctikzset{tripoles/mixer/width/.initial=0.7} +\ctikzset{tripoles/adder/width/.initial=0.7} +\ctikzset{tripoles/circulator/width/.initial=.7} +\ctikzset{tripoles/oscillator/width/.initial=.7} + +\ctikzset{tripoles/wilkinson/height/.initial=1.3} +\ctikzset{tripoles/wilkinson/width/.initial=1.3} + +\ctikzset{tripoles/splitter/height/.initial=1.3} +\ctikzset{tripoles/splitter/width/.initial=1.3} + +\ctikzset{tripoles/mzm/height/.initial=1.3} +\ctikzset{tripoles/mzm/width/.initial=1.3} +%%>>> + +% Transistors %<<<1 + +\newif\ifpgf@circuit@trans@depletiontype +\pgf@circuit@trans@depletiontypefalse + +\newif\ifpgf@circuit@mos@arrows +\ctikzset{tripoles/mos style/.is choice} +\ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}} +\ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}} +\pgfkeys{/tikz/arrowmos/.add code={}{\pgf@circuit@mos@arrowstrue}} +\pgfkeys{/tikz/noarrowmos/.add code={}{\pgf@circuit@mos@arrowsfalse}} + +% Fixed label positions +\newif\ifpgf@circuit@transisors@fixlabels +\pgf@circuit@transisors@fixlabelstrue +\pgfkeys{/tikz/center transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}} +\ctikzset{fix transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}} +\pgfkeys{/tikz/legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}} +\ctikzset{legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}} + +% Option solderdot for fet +\newif\ifpgf@circuit@fet@solderdot +\pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}} +\ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}} +\pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}} +\ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}} + +% Option bodydiode for fet +\newif\ifpgf@circuit@fet@bodydiode +\pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}} +\ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}} +\pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}} +\ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}} + +% Option draw fet without gate connection +\newif\ifpgf@circuit@bpt@drawgate +\pgf@circuit@bpt@drawgatetrue +\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}} +\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}} +\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}} +\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}} + +% Option draw bpt with schottky base +\newif\ifpgf@circuit@bpt@schottky +\pgf@circuit@bpt@schottkyfalse +\pgfkeys{/tikz/schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}} +\ctikzset{schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}} +\pgfkeys{/tikz/no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}} +\ctikzset{no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}} +\ctikzset{tripoles/schottky base size/.initial=0.05} + +% Option draw bpt without base connection +\newif\ifpgf@circuit@bpt@drawbase +\pgf@circuit@bpt@drawbasetrue +\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}} +\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}} +\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}} +\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}} + +% Option draw bpt with optical input +\newif\ifpgf@circuit@bpt@drawphoto +\pgf@circuit@bpt@drawphotofalse +\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} +\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} +\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} +\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} + +% Option draw fet without bulk connection -- Added by Burak Kelleci +\newif\ifpgf@circuit@bpt@drawbulk +\pgfkeys{/tikz/bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}} +\ctikzset{bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}} +\pgfkeys{/tikz/nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}} +\ctikzset{nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}} + +% Option draw pmos with empty circle +\newif\ifpgf@circuit@pmos@emptycircle +\pgf@circuit@pmos@emptycirclefalse +\ctikzset{tripoles/pmos style/.is choice} +\pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} +\ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} +% Option draw pmos with no circle +\newif\ifpgf@circuit@pmos@nocircle +\pgf@circuit@pmos@nocirclefalse +\pgfkeys{/tikz/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}} +\ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}} +% back to normal +\pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} +\ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} +% arrows at the end, the correct way +\newif\ifpgf@circuit@trans@arrowatend +\pgf@circuit@trans@arrowatendfalse +\ctikzset{transistors/arrow pos/.is choice} +\ctikzset{transistors/arrow pos/legacy/.code={\pgf@circuit@trans@arrowatendfalse}} +\ctikzset{transistors/arrow pos/end/.code={\pgf@circuit@trans@arrowatendtrue}} + +\newif\ifpgf@circuit@trans@ntype +\pgf@circuit@trans@ntypetrue %default true +%\newif\ifpgf@circuit@trans@ptype +%\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@ntypetrue}} +\ctikzset{tripoles/nmos/width/.initial=.7} +\ctikzset{tripoles/nmos/gate height/.initial=.35} +\ctikzset{tripoles/nmos/base height/.initial=.5} +\ctikzset{tripoles/nmos/conn height/.initial=0} +\ctikzset{tripoles/nmos/height/.initial=1.1} +\ctikzset{tripoles/nmos/base width/.initial=.5} +\ctikzset{tripoles/nmos/gate width/.initial=.62} +\ctikzset{tripoles/nmos/arrow pos/.initial=.6} +\ctikzset{tripoles/nmos/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nmos/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nmos/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nmos/curr direction/.initial=1} + +\ctikzset{tripoles/pmos/width/.initial=.7} +\ctikzset{tripoles/pmos/gate height/.initial=.35} +\ctikzset{tripoles/pmos/base height/.initial=.5} +\ctikzset{tripoles/pmos/conn height/.initial=0} +\ctikzset{tripoles/pmos/height/.initial=1.1} +\ctikzset{tripoles/pmos/base width/.initial=.5} +\ctikzset{tripoles/pmos/gate width/.initial=.62} +\ctikzset{tripoles/pmos/arrow pos/.initial=.4} +\ctikzset{tripoles/pmos/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pmos/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pmos/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pmos/curr direction/.initial=-1} + +\ctikzset{tripoles/nmosd/width/.initial=.7} +\ctikzset{tripoles/nmosd/gate height/.initial=.35} +\ctikzset{tripoles/nmosd/base height/.initial=.5} +\ctikzset{tripoles/nmosd/conn height/.initial=0} +\ctikzset{tripoles/nmosd/height/.initial=1.1} +\ctikzset{tripoles/nmosd/base width/.initial=.5} +\ctikzset{tripoles/nmosd/gate width/.initial=.62} +\ctikzset{tripoles/nmosd/arrow pos/.initial=.6} +\ctikzset{tripoles/nmosd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nmosd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nmosd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nmosd/curr direction/.initial=1} +\ctikzset{tripoles/nmosd/depletion width/.initial=.1} +\ctikzset{tripoles/nmosd/depletion color/.initial=default} + +\ctikzset{tripoles/pmosd/width/.initial=.7} +\ctikzset{tripoles/pmosd/gate height/.initial=.35} +\ctikzset{tripoles/pmosd/base height/.initial=.5} +\ctikzset{tripoles/pmosd/conn height/.initial=0} +\ctikzset{tripoles/pmosd/height/.initial=1.1} +\ctikzset{tripoles/pmosd/base width/.initial=.5} +\ctikzset{tripoles/pmosd/gate width/.initial=.62} +\ctikzset{tripoles/pmosd/arrow pos/.initial=.4} +\ctikzset{tripoles/pmosd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pmosd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pmosd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pmosd/curr direction/.initial=-1} +\ctikzset{tripoles/pmosd/depletion width/.initial=.1} +\ctikzset{tripoles/pmosd/depletion color/.initial=default} +\ctikzset{tripoles/hemt/width/.initial=.7} +\ctikzset{tripoles/hemt/gate height/.initial=.35} +\ctikzset{tripoles/hemt/base height/.initial=.5} +\ctikzset{tripoles/hemt/conn height/.initial=0} +\ctikzset{tripoles/hemt/height/.initial=1.1} +\ctikzset{tripoles/hemt/base width/.initial=.5} +\ctikzset{tripoles/hemt/gate width/.initial=.62} +\ctikzset{tripoles/hemt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/hemt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/hemt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/hemt/curr direction/.initial=1} + +\ctikzset{tripoles/nfet/width/.initial=.7} +\ctikzset{tripoles/nfet/gate height/.initial=.35} +\ctikzset{tripoles/nfet/base height/.initial=.5} +\ctikzset{tripoles/nfet/conn height/.initial=0} +\ctikzset{tripoles/nfet/height/.initial=1.1} +\ctikzset{tripoles/nfet/base width/.initial=.5} +\ctikzset{tripoles/nfet/gate width/.initial=.62} +\ctikzset{tripoles/nfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nfet/curr direction/.initial=1} + +\ctikzset{tripoles/pfet/width/.initial=.7} +\ctikzset{tripoles/pfet/gate height/.initial=.35} +\ctikzset{tripoles/pfet/base height/.initial=.5} +\ctikzset{tripoles/pfet/conn height/.initial=0} +\ctikzset{tripoles/pfet/height/.initial=1.1} +\ctikzset{tripoles/pfet/base width/.initial=.5} +\ctikzset{tripoles/pfet/gate width/.initial=.62} +\ctikzset{tripoles/pfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pfet/curr direction/.initial=-1} + +\ctikzset{tripoles/nfetd/width/.initial=.7} +\ctikzset{tripoles/nfetd/gate height/.initial=.35} +\ctikzset{tripoles/nfetd/base height/.initial=.5} +\ctikzset{tripoles/nfetd/conn height/.initial=0} +\ctikzset{tripoles/nfetd/height/.initial=1.1} +\ctikzset{tripoles/nfetd/base width/.initial=.5} +\ctikzset{tripoles/nfetd/gate width/.initial=.62} +\ctikzset{tripoles/nfetd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nfetd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nfetd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nfetd/curr direction/.initial=1} + +\ctikzset{tripoles/pfetd/width/.initial=.7} +\ctikzset{tripoles/pfetd/gate height/.initial=.35} +\ctikzset{tripoles/pfetd/base height/.initial=.5} +\ctikzset{tripoles/pfetd/conn height/.initial=0} +\ctikzset{tripoles/pfetd/height/.initial=1.1} +\ctikzset{tripoles/pfetd/base width/.initial=.5} +\ctikzset{tripoles/pfetd/gate width/.initial=.62} +\ctikzset{tripoles/pfetd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pfetd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pfetd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pfetd/curr direction/.initial=-1} + +\ctikzset{tripoles/nigfete/width/.initial=.7} +\ctikzset{tripoles/nigfete/gate height/.initial=.35} +\ctikzset{tripoles/nigfete/base height/.initial=.5} +\ctikzset{tripoles/nigfete/conn height/.initial=.35} +\ctikzset{tripoles/nigfete/height/.initial=1.1} +\ctikzset{tripoles/nigfete/base width/.initial=.5} +\ctikzset{tripoles/nigfete/gate width/.initial=.62} +\ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nigfete/curr direction/.initial=1} + +\ctikzset{tripoles/nigfetd/width/.initial=.7} +\ctikzset{tripoles/nigfetd/gate height/.initial=.35} +\ctikzset{tripoles/nigfetd/base height/.initial=.5} +\ctikzset{tripoles/nigfetd/conn height/.initial=.35} +\ctikzset{tripoles/nigfetd/height/.initial=1.1} +\ctikzset{tripoles/nigfetd/base width/.initial=.5} +\ctikzset{tripoles/nigfetd/gate width/.initial=.62} +\ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nigfetd/curr direction/.initial=1} + +\ctikzset{tripoles/nigfetebulk/width/.initial=.7} +\ctikzset{tripoles/nigfetebulk/gate height/.initial=.35} +\ctikzset{tripoles/nigfetebulk/base height/.initial=.5} +\ctikzset{tripoles/nigfetebulk/conn height/.initial=.35} +\ctikzset{tripoles/nigfetebulk/height/.initial=1.1} +\ctikzset{tripoles/nigfetebulk/base width/.initial=.5} +\ctikzset{tripoles/nigfetebulk/gate width/.initial=.62} +\ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nigfetebulk/curr direction/.initial=1} + +\ctikzset{tripoles/pigfete/width/.initial=.7} +\ctikzset{tripoles/pigfete/gate height/.initial=.35} +\ctikzset{tripoles/pigfete/base height/.initial=.5} +\ctikzset{tripoles/pigfete/conn height/.initial=.35} +\ctikzset{tripoles/pigfete/height/.initial=1.1} +\ctikzset{tripoles/pigfete/base width/.initial=.5} +\ctikzset{tripoles/pigfete/gate width/.initial=.62} +\ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pigfete/curr direction/.initial=-1} + +\ctikzset{tripoles/pigfetd/width/.initial=.7} +\ctikzset{tripoles/pigfetd/gate height/.initial=.35} +\ctikzset{tripoles/pigfetd/base height/.initial=.5} +\ctikzset{tripoles/pigfetd/conn height/.initial=.35} +\ctikzset{tripoles/pigfetd/height/.initial=1.1} +\ctikzset{tripoles/pigfetd/base width/.initial=.5} +\ctikzset{tripoles/pigfetd/gate width/.initial=.62} +\ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pigfetd/curr direction/.initial=-1} + +\ctikzset{tripoles/pigfetebulk/width/.initial=.7} +\ctikzset{tripoles/pigfetebulk/gate height/.initial=.35} +\ctikzset{tripoles/pigfetebulk/conn height/.initial=.35} +\ctikzset{tripoles/pigfetebulk/base height/.initial=.5} +\ctikzset{tripoles/pigfetebulk/height/.initial=1.1} +\ctikzset{tripoles/pigfetebulk/base width/.initial=.5} +\ctikzset{tripoles/pigfetebulk/gate width/.initial=.62} +\ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1} + +\ctikzset{tripoles/npn/width/.initial=.6} +\ctikzset{tripoles/npn/base height/.initial=.45} +\ctikzset{tripoles/npn/base height 2/.initial=.15} +\ctikzset{tripoles/npn/base height/.initial=.4} +\ctikzset{tripoles/npn/conn height/.initial=0} +\ctikzset{tripoles/npn/height/.initial=1.1} +\ctikzset{tripoles/npn/base width/.initial=.5} +\ctikzset{tripoles/npn/arrow pos/.initial=.5} +\ctikzset{tripoles/npn/bodydiode scale/.initial=.3} +\ctikzset{tripoles/npn/bodydiode distance/.initial=.3} +\ctikzset{tripoles/npn/bodydiode conn/.initial=.6} +\ctikzset{tripoles/npn/curr direction/.initial=1} + +\ctikzset{tripoles/pnp/width/.initial=.6} +\ctikzset{tripoles/pnp/base height/.initial=.45} +\ctikzset{tripoles/pnp/base height 2/.initial=.15} +\ctikzset{tripoles/pnp/base height/.initial=.4} +\ctikzset{tripoles/pnp/conn height/.initial=0} +\ctikzset{tripoles/pnp/height/.initial=1.1} +\ctikzset{tripoles/pnp/base width/.initial=.5} +\ctikzset{tripoles/pnp/arrow pos/.initial=.5} +\ctikzset{tripoles/pnp/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pnp/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pnp/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pnp/curr direction/.initial=-1} + +\ctikzset{tripoles/pigbt/width/.initial=.6} +\ctikzset{tripoles/pigbt/gate height/.initial=.45} +\ctikzset{tripoles/pigbt/gate height 2/.initial=.15} +\ctikzset{tripoles/pigbt/base height/.initial=.4} +\ctikzset{tripoles/pigbt/outer base height/.initial=.4} +\ctikzset{tripoles/pigbt/outer base thickness/.initial=1} +\ctikzset{tripoles/pigbt/conn height/.initial=0} +\ctikzset{tripoles/pigbt/height/.initial=1.1} +\ctikzset{tripoles/pigbt/gate width/.initial=.62} +\ctikzset{tripoles/pigbt/base width/.initial=.5} +\ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pigbt/curr direction/.initial=-1} + +\ctikzset{tripoles/nigbt/width/.initial=.6} +\ctikzset{tripoles/nigbt/gate height/.initial=.45} +\ctikzset{tripoles/nigbt/gate height 2/.initial=.15} +\ctikzset{tripoles/nigbt/base height/.initial=.4} +\ctikzset{tripoles/nigbt/outer base height/.initial=.4} +\ctikzset{tripoles/nigbt/outer base thickness/.initial=1} +\ctikzset{tripoles/nigbt/conn height/.initial=0} +\ctikzset{tripoles/nigbt/height/.initial=1.1} +\ctikzset{tripoles/nigbt/gate width/.initial=.62} +\ctikzset{tripoles/nigbt/base width/.initial=.5} +\ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nigbt/curr direction/.initial=1} + +\ctikzset{tripoles/Lpigbt/width/.initial=.6} +\ctikzset{tripoles/Lpigbt/gate height/.initial=.45} +\ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15} +\ctikzset{tripoles/Lpigbt/base height/.initial=.4} +\ctikzset{tripoles/Lpigbt/outer base height/.initial=.4} +\ctikzset{tripoles/Lpigbt/outer base thickness/.initial=1} +\ctikzset{tripoles/Lpigbt/conn height/.initial=.4} +\ctikzset{tripoles/Lpigbt/height/.initial=1.1} +\ctikzset{tripoles/Lpigbt/gate width/.initial=.62} +\ctikzset{tripoles/Lpigbt/base width/.initial=.5} +\ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/Lpigbt/curr direction/.initial=-1} + +\ctikzset{tripoles/Lnigbt/width/.initial=.6} +\ctikzset{tripoles/Lnigbt/gate height/.initial=.45} +\ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15} +\ctikzset{tripoles/Lnigbt/base height/.initial=.4} +\ctikzset{tripoles/Lnigbt/outer base height/.initial=.4} +\ctikzset{tripoles/Lnigbt/outer base thickness/.initial=1} +\ctikzset{tripoles/Lnigbt/conn height/.initial=.4} +\ctikzset{tripoles/Lnigbt/height/.initial=1.1} +\ctikzset{tripoles/Lnigbt/gate width/.initial=.62} +\ctikzset{tripoles/Lnigbt/base width/.initial=.5} +\ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/Lnigbt/curr direction/.initial=1} + +\ctikzset{tripoles/igbt/outer base height/.code={ + \ctikzset{tripoles/nigbt/outer base height/.initial=#1} + \ctikzset{tripoles/pigbt/outer base height/.initial=#1} + \ctikzset{tripoles/Lnigbt/outer base height/.initial=#1} + \ctikzset{tripoles/Lpigbt/outer base height/.initial=#1} + \ctikzset{tripoles/Lnigbt/conn height/.initial=#1} + \ctikzset{tripoles/Lpigbt/conn height/.initial=#1} +}} +\ctikzset{tripoles/igbt/outer base thickness/.code={ + \ctikzset{tripoles/nigbt/outer base thickness=#1} + \ctikzset{tripoles/pigbt/outer base thickness=#1} + \ctikzset{tripoles/Lnigbt/outer base thickness=#1} + \ctikzset{tripoles/Lpigbt/outer base thickness=#1} +}} + +\ctikzset{tripoles/njfet/width/.initial=.7} +\ctikzset{tripoles/njfet/gate height/.initial=.5} +\ctikzset{tripoles/njfet/gate height 2/.initial=.35} +\ctikzset{tripoles/njfet/gate width/.initial=.5} +\ctikzset{tripoles/njfet/conn height/.initial=.35} +\ctikzset{tripoles/njfet/height/.initial=1.1} +\ctikzset{tripoles/njfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/njfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/njfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/njfet/curr direction/.initial=1} + +\ctikzset{tripoles/pjfet/width/.initial=.7} +\ctikzset{tripoles/pjfet/gate height/.initial=.5} +\ctikzset{tripoles/pjfet/gate height 2/.initial=.35} +\ctikzset{tripoles/pjfet/gate width/.initial=.5} +\ctikzset{tripoles/pjfet/conn height/.initial=.35} +\ctikzset{tripoles/pjfet/height/.initial=1.1} +\ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pjfet/curr direction/.initial=-1} + +\ctikzset{tripoles/isfet/width/.initial=1} +\ctikzset{tripoles/isfet/gate height/.initial=.35} +\ctikzset{tripoles/isfet/base height/.initial=.5} +\ctikzset{tripoles/isfet/height/.initial=1.1} +\ctikzset{tripoles/isfet/base width/.initial=.3} +\ctikzset{tripoles/isfet/gate width/.initial=.5} +\ctikzset{tripoles/isfet/conn height/.initial=0} +\ctikzset{tripoles/isfet/wave width/.initial=.16} +\ctikzset{tripoles/isfet/wave amp/.initial=.06} +\ctikzset{tripoles/isfet/waves y sep/.initial=.22} +\ctikzset{tripoles/isfet/waves x sep/.initial=.8} +\ctikzset{tripoles/isfet/bodydiode scale/.initial=.3} +\ctikzset{tripoles/isfet/bodydiode distance/.initial=.3} +\ctikzset{tripoles/isfet/bodydiode conn/.initial=.6} +\ctikzset{tripoles/isfet/curr direction/.initial=1} +% +% multi-emitter and multi-collector BJTs by Romano Giannetti +% +\ctikzset{tripoles/bjt/emitters/.initial=1} +\ctikzset{tripoles/bjt/collectors/.initial=1} +\pgfkeys{/tikz/emitters/.add code={}{\ctikzset{tripoles/bjt/emitters=#1}}} +\pgfkeys{/tikz/collectors/.add code={}{\ctikzset{tripoles/bjt/collectors=#1}}} +\ctikzset{tripoles/bjt/pins width/.initial=0.3} +\pgfkeys{/tikz/bjt pins width/.add code={}{\ctikzset{tripoles/bjt/pins width=#1}}} +\ctikzset{tripoles/bjt/multi height/.initial=.5} +\pgfkeys{/tikz/bjt multi height/.add code={}{\ctikzset{tripoles/bjt/multi height/.initial=#1}}} +% +\ctikzset{tripoles/bjt/width/.initial=.3} +\ctikzset{tripoles/bjt/base height 2/.initial=.4} +\ctikzset{tripoles/bjt/base height/.initial=1.1} +\ctikzset{tripoles/bjt/height/.initial=.4} +\ctikzset{tripoles/bjt/base width/.initial=1} +\ctikzset{tripoles/bjt/arrow pos/.initial=.5} +% do NOT touch these two! +\ctikzset{tripoles/bjt/npn/curr direction/.initial=1} +\ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1} + +%% transistors stop here +%%>>> + +% Electronic tubes: diodetube, triode, tetrode and pentode%<<<1 +\ctikzset{tubes/width/.initial=1} % relative width +\ctikzset{tubes/height/.initial=1.4} % relative height +\ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle +\ctikzset{tubes/anode distance/.initial=0.40} % distance from center +\ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate +\ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center +\ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes +\ctikzset{tubes/grid separation/.initial=0.2} % separation between grids +\ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center +\ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid +\ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode +\ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire +\ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side +\ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode +\ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint + +\newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse +\pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} +\ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} +\newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse +\pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} +\ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} +\newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse +\pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}} +\ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}% +%>>> + +%% Logic ports%<<<1 +%% beware that the third option is in IEEE ports in pgfcircmultipoles.tex + +% switches for logic gates +% +\pgfkeys{/tikz/number inputs/.initial=0} +\pgfkeys{/tikz/number inputs/.default=0} + +\newif\ifpgf@circuit@europeanlogicport +\ctikzset{logic ports/.is choice} +\ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue + \tikzset{and port/.style={shape=european and port}}% + \tikzset{or port/.style={shape=european or port}}% + \tikzset{xor port/.style={shape=european xor port}}% + \tikzset{buffer port/.style={shape=european buffer port}}% + \tikzset{not port/.style={shape=european not port}}% + \tikzset{nand port/.style={shape=european nand port}}% + \tikzset{nor port/.style={shape=european nor port}}% + \tikzset{xnor port/.style={shape=european xnor port}}% + % there is no Schmitt ports in european style (yet) + \tikzset{schmitt port/.style={shape=schmitt}}% + \tikzset{invschmitt port/.style={shape=invschmitt}}% +}} +\ctikzset{logic ports/american/.code= {\pgf@circuit@europeanlogicportfalse + \tikzset{and port/.style={shape=american and port}}% + \tikzset{or port/.style={shape=american or port}}% + \tikzset{xor port/.style={shape=american xor port}}% + \tikzset{buffer port/.style={shape=american buffer port}}% + \tikzset{not port/.style={shape=american not port}}% + \tikzset{nand port/.style={shape=american nand port}}% + \tikzset{nor port/.style={shape=american nor port}}% + \tikzset{xnor port/.style={shape=american xnor port}}% + \tikzset{schmitt port/.style={shape=schmitt}}% + \tikzset{invschmitt port/.style={shape=invschmitt}}% +}} + +\ctikzset{logic ports origin/.is choice} +\ctikzset{logic ports origin/legacy/.code={ + \ctikzset{tripoles/american and port/origin/.initial=0.8}% + \ctikzset{tripoles/american nand port/origin/.initial=0.8}% + \ctikzset{tripoles/american nor port/origin/.initial=0.8}% + \ctikzset{tripoles/american or port/origin/.initial=0.8}% + \ctikzset{tripoles/american xor port/origin/.initial=0.8}% + \ctikzset{tripoles/american xnor port/origin/.initial=0.8}% + \ctikzset{tripoles/european and port/origin/.initial=0.8}% + \ctikzset{tripoles/european nand port/origin/.initial=0.8}% + \ctikzset{tripoles/european or port/origin/.initial=0.8}% + \ctikzset{tripoles/european nor port/origin/.initial=0.8}% + \ctikzset{tripoles/european xor port/origin/.initial=0.8}% + \ctikzset{tripoles/european xnor port/origin/.initial=0.8}% + \ctikzset{tripoles/european buffer port/origin/.initial=0.8}% + \ctikzset{tripoles/european not port/origin/.initial=0.8}% + }% +} +\ctikzset{logic ports origin/center/.code={% + \ctikzset{tripoles/american and port/origin/.initial=0}% + \ctikzset{tripoles/american nand port/origin/.initial=0}% + \ctikzset{tripoles/american nor port/origin/.initial=0}% + \ctikzset{tripoles/american or port/origin/.initial=0}% + \ctikzset{tripoles/american xor port/origin/.initial=0}% + \ctikzset{tripoles/american xnor port/origin/.initial=0}% + \ctikzset{tripoles/european and port/origin/.initial=0}% + \ctikzset{tripoles/european nand port/origin/.initial=0}% + \ctikzset{tripoles/european or port/origin/.initial=0}% + \ctikzset{tripoles/european nor port/origin/.initial=0}% + \ctikzset{tripoles/european xor port/origin/.initial=0}% + \ctikzset{tripoles/european xnor port/origin/.initial=0}% + \ctikzset{tripoles/european buffer port/origin/.initial=0}% + \ctikzset{tripoles/european not port/origin/.initial=0}% + }% +} + +\newif\ifpgfcirc@roundy@or@shapes\pgfcirc@roundy@or@shapesfalse +\ctikzset{american or shape/.is choice} +\ctikzset{american or shape/roundy/.code={\pgfcirc@roundy@or@shapestrue}} +\ctikzset{american or shape/pointy/.code={\pgfcirc@roundy@or@shapesfalse}} + +\newif\ifpgfcirc@draw@input@leads\pgfcirc@draw@input@leadstrue +\ctikzset{logic ports draw input leads/.is choice} +\ctikzset{logic ports draw input leads/true/.code={\pgfcirc@draw@input@leadstrue}} +\ctikzset{logic ports draw input leads/false/.code={\pgfcirc@draw@input@leadsfalse}} +\tikzset{input leads/.code={\pgfcirc@draw@input@leadstrue}} +\tikzset{no input leads/.code={\pgfcirc@draw@input@leadsfalse}} + +\newif\ifpgfcirc@draw@output@leads\pgfcirc@draw@output@leadstrue +\ctikzset{logic ports draw output leads/.is choice} +\ctikzset{logic ports draw output leads/true/.code={\pgfcirc@draw@output@leadstrue}} +\ctikzset{logic ports draw output leads/false/.code={\pgfcirc@draw@output@leadsfalse}} +\tikzset{output leads/.code={\pgfcirc@draw@output@leadstrue}} +\tikzset{no output leads/.code={\pgfcirc@draw@output@leadsfalse}} + +\ctikzset{logic ports draw leads/.is choice} +\ctikzset{logic ports draw leads/true/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}} +\ctikzset{logic ports draw leads/false/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}} +\tikzset{all leads/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}} +\tikzset{no leads/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}} + +% adding a different style of xnor port +% see https://github.com/circuitikz/circuitikz/issues/467 +\ctikzset{european xnor style/.is choice} +\ctikzset{european xnor style/default/.code={% + \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}}% +} +\ctikzset{european xnor style/direct/.code={% + \pgfcircdeclareeurologicport{xnor}{$=$}{\pgf@circ@res@count}{}}% +} + + +% old, legacy keys that should be killed over +\ctikzset{bipoles/buffer/height/.initial=1} +\ctikzset{bipoles/buffer/width/.initial=1} +\ctikzset{bipoles/not port/width/.initial=1} +\ctikzset{bipoles/not port/height/.initial=.8} +\ctikzset{bipoles/not port/circle width/.initial=.15} + +\ctikzset{tripoles/american and port/width/.initial=1.1} +\ctikzset{tripoles/american and port/height/.initial=.8} +\ctikzset{tripoles/american and port/port width/.initial=.7} +\ctikzset{tripoles/american and port/input height/.initial=.5} +\ctikzset{tripoles/american nand port/width/.initial=1.1} +\ctikzset{tripoles/american nand port/height/.initial=.8} +\ctikzset{tripoles/american nand port/port width/.initial=.7} +\ctikzset{tripoles/american nand port/circle width/.initial=.15} +\ctikzset{tripoles/american nand port/input height/.initial=.5} +\ctikzset{tripoles/american or port/width/.initial=1.1} +\ctikzset{tripoles/american or port/height/.initial=.8} +\ctikzset{tripoles/american or port/port width/.initial=.7} +\ctikzset{tripoles/american or port/input height/.initial=.5} +\ctikzset{tripoles/american or port/input skip/.initial=.25} +\ctikzset{tripoles/american or port/aaa/.initial=.6} +\ctikzset{tripoles/american or port/bbb/.initial=.4} +\ctikzset{tripoles/american or port/ccc/.initial=.5} +\ctikzset{tripoles/american or port/ddd/.initial=.0} +\ctikzset{tripoles/american nor port/width/.initial=1.1} +\ctikzset{tripoles/american nor port/height/.initial=.8} +\ctikzset{tripoles/american nor port/port width/.initial=.7} +\ctikzset{tripoles/american nor port/input height/.initial=.5} +\ctikzset{tripoles/american nor port/input skip/.initial=.25} +\ctikzset{tripoles/american nor port/circle width/.initial=.15} +\ctikzset{tripoles/american nor port/aaa/.initial=.6} +\ctikzset{tripoles/american nor port/bbb/.initial=.4} +\ctikzset{tripoles/american nor port/ccc/.initial=.5} +\ctikzset{tripoles/american nor port/ddd/.initial=.0} +\ctikzset{tripoles/american xor port/width/.initial=1.1} +\ctikzset{tripoles/american xor port/height/.initial=.8} +\ctikzset{tripoles/american xor port/port width/.initial=.7} +\ctikzset{tripoles/american xor port/input height/.initial=.5} +\ctikzset{tripoles/american xor port/input skip/.initial=.15} +\ctikzset{tripoles/american xor port/distance/.initial=.1} +\ctikzset{tripoles/american xnor port/width/.initial=1.1} +\ctikzset{tripoles/american xnor port/height/.initial=.8} +\ctikzset{tripoles/american xnor port/port width/.initial=.7} +\ctikzset{tripoles/american xnor port/input height/.initial=.5} +\ctikzset{tripoles/american xnor port/input skip/.initial=.15} +\ctikzset{tripoles/american xnor port/distance/.initial=.1} +\ctikzset{tripoles/american xnor port/circle width/.initial=.15} +\ctikzset{tripoles/american and port/origin/.initial=0.8} +\ctikzset{tripoles/american and port/inputs/.initial=2} +% variable number of inputs +\ctikzset{tripoles/american nand port/origin/.initial=0.8} +\ctikzset{tripoles/american nand port/inputs/.initial=2} +\ctikzset{tripoles/american nor port/origin/.initial=0.8} +\ctikzset{tripoles/american nor port/inputs/.initial=2} +\ctikzset{tripoles/american nor port/angle/.initial=70} +\ctikzset{tripoles/american nor port/inner/.initial=0.3} +\ctikzset{tripoles/american or port/origin/.initial=0.8} +\ctikzset{tripoles/american or port/inputs/.initial=2} +\ctikzset{tripoles/american or port/angle/.initial=70} +\ctikzset{tripoles/american or port/inner/.initial=0.3} +\ctikzset{tripoles/american xor port/origin/.initial=0.8} +\ctikzset{tripoles/american xor port/inputs/.initial=2} +\ctikzset{tripoles/american xor port/angle/.initial=70} +\ctikzset{tripoles/american xor port/inner/.initial=0.3} +\ctikzset{tripoles/american xnor port/origin/.initial=0.8} +\ctikzset{tripoles/american xnor port/inputs/.initial=2} +\ctikzset{tripoles/american xnor port/angle/.initial=70} +\ctikzset{tripoles/american xnor port/inner/.initial=0.3} + +\ctikzset{tripoles/european and port/width/.initial=1.4} +\ctikzset{tripoles/european and port/height/.initial=.65} +\ctikzset{tripoles/european and port/reserved/.initial=.6} +\ctikzset{tripoles/european and port/input height/.initial=.6} +\ctikzset{tripoles/european or port/width/.initial=1.4} +\ctikzset{tripoles/european or port/height/.initial=.65} +\ctikzset{tripoles/european or port/reserved/.initial=.6} +\ctikzset{tripoles/european or port/input height/.initial=.6} +\ctikzset{tripoles/european xor port/width/.initial=1.4} +\ctikzset{tripoles/european xor port/height/.initial=.65} +\ctikzset{tripoles/european xor port/reserved/.initial=.6} +\ctikzset{tripoles/european xor port/input height/.initial=.6} +\ctikzset{tripoles/european nand port/width/.initial=1.4} +\ctikzset{tripoles/european nand port/not height/.initial=.3} +\ctikzset{tripoles/european nand port/not width/.initial=.8} +\ctikzset{tripoles/european nand port/height/.initial=.65} +\ctikzset{tripoles/european nand port/reserved/.initial=.6} +\ctikzset{tripoles/european nand port/input height/.initial=.6} +\ctikzset{tripoles/european buffer port/width/.initial=1.4} +\ctikzset{tripoles/european buffer port/not height/.initial=.3} +\ctikzset{tripoles/european buffer port/not width/.initial=.8} +\ctikzset{tripoles/european buffer port/height/.initial=.65} +\ctikzset{tripoles/european buffer port/reserved/.initial=.6} +\ctikzset{tripoles/european buffer port/input height/.initial=0} +\ctikzset{tripoles/european not port/width/.initial=1.4} +\ctikzset{tripoles/european not port/not height/.initial=.3} +\ctikzset{tripoles/european not port/not width/.initial=.8} +\ctikzset{tripoles/european not port/height/.initial=.65} +\ctikzset{tripoles/european not port/reserved/.initial=.6} +\ctikzset{tripoles/european not port/input height/.initial=0} +\ctikzset{tripoles/european xnor port/width/.initial=1.4} +\ctikzset{tripoles/european xnor port/not height/.initial=.3} +\ctikzset{tripoles/european xnor port/not width/.initial=.8} +\ctikzset{tripoles/european xnor port/height/.initial=.65} +\ctikzset{tripoles/european xnor port/reserved/.initial=.6} +\ctikzset{tripoles/european xnor port/input height/.initial=.6} +\ctikzset{tripoles/european nor port/width/.initial=1.4} +\ctikzset{tripoles/european nor port/not height/.initial=.3} +\ctikzset{tripoles/european nor port/not width/.initial=.8} +\ctikzset{tripoles/european nor port/height/.initial=.65} +\ctikzset{tripoles/european nor port/reserved/.initial=.6} +\ctikzset{tripoles/european nor port/input height/.initial=.6} +% variable number of inputs +\ctikzset{tripoles/european and port/origin/.initial=0.8} +\ctikzset{tripoles/european and port/inputs/.initial=2} +\ctikzset{tripoles/european nand port/origin/.initial=0.8} +\ctikzset{tripoles/european nand port/inputs/.initial=2} +\ctikzset{tripoles/european or port/origin/.initial=0.8} +\ctikzset{tripoles/european or port/inputs/.initial=2} +\ctikzset{tripoles/european nor port/origin/.initial=0.8} +\ctikzset{tripoles/european nor port/inputs/.initial=2} +\ctikzset{tripoles/european xor port/origin/.initial=0.8} +\ctikzset{tripoles/european xor port/inputs/.initial=2} +\ctikzset{tripoles/european xnor port/origin/.initial=0.8} +\ctikzset{tripoles/european xnor port/inputs/.initial=2} +\ctikzset{tripoles/european buffer port/origin/.initial=0.8} +\ctikzset{tripoles/european buffer port/inputs/.initial=1}% +\ctikzset{tripoles/european not port/origin/.initial=0.8} +\ctikzset{tripoles/european not port/inputs/.initial=1}% +%%% parameters that are not used anymore after multi-input +%%% gates --- left for compatibility of source code. +\ctikzset{tripoles/american xor port/aaa/.initial=.6} +\ctikzset{tripoles/american xor port/bbb/.initial=.4} +\ctikzset{tripoles/american xor port/ccc/.initial=.5} +\ctikzset{tripoles/american xor port/ddd/.initial=.0} +\ctikzset{tripoles/american xnor port/aaa/.initial=.6} +\ctikzset{tripoles/american xnor port/bbb/.initial=.4} +\ctikzset{tripoles/american xnor port/ccc/.initial=.5} +\ctikzset{tripoles/american xnor port/ddd/.initial=.0} +%%>>> + +% flip flops and muxdemxes%<<<1 + +%% flip-flop specific keys (most others are the same as chips) + +\ctikzset{multipoles/flipflop/font/.initial=\pgf@circ@font@small} +\ctikzset{multipoles/flipflop/fontud/.initial=\pgf@circ@font@tiny} +\ctikzset{multipoles/flipflop/width/.initial=1.2} +\ctikzset{multipoles/flipflop/pin spacing/.initial=0.6} +\ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2} + +%% muxdemuxes keys + +\ctikzset{multipoles/muxdemux/base len/.initial=0.4} +\ctikzset{multipoles/muxdemux/Lh/.initial=8.0} +\ctikzset{multipoles/muxdemux/Rh/.initial=6.0} +\ctikzset{multipoles/muxdemux/w/.initial=3.0} +\ctikzset{multipoles/muxdemux/inset w/.initial=0.0} +\ctikzset{multipoles/muxdemux/inset Lh/.initial=0.0} +\ctikzset{multipoles/muxdemux/inset Rh/.initial=0.0} +\ctikzset{multipoles/muxdemux/NL/.initial=8} +\ctikzset{multipoles/muxdemux/NR/.initial=1} +\ctikzset{multipoles/muxdemux/NB/.initial=3} +\ctikzset{multipoles/muxdemux/NT/.initial=0} +\ctikzset{multipoles/muxdemux/square pins/.initial=0}% +%>>> + +% Amplifiers%<<<1 +% +% switches for op amps +% changing input polarity +% +\newif\ifpgf@circuit@oa@iplusup\pgf@circuit@oa@iplusupfalse +\pgfkeys{/tikz/noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}} +\ctikzset{noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}} +\pgfkeys{/tikz/noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}} +\ctikzset{noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}} +% +% changing output polarity (for fully diff objects) +% +\newif\ifpgf@circuit@oa@oplusup\pgf@circuit@oa@oplusuptrue +\pgfkeys{/tikz/noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} +\ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} +\pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} +\ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} + +% Operational amplifier +\ctikzset{tripoles/op amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/op amp/height/.initial=1.4} % Total height +\ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation +\ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position +\ctikzset{tripoles/op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +% Fully differential operational amplifier +\ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height +\ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation +\ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation +\ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position +\ctikzset{tripoles/fd op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +\ctikzset{tripoles/en amp/width/.initial=1.7} +\ctikzset{tripoles/en amp/port width/.initial=.7} +\ctikzset{tripoles/en amp/height/.initial=1.6} +\ctikzset{tripoles/en amp/input height/.initial=.3} +\ctikzset{tripoles/en amp/up pos/.initial=.45} +\ctikzset{tripoles/en amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! +\ctikzset{tripoles/en amp/font2/.initial=\pgf@circ@font@twelve} % Absolute font size needed! +\ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}} +\tikzset{ + en amp text/.code = {% + \ctikzsetvalof{tripoles/en amp/text}{#1}% + }, + en amp text A/.code = {% + \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}% + }, +} + +% Transconductance amplifier +\ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid +\ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid +\ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation +\ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position +\ctikzset{tripoles/gm amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +% Instrumentation amplifier +\ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid +\ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid +\ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation +\ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position +\ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position +\ctikzset{tripoles/inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +% Instrumentation amplifier with differential output +\ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid +\ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid +\ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation +\ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation +\ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position +\ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position +\ctikzset{tripoles/fd inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +% Instrumentation amplifier with gain resistor terminals +\ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width +\ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid +\ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid +\ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation +\ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position +\ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position +\ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation +\ctikzset{tripoles/inst amp ra/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! + +% Plain amplifier +\ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width +\ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length +\ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height +\ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation +\ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position + +% changing fonts and symbols of amplifiers +\ctikzset{amplifiers/symbol font/.code={% + \ctikzset{tripoles/inst amp ra/font=#1}% + \ctikzset{tripoles/fd inst amp/font=#1}% + \ctikzset{tripoles/inst amp/font=#1}% + \ctikzset{tripoles/gm amp/font=#1}% + \ctikzset{tripoles/en amp/font=#1}% + \ctikzset{tripoles/fd op amp/font=#1}% + \ctikzset{tripoles/op amp/font=#1}% +}} +\ctikzset{amplifiers/plus/.initial={$+$}} +\ctikzset{amplifiers/minus/.initial={$-$}} +\tikzset{amp symbol font/.code={% + \ctikzset{amplifiers/symbol font={#1}}% + } +} +\tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}} +\tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}} +\def\pgf@circ@ampli@plus{\ctikzvalof{amplifiers/plus}} +\def\pgf@circ@ampli@minus{\ctikzvalof{amplifiers/minus}} +%%>>> + +% Transformers%<<<1 + +\ctikzset{quadpoles/transformer/inner/.initial=0.4} +\ctikzset{quadpoles/transformer/width/.initial=1.5} +\ctikzset{quadpoles/transformer/width1/.initial=.4} +\ctikzset{quadpoles/transformer/height/.initial=1.5} +\ctikzset{quadpoles/transformer/height1/.initial=.8} +\ctikzset{quadpoles/transformer core/inner/.initial=0.4} +\ctikzset{quadpoles/transformer core/width/.initial=1.5} +\ctikzset{quadpoles/transformer core/height/.initial=1.5} +\ctikzset{quadpoles/transformer core/core height/.initial=.5} +\ctikzset{quadpoles/transformer core/core width/.initial=.05} +\ctikzset{quadpoles/gyrator/inner/.initial=0.4} +\ctikzset{quadpoles/gyrator/width/.initial=1.5} +\ctikzset{quadpoles/gyrator/height/.initial=1.5} +\ctikzset{quadpoles/fourport/width/.initial=1.3} +\ctikzset{quadpoles/fourport/height/.initial=1.3} +\ctikzset{quadpoles/coupler/width/.initial=1.3} +\ctikzset{quadpoles/coupler/height/.initial=1.3} +\ctikzset{quadpoles/coupler2/width/.initial=1.3} +\ctikzset{quadpoles/coupler2/height/.initial=1.3} + +\ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1} + +\ctikzset{quadpoles style/.is choice} +\ctikzset{quadpoles style/inward/.code={% default value + \ctikzset{quadpoles/transformer/inner=0.4}% + \ctikzset{quadpoles/transformer/width=1.5}% + \ctikzset{quadpoles/transformer core/inner=0.4}% + \ctikzset{quadpoles/transformer core/width=1.5}% + \ctikzset{quadpoles/gyrator/inner=0.4}% + \ctikzset{quadpoles/gyrator/width=1.5}% + }% +} +\ctikzset{quadpoles style/inline/.code={% now horizontal baffle + \ctikzset{quadpoles/transformer/inner=1}% + \ctikzset{quadpoles/transformer/width=0.6}% + \ctikzset{quadpoles/transformer core/inner=1}% + \ctikzset{quadpoles/transformer core/width=0.6}% + \ctikzset{quadpoles/gyrator/inner=1} % FIXME + \ctikzset{quadpoles/gyrator/width=0.6}% + }% +} +%%>>> + +% seven segment displays by RGtti%<<<1 + +\newif\ifpgf@circ@sevenseg@dot +\newif\ifpgf@circ@sevenseg@box +\def\pgf@circ@sevenseg@dotstate{empty} +\ctikzset{seven seg/.is family} +\ctikzset{seven seg/dot/.is choice} +% none means no dot, not space for it. Empty means no dot, but space +\ctikzset{seven seg/dot/none/.code={\pgf@circ@sevenseg@dotfalse}} +\ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}} +\ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}} +\ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}} +% +\ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen +\ctikzset{seven seg/thickness/.initial=4pt}% segment thickness +\ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments +\ctikzset{seven seg/box sep/.initial=1pt}% external box gap +\ctikzset{seven seg/color on/.initial=red}% color for segment "on" +\ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off" +\ctikzset{seven seg/box/.is choice} +\ctikzset{seven seg/box/off/.code={\pgf@circ@sevenseg@boxfalse}} +\ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@boxtrue}} + +\ctikzset{seven seg/bits/.initial=0000000} + +\ctikzset{seven seg/value/.code={% + \edef\@@tmp{#1}% + \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi + \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi + \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi + \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi + \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi + \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi + \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi + \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi + \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi + \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi + \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi + \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi + \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi + \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi + \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi + \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi + \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi + \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi + \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi + \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi + \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi + \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi + \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi + \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi + \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi + \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi + \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi + \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi + \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi +}} + +\tikzset{% + seven segment val/.style args={#1dot#2box#3}{% + shape=bare7seg, + /tikz/circuitikz/seven seg/value=#1, + /tikz/circuitikz/seven seg/dot=#2, + /tikz/circuitikz/seven seg/box=#3, + }, + seven segment bits/.style args={#1dot#2box#3}{% + shape=bare7seg, + /tikz/circuitikz/seven seg/bits=#1, + /tikz/circuitikz/seven seg/dot=#2, + /tikz/circuitikz/seven seg/box=#3, + }, +} +%%>>> + +% Options for twoports and blocks%<<<1 + +% Option ">" for twoports +\newif\ifpgf@circuit@inputarrow +\ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}} +\ctikzset{inputarrow/.is choice} +\ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}} +\ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}} + +% Option "boxed" for nodes and twoports +\newif\ifpgf@circuit@boxed +\pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue}} +\ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue}} +\pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue}} +\ctikzset{box/.add code={}{\pgf@circuit@boxedtrue}} + +% Option "dashed" for nodes and twoports +\newif\ifpgf@circuit@dashed +\pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}} +\ctikzset{dashed/.add code={}{\pgf@circuit@dashedtrue}}% +%>>> + +% Chips and Rotary switches (multipoles) %<<<1 +% +\ctikzset{multipoles/thickness/.initial=2} +\ctikzset{multipoles/font/.initial=\pgf@circ@font@tiny} +% DIP (dual in line package) chips +\ctikzset{multipoles/dipchip/width/.initial=1.2} +\ctikzset{multipoles/dipchip/num pins/.initial=8} +\ctikzset{multipoles/dipchip/pin spacing/.initial=0.4} +\pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/dipchip/num pins=#1}}} +% QFP (quad flat package) chips +\ctikzset{multipoles/qfpchip/num pins/.initial=8} +\ctikzset{multipoles/qfpchip/pin spacing/.initial=0.4} +\pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/qfpchip/num pins=#1}}} +% chip numbers +\newif\ifpgf@circuit@chip@shownumbers\pgf@circuit@chip@shownumberstrue +\pgfkeys{/tikz/show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}} +\ctikzset{show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}} +\pgfkeys{/tikz/hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}} +\ctikzset{hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}} +\newif\ifpgf@circuit@chip@straightnumbers\pgf@circuit@chip@straightnumberstrue +\pgfkeys{/tikz/straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}} +\ctikzset{straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}} +\pgfkeys{/tikz/rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}} +\ctikzset{rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}} +% external chip pins +\ctikzset{multipoles/external pins thickness/.initial=1} +\ctikzset{multipoles/external pins width/.initial=0.2} +\ctikzset{multipoles/external pad fraction/.initial=0} +\pgfkeys{/tikz/external pins width/.add code={}{\ctikzset{multipoles/external pins width=#1}}} +\pgfkeys{/tikz/external pad fraction/.add code={}{\ctikzset{multipoles/external pad fraction=#1}}} +% topmarks +\newif\ifpgf@circuit@chip@topmark\pgf@circuit@chip@topmarktrue +\pgfkeys{/tikz/topmark/.add code={}{\pgf@circuit@chip@topmarktrue}} +\ctikzset{topmark/.add code={}{\pgf@circuit@chip@topmarktrue}} +\pgfkeys{/tikz/no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}} +\ctikzset{no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}} + +% rotary switch by Romano +\ctikzset{multipoles/rotary/thickness/.initial=1} +\ctikzset{multipoles/rotary/shape/.initial=ocirc} +\ctikzset{multipoles/rotary/channels/.initial=5} +\ctikzset{multipoles/rotary/angle/.initial=60} +\ctikzset{multipoles/rotary/wiper/.initial=20} +\ctikzset{multipoles/rotary/arrow/.is choice} +\newif\ifpgf@circ@rotaryarrow\pgf@circ@rotaryarrowfalse +\newif\ifpgf@circ@rotaryarrow@cw\pgf@circ@rotaryarrow@cwfalse +\newif\ifpgf@circ@rotaryarrow@ccw\pgf@circ@rotaryarrow@ccwfalse +\ctikzset{multipoles/rotary/arrow/none/.code={\pgf@circ@rotaryarrowfalse\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwfalse}} +\ctikzset{multipoles/rotary/arrow/both/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwtrue}} +\ctikzset{multipoles/rotary/arrow/cw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwfalse}} +\ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwtrue}} + +\tikzset{% + rotary switch/.style args={#1in#2wiper#3}{% + shape=rotaryswitch, + /tikz/circuitikz/multipoles/rotary/channels=#1, + /tikz/circuitikz/multipoles/rotary/angle=#2, + /tikz/circuitikz/multipoles/rotary/wiper=#3, + }, + rotary switch -/.style args={#1in#2wiper#3}{ + rotary switch=#1 in #2 wiper #3, + /tikz/circuitikz/multipoles/rotary/arrow=none, + }, + rotary switch <-/.style args={#1in#2wiper#3}{ + rotary switch=#1 in #2 wiper #3, + /tikz/circuitikz/multipoles/rotary/arrow=ccw, + }, + rotary switch ->/.style args={#1in#2wiper#3}{ + rotary switch=#1 in #2 wiper #3, + /tikz/circuitikz/multipoles/rotary/arrow=cw, + }, + rotary switch <->/.style args={#1in#2wiper#3}{ + rotary switch=#1 in #2 wiper #3, + /tikz/circuitikz/multipoles/rotary/arrow=both, + }, + % Notice that these should be the same as the initial values of the keys + rotary switch/.default={5 in 60 wiper 20}, + rotary switch -/.default={5 in 60 wiper 20}, + rotary switch <-/.default={5 in 60 wiper 20}, + rotary switch ->/.default={5 in 60 wiper 20}, + rotary switch <->/.default={5 in 60 wiper 20}, +} +%%>>> + +% %Mechanical section%<<<1 +\ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8} +\ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6} +\ctikzset{bipoles/spring/height/.initial=.5} +\ctikzset{bipoles/spring/width/.initial=.5} +\ctikzset{bipoles/inerter/height/.initial=.7} +\ctikzset{bipoles/inerter/width/.initial=.175} +\ctikzset{bipoles/mass/height/.initial=.55} +\ctikzset{bipoles/mass/box height/.initial=.4} +\ctikzset{bipoles/mass/width/.initial=.5} + +\ctikzset{bipoles/damper/height/.initial=.35} +\ctikzset{bipoles/damper/length/.initial=.3} +\ctikzset{bipoles/damper/width/.initial=.4} +%%>>> + +% powerelectronic blocks%<<<1 +\ctikzset{bipoles/sacdc/width/.initial=.7} +\ctikzset{bipoles/sdcac/width/.initial=.7} +\ctikzset{bipoles/tacdc/width/.initial=.7} +\ctikzset{bipoles/tdcac/width/.initial=.7} +\ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole? +%>>> + +% voltage and current options%<<<1 +% +\ctikzset{current arrow scale/.initial=16} +\ctikzset{current/distance/.initial = .5} + +\newif\ifpgf@circuit@europeancurrent +\newif\ifpgf@circuit@europeanvoltage +\newif\ifpgf@circuit@bipole@voltage@straight +\newif\ifpgf@circuit@bipole@voltage@raised + +\ctikzset{voltage/.is choice} +% +% straight is expected to be a subset of european, so disable it in american style +% +\ctikzset{voltage/american/.code = {% + \pgf@circuit@europeanvoltagefalse + \pgf@circuit@bipole@voltage@straightfalse + \pgf@circuit@bipole@voltage@raisedfalse +}} +\ctikzset{voltage/raised/.code = {% + \pgf@circuit@europeanvoltagefalse + \pgf@circuit@bipole@voltage@straightfalse + \pgf@circuit@bipole@voltage@raisedtrue +}} +\ctikzset{voltage/european/.code = {% + \pgf@circuit@europeanvoltagetrue + \pgf@circuit@bipole@voltage@straightfalse + \pgf@circuit@bipole@voltage@raisedfalse +}} +\ctikzset{voltage/straight/.code = {% + \pgf@circuit@europeanvoltagetrue + \pgf@circuit@bipole@voltage@straighttrue + \pgf@circuit@bipole@voltage@raisedfalse +}} +\ctikzset{voltage/curved/.code = {% + \pgf@circuit@europeanvoltagetrue + \pgf@circuit@bipole@voltage@straightfalse + \pgf@circuit@bipole@voltage@raisedfalse +}} +% are these used? +\ctikzset{current/.is choice} +\ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse} +\ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue} + +% this is left for backward compatibility... +\ctikzset{straight/.is choice} +\ctikzset{straight/true/.code = {\pgf@circuit@bipole@voltage@straighttrue}} +\ctikzset{straight/false/.code = {\pgf@circuit@bipole@voltage@straightfalse}} +\ctikzset{bipole/straight/.is if=pgf@circuit@bipole@voltage@straight} +% +% voltage is used also to set parameters, apart for the /.is choice +% above. I hope it is ok --- would be a mess otherwise +% +\ctikzset{voltage/shift/.initial=0.0} % shift form the cable of voltage symbols +\ctikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}} +\tikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}} +% +% keys for exporting voltage, current, flow anchors +% +\newif\ifpgfcirc@has@v\pgfcirc@has@vfalse +\newif\ifpgfcirc@has@f\pgfcirc@has@ffalse +\newif\ifpgfcirc@has@i\pgfcirc@has@ifalse +\def\ctikzgetanchor#1#2{\csname pgfcirc@#1-#2-anchor\endcsname} +\def\ctikzgetdirection#1{\csname pgfcirc@#1-direction\endcsname} +% +% shaping the +/- sign, see pgfcircvoltage.tex +\ctikzset{voltage/american font/.initial={}} +\ctikzset{voltage/american plus/.initial={$+$}} +\ctikzset{voltage/american minus/.initial={$-$}} +% here we start the voltage adjustments for special components. +% default values: +% +% this is the distance of the "point" marking the voltage along the line +% 0.0 is on the external nodes of the to path +% 1.0 is cramped on the object +% this can be overriden component by component +\ctikzset{voltage/distance from node/.initial=.5}% pos, 0->1 +% +% this is the distance from the line (perpendicular to) where the voltage is drawn. +% It is global, and not adjustable by component (use the "label distance" or locally +% if you need it) +\ctikzset{voltage/distance from line/.initial=.08}% in \pgf@circ@scaled@Rlen units +% +% bend paramenters for european arc. You can override them component-based +\ctikzset{voltage/bump b/.initial=1.5} +% +% generator voltages symbols or arrows (always straight) are put along the +% 60 ... 120 angles of the symbol (don't ask why). The distance here is on the +% center..angle line. It's called bump a because I don't know... +% +\ctikzset{voltage/bump a/.initial=1.2} +% +% these are the label distances FROM the drawings. +% You can override them component by component. +\ctikzset{voltage/european label distance/.initial=1.4} +\ctikzset{voltage/straight label distance/.initial=1.4} +\ctikzset{voltage/american label distance/.initial=1.4} +% american open voltage adjusting +% +\newif\ifpgf@adjust@open@voltage\pgf@adjust@open@voltagetrue +\ctikzset{open voltage position/.is choice} +\ctikzset{open voltage position/center/.code={\pgf@adjust@open@voltagetrue}} +\ctikzset{open voltage position/legacy/.code={\pgf@adjust@open@voltagefalse}} +% bad names, kept for compatibility, don't use +\ctikzset{american open voltage/.is choice} +\ctikzset{american open voltage/center/.code={\pgf@adjust@open@voltagetrue}} +\ctikzset{american open voltage/legacy/.code={\pgf@adjust@open@voltagefalse}} +% +% voltage and current styles +% +\tikzset{american currents/.style = {\circuitikzbasekey/current = american}} +\tikzset{european currents/.style = {\circuitikzbasekey/current = european}} +\tikzset{american voltages/.style = {\circuitikzbasekey/voltage = american}} +\tikzset{european voltages/.style = {\circuitikzbasekey/voltage = european}} +\tikzset{straight voltages/.style = {\circuitikzbasekey/voltage = straight}} +\tikzset{raised voltages/.style = {\circuitikzbasekey/voltage = raised}} +%%>>> + +% special cases for voltage positions%<<<1 +% the KIND is the node name without SHAPE +% See the definition above for meaning +% if bipoles/KIND/voltage/straight label distance is not defined, it uses the height +% if bipoles/KIND/voltage/additional shift is not defined, it is 0 (extra distance) +% +\ctikzset{bipoles/generic/voltage/distance from node/.initial=0.4} +\ctikzset{bipoles/generic/voltage/bump b/.initial=2} +% +\ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4} +\ctikzset{bipoles/ageneric/voltage/bump b/.initial=2} +% +\ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4} +\ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2} +% +\ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4} +\ctikzset{bipoles/memristor/voltage/bump b/.initial=2} +% +\ctikzset{bipoles/tline/voltage/bump b/.initial=2.4} +% +\ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4} +\ctikzset{bipoles/varistor/voltage/american label distance/.initial=1.8} +% +\ctikzset{bipoles/photoresistor/voltage/bump b/.initial=1.6} +% +\ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4} +\ctikzset{bipoles/thermistor/voltage/european label distance/.initial=0.8} +\ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6} +\ctikzset{bipoles/thermistorntc/voltage/european label distance/.initial=0.8} +\ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6} +\ctikzset{bipoles/thermistorptc/voltage/european label distance/.initial=0.8} +% +\ctikzset{bipoles/ccapacitor/voltage/bump b/.initial=2.2} +% +\ctikzset{bipoles/emptyzzdiode/voltage/bump b/.initial=2.5} +\ctikzset{bipoles/emptyzzdiode/voltage/european label distance/.initial=1.0} +\ctikzset{bipoles/fullzzdiode/voltage/bump b/.initial=2.5} +\ctikzset{bipoles/fullzzdiode/voltage/european label distance/.initial=1.0} +\ctikzset{bipoles/emptythyristor/voltage/bump b/.initial=2.0} +\ctikzset{bipoles/emptythyristor/voltage/european label distance/.initial=1.2} +\ctikzset{bipoles/fullthyristor/voltage/bump b/.initial=2.0} +\ctikzset{bipoles/fullthyristor/voltage/european label distance/.initial=1.2} +\ctikzset{bipoles/emptytriac/voltage/bump b/.initial=1.8} +\ctikzset{bipoles/emptytriac/voltage/european label distance/.initial=0.8} +\ctikzset{bipoles/fulltriac/voltage/bump b/.initial=1.8} +\ctikzset{bipoles/fulltriac/voltage/european label distance/.initial=0.8} +% +\ctikzset{bipoles/short/voltage/american label distance/.initial=2.8} +\ctikzset{bipoles/open/voltage/distance from node/.initial=0.3} +% +\ctikzset{bipoles/battery/voltage/bump a/.initial=1.4} +\ctikzset{bipoles/vsourceAM/voltage/american label distance/.initial=1.2} +\ctikzset{bipoles/cvsourceAM/voltage/american label distance/.initial=1.2} +%%>>> + +% vim: set fdm=marker fmr=%<<<,%>>>: +%%%---------- close: tex/pgfcirc.defines +%%%%%%%%%%% Springe nach tex/pgfcircutils +%%%---------- open: tex/pgfcircutils.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +\def\pgf@circ@handleSI#1{ + \noexpandarg + \def\pgf@temp{} + \StrBetween{#1}{<}{>}[\pgf@circ@handleSI@unit] + \StrLen{\pgf@circ@handleSI@unit}[\pgf@circ@handleSI@unit@len] + + \ifnum\pgf@circ@handleSI@unit@len=0 + \pgf@circ@siunitx@resfalse + \else + \IfEndWith{#1}{>}{ + \pgf@circ@siunitx@restrue + \noexpandarg + \StrBefore{#1}{<}[\pgf@circ@handleSI@val] + %\typeout{si |#1|} + }{ + \pgf@circ@siunitx@resfalse + %\typeout{no si |#1|} + } +\fi +} + +\def\pgf@circ@ifkeyempty#1{ + \pgfextra{ + \ctikzset{#1/.get=\pgf@circ@temp} + \edef\pgf@temp{} + } + \ifx\pgf@circ@temp\pgf@temp + } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Math routines + +\def\pgf@circ@stripdecimals#1.#2\pgf@nil{#1} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% useful commands + +\ifpgfutil@format@is@latex + %% flipping text + \def\ctikzflipx#1{\scalebox{-1}[1]{#1}} + \def\ctikzflipy#1{\scalebox{1}[-1]{#1}} + \def\ctikzflipxy#1{\scalebox{-1}[-1]{#1}} + % text mode overbar + % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080 + \def\ctikztextnot#1{$\overline{\hbox{#1}}\m@th$} +\else\ifpgfutil@format@is@plain + % text mode overbar + % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080 + \def\ctikztextnot#1{$\overline{\hbox{#1}}$} +\else\ifpgfutil@format@is@context + % text mode overbar + % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080 + \def\ctikztextnot#1{$\overline{\hbox{#1}}$} +\fi\fi\fi + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% switch to use fpu in reciprocal scale transformations +%% +%% this code has been contributed by Schrödinger's cat +%% https://tex.stackexchange.com/a/529159/38080 +%% +%% Use the official key to use the fpu if installed, see +%% https://github.com/pgf-tikz/pgf/issues/861 +%% +%% Thanks to "muzimuzhi Z" https://tex.stackexchange.com/a/547085/38080 +%% +\pgfkeysifdefined{/pgf/fpu/install only/.@cmd}{% + \pgfqkeys{/pgf}{use fpu reciprocal/.code={\pgfkeys{/pgf/fpu/install only={reciprocal}}}}% + }{% + \pgfqkeys{/pgf}{use fpu reciprocal/.code={% + \def\pgfmathreciprocal@##1{% + \begingroup + \pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}% + \pgfmathparse{1/##1}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + }}}% +} + +%%%---------- close: tex/pgfcircutils + +%%%%%%%%%%% Springe nach tex/pgfcircshapes +%%%---------- open: tex/pgfcircshapes.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Other shapes + +%% Nothing + +\pgfdeclareshape{emptyshape}{ + \savedanchor{\northeast}{% + \pgf@x=.5\wd\pgfnodeparttextbox% + \pgf@y=.5\ht\pgfnodeparttextbox% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + \anchor{center}{ + \pgfpointorigin + } +} +% +% Provision for changing opacity. Only expert use, see the manual. +% +\ctikzset{poles/open fill opacity/.initial=1.0}% better not touch it +\tikzset{open poles opacity/.code={% + \ctikzset{poles/open fill opacity=#1}% +}} +\ctikzset{poles/full fill opacity/.initial=1.0}% better not touch it +\tikzset{full poles opacity/.code={% + \ctikzset{poles/full fill opacity=#1}% +}} + +% +% Provision for changing default background +% + +\ctikzset{open poles fill/.initial={white}} + +%% Full terminal + +\pgfdeclareshape{circ}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}} + } + \behindforegroundpath{ + + \pgfscope + \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgfsetcolor{\ctikzvalof{color}} + \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0 + \pgfusepath{draw,fill} + \endpgfscope + + } +} + +%% Empty round terminal + +\pgfdeclareshape{ocirc}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}} + } + + \behindforegroundpath{ + + \pgfscope + \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgfsetcolor{\ctikzvalof{color}} + \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white + \pgfsetfillcolor{\ctikzvalof{open poles fill}} + % ...but override it if the class is defined! + % note that this element has no class, but will inherit it when used + % into another component + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \fi + \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0 + \pgfusepath{draw,fill} + \endpgfscope + + } +} + +%% Diamond terminal + +\pgfdeclareshape{diamondpole}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y} + \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)} + \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)} + \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)} + \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)} + \pgfextracty{\pgf@circ@res@up}{\northwest} + % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up} + % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy} + \pgfpointintersectionoflines + {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}} + {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}} + % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y} + \pgf@x=\@@switchx\pgf@x + \pgf@y=\@@switchy\pgf@y + } + \behindforegroundpath{ + \pgfscope + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgftransformrotate{45} + \pgfpathrectanglecorners + {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + \pgfsetcolor{\ctikzvalof{color}} + \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0 + \pgfusepath{draw,fill} + \endpgfscope + } +} + +%% Diamond terminal, unfilled + +\pgfdeclareshape{odiamondpole}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y} + \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)} + \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)} + \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)} + \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)} + \pgfextracty{\pgf@circ@res@up}{\northwest} + % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up} + % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy} + \pgfpointintersectionoflines + {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}} + {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}} + % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y} + \pgf@x=\@@switchx\pgf@x + \pgf@y=\@@switchy\pgf@y + } + \behindforegroundpath{ + \pgfscope + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgftransformrotate{45} + \pgfpathrectanglecorners + {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + \pgfsetcolor{\ctikzvalof{color}} + \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white + \pgfsetfillcolor{\ctikzvalof{open poles fill}} + % ...but override it if the class is defined! + % note that this element has no class, but will inherit it when used + % into another component + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \fi + \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0 + \pgfusepath{draw,fill} + \endpgfscope + } +} + +%% square terminal, filled + +\pgfdeclareshape{squarepole}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpointborderrectangle + {\pgfqpoint{\pgf@xa}{\pgf@ya}} + {\pgfqpoint{\pgf@circ@res@up}{\pgf@circ@res@up}} + } + \behindforegroundpath{ + \pgfscope + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgfpathrectanglecorners + {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + \pgfsetcolor{\ctikzvalof{color}} + \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0 + \pgfusepath{draw,fill} + \endpgfscope + } +} +%% square terminal, unfilled + +\pgfdeclareshape{osquarepole}{ + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{ + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpointborderrectangle + {\pgfqpoint{\pgf@xa}{\pgf@ya}} + {\pgfqpoint{\pgf@circ@res@up}{\pgf@circ@res@up}} + } + \behindforegroundpath{ + \pgfscope + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \pgfpathrectanglecorners + {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + \pgfsetcolor{\ctikzvalof{color}} + \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white + \pgfsetfillcolor{\ctikzvalof{open poles fill}} + % ...but override it if the class is defined! + % note that this element has no class, but will inherit it when used + % into another component + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \fi + \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0 + \pgfusepath{draw,fill} + \endpgfscope + } +} +% BNC connector + +\pgfdeclareshape{bnc}{ + \anchor{center}{ + \pgfpointorigin + } + % BNC size is 2.5 times the size of the internal "ocirc" + \savedanchor\northwest{% + \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen + \pgf@y=2.5\pgf@y + \pgf@x=-\pgf@y + } + % center is on the opening + \anchor{center}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{zero}{ \pgfpointorigin } + \anchor{hot}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{shield}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + % geo-anchors + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{right}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{left}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}} + } + \behindforegroundpath{ + \pgfextracty{\pgf@circ@res@other}{\northwest} + \pgf@circ@res@step=\ctikzvalof{nodes width}\pgf@circ@Rlen + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgfsetcolor{\ctikzvalof{color}} + % external circle + \pgfscope + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{-2\pgf@circ@res@other}{-2\pgf@circ@res@other}} + {\pgfpoint{2\pgf@circ@res@other}{2\pgf@circ@res@other}} + % next the opening to the right + \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{-\pgf@circ@res@step}} + {\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@step}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@other} + \pgfusepath{draw} + \endpgfscope + % internal circle + \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@step} + \pgf@circ@draworfill + % and the contact line to the right + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \endpgfscope + } +} + +%% Fill for correct rectangular joins + +\pgfdeclareshape{rectjoinfill}{ + \savedanchor{\northeast}{% + \pgf@x=.5\pgflinewidth% + \pgf@y=.5\pgflinewidth% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{center}{ + \pgfpointorigin + } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + } + \behindforegroundpath{ + \pgfscope + \pgfpathrectanglecorners + {\pgfpoint{0}{.5\pgflinewidth}} + {\pgfpoint{0}{-.5\pgflinewidth}} + \pgfsetcolor{\ctikzvalof{color}} + \pgfusepath{draw,fill} + \endpgfscope + } +} + +%% transistor arrow + +\def\pgf@circ@find@linescale{ + % find the scale inverse of the scale factor: line width do not scale + % with scale=..., transform shape so we have to counteract it. + \iftikz@fullytransformed % this is true if `transform shape` is active + % from @Circumscribe https://tex.stackexchange.com/a/474035/38080 + % Note that this trick is not working inside a `spy` environment... + \pgfgettransformentries{\scaleA}{\scaleB}{\scaleC}{\scaleD}{\whatevs}{\whatevs}% + \pgfmathsetmacro{\@@factor}{1.0/sqrt(abs(\scaleA*\scaleD-\scaleB*\scaleC))}% + \else + \pgfmathsetmacro{\@@factor}{1.0} + \fi +} + +\pgfdeclareshape{trarrow}{% + % this arrow is only filled but grows with the linewidth, more or less + % like currarrow do + \savedanchor{\northeast}{% + \pgf@circ@res@step = \pgf@circ@Rlen + \pgf@circ@find@linescale + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} + \pgfpoint{0.7*\pgf@circ@res@step +0.5*\@@factor*\pgflinewidth} + {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth} + } + % The arrow size should be more or less the same of a currarrow, which is + % both filled and stroke, for backward output compatibility (more or less) + % + % angle \beta W is \pgf@circ@Rlen/\ctikzvalof{current arrow scale} + % |-\__ currarrow as the tip at (W,0) + % | | and the upper tail at (-0.7*W, 0.8*W) + % | \__ it then "overshoot" do to the linew width L + % | \__ xangle \alpha + % ---0-------> + % + % \beta = atan(0.7/0.8) \alpha=atan(0.8/1.7) + % tip overshoot is (L/2)/sin(\alpha) = 1.743*L only in x direction + % tail overshoot is -(L/2) in x, and (L/2)/sin(\beta) = 0.7539*L in y + % + \savedanchor{\northwest}{% + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} + \pgf@circ@find@linescale + \pgfpoint{-0.7*\pgf@circ@res@step -0.5*\@@factor*\pgflinewidth} + {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth} + } + \savedanchor{\tip}{% + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} + \pgf@circ@find@linescale + \pgfpoint{\pgf@circ@res@step + 1.743*\@@factor*\pgflinewidth}{0pt} + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{center}{ + \pgfpointorigin + } + \anchor{tip}{ + \tip + } + \anchor{btip}{% this anchor is behind the tip of half a linewidth + \tip + \pgf@circ@find@linescale + \pgf@circ@res@temp=\@@factor\pgflinewidth + \advance\pgf@x by -.5\pgf@circ@res@temp + } + \behindforegroundpath{ + \pgfscope + \northwest + \pgf@circ@res@up=\pgf@y + \pgf@circ@res@left=\pgf@x + \tip + \pgf@circ@res@step = \pgf@x + % + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathclose + \pgfsetcolor{\ctikzvalof{color}} + \pgfusepath{fill} % just fill + \endpgfscope + } +} + +%% Current arrow + +\pgfdeclareshape{currarrow}{ + \savedanchor{\northeast}{% + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} + \pgf@x=.5\pgf@circ@res@step + \pgf@y=\pgf@x% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{center}{ + \pgfpointorigin + } + \anchor{tip}{ + \pgfpointorigin + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} + \pgf@x =\pgf@circ@res@step + } + \behindforegroundpath{ + \pgfscope + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} + + \pgfpathmoveto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}} + \pgfsetcolor{\ctikzvalof{color}} + \pgfusepath{draw,fill} + + \endpgfscope + } +} + +%% Flow arrow + +\pgfdeclareshape{flowarrow}{ + \savedanchor{\northeast}{% + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} + \pgf@y=.5\pgf@circ@res@step + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by 4 + \pgf@x=\pgf@circ@res@step% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{text}{% text centered above + \pgfpointorigin + \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox} + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{tip}{ + \pgfpointorigin + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} + \pgf@x =\pgf@circ@res@step + } + \behindforegroundpath{ + \pgfscope + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by 4 + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfsetcolor{\ctikzvalof{color}} + \pgfusepath{draw} + \pgftransformshift{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfnode{currarrow}{tip}{}{}{\pgfusepath{fill}} + \endpgfscope + } +} + +%% Input arrow + +\pgfdeclareshape{inputarrow}{ + \savedanchor{\northeast}{% this is really not northeast, really -northwest + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale} + \pgf@y=.5\pgf@circ@res@step + \pgf@x=1.7\pgf@circ@res@step + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax\pgf@x=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax} + \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x} + \anchor{north east}{\northeast\pgf@x=0cm\relax} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@x=0cm\relax} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \savedanchor{\tip}{ + \pgfpointorigin + } + \anchor{center}{ + \tip + } + \anchor{tip}{ + \tip + } + \behindforegroundpath{ + + \pgfscope + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by 16 + + \pgfpathmoveto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}} + \pgfsetcolor{\ctikzvalof{color}} + \pgfusepath{fill} + + \endpgfscope + } +} + + +%% box + +\pgfdeclareshape{box}{ + \anchor{center}{ + \pgfpointorigin + } + \behindforegroundpath{ + + \pgfscope + \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen + \pgf@circ@res@step = 0.5\pgf@circ@res@step + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgf@circ@draworfill + \endpgfscope + } +} + +%% box scaled with blocks + +\pgfdeclareshape{blockbox}{ + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}} + \anchor{center}{ + \pgfpointorigin + } + \behindforegroundpath{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen} + \pgfscope + \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@step = 0.5\pgf@circ@res@step + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgf@circ@draworfill + \endpgfscope + } +} + +% full nodes for wire crossing + +\pgfdeclareshape{jump crossing} +{ + \savedanchor\northwest{% + \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \behindbackgroundpath{ + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + % horizontal jumper + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0pt}} + \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} + \pgfsetbeveljoin + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % vertical, broken path + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0pt}{0.3\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfusepath{draw} + + } +} +\pgfdeclareshape{plain crossing} +{ + \savedanchor\northwest{% + \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\pgf@y + } + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{w}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{n}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \behindbackgroundpath{ + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + % horizontal jumper + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % vertical, broken path + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{0.1\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0pt}{0.1\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfusepath{draw} + + } +} + +%%%---------- close: tex/pgfcircshapes +%%%%%%%%%%% Springe nach tex/pgfcircmonopoles +%%%---------- open: tex/pgfcircmonopoles.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Monopoles +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%% +%% Grounds +%%%%%%%%%%%%% + + +%% Ground symbol +% #1 -> name +% #2 -> width +% #3 -> depth +% #4 -> code +\long\def\pgf@circ@declareground#1#2#3#4{ + \pgfdeclareshape{#1}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{grounds}} % class of these components + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor{\southeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen + \pgf@x=#2\pgf@x + \pgf@y=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen + \pgf@y=-#3\pgf@y + } + \anchor{north}{\pgfpointorigin} + \anchor{north east}{\southeast\pgf@y=0pt\relax} + \anchor{east}{\southeast\pgf@y=.5\pgf@y} + \anchor{south east}{\southeast} + \anchor{south}{\southeast\pgf@x=0pt\relax} + \anchor{south west}{\southeast\pgf@x=-\pgf@x} + \anchor{west}{\southeast\pgf@y=.5\pgf@y\pgf@x=-\pgf@x} + \anchor{north west}{\southeast\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{left}{\pgfpointorigin} + \anchor{right}{\pgfpointorigin} + \anchor{center}{\pgfpointorigin} + \behindforegroundpath{ + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen + \pgfscope + \pgfstartlinewidth=\pgflinewidth + #4 + \endpgfscope + } + } +} + + +\pgf@circ@declareground{ground}{0.6}{1.6}{ + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}} + \pgfusepath{draw} + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfusepath{draw} +} + +\pgf@circ@declareground{tlground}{0.6}{0.4}{ + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}} + \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}} + \pgfusepath{draw} +} + + +\pgf@circ@declareground{rground}{0.6}{1}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{monopoles/rground}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfsetroundcap\pgfusepath{draw} +} + +\pgf@circ@declareground{tground}{0.6}{0}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}} + \pgfusepath{draw} +} + +\pgf@circ@declareground{sground}{0.6}{1.8}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0}{-1.8\pgf@circ@res@step}} + \pgfpathclose + \pgf@circ@draworfill +} + +% noiseless ground +\pgf@circ@declareground{nground}{0.9}{1.6}{ + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}} + \pgfusepath{draw} + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfpatharc{0}{180}{0.9\pgf@circ@res@step} + \pgfusepath{draw} +} + +% protective ground +\pgf@circ@declareground{pground}{0.9}{1.8}{ + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf@circ@res@step}}{0.9\pgf@circ@res@step} + \pgf@circ@draworfill + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1\pgf@circ@res@step}} + \pgfusepath{draw} + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfusepath{draw} +} + +% chassis ground +\pgf@circ@declareground{cground}{1}{2}{ + \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}} + \pgfusepath{draw} + \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{-2.10\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{ 0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{ 0.50\pgf@circ@res@step}{-2.10\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-1.50\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.25\pgf@circ@res@step}{-2.10\pgf@circ@res@step}} + \pgfusepath{draw} +} + +% Contributed by @fotesan https://github.com/fotesan +% european ground +\pgf@circ@declareground{eground}{1.1}{1.7}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-.1\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfusepath{draw} +} + +\pgf@circ@declareground{eground2}{1.1}{1.7}{ + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.45\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-1.7\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%%%%%%%%%%%%%%%%%% +%% Power supplies +%%%%%%%%%%%%%%%%%% + +% Vcc +\pgfdeclareshape{vcc}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080 + \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}% + \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed + \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}% + } + \savedanchor{\northeast}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@circ@res@step + \pgf@y=3\pgf@x% + } + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax} + \anchor{south}{\pgfpointorigin} + \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{center}{\pgfpointorigin} + \anchor{left}{\pgfpointorigin} + \anchor{right}{\pgfpointorigin} + \anchor{text}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}} + \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}} + \pgf@x=0pt + \pgf@y=2\pgf@circ@res@step + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \behindforegroundpath{ + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgfscope + \edef\pgf@circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf@temp{legacy} + \ifx\pgf@temp\pgf@circ@temp + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \else + \pgfsetarrowsend{\pgf@circ@temp} + \fi + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}} + \pgfusepath{draw} + \endpgfscope + } +} + +% Vee +\pgfdeclareshape{vee}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080 + \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}% + \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed + \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}% + } + \savedanchor{\northeast}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@circ@res@step + \pgf@y=-3\pgf@x% + } + \anchor{south}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax} + \anchor{north}{\pgfpointorigin} + \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x} + \anchor{south east}{\northeast} + \anchor{south west}{\northeast\pgf@x=-\pgf@x} + \anchor{north east}{\northeast\pgf@y=0pt\relax} + \anchor{north west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{center}{\pgfpointorigin} + \anchor{left}{\pgfpointorigin} + \anchor{right}{\pgfpointorigin} + \anchor{text}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}} + \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}} + \pgf@x=0pt + \pgf@y=-2\pgf@circ@res@step + \advance \pgf@y by -1.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + + \behindforegroundpath{ + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen + \pgfscope + \edef\pgf@circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf@temp{legacy} + \ifx\pgf@temp\pgf@circ@temp + + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + \else + \pgfsetarrowsend{\pgf@circ@temp} + \fi + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}} + \pgfusepath{draw} + \endpgfscope + } +} + +%%%%%%%%%%%%%%%% +%% RF elements +%%%%%%%%%%%%%%%% + +% Legacy tlinestub +% Contributed by Leonardo Azzinnari +\pgfdeclareshape{tlinestub}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor{\northeast}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen + \pgf@x=1.2\pgf@circ@res@step + \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen + \pgf@y=.2\pgf@circ@res@step% + } + % the center is on the left side of the shape for facility of usage + \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0.5\pgf@x\relax} + \anchor{west}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=0cm\relax} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\northeast\pgf@x=0cm\pgf@y=-\pgf@y} + \anchor{center}{\pgfpointorigin} + % this is not exact, but it's better than nothing + \anchor{text}{\northeast\pgf@xa=\pgf@x\pgf@ya=\pgf@y + \pgfpoint{\dimexpr-.5\wd\pgfnodeparttextbox+.8\pgf@xa} + {\dimexpr-.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@ya}} + \behindforegroundpath{ + \pgfstartlinewidth=\pgflinewidth + + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{bipoles/tline/width}\pgf@circ@scaled@Rlen + + \pgfscope\begin{pgftransparencygroup} + \pgfpathellipse{\pgfpoint{0.5\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0.125\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0\pgf@circ@res@step}{0.25\pgf@circ@res@step}} + \pgf@circ@maybefill + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{1.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}} + \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \pgfpathellipse{\pgfpoint{0.5\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0.125\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0\pgf@circ@res@step}{0.25\pgf@circ@res@step}} + \pgfusepath{draw} + \end{pgftransparencygroup} \endpgfscope + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0pt}} + \pgfusepath{draw} + } +} + +%% New antennas without tails + +% main body of antennas +\def\pgf@circ@antennabody{% + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@scaled@Rlen=\scaledRlen + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{2\pgf@circ@res@step}} + \pgfsetbeveljoin + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{2\pgf@circ@res@step}} + \pgfusepath{draw} +} + +% Waves for the antennas. +\def\pgf@circ@antennawaves{% + \pgfscope + % define a triangle for clipping the waves + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{3\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{-1\pgf@circ@res@step}} + \pgfpathclose + \pgfusepath{clip} + % ...and build the waves as clipped circles + \pgf@circ@count@a=8\pgf@circ@res@other=0.5\pgf@circ@res@step + \pgfmathloop% + \ifnum\pgf@circ@count@a>2 + \pgfpathcircle{\pgfpoint{0pt}{\pgf@circ@res@step}}{\the\pgf@circ@count@a*\pgf@circ@res@other} + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + \pgfusepath{draw} + \endpgfscope +} + +% additional shape with the waves +\pgfdeclareshape{waves}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen + \pgf@x=\pgf@circ@res@step + \pgf@y=\pgf@circ@res@step + } + \anchor{text}{ + \northeast + \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \anchor{top}{\northeast\pgf@x=0pt} + \anchor{right}{\northeast\pgf@y=0pt} + \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt} + \anchor{bottom}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{north east}{\northeast} + \anchor{east}{\northeast\pgf@y=0pt} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt} + \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x} + \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \behindforegroundpath{ + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@step=0.5\pgf@circ@res@step + \pgfsetcolor{\ctikzvalof{color}} + \pgfscope + % define a triangle for clipping the waves + \pgfpathmoveto{\pgfpoint{-2\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{-2\pgf@circ@res@step}} + \pgfpathclose + \pgfusepath{clip} + % ...and build the waves as clipped circles + \c@pgf@counta=8\pgf@circ@res@other=0.5\pgf@circ@res@step + \pgfmathloop% + \ifnum\c@pgf@counta>1 + \pgfpathcircle{\pgfpoint{-2\pgf@circ@res@step}{0pt}}{\the\c@pgf@counta*\pgf@circ@res@other} + \advance\c@pgf@counta-1\relax% + \repeatpgfmathloop + \pgfusepath{draw} + \endpgfscope + } +} + +% the three types of antennas: simple, TX, RX. Notice that you can flip them... + +\pgfdeclareshape{bareantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen + \pgf@x=\pgf@circ@res@step + \pgf@y=2\pgf@circ@res@step + } + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y + \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \anchor{top}{\northeast\pgf@x=0pt} + \anchor{right}{\northeast\pgf@y=0.5\pgf@y} + \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{bottom}{\pgfpointorigin} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y} + \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{south}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \behindforegroundpath{ + \pgf@circ@antennabody + } +} + +\pgfdeclareshape{bareTXantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen + \pgf@x=\pgf@circ@res@step + \pgf@y=2\pgf@circ@res@step + } + \savedanchor{\savedwaves}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen + \pgf@x=4.2\pgf@circ@res@step + \pgf@y=\pgf@circ@res@step + } + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y + \pgf@x=\dimexpr-\pgf@x-\wd\pgfnodeparttextbox\relax + \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \anchor{waves}{\savedwaves} + \anchor{top}{\northeast\pgf@x=0pt} + \anchor{right}{\northeast\pgf@y=0.5\pgf@y} + \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{bottom}{\pgfpointorigin} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y} + \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{south}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \behindforegroundpath{ + \pgf@circ@antennabody + \pgf@circ@antennawaves + } +} + +\pgfdeclareshape{bareRXantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen + \pgf@x=\pgf@circ@res@step + \pgf@y=2\pgf@circ@res@step + } + \savedanchor{\savedwaves}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen + \pgf@x=-4.2\pgf@circ@res@step + \pgf@y=\pgf@circ@res@step + } + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y + \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \anchor{waves}{\savedwaves} + \anchor{top}{\northeast\pgf@x=0pt} + \anchor{right}{\northeast\pgf@y=0.5\pgf@y} + \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{bottom}{\pgfpointorigin} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y} + \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{south}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \behindforegroundpath{ + \pgf@circ@antennabody + \pgftransformxshift{-5.2\pgf@circ@res@step} + \pgf@circ@antennawaves + } +} + +%%% dynodes (see https://github.com/circuitikz/circuitikz/issues/469) +\ctikzset{monopoles/dynode/width/.initial=0.4} +\ctikzset{monopoles/dynode/height/.initial=0.8} +\ctikzset{monopoles/dynode/arc pos/.initial=0.5} +\ctikzset{monopoles/dynode/arc angle/.initial=30} +\ctikzset{monopoles/dynode/top width/.initial=1.0} + +\pgfdeclareshape{dynode}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/dynode/width}\pgf@circ@scaled@Rlen + \pgf@x=0.5\pgf@x + \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen + } + \savedanchor{\arcpos}{% bottom part of the arc pos + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=0pt + \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen + \pgf@y=\ctikzvalof{monopoles/dynode/arc pos}\pgf@y + } + \savedanchor{\topright}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/dynode/width}\pgf@circ@scaled@Rlen + \pgf@x=\ctikzvalof{monopoles/dynode/top width}\pgf@x + \pgf@x=0.5\pgf@x + \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen + } + \anchor{arc}{\arcpos} + \anchor{top right}{\topright} + \anchor{top left}{\topright\pgf@x=-\pgf@x} + \anchor{text}{ + \northeast + \advance\pgf@x by 4pt\relax + \pgf@y=\dimexpr0.5\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \anchor{top}{\northeast\pgf@x=0pt} + \anchor{right}{\northeast\pgf@y=0.5\pgf@y} + \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{bottom}{\pgfpointorigin} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{east}{\northeast\pgf@y=0.5\pgf@y} + \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{south}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x} + \behindforegroundpath{ + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@scaled@Rlen=\scaledRlen + \pgfsetcolor{\ctikzvalof{color}} + \northeast + \pgf@circ@res@right=\pgf@x + \pgf@circ@res@up=\pgf@y + \arcpos + \pgf@circ@res@step=\pgf@y + % top + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{monopoles/dynode/top width}*\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{monopoles/dynode/top width}*\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + % arc + \edef\@@angle{\ctikzvalof{monopoles/dynode/arc angle}} + \ifnum90=\@@angle\else % avoid divisions by zero + % radius + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right/cos(\@@angle)} + % start angle y position + \pgfmathsetlength{\pgf@circ@res@step}{\pgf@circ@res@step+\pgf@circ@res@other*(1-sin(\@@angle))} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@step}} + \pgfpatharc{-180+\@@angle}{-\@@angle}{\pgf@circ@res@other} + \fi + % tail + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfusepath{draw} + } +} +% Microstrip monopoles + +\pgfdeclareshape{mslstub}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor{\southeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen + \pgf@y=-.5\pgf@y + } + \savedanchor{\northwest}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen + \pgf@x=-.5\pgf@x + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + } + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{east}{\southeast\pgf@y=0pt\relax} + \anchor{south east}{\southeast} + \anchor{south}{\southeast\pgf@x=0pt\relax} + \anchor{south west}{\southeast\pgf@x=-\pgf@x} + \anchor{west}{\northwest\pgf@y=0pt\relax} + \anchor{north west}{\northwest} + % + \anchor{center}{\northwest\pgf@y=0pt\relax} + \anchor{left}{\northwest\pgf@y=0pt\relax} + \anchor{right}{\southeast\pgf@y=0pt\relax} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } + \behindbackgroundpath{ + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@right}{\southeast} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfextracty{\pgf@circ@res@down}{\southeast} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfstartlinewidth=\pgflinewidth + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \endpgfscope + } +} + +\pgfdeclareshape{msrstub}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor{\southeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=0pt\relax + } + \savedanchor{\northwest}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen + \pgf@x=-.5\pgf@x + \pgf@y=\ctikzvalof{monopoles/msrstub/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + } + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{east}{\southeast\pgf@y=0pt\relax} + \anchor{south east}{\southeast} + \anchor{south}{\southeast\pgf@x=0pt\relax} + \anchor{south west}{\southeast\pgf@x=-\pgf@x} + \anchor{west}{\northwest\pgf@y=0pt\relax} + \anchor{north west}{\northwest} + % + \anchor{center}{\pgfpointorigin} + \anchor{left}{\pgfpointorigin} + \anchor{right}{\pgfpointorigin} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } + \behindbackgroundpath{ + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@right}{\southeast} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfextracty{\pgf@circ@res@down}{\southeast} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfstartlinewidth=\pgflinewidth + \pgfscope + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@step}} + \pgfusepath{draw} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointpolar{135}{\pgf@circ@res@step}} + \pgfpatharc{135}{45}{\pgf@circ@res@step} + \pgfpathlineto{\pgfpointpolar{45}{\pgf@circ@res@up}} + \pgfpatharc{45}{135}{\pgf@circ@res@up} + \pgfclosepath + \pgf@circ@draworfill + \endpgfscope + } +} + +\pgfdeclareshape{msport}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor{\southeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen + \pgf@y=-.5\pgf@y + } + \savedanchor{\northwest}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen + \pgf@x=-.5\pgf@x + \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + } + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{east}{\southeast\pgf@y=0pt\relax} + \anchor{south east}{\southeast} + \anchor{south}{\southeast\pgf@x=0pt\relax} + \anchor{south west}{\southeast\pgf@x=-\pgf@x} + \anchor{west}{\northwest\pgf@y=0pt\relax} + \anchor{north west}{\northwest} + % + \anchor{center}{\northwest\pgf@y=0pt\relax} + \anchor{left}{\northwest\pgf@y=0pt\relax} + \anchor{right}{\southeast\pgf@y=0pt\relax} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr-.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + } + \behindbackgroundpath{ + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@right}{\southeast} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfextracty{\pgf@circ@res@down}{\southeast} + \pgfmathsetlength{\pgf@circ@res@step}{0.5*\pgf@circ@res@up} + \pgfstartlinewidth=\pgflinewidth + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + } +} + +% Legacy antennas (with tails) +\def\pgf@circ@shift@antenna@xy#1#2{% + \pgf@y=\dimexpr\pgf@y+#2\pgf@circ@res@step + \pgf@x=\dimexpr\pgf@x+#1\pgf@circ@res@step +\relax} + +% Legacy antenna +\pgfdeclareshape{antenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen + \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth + \pgf@y=4\pgf@circ@res@step + } + \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{2}} + \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{0}{3}\relax} + \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{4}\relax} + \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{3}} + \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{0}{2}} + \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{2}} + \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{0}{4}} + \anchor{south west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{4}} + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/antenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/antenna/label/yanchor}\pgf@y + } + \behindforegroundpath{ + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen + + \pgftransformxshift{ -4\pgf@circ@res@step } + + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{0pt}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{5\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{3\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfusepath{draw} + \endpgfscope + \pgfsetlinewidth{\pgfstartlinewidth} + + } +} + +% Legacy TX antenna +\pgfdeclareshape{txantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen + \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth + \pgf@y=4\pgf@circ@res@step + } + \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}} + \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax} + \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax} + \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}} + \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}} + \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}} + \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}} + \anchor{south west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}} + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/txantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/txantenna/label/yanchor}\pgf@y + } + \behindforegroundpath{ + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/txantenna/width}\pgf@circ@scaled@Rlen + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}} + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{0pt}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{5\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{3\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfusepath{draw} + \endpgfscope + \pgfpathmoveto{\pgfpoint{5.5\pgf@circ@res@step}{6\pgf@circ@res@step}} + % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step} + \pgfpatharc{30}{-30}{2\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{6.25\pgf@circ@res@step}} + \pgfpatharc{30}{-30}{2.5\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.5\pgf@circ@res@step}} + \pgfpatharc{30}{-30}{3\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.75\pgf@circ@res@step}} + \pgfpatharc{30}{-30}{3.5\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{7\pgf@circ@res@step}} + \pgfpatharc{30}{-30}{4\pgf@circ@res@step} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + + } +} + +% Legacy RX antenna +\pgfdeclareshape{rxantenna}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor{\northeast}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen + \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth + \pgf@y=4\pgf@circ@res@step + } + \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}} + \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax} + \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax} + \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}} + \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}} + \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}} + \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}} + \anchor{south west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}} + \anchor{text}{ + \northeast + \pgf@x=\ctikzvalof{monopoles/rxantenna/label/xanchor}\pgf@x + \pgf@y=\ctikzvalof{monopoles/rxantenna/label/yanchor}\pgf@y + } + \behindforegroundpath{ + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/rxantenna/width}\pgf@circ@scaled@Rlen + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}} + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{0pt}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{5\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{3\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step-0.5\pgflinewidth}{6\pgf@circ@res@step}} + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{7\pgf@circ@res@step}} + % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step} + \pgfpatharc{150}{210}{4\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.75\pgf@circ@res@step}} + \pgfpatharc{150}{210}{3.5\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.5\pgf@circ@res@step}} + \pgfpatharc{150}{210}{3\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{6.25\pgf@circ@res@step}} + \pgfpatharc{150}{210}{2.5\pgf@circ@res@step} + \pgfpathmoveto{\pgfpoint{8\pgf@circ@res@step}{6\pgf@circ@res@step}} + \pgfpatharc{150}{210}{2\pgf@circ@res@step} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + } +} + +% Legacy match +\pgfdeclareshape{match}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor{\northeast}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen + \pgf@x=2\pgf@circ@res@step + \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@circ@res@step% + } + % the center is on the left side of the shape for facility of usage + \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x\relax} + \anchor{west}{\pgfpointorigin} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=0cm\relax} + \anchor{south east}{\northeast\pgf@y=0pt\relax} + \anchor{south west}{\pgfpointorigin} + \anchor{center}{ + \pgfpointorigin + } + \anchor{text}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen + \pgf@x=1.5\pgf@x + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \pgf@y=-1.5\ht\pgfnodeparttextbox + } + \behindforegroundpath{ + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen + + \pgfscope + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0pt}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0}} + \pgfusepath{fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + \endpgfscope + } +} + +%%%---------- close: tex/pgfcircmonopoles +%%%%%%%%%%% Springe nach tex/pgfcircbipoles +%%%---------- open: tex/pgfcircbipoles.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%% Generic macro for defining a bipole shape +% #1 - additional anchors +% #2 - lower y-size of the bipole (from the center). +% #3 - #shape is the name of the shape +% #4 - upper y-size of the bipole (from the center) +% #5 - width of the bipole +% #6 - macros drawing the bipole +% +\long\def\pgfcircdeclarebipole{% + \pgfcircdeclarebipolescaled{default}} + +%% Generic macro for defining a bipole shape +% #1 - scale factor +% #2 - additional anchors +% #3 - lower y-size of the bipole (from the center). +% #4 - #shape is the name of the shape +% #5 - upper y-size of the bipole (from the center) +% #6 - width of the bipole +% #7 - macros drawing the bipole +% +\long\def\pgfcircdeclarebipolescaled#1#2#3#4#5#6#7{ + \pgfdeclareshape{#4shape}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{#1}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor{\northeast}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=#5\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=#6\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor{\northeastborder}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=#5\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y + \pgf@x=#6\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x + } + \savedanchor{\southwestborder}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=-#3\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y + \pgf@x=-#6\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x + } + \savedanchor{\southwest}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@y=-#3\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-#6\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor{\centerpoint}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@circ@res@down=-#3\pgf@circ@scaled@Rlen + \pgf@circ@res@up=#5\pgf@circ@scaled@Rlen + \pgfpointorigin + \pgf@y=\pgf@circ@res@up + \advance\pgf@y by\pgf@circ@res@down + \pgf@y=.5\pgf@y + } + \anchor{center}{\pgfpointorigin} + \anchor{n}{ + \northeast + \pgf@x=0cm + } + \anchor{north east}{ + \northeast + } + \anchor{north west}{ + \northeast + \pgf@x=-\pgf@x + } + \anchor{ne}{ + \northeast + } + \anchor{nw}{ + \northeast + \pgf@x=-\pgf@x + } + \anchor{e}{ + \northeast + \pgf@y=0cm + } + \anchor{s}{ + \southwest + \pgf@x=0cm + } + \anchor{south east}{ + \southwest + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \southwest + } + \anchor{se}{ + \southwest + \pgf@x=-\pgf@x + } + \anchor{sw}{ + \southwest + } + \anchor{w}{ + \southwest + \pgf@y=0cm + } + \anchor{north}{ + \northeast + \pgf@x=0cm + } + \anchor{east}{ + \northeast + \pgf@y=0cm + } + \anchor{south}{ + \southwest + \pgf@x=0cm + } + \anchor{west}{ + \southwest + \pgf@y=0cm + } + \anchor{right}{ + \northeast + \pgf@y=0cm + } + \anchor{above}{ + \northeast + \pgf@x=0cm + } + \anchor{left}{ + \southwest + \pgf@y=0cm + } + \anchor{below}{ + \southwest + \pgf@x=0cm + } + \anchor{a}{ + \northeast + \pgf@y=0cm + } + \anchor{b}{ + \southwest + \pgf@y=0cm + } + \savedanchor{\textanchor}{% + \pgf@y=\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \anchor{text}{ + \textanchor + } + \anchorborder{% + \ifpgf@circuit@bipole@inverted + \pgf@circ@res@left=-\pgf@x + \pgf@circ@res@up=-\pgf@y + \else + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \fi + \ifdim\pgf@circ@res@up>0cm + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\northeastborder} + \else + \southwestborder + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-\pgf@x}{-\pgf@y}} + \fi + } + + #2 + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northeast + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@zero = 0cm + \pgf@circ@res@left = -\pgf@x + \pgf@circ@res@right = \pgf@x + \southwest + \pgf@circ@res@down = \pgf@y + \pgf@circ@scaled@Rlen=\scaledRlen + \pgfstartlinewidth=\pgflinewidth + \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners! + #7 + + \pgfsetlinewidth{\pgfstartlinewidth} + } + } +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% anchor adjustment macros +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Extend the border anchor position by the specified factors on the right-top (north east corner) +% and the left-down (southwest border). Argument must be number (possibly decimal) without sign + +\def\pgfcirc@border@extend@full#1#2#3#4{% right, top, left, down + \anchorborder{% + \ifpgf@circuit@bipole@inverted + \pgf@circ@res@left=-\pgf@x + \pgf@circ@res@up=-\pgf@y + \else + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \fi + \ifdim\pgf@circ@res@up>0cm + \northeastborder + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{#1\pgf@x}{#2\pgf@y}} + \else + \southwestborder + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-#3\pgf@x}{-#4\pgf@y}} + \fi + } +} + +% Just up and down (very common) +\def\pgfcirc@border@extend@updown#1#2{\pgfcirc@border@extend@full{1}{#1}{1}{#2}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Standard bipole shapes declarations +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%% +% Resistive components +%%%%%%%%%%%%%%%%%%%%%%%% + +%% Short circuit + +%%% NOTICE that the short is really NOT drawn; we trust the fact that its +%%% natural length is zero. +\pgfcircdeclarebipole +{% fix the anchor border to add a bit of space for voltage and labels + % it uses the dummy width and height + \anchorborder{% + \ifpgf@circuit@bipole@inverted + \pgf@circ@res@left=-\pgf@x + \pgf@circ@res@up=-\pgf@y + \else + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \fi + \ifdim\pgf@circ@res@up>0cm + \pgf@x=\ctikzvalof{bipoles/short/width}\pgf@circ@Rlen + \pgf@y=\ctikzvalof{bipoles/short/height}\pgf@circ@Rlen + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{\pgf@x}{\pgf@y}} + \else + \pgf@x=-\ctikzvalof{bipoles/short/width}\pgf@circ@Rlen + \pgf@y=-\ctikzvalof{bipoles/short/height}\pgf@circ@Rlen + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{-\pgf@x}{-\pgf@y}} + \fi + } +} +{0} +{short} +{0} +{0} +{} + +%% Open circuit +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/open/height}} +{open} +{\ctikzvalof{bipoles/open/height}} +{\ctikzvalof{bipoles/open/width}} +{} + +% multiwire(s) +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/multiwire/height}} +{multiwire} +{\ctikzvalof{bipoles/multiwire/height}} +{\ctikzvalof{bipoles/multiwire/width}} +{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} +} + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/multiwire/height}} +{bmultiwire} +{\ctikzvalof{bipoles/multiwire/height}} +{\ctikzvalof{bipoles/multiwire/width}} +{ + \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} +} + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/multiwire/height}} +{tmultiwire} +{\ctikzvalof{bipoles/multiwire/height}} +{\ctikzvalof{bipoles/multiwire/width}} +{ + \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+2\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} +} + +% +% +%% Generic bipole - used as resistor by some (bleah) +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/generic/height}} +{generic} +{\ctikzvalof{bipoles/generic/height}} +{\ctikzvalof{bipoles/generic/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill +} + +% +% generic crossed, suggested by Radványi Patrik Tamás +% inherit "generic" properties +% +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/generic/height}} +{xgeneric} +{\ctikzvalof{bipoles/generic/height}} +{\ctikzvalof{bipoles/generic/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + % cross it + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} +} +%% Generic empty tunable +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/tgeneric/height}} +{tgeneric} +{\ctikzvalof{bipoles/tgeneric/height}} +{\ctikzvalof{bipoles/tgeneric/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Generic asymmetric bipole +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/ageneric/height}} +{ageneric} +{\ctikzvalof{bipoles/ageneric/height}} +{\ctikzvalof{bipoles/ageneric/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{stroke,fill} +} + +%% Memristor +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/memristor/height}} +{memristor} +{\ctikzvalof{bipoles/memristor/height}} +{\ctikzvalof{bipoles/memristor/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.8*\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{stroke,fill} +} + +%% Photoresistor +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/photoresistor/height 2}} +{photoresistor} +{\ctikzvalof{bipoles/photoresistor/height}} +{\ctikzvalof{bipoles/photoresistor/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{-1.2\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@right}{-1.2\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Thermistor +\pgfcircdeclarebipolescaled{resistors} +{% anchor for labelling the type of dependency + \anchor{label}{% + \southwest + \pgf@x=0.4\pgf@x + \pgf@y=1.2\pgf@y + }% + \pgfcirc@border@extend@updown{1}{1.2} +} +{\ctikzvalof{bipoles/thermistor/height}} +{thermistor} +{\ctikzvalof{bipoles/thermistor/height}} +{\ctikzvalof{bipoles/thermistor/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/thermistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/thermistor/main}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + %\pgfscope + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{1.2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.2\pgf@circ@res@down}} + \pgfusepath{draw} + %\endpgfscope +} + +%% Thermistor PTC +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/thermistorptc/height 2}} +{thermistorptc} +{\ctikzvalof{bipoles/thermistorptc/height}} +{\ctikzvalof{bipoles/thermistorptc/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/thermistorptc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/thermistorptc/main}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfusepath{draw} +} + +%% Thermistor NTC +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/thermistorntc/height 2}} +{thermistorntc} +{\ctikzvalof{bipoles/thermistorntc/height}} +{\ctikzvalof{bipoles/thermistorntc/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/thermistorntc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/thermistorntc/main}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$} + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} +} + +%% Generic tunable +\pgfcircdeclarebipolescaled{resistors} +{ + \savedanchor{\wiper}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@ya=\ctikzvalof{bipoles/generic potentiometer/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@ya + \pgf@xa=\ctikzvalof{bipoles/generic potentiometer/width}\pgf@circ@scaled@Rlen + \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/generic potentiometer/wiper pos}-0.5)*\pgf@xa} + } + \anchor{wiper}{\wiper} + \anchor{W}{\wiper} +} +{\ctikzvalof{bipoles/generic potentiometer/height 2}} +{genericpotentiometer} +{\ctikzvalof{bipoles/generic potentiometer/height}} +{\ctikzvalof{bipoles/generic potentiometer/width}} +{ + + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + \pgfscope + %\pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \pgfextractx{\pgf@circ@res@other}{\wiper} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Zig zag resistores +\def\pgf@circ@zigzag#1{% + \divide \pgf@circ@res@step by \numexpr4*\zigs\relax + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \pgf@circ@count@a=\zigs\relax + % first half zig + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}} + \pgfmathloop% + \advance\pgf@circ@count@a by -1\relax% Loop zigs -1 times + \ifnum\pgf@circ@count@a>0 + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}} + \repeatpgfmathloop% + % last zig and a half + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfsetbeveljoin + \pgfusepath{draw} +} + +%% Resistor +\pgfcircdeclarebipolescaled{resistors} +{ +\savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}} +} +{\ctikzvalof{bipoles/resistor/height}} +{resistor} +{\ctikzvalof{bipoles/resistor/height}} +{\ctikzvalof{bipoles/resistor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgf@circ@zigzag{1} +} + + +%% Variable resistor +\pgfcircdeclarebipolescaled{resistors} +{ +\savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}} +} +{\ctikzvalof{bipoles/vresistor/height}} +{vresistor} +{\ctikzvalof{bipoles/vresistor/height}} +{\ctikzvalof{bipoles/vresistor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/vresistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgf@circ@zigzag{.5} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Potentiometer +\pgfcircdeclarebipolescaled{resistors} +{ + \savedanchor{\wiper}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@ya=\ctikzvalof{bipoles/potentiometer/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@ya + \pgf@xa=\ctikzvalof{bipoles/potentiometer/width}\pgf@circ@scaled@Rlen + \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/potentiometer/wiper pos}-0.5)*\pgf@xa} + } + \anchor{wiper}{\wiper} + \anchor{W}{\wiper} + \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}} +} +{\ctikzvalof{bipoles/potentiometer/height 2}} +{potentiometer} +{\ctikzvalof{bipoles/potentiometer/height}} +{\ctikzvalof{bipoles/potentiometer/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/potentiometer/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgf@circ@zigzag{1} + + \pgfscope + %\pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \pgfextractx{\pgf@circ@res@other}{\wiper} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Resistive sensor +\pgfcircdeclarebipolescaled{resistors} +{% anchor for labelling the type of dependency + \anchor{label}{\southwest\pgf@x=0.4\pgf@x}% + \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}} +} +{\ctikzvalof{bipoles/resistivesens/height}} +{resistivesens} +{\ctikzvalof{bipoles/resistivesens/height}} +{\ctikzvalof{bipoles/resistivesens/width}} +{% + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistivesens/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgf@circ@zigzag{.5} + + \pgfscope + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%%%%%%%%%%%%%% +%% Capacitors +%%%%%%%%%%%%% + +%% Plain Capacitor +\pgfcircdeclarebipolescaled{capacitors} +{} +{\ctikzvalof{bipoles/capacitor/height}} +{capacitor} +{\ctikzvalof{bipoles/capacitor/height}} +{\ctikzvalof{bipoles/capacitor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + +} + +%% Capacitive sensor +\pgfcircdeclarebipolescaled{capacitors} +{ + \anchor{label}{\southwest\pgf@x=2.6\pgf@x\pgf@y=1.2\pgf@y}% + \pgfcirc@border@extend@full{2.6}{1}{4.4}{1.2} +} +{\ctikzvalof{bipoles/capacitor/height}} +{capacitivesens} +{\ctikzvalof{bipoles/capacitor/height}} +{\ctikzvalof{bipoles/capacitor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfscope + \pgfpathmoveto{\pgfpoint{2.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-2.6\pgf@circ@res@right}{1.2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-4.4\pgf@circ@res@right}{1.2\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Polar Capacitor (DEPRECATED) +\pgfcircdeclarebipolescaled{capacitors} +{} +{\ctikzvalof{bipoles/pcapacitor/height}} +{polarcapacitor} +{\ctikzvalof{bipoles/pcapacitor/height}} +{\ctikzvalof{bipoles/pcapacitor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+ \ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgftransformrotate{-90} + \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}} + \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} +} + + +%% Curved capacitor +% see https://tex.stackexchange.com/questions/509594/polar-capacitor-orientation-in-circuitikz-seems-wrong +% for a rationale +% +\pgfcircdeclarebipolescaled{capacitors} +{} +{\ctikzvalof{bipoles/ccapacitor/height}} +{ccapacitor} +{\ctikzvalof{bipoles/ccapacitor/height}} +{\ctikzvalof{bipoles/ccapacitor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+ \ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgftransformrotate{-90} + \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}} + \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} +} + + + + +%% Electrolytic Capacitor +\pgfcircdeclarebipolescaled{capacitors} +{} +{\ctikzvalof{bipoles/ecapacitor/height}} +{ecapacitor} +{\ctikzvalof{bipoles/ecapacitor/height}} +{\ctikzvalof{bipoles/ecapacitor/width}} +{ + \pgfsetrectcap + % % % Draw plus pole + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgf@circ@draworfill + % % Draw minus pole + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfsetfillcolor{\ctikzvalof{color}} + \pgfusepath{draw,fill} + \pgfsetfillcolor{\ctikzvalof{color}} + % % plus pole annotation + \pgftext[right,at=\pgfpoint{1.2\pgf@circ@res@left}{.6\pgf@circ@res@up}] + {\ctikzvalof{bipoles/ecapacitor/font} $+$} +} + +%% Variable Capacitor +\pgfcircdeclarebipolescaled{capacitors} +{} +{\ctikzvalof{bipoles/vcapacitor/height}} +{vcapacitor} +{\ctikzvalof{bipoles/vcapacitor/height}} +{\ctikzvalof{bipoles/vcapacitor/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/capacitor width} \pgf@circ@res@right + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfusepath{draw} +} + + +%% Piezoelectric Element + +\pgfcircdeclarebipolescaled{capacitors} +{} +{\ctikzvalof{bipoles/piezoelectric/height}} +{piezoelectric} +{\ctikzvalof{bipoles/piezoelectric/height}} +{\ctikzvalof{bipoles/piezoelectric/width}} +{ + % \pgf@circ@res@step = \ctikzvalof{bipoles/piezoelectric/width}\pgf@circ@Rlen + % \divide \pgf@circ@res@step by 5 + + %% Outer markings + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + %% Inner Box + \pgf@circ@res@step = \pgf@circ@res@right \divide \pgf@circ@res@step by 10 + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners + {\pgfpoint{\pgf@circ@res@left+4*\pgf@circ@res@step}{\pgf@circ@res@up-\pgf@circ@res@step}} + {\pgfpoint{\pgf@circ@res@right-4*\pgf@circ@res@step}{\pgf@circ@res@down+\pgf@circ@res@step}} + \pgf@circ@draworfill + \endpgfscope +} + +%%%%%%%%%%%%%%% +%% Inductors +%%%%%%%%%%%%%%% + +%% cute inductor +\pgfcircdeclarebipolescaled{inductors} +{ + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?% + \ctikzvalof{bipoles/cuteinductor/height} :% even + -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} +} +{\ctikzvalof{bipoles/cuteinductor/lower coil height}} +{cuteinductor} +{\ctikzvalof{bipoles/cuteinductor/height}} +{\ctikzvalof{bipoles/cuteinductor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@other}%width of small coil + {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)} + + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down} + } + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} +} + +%% cute inductive sensor +\pgfcircdeclarebipolescaled{inductors} +{% anchor for labelling the type of dependency + \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}% + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?% + \ctikzvalof{bipoles/cuteinductor/height} :% even + -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} + \pgfcirc@border@extend@full{1}{2}{1.6}{2.6} +} +{\ctikzvalof{bipoles/cuteinductor/lower coil height}} +{scuteinductor} +{\ctikzvalof{bipoles/cuteinductor/height}} +{\ctikzvalof{bipoles/cuteinductor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@other}%width of small coil + {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)} + + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down} + } + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} + \pgfscope + \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% cute choke +\pgfcircdeclarebipolescaled{inductors} +{ + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?% + \ctikzvalof{bipoles/cuteinductor/height} :% even + -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} +} +{\ctikzvalof{bipoles/cutechoke/lower coil height}} +{cutechoke} +{\ctikzvalof{bipoles/cutechoke/height}} +{\ctikzvalof{bipoles/cutechoke/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@other}%width of small coil + {0.5*\ctikzvalof{bipoles/cutechoke/coil aspect}*\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen/(\ctikzvalof{bipoles/cutechoke/coils}-1)} + + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cutechoke/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cutechoke/coils}/2} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {2,...,\ctikzvalof{bipoles/cutechoke/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down} + } + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth} + \pgfusepath{stroke} + + \ifpgf@circuit@bipole@twolineschoke + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up+\ctikzvalof{bipoles/cutechoke/cstep}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up+\ctikzvalof{bipoles/cutechoke/cstep}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth} + \pgfusepath{stroke} + \fi +} + +%% variable cute inductor +\pgfcircdeclarebipolescaled{inductors} +{ + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?% + \ctikzvalof{bipoles/cuteinductor/height} :% even + -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} +} +{\ctikzvalof{bipoles/vcuteinductor/lower coil height}} +{vcuteinductor} +{\ctikzvalof{bipoles/vcuteinductor/height}} +{\ctikzvalof{bipoles/vcuteinductor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@other}%width of small coil + {0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)} + + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {2,...,\ctikzvalof{bipoles/vcuteinductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up} + \pgfpatharc{0}{-180}{\pgf@circ@res@other and -.5\pgf@circ@res@down} + } + \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} +} + +%% american inductor +\pgfcircdeclarebipolescaled{inductors} +{ + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?% + 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even + 0) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} +} +{\ctikzvalof{bipoles/americaninductor/height 2}} +{americaninductor} +{\ctikzvalof{bipoles/americaninductor/height}} +{\ctikzvalof{bipoles/americaninductor/width}} +{ + \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth + \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils} + \divide \pgf@circ@res@step by 2 + \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} + } + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} +} + + +%% american inductive sensor +\pgfcircdeclarebipolescaled{inductors} +{% anchor for labelling the type of dependency + \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}% + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?% + 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even + 0) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} + \pgfcirc@border@extend@full{1}{2}{1.6}{2.6} +} +{\ctikzvalof{bipoles/americaninductor/height 2}} +{samericaninductor} +{\ctikzvalof{bipoles/americaninductor/height}} +{\ctikzvalof{bipoles/americaninductor/width}} +{ + \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth + \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils} + \divide \pgf@circ@res@step by 2 + \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} + } + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} + \pgfscope + \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% variable american inductor +\pgfcircdeclarebipolescaled{inductors} +{ + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/vamericaninductor/coils},2) ?% + 2*\ctikzvalof{bipoles/vamericaninductor/coil height} :% even + 0) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} +} +{\ctikzvalof{bipoles/vamericaninductor/height 2}} +{vamericaninductor} +{\ctikzvalof{bipoles/vamericaninductor/height}} +{\ctikzvalof{bipoles/vamericaninductor/width}} +{ + \pgf@circ@res@step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf@circ@scaled@Rlen + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth + \divide \pgf@circ@res@step by \ctikzvalof{bipoles/vamericaninductor/coils} + \divide \pgf@circ@res@step by 2 + \pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@scaled@Rlen + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {1,...,\ctikzvalof{bipoles/vamericaninductor/coils}} + { + \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} + } + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Generic bipole, filled - used as inductor by some +\pgfcircdeclarebipolescaled{inductors} +{ + \anchor{midtap}{\northeast\pgf@x=0pt\relax} +} +{\ctikzvalof{bipoles/fullgeneric/height}} +{fullgeneric} +{\ctikzvalof{bipoles/fullgeneric/height}} +{\ctikzvalof{bipoles/fullgeneric/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfusepath{draw,fill} +} + +%% Generic sensor, filled - used as inductive sensor by some +\pgfcircdeclarebipolescaled{inductors} +{% anchor for labelling the type of dependency + \anchor{label}{\southwest\pgf@x=0.4\pgf@x\pgf@y=2\pgf@y}% + \anchor{midtap}{\northeast\pgf@x=0pt\relax} + \pgfcirc@border@extend@full{1}{2}{1}{2} +} +{\ctikzvalof{bipoles/fullgeneric/height}} +{sfullgeneric} +{\ctikzvalof{bipoles/fullgeneric/height}} +{\ctikzvalof{bipoles/fullgeneric/width}} +{ + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfusepath{draw,fill} + %\pgfscope + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{2\pgf@circ@res@down}} + \pgfusepath{draw} + %\endpgfscope +} + +%% Generic full tunable +\pgfcircdeclarebipolescaled{inductors} +{ + \anchor{midtap}{\northeast\pgf@x=0pt\relax} +} +{\ctikzvalof{bipoles/tfullgeneric/height}} +{tfullgeneric} +{\ctikzvalof{bipoles/tfullgeneric/height}} +{\ctikzvalof{bipoles/tfullgeneric/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfusepath{draw,fill} + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%%%%%%%%%%% +%% Battery +%%%%%%%%%%% + +%% Battery +\pgfcircdeclarebipolescaled{batteries} +{} +{\ctikzvalof{bipoles/battery/height}} +{battery} +{\ctikzvalof{bipoles/battery/height}} +{\ctikzvalof{bipoles/battery/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 6 + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \ifpgf@circ@fixbatteries + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +} + + +%% Battery 1 % poles with equl thickness + +\pgfcircdeclarebipolescaled{batteries} +{} +{\ctikzvalof{bipoles/battery1/height}} +{battery1} +{\ctikzvalof{bipoles/battery1/height}} +{\ctikzvalof{bipoles/battery1/width}} +{ + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \ifpgf@circ@fixbatteries + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +} + +%% Battery 2 % negative pole thicker + +\pgfcircdeclarebipolescaled{batteries} +{} +{\ctikzvalof{bipoles/battery2/height}} +{battery2} +{\ctikzvalof{bipoles/battery2/height}} +{\ctikzvalof{bipoles/battery2/width}} +{ + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \ifpgf@circ@fixbatteries + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfsetlinewidth{3\pgflinewidth} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfsetlinewidth{3\pgflinewidth} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +} + +%%%%%%%%%%% +%% Round and diamond sources +%%%%%%%%%%% + +%% Independent voltage source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/vsource/height}} +{vsource} +{\ctikzvalof{bipoles/vsource/height}} +{\ctikzvalof{bipoles/vsource/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} +} + +%% To change the internal symbols of the voltage source american style +\ctikzset{bipoles/vsourceam/inner plus/.initial={$+$}} +\ctikzset{bipoles/vsourceam/inner minus/.initial={$-$}} +%% Independent voltage source - American style +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/vsourceam/height}} +{vsourceAM} +{\ctikzvalof{bipoles/vsourceam/height}} +{\ctikzvalof{bipoles/vsourceam/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfsetcolor{\ctikzvalof{color}} + \ifpgf@circ@oldvoltagedirection + \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner plus}} + \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner minus}} + \else + \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner minus}} + \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner plus}} + \fi +} + +%% Independent sinusoidal voltage source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/vsourcesin/height}} +{vsourcesin} +{\ctikzvalof{bipoles/vsourcesin/height}} +{\ctikzvalof{bipoles/vsourcesin/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +% Square Voltage source - contributed by Alistair Kwan +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/vsourcesquare/height}} +{vsourcesquare} +{\ctikzvalof{bipoles/vsourcesquare/height}} +{\ctikzvalof{bipoles/vsourcesquare/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}} + \pgfpathlineto{\pgfpoint{-1\pgf@circ@res@up}{1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{-1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{-1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +% Triangle Voltage source - contributed by Ralf Farkas +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/vsourcetri/height}} +{vsourcetri} +{\ctikzvalof{bipoles/vsourcetri/height}} +{\ctikzvalof{bipoles/vsourcetri/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}} + \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@up}{0.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@up}{-0.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + + +%% PV Source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/pvsource/height}} +{pvsource} +{\ctikzvalof{bipoles/pvsource/height}} +{\ctikzvalof{bipoles/pvsource/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@down}} + \pgfusepath{draw} + + %Arrow Part + \pgfscope + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}} + \pgfusepath{draw} + \endpgfscope + +} + +%% Empty Source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/esource/height}} +{esource} +{\ctikzvalof{bipoles/esource/height}} +{\ctikzvalof{bipoles/esource/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill +} + +%% DC Current Source with open shape +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/dcisource/height}} +{dcisource} +{\ctikzvalof{bipoles/dcisource/height}} +{\ctikzvalof{bipoles/dcisource/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@maybefill + \edef\@@angle{\ctikzvalof{bipoles/dcisource/angle}} + \pgfpathmoveto{\pgfpointpolar{\@@angle}{\pgf@circ@res@up}} + \pgfpatharc{\@@angle}{-\@@angle}{\pgf@circ@res@up} + \pgfpathmoveto{\pgfpointpolar{180-\@@angle}{\pgf@circ@res@up}} + \pgfpatharc{180-\@@angle}{180+\@@angle}{\pgf@circ@res@up} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope +} + +%% DC-Voltage source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/dcvsource/height}} +{dcvsource} +{\ctikzvalof{bipoles/dcvsource/height}} +{\ctikzvalof{bipoles/dcvsource/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@left}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@right}} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@left}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@right}} + \pgfusepath{draw} +} + +%% Independent current source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/isource/height}} +{isource} +{\ctikzvalof{bipoles/isource/height}} +{\ctikzvalof{bipoles/isource/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgf@circ@draworfill +} + +%% Independent double oo source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/oosource/height}} +{oosource} +{\ctikzvalof{bipoles/oosource/height}} +{\ctikzvalof{bipoles/oosource/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}} + {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left} + \pgf@circ@maybefill + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@right}{0}} + {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@right} + \pgf@circ@draworfill + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}} + {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left} + \pgfusepath{draw} +} + +% % % winding symbols +% triangle +\def\pgf@circ@delta#1{ + \pgfscope + \pgftransformscale{-.01\pgf@circ@res@left*#1} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \pgftransformrotate{-\pgfcircmathresult} + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0}{.866\pgf@circ@res@up}} + \pgfpathclose + \pgfusepath{stroke} + \endpgfscope +} + +% star +\def\pgf@circ@wye#1{ + \pgfscope + \pgftransformscale{-.015\pgf@circ@res@left*#1} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \pgftransformrotate{-\pgfcircmathresult} + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpointorigin} + \pgfpathlineto{\pgfpointpolar{-30}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpointpolar{-150}{\pgf@circ@res@down}} + \pgfusepath{stroke} + \endpgfscope +} + +% zigzag +\def\pgf@circ@zig#1{ + \pgfscope + \pgftransformscale{-.015\pgf@circ@res@left*#1} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \pgftransformrotate{-\pgfcircmathresult} + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpointpolar{90}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointpolar{60}{\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpointpolar{210}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointpolar{0}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpointpolar{330}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointpolar{-60}{\pgf@circ@res@up}} + \pgfusepath{stroke} + \endpgfscope +} + +% % % % round three-phase transformer +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/oosourcetrans/height}} +{oosourcetrans} +{\ctikzvalof{bipoles/oosourcetrans/height}} +{\ctikzvalof{bipoles/oosourcetrans/width}} +{ + + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}} + {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left} + \pgf@circ@maybefill + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@right}{0}} + {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right} + \pgf@circ@draworfill + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}} + {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left} + \pgfusepath{draw} + + +% % % % draw inner symbols + + %%primary winding + \ifpgf@circ@prim@delta + \pgfscope + \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left} + \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@prim@wye + \pgfscope + \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left} + \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@prim@zig + \pgfscope + \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left} + \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}} + \endpgfscope + \fi\fi\fi + + %%secondary winding + \ifpgf@circ@sec@delta + \pgfscope + \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right} + \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@sec@wye + \pgfscope + \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right} + \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@sec@zig + \pgfscope + \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right} + \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}} + \endpgfscope + \fi\fi\fi +} + + +% % % % ooosource for three phase transformer +\pgfcircdeclarebipolescaled{sources} +{ + \anchor{right}{ + \northeast + \pgf@y=0pt + \pgfmathparse{ + \ctikzvalof{bipoles/ooosource/circleoffset}* sin(30) + + %%the sqrt must be > 0, the circles have to intersect + sqrt( + pow(\ctikzvalof{bipoles/ooosource/circlesize},2) - + pow(\ctikzvalof{bipoles/ooosource/circleoffset}*cos(30),2) + ) + } + \pgf@x=\pgfmathresult\pgf@x + } + \anchor{east}{ + \northeast + \pgf@y=0pt + } + \savedanchor{\centerprim}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@scaled@Rlen + \pgf@y=0pt + \pgf@x=.5\pgf@circ@scaled@Rlen + } + \anchor{centerprim}{ + \centerprim + } + \savedanchor{\centersec}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@scaled@Rlen + \pgfpointpolar{60}{.5\pgf@circ@scaled@Rlen} + \pgf@y=-\pgf@y + \pgf@x=-\pgf@x + } + \anchor{centersec}{ + \centersec + } + \savedanchor{\centertert}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@scaled@Rlen + \pgfpointpolar{60}{.5\pgf@circ@scaled@Rlen} + \pgf@y=\pgf@y + \pgf@x=-\pgf@x + } + \anchor{centertert}{ + \centertert + } + + % add some anchors in case the are needed :) + \anchor{prim1}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen + \pgfpointadd{\centerprim}{\pgfpointpolar{135}{.5\pgf@circ@scaled@Rlen}} + } + \anchor{prim2}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen + \pgfpointadd{\centerprim}{\pgfpointpolar{-135}{.5\pgf@circ@scaled@Rlen}} + } + \anchor{sec1}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen + \pgfpointadd{\centersec}{\pgfpointpolar{0}{.5\pgf@circ@scaled@Rlen}} + } + \anchor{sec2}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen + \pgfpointadd{\centersec}{\pgfpointpolar{45}{.5\pgf@circ@scaled@Rlen}} + } + \anchor{sec3}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen + \pgfpointadd{\centersec}{\pgfpointpolar{90}{.5\pgf@circ@scaled@Rlen}} + } + \anchor{tert1}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen + \pgfpointadd{\centertert}{\pgfpointpolar{0}{.5\pgf@circ@scaled@Rlen}} + } + \anchor{tert2}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen + \pgfpointadd{\centertert}{\pgfpointpolar{-45}{.5\pgf@circ@scaled@Rlen}} + } + \anchor{tert3}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen + \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen + \pgfpointadd{\centertert}{\pgfpointpolar{-90}{.5\pgf@circ@scaled@Rlen}} + } +} +{\ctikzvalof{bipoles/ooosource/height}} +{ooosource} +{\ctikzvalof{bipoles/ooosource/height}} +{\ctikzvalof{bipoles/ooosource/height}} +{ +% \pgf@circ@res@other = \ctikzvalof{bipoles/ooosource/vectorgroup} \pgf@circ@scaled@Rlen + +% % filling +% left + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left} + \pgf@circ@maybefill + + % up + \pgfscope + \pgfpointorigin + \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right} + \pgf@circ@maybefill + \endpgfscope +% down + \pgfscope + \pgfpointorigin + \pgfpathcircle{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right} + \pgf@circ@draworfill + \endpgfscope + +% drawing + % left + \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left} + \pgfusepath{draw} + + % up + \pgfscope + \pgfpointorigin + \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right} + \pgfusepath{draw} + \endpgfscope + +% % % draw inner symbols + +% % primary winding + \ifpgf@circ@prim@delta + \pgfscope + \pgftransformxshift{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left} + \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@prim@wye + \pgfscope + \pgftransformxshift{.6\pgf@circ@res@left} + \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@prim@zig + \pgfscope + \pgftransformxshift{.6\pgf@circ@res@left} + \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}} + \endpgfscope + \fi\fi\fi + +% % secondary winding + \ifpgf@circ@sec@delta + \pgfscope + \pgfpointorigin + \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}} + \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@sec@wye + \pgfscope + \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}} + \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@sec@zig + \pgfscope + \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}} + \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}} + \endpgfscope + \fi\fi\fi + +% % tertiary winding + \ifpgf@circ@tert@delta + \pgfscope + \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}} + \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@tert@wye + \pgfscope + \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}} + \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}} + \endpgfscope + + \else\ifpgf@circ@tert@zig + \pgfscope + \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}} + \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}} + \endpgfscope + \fi\fi\fi +} + +%% Independent current source - American +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/isourceam/height}} +{isourceAM} +{\ctikzvalof{bipoles/isourceam/height}} +{\ctikzvalof{bipoles/isourceam/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope +} + +%% Independent sinusoidal current source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/isource/height}} +{isourcesin} +{\ctikzvalof{bipoles/isource/height}} +{\ctikzvalof{bipoles/isource/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Empty controlled source +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/ecsource/height}} +{ecsource} +{\ctikzvalof{bipoles/ecsource/height}} +{\ctikzvalof{bipoles/ecsource/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill +} + +%% Controlled voltage source +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/cvsource/height}} +{cvsource} +{\ctikzvalof{bipoles/cvsource/height}} +{\ctikzvalof{bipoles/cvsource/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} +} + +%% To change the internal symbols of the controlled voltage source american style +\ctikzset{bipoles/cvsourceam/inner plus/.initial={$+$}} +\ctikzset{bipoles/cvsourceam/inner minus/.initial={$-$}} +%% Controlled voltage source - American +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/cvsourceam/height}} +{cvsourceAM} +{\ctikzvalof{bipoles/cvsourceam/height}} +{\ctikzvalof{bipoles/cvsourceam/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + + \pgfsetcolor{\ctikzvalof{color}} + \ifpgf@circ@oldvoltagedirection + \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{\ctikzvalof{bipoles/cvsourceam/inner plus}} + \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{\ctikzvalof{bipoles/cvsourceam/inner minus}} + \else + \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{\ctikzvalof{bipoles/cvsourceam/inner minus}} + \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{\ctikzvalof{bipoles/cvsourceam/inner plus}} + \fi +} + +%% Controlled sinusoidal voltage source +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/cvsourcesin/height}} +{cvsourcesin} +{\ctikzvalof{bipoles/cvsourcesin/height}} +{\ctikzvalof{bipoles/cvsourcesin/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Controlled sinusoidal current source +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/cvsourcesin/height}} +{cisourcesin} +{\ctikzvalof{bipoles/cvsourcesin/height}} +{\ctikzvalof{bipoles/cvsourcesin/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Controlled current source +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/cisource/height}} +{cisource} +{\ctikzvalof{bipoles/cisource/height}} +{\ctikzvalof{bipoles/cisource/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfusepath{draw} +} + +%% Controlled current source - American +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/cisourceam/height}} +{cisourceAM} +{\ctikzvalof{bipoles/cisourceam/height}} +{\ctikzvalof{bipoles/cisourceam/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope +} + +%% Cute Independent voltage source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/vsource/height}} +{vsourceC} +{\ctikzvalof{bipoles/vsource/height}} +{\ctikzvalof{bipoles/vsource/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfsetroundcap\pgfusepath{draw} +} + +%% Cute Independent current source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/isource/height}} +{isourceC} +{\ctikzvalof{bipoles/isource/height}} +{\ctikzvalof{bipoles/isource/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}} + \pgfsetroundcap\pgfusepath{draw} +} + +%% Cute Controlled voltage source +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/cvsource/height}} +{cvsourceC} +{\ctikzvalof{bipoles/cvsource/height}} +{\ctikzvalof{bipoles/cvsource/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@draworfill + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfsetroundcap\pgfusepath{draw} +} + +%% Cute Controlled current source +\pgfcircdeclarebipolescaled{csources} +{} +{\ctikzvalof{bipoles/cisource/height}} +{cisourceC} +{\ctikzvalof{bipoles/cisource/height}} +{\ctikzvalof{bipoles/cisource/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@draworfill + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@down}} + \pgfsetroundcap\pgfusepath{draw} +} + +%% Noise voltage source +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/vsource/height}} +{vsourceN} +{\ctikzvalof{bipoles/vsource/height}} +{\ctikzvalof{bipoles/vsource/width}} +{ + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + % + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax + \edef\pgf@noise@temp{dashed} + \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}} + \ifx\pgf@noise@temp\pgf@noise@fill + % fillable in this case + \pgf@circ@draworfillandclip + \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thinner\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + % + \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \else + \pgfsetfillcolor{\pgf@noise@fill} + \pgfusepath{draw,fill} + \fi + \endpgfscope + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfsetroundcap\pgfusepath{draw} +} +%% Noise current source + +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/isource/height}} +{isourceN} +{\ctikzvalof{bipoles/isource/height}} +{\ctikzvalof{bipoles/isource/width}} +{ + \pgfpointorigin + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + % + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax + \edef\pgf@noise@temp{dashed} + \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}} + \ifx\pgf@noise@temp\pgf@noise@fill + % fillable in this case + \pgf@circ@draworfillandclip + \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thinner\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + % + \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \else + \pgfsetfillcolor{\pgf@noise@fill} + \pgfusepath{draw,fill} + \fi + \endpgfscope + \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}} + \pgfsetlinewidth{\@@thicker\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}} + \pgfsetroundcap\pgfusepath{draw} +} + +%%%%%%%%%%%%%% +%% Diodes +%%%%%%%%%%%%%% + +%% Black generic diode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/diode/height}} +{fulldiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Black Zener diode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/diode/height}} +{fullzdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Black alternative zigzag Zener diode +\pgfcircdeclarebipolescaled{diodes} +{% fix the anchor border + \pgfcirc@border@extend@updown{1.3}{1.3} +} +{\ctikzvalof{bipoles/diode/height}} +{fullzzdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-1.8\pgf@circ@res@left}{\pgf@circ@res@down-0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-0.2\pgf@circ@res@left}{\pgf@circ@res@up-0.5\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +%% Black Schottky diode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/diode/height}} +{fullsdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{.6\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{.6\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + +} + +%% Black tunnel diode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/diode/height}} +{fulltdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +% +% draw LED arrows +% +\def\pgf@circ@draw@ledarrows{% + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \ifpgf@led@fliparrows + \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}} + \pgfusepath{draw} + \else + \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} + \fi +} +% +% ---and photodiode arrows +% +\def\pgf@circ@draw@pdarrows{% + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsstart{latexslim} + \ifpgf@pd@fliparrows + \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}} + \pgfusepath{draw} + \else + \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} + \fi +} +%% Black light emitting diode +\pgfcircdeclarebipolescaled{diodes} +{% fix the anchor border + \pgfcirc@border@extend@updown{1.8}{1} +} +{\ctikzvalof{bipoles/diode/height}} +{fulllediode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgf@circ@draw@ledarrows +} + +%% Black photodiode +\pgfcircdeclarebipolescaled{diodes} +{% fix the anchor border + \pgfcirc@border@extend@updown{1.8}{1} +} +{\ctikzvalof{bipoles/diode/height}} +{fullpdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgf@circ@draw@pdarrows +} + +%% Black varcap +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/varcap/height}} +{fullvarcap} +{\ctikzvalof{bipoles/varcap/height}} +{\ctikzvalof{bipoles/varcap/width}} +{ + \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgfsetlinewidth{\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfusepath{draw,fill} + % + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Code for the diode triangle +\def\pgf@circ@basicdiodeshape{ + % \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \pgfscope + % to allow filling, we need to draw explicitly the stroke here. + \pgfsetlinewidth{\pgfstartlinewidth} + \ifpgf@circuit@bipole@strokedsymbol + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfusepath{draw} + \fi + \endpgfscope + % \endpgfscope +} + +%% Empty generic diode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/diode/height}} +{emptydiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Empty Zener diode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/diode/height}} +{emptyzdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgf@circ@basicdiodeshape + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-0.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Empty alternative zigzag Zener diode +\pgfcircdeclarebipolescaled{diodes} +{% fix the anchor border + \pgfcirc@border@extend@updown{1.3}{1.3} +} +{\ctikzvalof{bipoles/diode/height}} +{emptyzzdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfscope + \pgf@circ@basicdiodeshape + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-1.8\pgf@circ@res@left}{\pgf@circ@res@down-0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-0.2\pgf@circ@res@left}{\pgf@circ@res@up-0.5\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} +%% Empty Schottky diode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/diode/height}} +{emptysdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{.6\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{.6\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + +} + +%% Empty tunnel diode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/diode/height}} +{emptytdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Empty light emitting diode +\pgfcircdeclarebipolescaled{diodes} +{% fix the anchor border + \pgfcirc@border@extend@updown{1.8}{1} +} +{\ctikzvalof{bipoles/diode/height}} +{emptylediode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgf@circ@draw@ledarrows +} + +%% Empty photodiode +\pgfcircdeclarebipolescaled{diodes} +{% fix the anchor border + \pgfcirc@border@extend@updown{1.8}{1} +} +{\ctikzvalof{bipoles/diode/height}} +{emptypdiode} +{\ctikzvalof{bipoles/diode/height}} +{\ctikzvalof{bipoles/diode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgf@circ@basicdiodeshape + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgf@circ@draw@pdarrows +} + +%% Empty varcap +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/varcap/height}} +{emptyvarcap} +{\ctikzvalof{bipoles/varcap/height}} +{\ctikzvalof{bipoles/varcap/width}} +{ + \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgfsetlinewidth{\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + % \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + \pgfscope + % to allow filling, we need to draw explicitily the stroke here. + \pgfsetlinewidth{\pgfstartlinewidth} + \ifpgf@circuit@bipole@strokedsymbol + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfusepath{draw} + \fi + \endpgfscope + % + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Empty bidirectionaldiode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/bidirectionaldiode/height}} +{emptybidirectionaldiode} +{\ctikzvalof{bipoles/bidirectionaldiode/height}} +{\ctikzvalof{bipoles/bidirectionaldiode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgf@circ@draworfill + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} +} + +%% Full bidirectionaldiode +\pgfcircdeclarebipolescaled{diodes} +{} +{\ctikzvalof{bipoles/bidirectionaldiode/height}} +{fullbidirectionaldiode} +{\ctikzvalof{bipoles/bidirectionaldiode/height}} +{\ctikzvalof{bipoles/bidirectionaldiode/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfusepath{draw, fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} +} + +%% Black thyristor +\pgfcircdeclarebipolescaled{diodes} +{ + \anchor{gate}{\northeast} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{G}{\northeast} + \anchor{cathode}{\northeast\pgf@y=0cm } +} +{\ctikzvalof{tripoles/thyristor/height 2}} +{fullthyristor} +{\ctikzvalof{tripoles/thyristor/height}} +{\ctikzvalof{tripoles/thyristor/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right + + \pgfscope + \pgftransformxshift{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfusepath{draw,fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + +} + +%% Empty thyristor + +\pgfcircdeclarebipolescaled{diodes} +{ + \anchor{gate}{\northeast} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{G}{\northeast} + \anchor{cathode}{\northeast\pgf@y=0cm } +} +{\ctikzvalof{tripoles/thyristor/height 2}} +{emptythyristor} +{\ctikzvalof{tripoles/thyristor/height}} +{\ctikzvalof{tripoles/thyristor/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right + + \pgfscope + \pgftransformxshift{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \pgfscope + % to allow filling, we need to draw explicitily the stroke here. + \pgfsetlinewidth{\pgfstartlinewidth} + \ifpgf@circuit@bipole@strokedsymbol + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfusepath{draw} + \fi + \endpgfscope + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} +} + +%% Empty triac +\pgfcircdeclarebipolescaled{diodes} +{ + \anchor{gate}{\northeast} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{G}{\northeast} + \anchor{cathode}{\northeast\pgf@y=0cm } +} +{\ctikzvalof{tripoles/triac/height}} +{emptytriac} +{\ctikzvalof{tripoles/triac/height}} +{\ctikzvalof{tripoles/triac/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgf@circ@draworfill + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} +} + +%% Full triac +\pgfcircdeclarebipolescaled{diodes} +{ + \anchor{gate}{\northeast} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{G}{\northeast} + \anchor{cathode}{\northeast\pgf@y=0cm } +} +{\ctikzvalof{tripoles/triac/height}} +{fulltriac} +{\ctikzvalof{tripoles/triac/height}} +{\ctikzvalof{tripoles/triac/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + + \pgfusepath{draw,fill} + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} +} + +%%%%%%%%%%%%% +%% switches +%%%%%%%%%%%%% + +%% (Closing) SPST +\pgfcircdeclarebipolescaled{switches} +{} +{\ctikzvalof{bipoles/spst/depth}} +{cspst} +{\ctikzvalof{bipoles/spst/height}} +{\ctikzvalof{bipoles/spst/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpointpolar{90}{1.2\pgf@circ@res@right}} + \pgfpatharc{90}{-20}{1.2\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfsetbeveljoin + \pgfusepath{draw} + \endpgfscope +} + +%% Opening SPST +\pgfcircdeclarebipolescaled{switches} +{} +{\ctikzvalof{bipoles/spst/depth}} +{ospst} +{\ctikzvalof{bipoles/spst/height}} +{\ctikzvalof{bipoles/spst/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}} + \pgfpatharc{-10}{90}{1.2\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfsetbeveljoin + \pgfusepath{draw} + \endpgfscope +} + +%% Normal open Switch +\pgfcircdeclarebipolescaled{switches} +{} +{\ctikzvalof{bipoles/nos/depth}} +{nos} +{\ctikzvalof{bipoles/nos/height}} +{\ctikzvalof{bipoles/nos/width}} +{ + + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfusepath{draw} +} + +%% Normal closed Switch +\pgfcircdeclarebipolescaled{switches} +{} +{\ctikzvalof{bipoles/ncs/depth}} +{ncs} +{\ctikzvalof{bipoles/ncs/height}} +{\ctikzvalof{bipoles/ncs/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Push Button +\pgfcircdeclarebipolescaled{switches} +{ + \anchor{tip}{\northeast\pgf@x=0pt\relax} +} +{\ctikzvalof{bipoles/pushbutton/height 2}} +{pushbutton} +{\ctikzvalof{bipoles/pushbutton/height}} +{\ctikzvalof{bipoles/pushbutton/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} + \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} +} + +%% Normally closed Push Button +\pgfcircdeclarebipolescaled{switches} +{ + \anchor{tip}{\northeast\pgf@x=0pt\relax} +} +{\ctikzvalof{bipoles/pushbutton/height 2}} +{ncpushbutton} +{\ctikzvalof{bipoles/pushbutton/height}} +{\ctikzvalof{bipoles/pushbutton/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + % Warning, if the nodes will have a class, we have to touch this. + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp}} + \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}} + \pgfusepath{draw} + % + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} + \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} +} +%% Push Button (normally closed but now open :-) see +%% https://github.com/circuitikz/circuitikz/issues/128#issuecomment-731771299 +\pgfcircdeclarebipolescaled{switches} +{ + \anchor{tip}{ + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen + \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp + \pgf@x=0pt\relax + } +} +{\ctikzvalof{bipoles/pushbutton/height 2}} +{pushbuttonc} +{\ctikzvalof{bipoles/pushbutton/height}} +{\ctikzvalof{bipoles/pushbutton/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}} + \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up/2+\pgf@circ@res@temp}} + \pgfusepath{draw} + + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} + \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} +} + +%% Normally closed Push Button now open +\pgfcircdeclarebipolescaled{switches} +{ + \anchor{tip}{ + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen + \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp + \pgf@x=0pt\relax + } +} +{\ctikzvalof{bipoles/pushbutton/height 2}} +{ncpushbuttono} +{\ctikzvalof{bipoles/pushbutton/height}} +{\ctikzvalof{bipoles/pushbutton/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + % Warning, if the nodes will have a class, we have to touch this. + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up/2}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up/2}} + \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@up/2}} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up/2+\pgf@circ@res@temp}} + \pgfusepath{draw} + % + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} + \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}} +} +%%% reed switches +\pgfcircdeclarebipolescaled{switches} +{} +{\ctikzvalof{bipoles/reed/depth}} +{reed} +{\ctikzvalof{bipoles/reed/height}} +{\ctikzvalof{bipoles/reed/width}} +{ + % this is designed to be the same as a "nos". + \pgfmathsetmacro{\@@tmpx}{0.9*\ctikzvalof{bipoles/nos/width}/\ctikzvalof{bipoles/reed/width}} + \pgfmathsetmacro{\@@tmpy}{\ctikzvalof{bipoles/nos/height}/\ctikzvalof{bipoles/reed/height}} + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + % eclosure + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@up}{\pgf@circ@res@up}} + \pgfpatharc{90}{-90}{\pgf@circ@res@up} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@up}{-\pgf@circ@res@up}} + \pgfpatharc{270}{90}{\pgf@circ@res@up} + \pgfpathclose + \pgf@circ@draworfill + % switch + \pgfpathmoveto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{\@@tmpy\pgf@circ@res@up}} + % connection lines + \pgfsetbuttcap + \pgfusepath{draw} + \endpgfscope + % connection lines + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} +} + +% cute switch "to" shapes help function +% #1 -> name +% #2 -> barposition +% #3 -> arrowcode +\long\def\pgfcircdeclarecutesw#1#2#3{ + \pgfcircdeclarebipolescaled{switches} + { + \savedanchor\midlever{ + % these values are calculated when we create the definition of the shape. + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgf@circ@res@down = -.5\pgf@y + \pgf@circ@res@up = .5\pgf@y + \pgfextracty{\pgf@circ@res@other}{#2} + \pgf@x=0pt + \pgf@y=.5\pgf@circ@res@other + } + % radius of the connector + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + % If cnnecting nodes are scaled, we have to modify this + \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} + % shapename + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + % shape type + \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}} + % mid of the lever, to stack switches + \anchor{mid}{\midlever} + \anchor{cout}{\northeast \pgf@y=0cm} + \anchor{cin}{\southwest\pgf@y=0cm} + \anchor{out}{\northeast \pgf@y=0cm\advance\pgf@x by \radius} + \anchor{in}{\southwest\pgf@y=0cm\advance\pgf@x by -\radius} + } + {\ctikzvalof{bipoles/cuteswitch/height 2}} + {#1} + {\ctikzvalof{bipoles/cuteswitch/height}} + {\ctikzvalof{bipoles/cuteswitch/width}}{ + \pgfscope + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + % If cnnecting nodes are scaled, we have to modify this + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgfsetlinewidth{2\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{#2} + \pgfsetroundcap\pgfusepath{draw} + \endpgfscope + \pgfscope % arrow + #3 + \endpgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}} + \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}} + \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}} + } +} + +%% closed cute switch +\pgfcircdeclarecutesw{cuteclosedswitch} + {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}} + {} + +%% open cute switch +\pgfcircdeclarecutesw{cuteopenswitch} + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + {} + +%% closing cute switch +\pgfcircdeclarecutesw{cuteclosingswitch} + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + { + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{70}{1.2\pgf@circ@res@right}} + \pgfpatharc{70}{-10}{1.2\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} + } + +%% opening cute switch +\pgfcircdeclarecutesw{cuteopeningswitch} + {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}} + { + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}} + \pgfpatharc{-10}{60}{1.2\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} + } + +%%%%%%%%%%%%%%%%% +%% Instruments +%%%%%%%%%%%%%%%%% + +% % METERINGSHAPE +\long\def\drawmeteringcircle{ + \def\pgf@circ@temp{right} + \ifx\tikz@res@label@pos\pgf@circ@temp + \pgf@circ@res@step=-1.2\pgf@circ@res@up + \else + \def\pgf@circ@temp{below} + \ifx\tikz@res@label@pos\pgf@circ@temp + \pgf@circ@res@step=-1.2\pgf@circ@res@up + \else + \pgf@circ@res@step=1.2\pgf@circ@res@up + \fi + \fi + %draw connections to circle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + %draw circle + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up} + \pgf@circ@draworfill + \endpgfscope + %draw arrow + \pgfscope + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%AMPEREMETER +\pgfcircdeclarebipolescaled{instruments} +{} +{\ctikzvalof{bipoles/ammeter/height}} +{ammeter} +{\ctikzvalof{bipoles/ammeter/height}} +{\ctikzvalof{bipoles/ammeter/width}} +{ + \drawmeteringcircle + \pgfnode{circle}{center}{\pgf@circ@font@bold{A}}{}{} +} +%OHMMETER +\pgfcircdeclarebipolescaled{instruments} +{} +{\ctikzvalof{bipoles/ohmmeter/height}} +{ohmmeter} +{\ctikzvalof{bipoles/ohmmeter/height}} +{\ctikzvalof{bipoles/ohmmeter/width}} +{ + \drawmeteringcircle + \pgfnode{circle}{center}{\boldmath$\Omega$}{}{} +} +%VOLTMETER +\pgfcircdeclarebipolescaled{instruments} +{} +{\ctikzvalof{bipoles/voltmeter/height}} +{voltmeter} +{\ctikzvalof{bipoles/voltmeter/height}} +{\ctikzvalof{bipoles/voltmeter/width}} +{ + \drawmeteringcircle + \pgfnode{circle}{center}{\pgf@circ@font@bold{V}}{}{} + +} + +% oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176 +\pgfcircdeclarebipolescaled{instruments} +{ + \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x} + \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/oscope/height}} +{oscope} +{\ctikzvalof{bipoles/oscope/height}} +{\ctikzvalof{bipoles/oscope/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\southwest} + \pgfextracty{\pgf@circ@res@down}{\southwest} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfscope + \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + % this would create a round (analog?) scope... + % \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \endpgfscope + % get the rotation + \ifpgf@circuit@straightinstruments + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \else + \edef\rot{0} + \fi + % and unrotate the scope + \pgfscope + \pgftransformrotate{\rot} + % grid + \pgfscope + \pgfsetlinewidth{0.5\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}} + \pgfpathgrid[stepx=\pgf@circ@res@step, stepy=\pgf@circ@res@step]% + {\pgfpoint{0.75\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + {\pgfpoint{0.75\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfsetstrokeopacity{0.5} + \pgfusepath{draw} + \endpgfscope + % function displayed, thanks to + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + +% generic round meter with always horizontal text, no arrow +\pgfcircdeclarebipolescaled{instruments} +{} +{\ctikzvalof{bipoles/esource/height}} +{rmeter} +{\ctikzvalof{bipoles/esource/height}} +{\ctikzvalof{bipoles/esource/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + % draw the text label + % get the rotation + \ifpgf@circuit@straightinstruments + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \else + \edef\rot{0} + \fi + % and unrotate the scope + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + \pgftransformrotate{\rot} + \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}} + \endpgfscope +} + +% generic round meter with always horizontal text, with arrow +\pgfcircdeclarebipolescaled{instruments} +{} +{\ctikzvalof{bipoles/esource/height}} +{rmeterwa} +{\ctikzvalof{bipoles/esource/height}} +{\ctikzvalof{bipoles/esource/width}} +{ + \pgfpointorigin + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + % draw the text label + % get the rotation + \ifpgf@circuit@straightinstruments + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \else + \edef\rot{0} + \fi + % and unrotate the scope + \pgfscope + \pgftransformrotate{\rot} + \pgfsetcolor{\ctikzvalof{color}} + \pgfsetlinewidth{\pgfstartlinewidth} + % arrow: create a center hole to have better visual + \pgfscope + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next open a circle into it + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{.6\pgf@circ@res@up}}{\pgfpoint{.6\pgf@circ@res@left}{0}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfsetarrowsend{latexslim} + % the arrow is better if it has a bit of breath and it's not 45º + \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@left}{1.2\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@right}{1.2\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + \pgftext[center]{\ctikzvalof{bipoles/twoport/text}} + \endpgfscope +} + +% generic square meter with always horizontal text +\pgfcircdeclarebipolescaled{instruments} +{ + \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x} + \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/smeter/height}} +{smeter} +{\ctikzvalof{bipoles/smeter/height}} +{\ctikzvalof{bipoles/smeter/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\southwest} + \pgfextracty{\pgf@circ@res@down}{\southwest} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfscope + \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@draworfill + \endpgfscope + % get the rotation + \ifpgf@circuit@straightinstruments + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \else + \edef\rot{0} + \fi + % and unrotate the scope + \pgfscope + \pgftransformrotate{\rot} + % the metering window + \pgfscope + \def\@starta{105}\def\@stopa{75} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgftransformshift{\pgfpoint{0pt}{-1.8\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpointpolar{\@starta}{2\pgf@circ@res@up}} + \pgfpatharc{\@starta}{\@stopa}{2\pgf@circ@res@up} + \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}} + \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up} + \pgfclosepath + \pgfpathmoveto{\pgfpointpolar{80}{2\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointpolar{80}{2.4\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + \pgftext[center, y=0.5\pgf@circ@res@down]{\ctikzvalof{bipoles/twoport/text}} + \endpgfscope +} + +% probes qucs style: +% #1 : name +% #2 : extra code +\long\def\pgfcirc@qucsprobe#1#2{ + \pgfcircdeclarebipolescaled{instruments} + { + \anchor{v+}{\southwest\pgf@x=0.6\pgf@x} + \anchor{v-}{\southwest\pgf@x=-0.6\pgf@x} + % put the node text above and centered + \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } + } + {\ctikzvalof{bipoles/qmeter/depth}} + {#1} + {\ctikzvalof{bipoles/qmeter/height}} + {\ctikzvalof{bipoles/qmeter/width}} + { + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\southwest} + \pgfextracty{\pgf@circ@res@down}{\southwest} + \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up} + \pgfscope + \pgfscope + \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@draworfill + \endpgfscope + \def\@starta{103}\def\@stopa{77} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfscope + \pgftransformshift{\pgfpoint{0pt}{-1.7\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpointpolar{\@starta}{2.1\pgf@circ@res@up}} + \pgfpatharc{\@starta}{\@stopa}{2.1\pgf@circ@res@up} + \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}} + \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up} + \pgfclosepath + \pgfpathmoveto{\pgfpointpolar{83}{2.1\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointpolar{83}{2.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgf@circ@draworfill + \endpgfscope + #2 + \endpgfscope + } +} + +\pgfcirc@qucsprobe{qiprobe}{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \pgfnode{currarrow}{center}{}{}{} +} + +\pgfcirc@qucsprobe{qvprobe}{ + \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{0pt}} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other} + \pgfusepath{draw} + \pgfscope + % "+" and "-", drawn so that they scale correctly + \pgfsetlinewidth{2\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-1.5\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-3.5\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}} + \pgfusepath{draw} + \endpgfscope +} + +\pgfcirc@qucsprobe{qpprobe}{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \pgfnode{currarrow}{center}{}{}{} + \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left}{-3\pgf@circ@res@other}}{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{-4\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right}{-3\pgf@circ@res@other}}{\pgf@circ@res@other} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{-4\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfscope + % "+" and "-", drawn so that they scale correctly + \pgfsetlinewidth{2\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-2\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-4\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+4\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right-4\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-3\pgf@circ@res@other}} + \pgfusepath{draw} + \endpgfscope +} + +% current loop for oscope and similar: stylized +\pgfcircdeclarebipolescaled{instruments} +{ + \anchor{i}{\northeast\pgf@x=0pt\relax} + \anchor{text}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/iloop/height}} +{iloop} +{\ctikzvalof{bipoles/iloop/height}} +{\ctikzvalof{bipoles/iloop/width}} +{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@down=-\pgf@circ@res@up + \pgf@circ@res@left=-\pgf@circ@res@right + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgfsetcolor{\ctikzvalof{color}} + % external ellipse + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next the opening to the left + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} + {\pgfpoint{0pt}{.1\pgf@circ@res@up}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfpathellipse{\pgfpointorigin}{ + \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{ + \pgfpoint{0.4\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \endpgfscope + % internal wire + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % and the contact line up + \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +% current loop for oscope and similar: real (double connection) +\pgfcircdeclarebipolescaled{instruments} +{ + \anchor{i+}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgf@y=\pgf@circ@res@up + } + \anchor{i-}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgf@y=\pgf@circ@res@up + } + \anchor{text}{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@left}{\northeast} + \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{ + \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax + } + } +} +{\ctikzvalof{bipoles/iloop/height}} +{iloop2} +{\ctikzvalof{bipoles/iloop/height}} +{\ctikzvalof{bipoles/iloop/width}} +{ + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgf@circ@res@down=-\pgf@circ@res@up + \pgf@circ@res@left=-\pgf@circ@res@right + % must be the same than internal i+ and i- anchors definition + \pgf@circ@res@step=0.4\pgf@circ@res@right + \pgf@circ@res@other=0.8\pgf@circ@res@up + \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}} + \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}} + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgfsetcolor{\ctikzvalof{color}} + % external ellipse + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + % clipping path: first a rectangle bigger then the shape + % to avoid problems with the line thickness + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}} + {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}} + % next the opening to the left + \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}} + {\pgfpoint{0pt}{.1\pgf@circ@res@up}} + % do the difference and clip before drawing + \pgfseteorule + \pgfusepath{clip} + \pgfpathmoveto{\@plus} + \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other} + \pgfusepath{draw} + \endpgfscope + % internal wire + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + % and the contact line up + % I use ...left and ---right as temporal lengths here to avoid defining more + \pgfextractx{\pgf@circ@res@left}{\@plus} + \pgfextractx{\pgf@circ@res@right}{\@minus} + \pgfpathmoveto{\@plus} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathmoveto{\@minus} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + + +%% Varistor +\pgfcircdeclarebipolescaled{resistors} +{ + \pgfcirc@border@extend@updown{1}{1.4} +} +{\ctikzvalof{bipoles/varistor/height}} +{varistor} +{\ctikzvalof{bipoles/varistor/height}} +{\ctikzvalof{bipoles/varistor/width}} +{ + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/varistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/varistor/main}\pgf@circ@res@up}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\pgf@circ@font@tiny\textsf{U}}} +} + +%%%%%%%%%%%%%% +%% RF bipoles +%%%%%%%%%%%%%% + +% transmission line +\pgfcircdeclarebipolescaled{RF} +{} +{\ctikzvalof{bipoles/tline/height}} +{tline} +{\ctikzvalof{bipoles/tline/height}} +{\ctikzvalof{bipoles/tline/width}} +{ + \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis + \begin{pgftransparencygroup} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \pgfpathellipse{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} + {\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{-\pgf@circ@res@up}} + \pgf@circ@draworfill + \end{pgftransparencygroup} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{stroke} +} + +% microstrip transmission line +\pgfcircdeclarebipolescaled{RF} +{} +{\ctikzvalof{bipoles/mstline/height}} +{mstline} +{\ctikzvalof{bipoles/mstline/height}} +{\ctikzvalof{bipoles/mstline/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill +} + +%%%%%%%%%%%%%%%%%%% +%% Block diagrams +%%%%%%%%%%%%%%%%%%% + +%% Draw the two-port fillable box +\def\pgf@circ@twoportbox{ + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \endpgfscope +} + +%% Generic two port box +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/twoport/height}} +{twoport} +{\ctikzvalof{bipoles/twoport/height}} +{\ctikzvalof{bipoles/twoport/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + % draw outer box + \pgf@circ@twoportbox + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}} + +} + +%% twoport split +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/twoportsplit/width}} +{twoportsplit} +{\ctikzvalof{bipoles/twoportsplit/width}} +{\ctikzvalof{bipoles/twoportsplit/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/twoportsplit/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + %get texts + \def\pgfcirc@tin{\ctikzvalof{bipoles/twoport/text in}} + \def\pgfcirc@tout{\ctikzvalof{bipoles/twoport/text out}} + + % rotate inner symbol + \def\texti{\pgfcirc@tin} + \def\textii{\pgfcirc@tout} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \def\texti{\pgfcirc@tout} + \def\textii{\pgfcirc@tin} + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \def\texti{\pgfcirc@tout} + \def\textii{\pgfcirc@tin} + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \def\texti{\pgfcirc@tin} + \def\textii{\pgfcirc@tout} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\texti} + \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textii} +} + +%% voltage controled oscillator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/vco/width}} +{vco} +{\ctikzvalof{bipoles/twoport/width}} +{\ctikzvalof{bipoles/vco/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + % draw circle + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step} + \pgf@circ@draworfill + \endpgfscope + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner sine waves + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% bandpass filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/bandpass/width}} +{bandpass} +{\ctikzvalof{bipoles/bandpass/width}} +{\ctikzvalof{bipoles/bandpass/width}} +{ + + \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% bandstop filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/bandstop/width}} +{bandstop} +{\ctikzvalof{bipoles/bandstop/width}} +{\ctikzvalof{bipoles/bandstop/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225% 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt}% always draw solid line for inner symbol + \pgfsetarrows{-}%never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% highpass filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/highpass/width}} +{highpass} +{\ctikzvalof{bipoles/highpass/width}} +{\ctikzvalof{bipoles/highpass/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% lowpass filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/lowpass/width}} +{lowpass} +{\ctikzvalof{bipoles/lowpass/width}} +{\ctikzvalof{bipoles/lowpass/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% allpass filter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/allpass/width}} +{allpass} +{\ctikzvalof{bipoles/allpass/width}} +{\ctikzvalof{bipoles/allpass/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/allpass/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% ADC +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/adc/width}} +{adc} +{\ctikzvalof{bipoles/adc/width}} +{\ctikzvalof{bipoles/adc/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\texti{A} + \def\textii{D} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \def\texti{D} + \def\textii{A} + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \def\texti{D} + \def\textii{A} + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \def\texti{A} + \def\textii{D} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} + \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} +} + +%% DAC +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/dac/width}} +{dac} +{\ctikzvalof{bipoles/dac/width}} +{\ctikzvalof{bipoles/dac/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\texti{D} + \def\textii{A} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \def\texti{A} + \def\textii{D} + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \def\texti{A} + \def\textii{D} + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \def\texti{D} + \def\textii{A} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}} + \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}} +} + +%% DSP +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/dsp/width}} +{dsp} +{\ctikzvalof{bipoles/dsp/width}} +{\ctikzvalof{bipoles/dsp/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgftext[center,x=0,y=0]{\textsf{DSP}} +} + +%% FFT +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/fft/width}} +{fft} +{\ctikzvalof{bipoles/fft/width}} +{\ctikzvalof{bipoles/fft/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgftext[center,x=0,y=0]{\textsf{FFT}} +} + +%% Amplifier +\pgfcircdeclarebipolescaled{blocks} +{} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{amp} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \ifpgf@circuit@boxed + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \pgf@circ@draworfill + \fi + + % draw input arrow + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + \ifpgf@circuit@boxed + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn + \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + + \pgfsetarrows{-} %never draw arrows + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} + \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} + + \pgfpathclose + \pgf@circ@draworfill + + % draw inner text + \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} +} + + +%% variable amplifier +\pgfcircdeclarebipolescaled{blocks} +{} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{vamp} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \ifpgf@circuit@boxed + \ctikzvalof{bipoles/twoport/width} + \else + \ctikzvalof{bipoles/amp/width} + \fi +} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw input arrow + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + \ifpgf@circuit@boxed + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn + \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + + + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + + \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}} + \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}} + + \pgfpathclose + \pgf@circ@draworfill + + % draw inner text + \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} + + % draw arrow + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}} + \pgfusepath{draw} +} + +%% pi attenuator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/piattenuator/width}} +{piattenuator} +{\ctikzvalof{bipoles/piattenuator/width}} +{\ctikzvalof{bipoles/piattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% variable pi attenuator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{vpiattenuator} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{\ctikzvalof{bipoles/vpiattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% T attenuator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/tattenuator/width}} +{tattenuator} +{\ctikzvalof{bipoles/tattenuator/width}} +{\ctikzvalof{bipoles/tattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% variable T attenuator +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/vtattenuator/width}} +{vtattenuator} +{\ctikzvalof{bipoles/vtattenuator/width}} +{\ctikzvalof{bipoles/vtattenuator/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% phase shifter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/phaseshifter/width}} +{phaseshifter} +{\ctikzvalof{bipoles/phaseshifter/width}} +{\ctikzvalof{bipoles/phaseshifter/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % inner symbol + \pgftext[center,x=0,y=0]{\Large$\varphi$} +} + +%% variable phase shifter +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/phaseshifter/width}} +{vphaseshifter} +{\ctikzvalof{bipoles/vphaseshifter/width}} +{\ctikzvalof{bipoles/vphaseshifter/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225 + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % inner symbol + \pgftext[center,x=0,y=0]{\Large$\varphi$} + + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% detector +\pgfcircdeclarebipolescaled{blocks} +{} +{\ctikzvalof{bipoles/detector/width}} +{detector} +{\ctikzvalof{bipoles/detector/width}} +{\ctikzvalof{bipoles/detector/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{0.8\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}} + \pgfusepath{draw} + + \ifpgf@circuit@fulldiode + \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width}} + \pgftransformscale{\pgfmathresult} + \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}} + \else + \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width}} + \pgftransformscale{\pgfmathresult} + \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}} + \fi + +} + +%% single phase ac/dc converter +\pgfcircdeclarebipolescaled{blocks} +{ + \anchor{dc1}{ + \northeast + \pgf@y=.4\pgf@y + } + \anchor{dc2}{ + \northeast + \pgf@y=-.4\pgf@y + } +} +{\ctikzvalof{bipoles/sacdc/width}} +{sacdc} +{\ctikzvalof{bipoles/sacdc/width}} +{\ctikzvalof{bipoles/sacdc/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/sacdc/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + % draw sin wave + \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + + % draw equal sign + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}} + \pgfusepath{draw} +} + + + +%% single phase dc/ac converter +\pgfcircdeclarebipolescaled{blocks} +{ + \anchor{dc1}{ + \northeast + \pgf@y=.4\pgf@y + \pgf@x=-\pgf@x + } + \anchor{dc2}{ + \northeast + \pgf@y=-.4\pgf@y + \pgf@x=-\pgf@x + } +} +{\ctikzvalof{bipoles/sdcac/width}} +{sdcac} +{\ctikzvalof{bipoles/sdcac/width}} +{\ctikzvalof{bipoles/sdcac/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/sdcac/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + % draw sin wave + \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + + % draw equal sign + \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}} + \pgfusepath{draw} +} + + +%% threephase ac/dc converter +\pgfcircdeclarebipolescaled{blocks} +{ + \anchor{dc1}{ + \northeast + \pgf@y=.4\pgf@y + } + \anchor{dc2}{ + \northeast + \pgf@y=-.4\pgf@y + } + \anchor{ac1}{ + \northeast + \pgf@y=.6\pgf@y + \pgf@x=-\pgf@x + } + \anchor{ac2}{ + \northeast + \pgf@y=0\pgf@y + \pgf@x=-\pgf@x + } + \anchor{ac3}{ + \northeast + \pgf@y=-.6\pgf@y + \pgf@x=-\pgf@x + } +} +{\ctikzvalof{bipoles/tacdc/width}} +{tacdc} +{\ctikzvalof{bipoles/tacdc/width}} +{\ctikzvalof{bipoles/tacdc/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/tacdc/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + % draw sin waves + \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.65\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.35\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + + + + + % draw equal sign + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}} + \pgfusepath{draw} +} + + +%% threephase dc/ac converter +\pgfcircdeclarebipolescaled{blocks} +{ + \anchor{dc1}{ + \northeast + \pgf@y=.4\pgf@y + \pgf@x=-\pgf@x + } + \anchor{dc2}{ + \northeast + \pgf@y=-.4\pgf@y + \pgf@x=-\pgf@x + } + \anchor{ac1}{ + \northeast + \pgf@y=.6\pgf@y + } + \anchor{ac2}{ + \northeast + \pgf@y=0\pgf@y + } + \anchor{ac3}{ + \northeast + \pgf@y=-.6\pgf@y + } +} +{\ctikzvalof{bipoles/tdcac/width}} +{tdcac} +{\ctikzvalof{bipoles/tdcac/width}} +{\ctikzvalof{bipoles/tdcac/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/tdcac/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + % draw sin waves + \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.65\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.35\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}} + \pgfusepath{draw} + + + + + % draw equal sign + \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}} + \pgfusepath{draw} +} + + +%%%%%%%%%%%%%%%%%%%%%%% +%% MECHANICAL SYMBOLS +%%%%%%%%%%%%%%%%%%%%%%% + +%% mechanical capacitance - stiffness/spring + +\pgfcircdeclarebipolescaled{mechanicals} +{} +{\ctikzvalof{bipoles/spring/height}} +{spring} +{\ctikzvalof{bipoles/spring/height}} +{\ctikzvalof{bipoles/spring/width}}{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + + \pgfmathsetlength{\pgf@circ@res@step} + {(\ctikzvalof{bipoles/spring/width}*\pgf@circ@scaled@Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + \pgfsetcornersarced{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfsetbuttcap + \pgfsetbeveljoin + \pgfusepath{stroke} +} + +%% mechanical capacitance - inerter +\pgfcircdeclarebipolescaled{mechanicals} +{} +{\ctikzvalof{bipoles/inerter/height}} +{inerter} +{\ctikzvalof{bipoles/inerter/height}} +{\ctikzvalof{bipoles/inerter/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill +} + + +%% mechanical inductance - mass +\pgfcircdeclarebipolescaled{mechanicals} +{} +{\ctikzvalof{bipoles/mass/box height}} +{mass} +{\ctikzvalof{bipoles/mass/height}} +{\ctikzvalof{bipoles/mass/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgftransformationadjustments + \pgfpathrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{-2\pgf@circ@res@down}{-2\pgf@circ@res@down}} + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfsetrectcap + \pgfsetmiterjoin + \pgfusepath{stroke} +} + +%% mechanical resistor - damper +\pgfcircdeclarebipolescaled{mechanicals} +{} +{\ctikzvalof{bipoles/damper/height}} +{damper} +{\ctikzvalof{bipoles/damper/height}} +{\ctikzvalof{bipoles/damper/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@maybefill + + % line into the damper + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {\pgf@circ@res@zero}} + \pgfusepath{stroke} + + % damper box + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + + \pgfsetrectcap + \pgfsetmiterjoin + \pgfusepath{stroke} + + % damper vertical element + \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfusepath{stroke} + +} +%% mechanical viscoelastic element, suggested by @alex +%% in https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz +\pgfcircdeclarebipolescaled{mechanicals} +{} % extra anchors +{\ctikzvalof{bipoles/damper/height}} % depth (under the path line) +{viscoe} % name +{\ctikzvalof{bipoles/damper/height}} % height (above the path line) +{\ctikzvalof{bipoles/damper/width}} % width +{ % draw the bipole + \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgf@circ@maybefill + + % spring into the damper + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfsetcornersarced{\pgfpoint{.25\pgf@circ@res@up}{.25\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.75\pgf@circ@res@left}{.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@left}{-.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-.75\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{.75\pgf@circ@res@up}} + \pgfusepath{stroke} + \endpgfscope + % damper box + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + + \pgfsetrectcap + \pgfsetmiterjoin + \pgfusepath{stroke} + + % damper vertical element + \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right} + {.8\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfusepath{stroke} + +} + +%%%%%%%%%%%%%%%% +%% Crossing +%%%%%%%%%%%%%%%% + +%% crossing bipole (but see also nodes) +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/crossing/size}} +{crossing} +{\ctikzvalof{bipoles/crossing/size}} +{\ctikzvalof{bipoles/crossing/size}}{ + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} + \pgfsetbeveljoin + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \endpgfscope +} + +%%%%%%%%%%%%%%%%%%%%%%%%% +%% Miscellaneous bipoles +%%%%%%%%%%%%%%%%%%%%%%%%% + +%% loudspeaker and microphone + +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/loudspeaker/depth}} +{loudspeaker} +{\ctikzvalof{bipoles/loudspeaker/height}} +{\ctikzvalof{bipoles/loudspeaker/width}}{ + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}} + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.4\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill +} + +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/mic/depth}} +{mic} +{\ctikzvalof{bipoles/mic/height}} +{\ctikzvalof{bipoles/mic/width}}{ + + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpoint{0pt}{.6\pgf@circ@res@up}}{.4\pgf@circ@res@up} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{0pt}} + % 0.25358 is 0.6-0.4*cos(30) + \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + + \pgfusepath{draw} + \endpgfscope +} + +%% european gas filled surge arrester +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/european gas filled surge arrester/height}} +{european gas filled surge arrester} +{\ctikzvalof{bipoles/european gas filled surge arrester/height}} +{\ctikzvalof{bipoles/european gas filled surge arrester/width}} +{ + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@draworfill + + \pgfscope + \pgfsetarrowsend{latexslim} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/european gas filled surge arrester/inside}\pgf@circ@res@left}{0pt}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfusepath{draw} + + \endpgfscope +} + +%% american gas filled surge arrester +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/american gas filled surge arrester/height}} +{american gas filled surge arrester} +{\ctikzvalof{bipoles/american gas filled surge arrester/height}} +{\ctikzvalof{bipoles/american gas filled surge arrester/width}}{ + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpointorigin \pgf@circ@res@other = \pgf@x \advance \pgf@circ@res@other by -\pgf@circ@res@up + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfscope + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfscope + \pgfsetarrowsend{latex} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \endpgfscope{} + + \pgfcircle{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/dot x}\pgf@circ@res@left}{\ctikzvalof{bipoles/american gas filled surge arrester/dot y}\pgf@circ@res@down}}{\ctikzvalof{bipoles/american gas filled surge arrester/size}\pgf@circ@res@down} + \pgfusepath{fill} +} + +%% thermocouple +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/thermocouple/height 2}} +{thermocouple} +{\ctikzvalof{bipoles/thermocouple/height}} +{\ctikzvalof{bipoles/thermocouple/width}} +{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfusepath{draw} +} + +%% fuse +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/fuse/height}} +{fuse} +{\ctikzvalof{bipoles/fuse/height}} +{\ctikzvalof{bipoles/fuse/width}} +{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfusepath{draw} + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgf@circ@draworfill +} + +%% asymmetric fuse +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/afuse/height}} +{afuse} +{\ctikzvalof{bipoles/afuse/height}} +{\ctikzvalof{bipoles/afuse/width}} +{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfusepath{draw} + + \pgfscope + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \endpgfscope + + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{stroke,fill} +} + +%% SQUID added by Cor Molenaar 5 March 2010 +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/squid/height}} +{squid} +{\ctikzvalof{bipoles/squid/height}} +{\ctikzvalof{bipoles/squid/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@down}} + + \pgfusepath{draw} +} + +% Generic barrier added by Cor Molenaar 5 March 2010 +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/barrier/height}} +{barrier} +{\ctikzvalof{bipoles/barrier/height}} +{\ctikzvalof{bipoles/barrier/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}} + + \pgfusepath{draw} +} + +% +% open version of the barrier symbol +% suggested by Radványi Patrik Tamás +% +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/barrier/height}} +{openbarrier} +{\ctikzvalof{bipoles/barrier/height}} +{\ctikzvalof{bipoles/barrier/width}} +{ + % this is set with normal wire linewidth + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + + % do the cross part + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}} + + \pgfusepath{draw} +} +%% Lamp +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/lamp/height}} +{lamp} +{\ctikzvalof{bipoles/lamp/height}} +{\ctikzvalof{bipoles/lamp/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% bulb +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/bulb/height}} +{bulb} +{\ctikzvalof{bipoles/bulb/height}} +{\ctikzvalof{bipoles/bulb/width}} +{% + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left} + \pgfsetbeveljoin + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} +} + + +% end of pgfcircbipoles.tex +%%%---------- close: tex/pgfcircbipoles +%%%%%%%%%%% Springe nach tex/pgfcirctripoles +%%%---------- open: tex/pgfcirctripoles.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Tripoles + +%%%%%%%%%%%%% +%% switches +%%%%%%%%%%%%% + +% Legacy spdt +\pgfdeclareshape{spdt}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/spdt/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out 1}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{out 2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@res@other = \ctikzvalof{tripoles/spdt/margin}\pgf@circ@res@left + + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + + \pgfusepath{draw} + + \pgfscope + \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}} + \endpgfscope + + \pgfscope + \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}} + \pgfpathlineto{ + \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}} + {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}} + } + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + } +} + + +% cute switch "node" shapes, matching with cute "to" shapes +% #1 -> name +% #2 -> barposition +% #3 -> arrowcode +\long\def\pgfcircdeclarecutespdt#1#2#3{ + \pgfdeclareshape{#1} + { + \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen + \pgf@x=.25\pgf@x + } + \savedanchor\midlever{ + % these values are calculated when we create the definition of the shape. + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgf@circ@res@down = -.5\pgf@y + \pgf@circ@res@up = .5\pgf@y + \pgfextracty{\pgf@circ@res@other}{#2} + \pgf@x=0pt + \pgf@y=.5\pgf@circ@res@other + } + % radius of the connector + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} + % shapename + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + % shape type + \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}} + % mid of the lever, to stack switches + \anchor{mid}{\midlever} + % center anchors + \anchor{cin}{ \northwest \pgf@y=0pt} + \anchor{cout 1}{ \northwest \pgf@x=-\pgf@x } + \anchor{cout 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + % horizontal angles + \anchor{in}{ \northwest \pgf@y=0pt\advance\pgf@x by -\radius} + \anchor{out 1}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius} + \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius \pgf@y=-\pgf@y } + + \anchor{center}{ \pgf@y=0pt \pgf@x=0pt } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \pgf@circ@res@temp=\radius\relax + \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp + \pgfsetlinewidth{2\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{#2} + \pgfsetroundcap\pgfusepath{draw} + \endpgfscope + \pgfscope % arrow + #3 + \endpgfscope + % terminals + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}} + \endpgfscope + + } + } +} + +\pgfcircdeclarecutespdt{cute spdt up} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up-1.5\pgf@circ@res@temp}} +{} + +\pgfcircdeclarecutespdt{cute spdt mid} +{\pgfpoint{\pgf@circ@res@right}{0pt}} +{} + +\pgfcircdeclarecutespdt{cute spdt down} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}} +{} + +\pgfcircdeclarecutespdt{cute spdt up arrow} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up-1.5\pgf@circ@res@temp}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}} + \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} +} + +\pgfcircdeclarecutespdt{cute spdt mid arrow} +{\pgfpoint{\pgf@circ@res@right}{0pt}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfsetarrowsstart{latexslim} + \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}} + \pgfpatharc{-60}{60}{1.5\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} +} + +\pgfcircdeclarecutespdt{cute spdt down arrow} +{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node + \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}} + \pgfpatharc{-50}{70}{1.5\pgf@circ@res@right} + \pgfsetarrowsend{latexslim} + \pgfusepath{draw} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Logic ports +%% +%% Code from John Kormylo at tex.stackexchange.com +%% See https://tex.stackexchange.com/questions/372993/is-it-possible-to-implement-multiple-input-logic-ports-with-circuitikz +%% Integration and fixes from Romano Giannetti and TheTeXnician <38565529+TheTeXnician@users.noreply.github.com> +%% + +\newcount\pgf@circ@res@count% reserve global register + +\def\pgf@circ@logicport@input#1% #1 = \pgfmathcounter +{% + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@step\relax +}% + +% #1 = \pgfmathcounter #2=type #3 specificic port +% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor, 4 for european. +\def\pgf@circ@logicport@baseinput#1#2#3% +{% + % and and nand + \ifnum #2=1\relax + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@step\relax + \pgf@x=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@left + \fi + % or and nor + \ifnum #2=2\relax + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfextractx{\pgf@circ@res@right}{\northeast}% + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@step\relax + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american #3 port/angle}}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + \pgf@circ@res@temp=\pgf@y + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgf@x=\pgf@circ@res@other + \fi + % xor and xnor + \ifnum #2=3\relax + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american #3 port/angle}{\pgf@circ@math@angle}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + \pgf@circ@res@temp=\ctikzvalof{tripoles/american #3 port/distance}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} + % this compensates for the effect of the line width on the gap between the arcs + \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% + \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}% + + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@step\relax + \pgf@circ@res@temp=\pgf@y + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \advance\pgf@circ@res@other by -\pgf@circ@math@distance + \pgf@x=\pgf@circ@res@other + \fi + % european + \ifnum #2=4\relax + \pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@other}{\left}% + \step + \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax + \advance\pgf@y by -#1\pgf@circ@res@step\relax + \pgf@x=\pgf@circ@res@other + \fi +}% + +%%% american +\long\def\pgfcircdeclarelogicport#1#2#3{% + \pgfdeclareshape{american #1 port}% + {% + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro\resize{% automatic + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@up = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgf@circ@res@down = -\pgf@circ@res@up + \pgf@circ@res@right = \ctikzvalof{tripoles/american #1 port/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@right = .5\pgf@circ@res@right + \pgf@circ@res@left = -\pgf@circ@res@right + }% + \savedmacro\inputs{% get number of inputs + \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax% + \ifnum\pgf@circ@res@count=0 + \pgf@circ@res@count=\ctikzvalof{tripoles/american #1 port/inputs}\relax% + \fi + \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi + \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi + \def\inputs{\the\pgf@circ@res@count}% + }% + \savedanchor\step{% 1/2 gap at edges + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen + \divide\pgf@circ@res@step by \pgf@circ@res@count + \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}% + }% + \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@left}{0pt}} + \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@right}{0pt}} + \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/american #1 port/origin}\pgf@circ@res@right}{0pt}} + + \anchor{center}{\origin}% for backwards compatibility + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + % create input anchors + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@american #1 port\endcsname{% + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@circ@res@count% + \else% + %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@american #1 port@in \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above + }% + \expandafter\xdef\csname pgf@anchor@american #1 port@bin \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{#2}{#1}% defined above + }% + %}{}% + \repeatpgfmathloop% + } + + \anchor{out}{\northeast\pgf@y=0pt} + \anchor{bout}{\right\pgf@y=0pt} + + + \anchor{left}{\left}% edges of component minus leads + \anchor{right}{\right} + + \anchor{north east}{\northeast}% see \Compass macro + \anchor{south west}{\southwest} + \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfpoint{0cm}{\pgf@circ@res@up}} + \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfpoint{\pgf@circ@res@left}{0cm}} + \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}% + \pgfpoint{0cm}{\pgf@circ@res@down}} + \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}% + \pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfpoint{\pgf@circ@res@right}{0cm}} + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + #3 + } +} +} +%%% american and %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{and}{1}{ + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \ifpgfcirc@draw@input@leads + %input leads + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left} + {\pgf@circ@res@temp}} + \advance\pgf@circ@res@count by -1 + \repeat + \fi + % output lead + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@right} {0pt}} + \pgfusepath{draw} + \fi + + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgf@circ@res@other=\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpatharc{-90}{90}{-2\pgf@circ@res@other and \pgf@circ@res@up} + \pgfpathclose + \pgf@circ@draworfill + } +%%% american nand %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \pgfcircdeclarelogicport{nand}{1}{ + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \ifpgfcirc@draw@input@leads + %input leads + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@left} + {\pgf@circ@res@temp}} + \advance\pgf@circ@res@count by -1 + \repeat + \fi + + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}} + \pgfusepath{draw} + \fi + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgf@circ@res@step = \ctikzvalof{tripoles/american nand port/circle width}\pgf@circ@res@right + \pgf@circ@res@other = \ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right + \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpatharc{-90}{90}{\pgf@circ@res@temp and \pgf@circ@res@up} + \pgfpathclose + + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@other-.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@step}} + + \pgf@circ@draworfill +} +%%% american nor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{nor}{2}{ + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \ifpgfcirc@draw@input@leads + %input leads + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + \fi + + \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}% + \pgf@circ@res@step = \ctikzvalof{tripoles/american nor port/circle width}\pgf@circ@res@right + \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax + \advance\pgf@circ@res@other by -\pgf@circ@res@step + + % main shape + \ifpgfcirc@roundy@or@shapes + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpathclose + \else + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathclose + \fi + + % not dot + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@step}} + + \pgf@circ@draworfill +} +%%% american or %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{or}{2}{ + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \ifpgfcirc@draw@input@leads + %input leads + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + \fi + + \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}% + + % main shape + \ifpgfcirc@roundy@or@shapes + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpathclose + \else + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathclose + \fi + + \pgf@circ@draworfill +} +%%% american xor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{xor}{3}{ + \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xor port/angle}{\pgf@circ@math@angle}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} + % this compensates for the effect of the line width on the gap between the arcs + \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% + \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}% + + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \ifpgfcirc@draw@input@leads + %input leads + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \advance\pgf@circ@res@other by -\pgf@circ@math@distance + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + \fi + + \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xor port/angle}}% + + % main shape + \ifpgfcirc@roundy@or@shapes + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpathclose + \else + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathclose + \fi + \pgf@circ@draworfill + + \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}% + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}% + + \pgfusepath{draw} +} +%%% american xnor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\pgfcircdeclarelogicport{xnor}{3}{ + \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xnor port/angle}{\pgf@circ@math@angle}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/inner}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% + \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% + \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% + \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right + \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} + % this compensates for the effect of the line width on the gap between the arcs + \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% + \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}% + + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + \pgf@circ@res@count = \inputs\relax + \ifpgfcirc@draw@input@leads + %input leads + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \advance\pgf@circ@res@other by -\pgf@circ@math@distance + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + \fi + + \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + + \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xnor port/angle}}% + \pgf@circ@res@step = \ctikzvalof{tripoles/american xnor port/circle width}\pgf@circ@res@right + \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax + \advance\pgf@circ@res@other by -\pgf@circ@res@step + + % main shape + \ifpgfcirc@roundy@or@shapes + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpathclose + \else + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathclose + \fi + + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@step}} + \pgf@circ@draworfill + + \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@left + \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}% + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}% + + \pgfusepath{draw} +} + +%%% Original one-input ports + +\pgfdeclareshape{american not port}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{left}{ + \northwest + \pgf@x=0.7\pgf@x + \pgf@y=0pt + } + \anchor{bin}{ + \northwest + \pgf@x=0.7\pgf@x + \pgf@y=0pt + } + \anchor{bin 1}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{right}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } + \anchor{bout}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchorborder{% this is used when the node is used as a path element + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + } + \anchor{text}{% + % centered and a bit to the left (it's a triangle)! + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right + + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgf@circ@draworfill + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@step-.5\pgf@circ@res@other}{0pt}} + {\pgfpoint{.5\pgf@circ@res@other}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@other}} + \pgf@circ@draworfill + \endpgfscope + + \ifpgfcirc@draw@input@leads + %input leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + \fi + + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + \fi + + \pgfusepath{draw} + } +} + +\pgfdeclareshape{american buffer port}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{left}{ + \northwest + \pgf@x=0.7\pgf@x + \pgf@y=0pt + } + \anchor{bin}{ + \northwest + \pgf@x=0.7\pgf@x + \pgf@y=0pt + } + \anchor{bin 1}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{right}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } + \anchor{bout}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchorborder{% this is used when the node is used as a path element + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + } + \anchor{text}{% + % centered and a bit to the left (it's a triangle)! + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgf@circ@draworfill + \endpgfscope + + \ifpgfcirc@draw@input@leads + %input leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + \fi + + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + \fi + + \pgfusepath{draw} + } +} +\pgfdeclareshape{invschmitt}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{left}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{bin}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{bin 1}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{right}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } + \anchor{bout}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchorborder{% this is used when the node is used as a path element + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + } + \anchor{text}{% + % centered and a bit to the left (it's a triangle)! + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right + + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@step-.5\pgf@circ@res@other}{0pt}} + {\pgfpoint{.5\pgf@circ@res@other}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@other}} + \pgf@circ@draworfill + \endpgfscope + + \ifpgfcirc@draw@input@leads + %input leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + \fi + + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + \fi + \pgfusepath{draw} + %draw inner shape + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfusepath{draw} + + } +} + +\pgfdeclareshape{schmitt}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{left}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{bin}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{bin 1}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{right}{ + \northwest + \pgf@y=0pt + \pgf@x=-.7\pgf@x + } + \anchor{bout}{ + \northwest + \pgf@y=0pt + \pgf@x=-.7\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchorborder{% this is used when the node is used as a path element + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + } + \anchor{text}{% + % centered and a bit to the left (it's a triangle)! + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \ifpgfcirc@draw@input@leads + %input leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + \fi + + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right-\pgf@circ@res@other}{0pt}} + \fi + \pgfusepath{draw} + %draw inner shape + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfusepath{draw} + + } +} + + +%%% start european logic ports, from John Kormylo +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% + +% #1 - name +% #2 - text inside +% #3 - number of inputs +% #4 = is it a not? +% +% option to add a circle for not-output, see +% https://github.com/circuitikz/circuitikz/issues/385 +% +\newif\ifpgf@circ@european@port@circle\pgf@circ@european@port@circlefalse +\newif\ifpgf@circ@european@port@circle@ieee\pgf@circ@european@port@circle@ieeefalse +\ctikzset{tripoles/european not shape/.initial=ocirc} +\ctikzset{tripoles/european not symbol/.is choice} +\ctikzset{tripoles/european not symbol/triangle/.code={\pgf@circ@european@port@circlefalse}} +\ctikzset{tripoles/european not symbol/circle/.code={% +\pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeefalse\ctikzset{tripoles/european not shape=ocirc}}} +\ctikzset{tripoles/european not symbol/ieee circle/.code={% +\pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeetrue\ctikzset{tripoles/european not shape=notcirc}}} + +\long\def\pgfcircdeclareeurologicport#1#2#3#4{ + \pgfdeclareshape{european #1 port} + { + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \saveddimen{\boutshift}{% + \edef\pgf@temp{not} + \edef\pgf@circ@temp{#4} + \ifx\pgf@temp\pgf@circ@temp % is a not + \ifpgf@circ@european@port@circle + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \edef\pgf@temp{ocirc} + \edef\pgf@circ@temp{\ctikzvalof{tripoles/european not shape}} + \ifx\pgf@temp\pgf@circ@temp % it's ocirc + \pgfmathsetlength{\pgf@x}{2*\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \else % it's ieee not circ + \pgf@circ@notradius % defined together with ieeestd ports + \pgf@x=2\pgf@circ@res@temp + \fi + \else + \pgf@x=0pt + \fi + \else + \pgf@x=0pt + \fi + } + \savedmacro\resize{% automatic + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@up = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgf@circ@res@down = -\pgf@circ@res@up + \pgf@circ@res@right = \ctikzvalof{tripoles/european #1 port/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@right = .5\pgf@circ@res@right + \pgf@circ@res@left = -\pgf@circ@res@right + }% + \savedmacro\inputs{% get number of inputs + \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax% + \ifnum\pgf@circ@res@count=0 + \pgf@circ@res@count=\ctikzvalof{tripoles/european #1 port/inputs}\relax% + \fi + \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi + \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi + \def\inputs{\the\pgf@circ@res@count}% + }% + \savedanchor\step{% 1/2 gap at edges + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@step = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen + \divide\pgf@circ@res@step by #3 + \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}% + }% + \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}% + \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}% + \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% + \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}% + \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/european #1 port/origin}\pgf@circ@res@right}{0pt}}% + + \anchor{center}{\origin}% for backwards compatibility + % the text anchor overlaps the logic symbol + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}% + % create input anchors + \ifnum#3=1\relax + \anchor{in}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step + \anchor{in 1}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step + \anchor{bin}{\left\pgfpoint{\pgf@x}{0pt}}% or \step + \anchor{bin 1}{\left\pgfpoint{\pgf@x}{0pt}}% or \step + \else + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@european #1 port\endcsname{% + \pgfmathloop% + \ifnum\pgfmathcounter>#3% + \else% + %\pgfutil@ifundefined{pgf@anchor@european #1 port@in \pgfmathcounter}{% redundant + \expandafter\xdef\csname pgf@anchor@european #1 port@in \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above + }% + \expandafter\xdef\csname pgf@anchor@european #1 port@bin \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{4}{#1}% defined above + }% + %}{}% + \repeatpgfmathloop% + } + \fi + \anchor{out}{\northeast\pgf@y=0pt} + \anchor{bout}{\right\advance\pgf@x by \boutshift\pgf@y=0pt} + + \anchor{left}{\left}% edges of component minus leads + \anchor{right}{\right\advance\pgf@x by \boutshift\pgf@y=0pt} + + \anchor{north east}{\northeast}% see \Compass macro + \anchor{south west}{\southwest} + \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfpoint{0cm}{\pgf@circ@res@up}} + \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}% + \pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}% + \pgfpoint{\pgf@circ@res@left}{0cm}} + \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}% + \pgfpoint{0cm}{\pgf@circ@res@down}} + \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}% + \pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}% + \pgfpoint{\pgf@circ@res@right}{0cm}} + + \anchorborder{% this is used when the node is used as a path element + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\northeast} + \pgfextractx{\pgf@circ@res@right}{\northeast} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgfstartlinewidth=\pgflinewidth + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathrectanglecorners + {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + \endpgfscope + \ifpgfcirc@draw@input@leads + %input leads + \ifnum#3=1\relax + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}% + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% + \else + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + %\pgf@circ@res@count = #3\relax% redundant + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left} + {\pgf@circ@res@temp}} + \advance\pgf@circ@res@count by -1 + \repeat + \fi + \pgfusepath{draw} + \fi + % + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{ \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \fi + % + \edef\pgf@temp{not} + \edef\pgf@circ@temp{#4} + \ifx\pgf@temp\pgf@circ@temp % is a not + \ifpgf@circ@european@port@circle + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right} + % reset linewidth for IEEE ports, otherwise they will multiply... + \ifpgf@circ@european@port@circle@ieee\pgfsetlinewidth{\pgfstartlinewidth}\fi + \pgfnode{\ctikzvalof{tripoles/european not shape}}{west}{}{NOT}{\pgfusepath{stroke}} + \endpgfscope + \else + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}% + {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}} + \pgfusepath{draw} + \fi + \fi + % + \pgfpathmoveto{\pgfpointorigin} + \pgftext{#2} + } + } +} +\pgfcircdeclareeurologicport{and}{\&}{\pgf@circ@res@count}{} +\pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf@circ@res@count}{} +\pgfcircdeclareeurologicport{xor}{$=1$}{\pgf@circ@res@count}{} +\pgfcircdeclareeurologicport{not}{$1$}{1}{not} +\pgfcircdeclareeurologicport{buffer}{$1$}{1}{} +\pgfcircdeclareeurologicport{nand}{\&}{\pgf@circ@res@count}{not} +\pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf@circ@res@count}{not} +\pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not} + +%% end european logic ports + +%%%%%%%%%%%%%%%%%%%%%%%% +%% Transistors +%%%%%%%%%%%%%%%%%%%%%%%% + +% +% definitions for transistor circles +% +\ctikzset{transistor circle/.is family} +\ctikzset{transistor circle/relative thickness/.initial=1} +\ctikzset{transistor circle/color/.initial=default} +\ctikzset{transistor circle/dash/.initial=none} +\ctikzset{transistor circle/scale circle radius/.initial=1} +\ctikzset{transistor circle/default base in/.initial=0.9} +\ctikzset{transistor circle/njfet base in/.initial=1.05} +\ctikzset{transistor circle/pjfet base in/.initial=1.05} +\ctikzset{transistor circle/isfet base in/.initial=0.65} + +\newif\ifpgf@circ@trcircle\pgf@circ@trcirclefalse +\ctikzset{tr circle/.is if=pgf@circ@trcircle} +\tikzset{tr circle/.is if=pgf@circ@trcircle} +% +% add a circle to the transistor: +% +\def\pgfcirc@transistorcircle{ + \ifpgf@circ@trcircle + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfsetlinewidth{\ctikzvalof{transistor circle/relative thickness}\pgflinewidth} + \edef\@@none{none}\edef\@@default{default} + \edef\@@tmp{\ctikzvalof{transistor circle/color}} + \ifx\@@tmp\@@default\else + \pgfsetcolor{\@@tmp} + \fi + \edef\@@tmp{\ctikzvalof{transistor circle/dash}} + \ifx\@@tmp\@@none\else + \expandafter\pgfsetdash\expandafter{\@@tmp}{0cm} + \fi + % radius of the circle + % \pgfmathsetlength{\pgf@circ@res@temp}{((#2+\extrabodydiodelen)-(#1)+(#3)*(#3)/((#2+\extrabodydiodelen)-(#1)))/2} + % \pgfpathcircle{\pgfpoint{#1+\pgf@circ@res@temp}{0pt}}{\pgf@circ@res@temp} + \pgfpathcircle{\pgfpoint{\circleleft+\circleradius}{0pt}}{\circleradius} + \pgf@circ@draworfill + \endpgfscope + \fi +} + +\long\def\pgfcircdeclaretransistor#1#2#3{ + \pgfdeclareshape{#1} + { + \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\circlebase}{ + \pgfkeysifdefined{\circuitikzbasekey/transistor circle/#1 base in}% + {% yes, we have it + \edef\circlebase{\ctikzvalof{transistor circle/#1 base in}}% + }{% no, use default + \edef\circlebase{\ctikzvalof{transistor circle/default base in}} + }} + % \savedmacro{\thistypeoftr}{\edef\thistypeoftr{#1}} + \saveddimen{\extrabodydiodelen}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@fet@bodydiode + % try to put the text to the right of the flyback diode + \pgfmathsetlength{\pgf@x}{( + \ctikzvalof{tripoles/#1/bodydiode distance}* + \ctikzvalof{tripoles/#1/width} + + \ctikzvalof{tripoles/#1/bodydiode scale}* + \ctikzvalof{bipoles/diode/height}/2 + )*\pgf@circ@scaled@Rlen} + \else + \pgf@x=0pt\relax + \fi + } + \savedmacro{\scaecircleradius}{ + \edef\scalecircleradius{\ctikzvalof{transistor circle/scale circle radius}} + } + \saveddimen{\circleradius}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + % repeat the extrabodydiodelen (grrr) + \ifpgf@circuit@fet@bodydiode + % try to put the text to the right of the flyback diode + \pgfmathsetlength{\pgf@circ@res@other}{( + \ctikzvalof{tripoles/#1/bodydiode distance}* + \ctikzvalof{tripoles/#1/width} + + \ctikzvalof{tripoles/#1/bodydiode scale}* + \ctikzvalof{bipoles/diode/height}/2 + )*\pgf@circ@scaled@Rlen} + \else + \pgf@circ@res@other=0pt\relax + \fi + % left + \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen + \pgf@xa=\circlebase\pgf@xa % this is the base point of the circle + % northeast + \pgf@yb=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen % y of the left point of circle + \pgf@yb=.5\pgf@yb + \pgf@xb=\pgf@circ@res@other % this is the x of the right points of the circle + % + \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@yb %this is #3 of the circle + % find the radius of the circle + \pgfmathsetlength{\pgf@x}{((\pgf@xb)-(\pgf@xa)+(\pgf@yb)*(\pgf@yb)/((\pgf@xb)-(\pgf@xa)))/2*\scalecircleradius} + } + \saveddimen{\circleleft}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen + \pgf@x=\circlebase\pgf@xa + } + \anchor{circle center}{ + \pgf@y=0pt\pgf@x=\circleleft\advance\pgf@x by\circleradius + } + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northeast{% upper right + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=0pt + } + \savedanchor\left{%center left + \pgf@y=0pt + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen + } + \savedanchor\right{%center right -- added by Burak Kelleci % this is really 0,0 + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{text}{ + \northeast + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@transisors@fixlabels + \ifpgf@circuit@fet@bodydiode + \advance \pgf@x by \extrabodydiodelen + \fi + \ifpgf@circ@trcircle + \left\pgf@xa=\pgf@x + \pgfmathsetlength{\pgf@x}{\circleleft+2*\circleradius} + % \advance \pgf@x by \circleradius + \fi + % add a bit of space to avoid central (substrate) terminal if drawn + \advance\pgf@x by 0.05\pgf@circ@scaled@Rlen\relax + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + \else + \pgf@y=.7\pgf@y + \pgf@x= \pgf@circ@scaled@Rlen + \pgf@x=0.1\pgf@x + \fi + } + \anchor{pathstart}{ % south + \northeast + \pgf@y=-\pgf@y + } + \anchor{pathend}{ + \northeast + } + \anchor{north}{ + \northeast + \pgf@circ@res@step=\pgf@y + \left + \pgf@y=\pgf@circ@res@step + \pgf@x=.5\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \northeast + \pgf@y=0pt + } + \anchor{south}{ + \northeast + \pgf@circ@res@step=\pgf@y + \left + \pgf@y=-\pgf@circ@res@step + \pgf@x=.5\pgf@x + } + \anchor{south west}{ + \northeast + \pgf@circ@res@step=\pgf@y + \left + \pgf@y=-\pgf@circ@res@step + } + \anchor{north east}{ + \northeast + } + \anchor{north west}{ + \northeast + \pgf@circ@res@step=\pgf@y + \left + \pgf@y=\pgf@circ@res@step + } + \anchor{south east}{ + \northeast + \pgf@y=-\pgf@y + } + \anchor{B}{ + \northeast + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y + \left + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step + } + \anchor{base}{ + \northeast + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y + \left + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step + } + \anchor{bulk}{ %added by Burak Kelleci + \northeast + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y + \right + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step + } + \anchor{nobulk}{ %added by Burak Kelleci + \left + \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x + } + \anchor{G}{ + \northeast + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y + \left + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step + } + \anchor{gate}{ + \northeast + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y + \left + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step + } + \anchor{nobase}{ + \left + \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x + } + \anchor{circle base}{ + \left + \pgf@x=\circlebase\pgf@x + } + \anchor{nogate}{ + \left + \pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x + } + \anchor{E}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y + } + \anchor{emitter}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y + } + \anchor{C}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y + } + \anchor{collector}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y + } + \anchor{S}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y + } + \anchor{source}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y + } + \anchor{D}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y + } + \anchor{drain}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y + } + \anchor{body C in}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y + \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y + } + \anchor{circle C}{ + \left + \pgf@xa=\circlebase\pgf@x % this is #1 of the circle + \northeast + \pgf@xb=\pgf@x %this is #2 of the circle + \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y %this is #3 of the circle + % the base of the triangle is x_2 - x_1 - r + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@xb-\pgf@xa-\circleradius} + % so let's go with the height + \pgfmathsetlength{\pgf@ya}{sqrt(abs(\circleradius*\circleradius-\pgf@circ@res@other*\pgf@circ@res@other))} + % finally, direction + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@ya + } + \anchor{circle E}{ + \left + \pgf@xa=\circlebase\pgf@x % this is #1 of the circle + \northeast + \pgf@xb=\pgf@x %this is #2 of the circle + \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y %this is #3 of the circle + % the base of the triangle is x_2 - x_1 - r + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@xb-\pgf@xa-\circleradius} + % so let's go with the height + \pgfmathsetlength{\pgf@ya}{sqrt(abs(\circleradius*\circleradius-\pgf@circ@res@other*\pgf@circ@res@other))} + % finally, direction + % finally, direction + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@ya + } + \anchor{body E in}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y + \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y + } + \anchor{body C out}{ + \northeast + \pgf@ya=\ctikzvalof{tripoles/#1/curr direction}\pgf@y + \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya + \pgf@y=\pgf@ya + \left + \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x + \pgf@y=\pgf@ya + } + \anchor{body E out}{ + \northeast + \pgf@ya=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y + \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya + \pgf@y=\pgf@ya + \left + \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x + \pgf@y=\pgf@ya + } + #2 + \backgroundpath{ + \pgftransformationadjustments + \pgfsetcolor{\ctikzvalof{color}} + % + \ifnum \ctikzvalof{tripoles/#1/curr direction} > 0 + \pgf@circuit@trans@ntypetrue + \else + \pgf@circuit@trans@ntypefalse + \fi + \northeast + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = \pgf@x + \left + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + % + #3 + % BODY DIODE + \ifpgf@circuit@fet@bodydiode + \drawbodydiode{#1} + \fi + % + } +} +} + +\long\def\drawbodydiode#1{ + \pgfscope + \pgftransformshift{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgftransformrotate{90} + % diode scale and bodydiode scale interacts. We want the size of the diode + % proportional to the transistor, so we will: + % 1) undo diode scale 2) apply transistor scale (using the current class) 3) apply bodydiode scale + \pgfmathsetmacro{\@@BDscale}{\ctikzvalof{tripoles/#1/bodydiode scale}* \ctikzvalof{\ctikzclass/scale}/\ctikzvalof{diodes/scale}} + \pgftransformscale{\@@BDscale} + \ifpgf@circuit@fulldiode + \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}} + \else + \pgfnode{emptydiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}} + \fi + \endpgfscope + % Draw stroke line + \ifpgf@circuit@strokediode + \pgfpathmoveto{\pgfpointanchor{pgf@bodydiode}{west}} + \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}} + \pgfusepath{stroke} + \fi + %Draw upper connection to body diode + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}} + \pgftransformscale{0.5} + \pgfnode{circ}{center}{}{}{\pgfusepath{fill}} + \endpgfscope{} + %Draw lower connection to body diode + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{west}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right} {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}} + \pgftransformscale{0.5} + \pgfnode{circ}{center}{}{}{\pgfusepath{fill}} + \endpgfscope +} + +\long\def\declarebpt#1{ + \pgfcircdeclaretransistor{#1}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/#1/base height}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/#1/base height}\pgf@y + } + }{ + + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}} + \pgfusepath{draw} + + % drawing base + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \ifpgf@circuit@bpt@schottky + % upper + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+ + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+ + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+ + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+ + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} + % % lower + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down- + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left- + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down- + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left- + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} + \fi + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + %draw arrow depending on type of transistor + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \edef\@@anchor{center} + \ifpgf@circuit@trans@ntype + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{btip} + \pgftransformlineattime{1.0}{% + \pgfpoint% + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}% + }{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}% + } + \else + \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{% + \pgfpoint% + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}% + }{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}% + } + \fi + \else % p-type + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip} + \pgftransformlineattime{1.0}{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}% + }{% + \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}% + } + \else + \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}% + }{% + \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}% + } + \fi + \fi + \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + \endpgfscope + + \ifpgf@circuit@bpt@drawphoto + \pgfscope + \pgfsetarrowsstart{latexslim} + \pgfpathmoveto{\pgfpointadd{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + {\pgfpoint{0.05\pgf@circ@res@left}{0.1\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpointadd{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + {\pgfpoint{0.5\pgf@circ@res@left}{0.3\pgf@circ@res@up}}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpointadd{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + {\pgfpoint{0.05\pgf@circ@res@left}{-0.1\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpointadd{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + {\pgfpoint{0.5\pgf@circ@res@left}{0.1\pgf@circ@res@up}}} + \pgfusepath{draw} + \endpgfscope + \else + \ifpgf@circuit@bpt@drawbase + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi + \fi + } +} + +\declarebpt{npn} +\declarebpt{pnp} +% +% multi-emitter and multi-collector BJTs by Romano Giannetti +% +\def\pgf@circ@bjt@C@anchor#1{% #1: collector number + \pgfextractx{\pgf@circ@res@temp}{\basedimension} + \pgfextracty{\pgf@circ@res@other}{\basedimension} + \ifnum\cdir>0 % NPN, above + \pgfpoint{\pgf@circ@res@temp}{% + \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep} + \else % PNP, below + \pgfpoint{\pgf@circ@res@temp}{% + -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep} + \fi +} +\def\pgf@circ@bjt@E@anchor#1{% #1: collector number + \pgfextractx{\pgf@circ@res@temp}{\basedimension} + \pgfextracty{\pgf@circ@res@other}{\basedimension} + \ifnum\cdir<0 % PNP, above + \pgfpoint{\pgf@circ@res@temp}{% + \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep} + \else % PNP, below + \pgfpoint{\pgf@circ@res@temp}{% + -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep} + \fi +} + +\long\def\declarebjt#1{ + \pgfdeclareshape{bjt#1}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + % \cdir is 1 for npn, -1 for pnp + \savedmacro{\cdir}{\edef\cdir{\ctikzvalof{tripoles/bjt/#1/curr direction}}} + \savedmacro{\numE}{\edef\numE{\ctikzvalof{tripoles/bjt/emitters}}} + \savedmacro{\numC}{\edef\numC{\ctikzvalof{tripoles/bjt/collectors}}} + % step up or down for the additional C/Es + \saveddimen{\multistep}{\pgfmathsetlength{\pgf@x}{% + \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}* + \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}} + \saveddimen{\external}{\pgfmathsetlength{\pgf@x}{% + \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}} + \savedanchor\basedimension{% these are the dimensions if nC=1 y nE=1 + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\northeast{% upper right + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@step}{% + \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}* + \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \ifnum\cdir> 0 + \edef\numup{\numC}\edef\numdown{\numE} + \else + \edef\numup{\numE}\edef\numdown{\numC} + \fi + \pgfmathsetlength{\pgf@y}{0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen + + (\numup-1)*\pgf@circ@res@step+\pgfverticaltransformationadjustment*.5*\pgflinewidth + + \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\southeast{% lower right + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@step}{% + \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}* + \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \ifnum\cdir> 0 + \edef\numup{\numC}\edef\numdown{\numE} + \else + \edef\numup{\numE}\edef\numdown{\numC} + \fi + \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen + - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth + - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\southwest{% lower left + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@step}{% + \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}* + \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \ifnum\cdir> 0 + \edef\numup{\numC}\edef\numdown{\numE} + \else + \edef\numup{\numE}\edef\numdown{\numC} + \fi + \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen + - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth + - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{tripoles/bjt/width}*\pgf@circ@scaled@Rlen + - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + } + \anchor{center}{\pgfpointorigin} + \anchor{north}{\northeast\pgf@x=0cm\relax} + \anchor{east}{\northeast\pgf@y=0cm\relax} + \anchor{south}{\southwest\pgf@x=0cm\relax} + \anchor{west}{\southwest\pgf@y=0cm} + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@ya=\pgf@y\southwest\pgf@y=\pgf@ya} + \anchor{south west}{\southwest} + \anchor{south east}{\southeast} + + \anchor{text}{\northeast\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax} + \anchor{B}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external} + \anchor{base}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external} + \anchor{nobase}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x} + % center of the base "bar" + \anchor{cbase}{\basedimension\pgf@x=-\pgf@x + \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}% + } + % geometrical centers + \anchor{vcenter}{\pgf@x=0cm\relax + \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}% + } + \anchor{gcenter}{% + \northeast\pgf@xa=0.5\pgf@x + \southwest\advance\pgf@xa by 0.5\pgf@x + \pgf@x=\pgf@xa + \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}% + } + % external connections + \anchor{E}{ + \ifnum\cdir>0% npn, emitter down + \southeast + \else + \northeast + \fi + }% first emitter + \anchor{emitter}{\ifnum\cdir>0\southeast\else\northeast\fi}% first emitter + \anchor{C}{\ifnum\cdir<0\southeast\else\northeast\fi} + \anchor{collector}{\ifnum\cdir<0\southeast\else\northeast\fi} + + \backgroundpath{ + \pgftransformationadjustments + \pgfsetcolor{\ctikzvalof{color}} + % + % set the type and up and down number of connections + % + \ifnum\cdir> 0 + \pgf@circuit@trans@ntypetrue + \edef\numup{\numC} + \edef\numdown{\numE} + \else + \pgf@circuit@trans@ntypefalse + \edef\numup{\numE} + \edef\numdown{\numC} + \fi + \basedimension + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = \pgf@x + \pgf@circ@res@left = -\pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\multistep + % + % set arrow positions options + % + \edef\@@anchor{center}\edef\@@pos{\ctikzvalof{tripoles/#1/arrow pos}} + \ifpgf@circuit@trans@arrowatend + \edef\@@pos{1.0} + \ifpgf@circuit@trans@ntype % arrow is toward outside, push it a bit + \edef\@@anchor{btip} + \else + \edef\@@anchor{tip} + \fi + \fi + % + % Drawing upper connections + % + \pgfscope + \pgf@circ@count@a=\numup\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \advance\pgf@circ@count@a-1\relax + \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}% + \ifnum\pgf@circ@count@a=\numexpr\numup-1\relax % draw the external pin connection + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@right}% + {\pgf@circ@res@up+\external+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}% + \pgfpathlineto{\pgfpoint + {\pgf@circ@res@right}% + {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}% + \else + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@right}% + {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}% + \fi + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}}% + \pgfsetroundcap % better when connecting to sloped lines + \pgfusepath{draw} + \ifpgf@circuit@trans@ntype\else % it's a PNP; draw arrow + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\@@pos}{% + \pgfpoint + {\pgf@circ@res@right}% + {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}% + }{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}% + } + \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + \endpgfscope + \fi + \repeatpgfmathloop + \endpgfscope + % + % Drawing base + % + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \ifpgf@circuit@bpt@schottky + % upper + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+ + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+ + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+ + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+ + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}} + % lower + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep- + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left- + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep- + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left- + \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} + {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}} + \fi + \pgfsetroundcap % I like it more... + \pgfusepath{draw} + \endpgfscope + % + % draw base external connection + % + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-\external}{0pt}} + \pgfusepath{draw} + % + % Drawing lower connections + % + \pgfscope + \pgf@circ@count@a=\numdown\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \advance\pgf@circ@count@a-1\relax + \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}% + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint + {\pgf@circ@res@right} + {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}} + \ifnum\pgf@circ@count@a=\numexpr\numdown-1\relax % draw the external pin connection + \pgfpathlineto{\pgfpoint + {\pgf@circ@res@right} + {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other-\external}} + \fi + \pgfsetroundcap % better when connecting to sloped lines + \pgfusepath{draw} + \ifpgf@circuit@trans@ntype % it's a NPN; draw arrow + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\@@pos}{% + \pgfpoint + {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}% + }{\pgfpoint + {\pgf@circ@res@right}% + {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}% + } + \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + \endpgfscope + \fi + \repeatpgfmathloop + \endpgfscope + } + % \pgf@sh@s@ contains all the code for the shape + % and is executed just before a node is drawn. + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@bjt#1\endcsname{% + % Start with the maximum collector number and go backwards. + \pgf@circ@count@a=\numC\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `pin 1` for the + % electrical contact, and the "border one" like `bpin 1` for labels. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@bjt#1@C\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@bjt@C@anchor{\the\pgf@circ@count@a}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + % and emitters + \pgf@circ@count@a=\numE\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `pin 1` for the + % electrical contact, and the "border one" like `bpin 1` for labels. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@bjt#1@E\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@bjt@E@anchor{\the\pgf@circ@count@a}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + }% + } +} + +\declarebjt{npn} +\declarebjt{pnp} + +% end of multi-bjts + +\long\def\declareigbt#1{ + \pgfcircdeclaretransistor{#1}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y + } + } + { + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + %draw upper connection + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}} + \pgfusepath{draw} + + %draw thicker gate lines + \pgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} + % set the normal thickness + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}} + \pgfsetlinewidth{\@@extrat\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + %draw lower connection + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + %draw arrow depending on type of transistor + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \ifpgf@circuit@trans@arrowatend + \ifpgf@circuit@trans@ntype + \edef\@@anchor{btip}\edef\@@pos{1.0} + \else + \edef\@@anchor{tip}\edef\@@pos{1.0} + \fi + \else + \edef\@@anchor{center}\edef\@@pos{0.5} + \fi + \ifpgf@circuit@trans@ntype + \pgftransformlineattime{\@@pos}{% + \pgfpoint% + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}% + }{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}% + } + \else + \pgftransformlineattime{\@@pos}{% + \pgfpoint{\pgf@circ@res@right}% + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}% + }{% + \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}% + } + \fi + \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + \endpgfscope + %draw gate + \ifpgf@circuit@trans@ntype + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}% + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}% + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}} + \fi + \pgfusepath{draw} + } +} + +\declareigbt{pigbt} +\declareigbt{nigbt} +\declareigbt{Lnigbt} +\declareigbt{Lpigbt} + +\pgfcircdeclaretransistor{nmos}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/nmos/gate height}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/nmos/gate height}\pgf@y + } + }{% + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + \ifpgf@circuit@mos@arrows + \pgfscope + \ifpgf@circuit@trans@arrowatend + \pgftransformshift{\pgfpoint + {\pgf@circ@res@right}% + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}% + } + \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}} + \else + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\ctikzvalof{tripoles/nmos/arrow pos}}{% + \pgfpoint% + {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}% + }{% + \pgfpoint + {\pgf@circ@res@right}% + {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \fi + \endpgfscope + \fi + + \ifpgf@circuit@bpt@drawgate + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi + + \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi +} + +\pgfcircdeclaretransistor{pmos}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/pmos/gate height}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/pmos/gate height}\pgf@y + } + }{% + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}} + \pgfusepath{draw} + + \ifpgf@circuit@mos@arrows + \pgfscope + \ifpgf@circuit@trans@arrowatend + \pgftransformshift{\pgfpoint + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}% + } + \pgftransformrotate{180} + \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}} + \else + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\ctikzvalof{tripoles/pmos/arrow pos}}{% + \pgfpoint% + {\pgf@circ@res@right}% + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}% + }{% + \pgfpoint + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \fi + \endpgfscope + \fi + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + + + \pgfusepath{draw} + \ifpgf@circuit@bpt@drawgate + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi + + \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi + + \ifpgf@circuit@pmos@nocircle\else + % we are not scaling the circle with the MOS --- I think it's better to have it + % coherent with the poles/nodes of the rest of the circuit. + \pgfpathcircle{\pgfpoint + {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen} + {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \ifpgf@circuit@pmos@emptycircle + \pgfsetfillcolor{white} + \fi + \pgfusepath{draw,fill} + \fi +} + +%%% depletion MOSFET (simplified symbols) + +\long\def\pgfcirc@filldraw@depletion#1{% + \ifx\tikz@fillcolor\pgfutil@empty + % if there is no explicit fill check the specific key + \edef\@@tmp{\ctikzvalof{tripoles/#1/depletion color}}\edef\@@none{none}% + \ifx\@@tmp\@@none % if it's none + \pgfusepath{draw}% + \else + \edef\@@default{default}% + \ifx\@@tmp\@@default % fill with the pen color + \pgfusepath{draw, fill}% + \else + \pgfsetfillcolor{\@@tmp}% + \pgfusepath{draw, fill}% + \fi + \fi + \else + \pgfsetfillcolor{\tikz@fillcolor}% + \pgfusepath{draw, fill}% + \fi +} + +\pgfcircdeclaretransistor{nmosd}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/nmosd/gate height}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/nmosd/gate height}\pgf@y + } + \anchor{nobulk}{ %override + \left + \pgf@circ@res@temp=\ctikzvalof{tripoles/nmosd/depletion width}\pgf@x + \pgf@x=\ctikzvalof{tripoles/nmosd/base width}\pgf@x + \advance\pgf@x by -\pgf@circ@res@temp + } + }{% + % draw depletion channel + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + \pgfscope + \pgfpathrectanglecorners + {\pgfpoint + {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}} + {\pgfpoint + {(\ctikzvalof{tripoles/nmosd/base width} - \ctikzvalof{tripoles/nmosd/depletion width})*\pgf@circ@res@left} + {-\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}} + \pgfcirc@filldraw@depletion{nmosd} + \endpgfscope + % draw drain and source terminals + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmosd/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmosd/base height}\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + \ifpgf@circuit@mos@arrows + \pgfscope + \ifpgf@circuit@trans@arrowatend + \pgftransformshift{\pgfpoint + {\pgf@circ@res@right}% + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}% + } + \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}} + \else + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\ctikzvalof{tripoles/nmosd/arrow pos}}{% + \pgfpoint% + {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}% + }{% + \pgfpoint + {\pgf@circ@res@right-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}% + {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \fi + \endpgfscope + \fi + + \ifpgf@circuit@bpt@drawgate + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi + + \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi +} + +\pgfcircdeclaretransistor{pmosd}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/pmosd/gate height}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/pmosd/gate height}\pgf@y + } + \anchor{nobulk}{ %override + \left + \pgf@circ@res@temp=\ctikzvalof{tripoles/pmosd/depletion width}\pgf@x + \pgf@x=\ctikzvalof{tripoles/pmosd/base width}\pgf@x + \advance\pgf@x by -\pgf@circ@res@temp + } + }{% + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + % draw depletion channel + \pgfscope + \pgfpathrectanglecorners + {\pgfpoint + {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}} + {\pgfpoint + {(\ctikzvalof{tripoles/pmosd/base width} - \ctikzvalof{tripoles/pmosd/depletion width})*\pgf@circ@res@left} + {-\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}} + \pgfcirc@filldraw@depletion{pmosd} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}} + \pgfusepath{draw} + + \ifpgf@circuit@mos@arrows + \pgfscope + \ifpgf@circuit@trans@arrowatend + \pgftransformshift{\pgfpoint + {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}% + } + \pgftransformrotate{180} + \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}} + \else + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \pgftransformlineattime{\ctikzvalof{tripoles/pmosd/arrow pos}}{% + \pgfpoint% + {\pgf@circ@res@right-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}% + }{% + \pgfpoint + {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \fi + \endpgfscope + \fi + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmosd/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmosd/base height}\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + + + \pgfusepath{draw} + \ifpgf@circuit@bpt@drawgate + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi + + \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + \fi + + \ifpgf@circuit@pmos@nocircle\else + % we are not scaling the circle with the MOS --- I think it's better to have it + % coherent with the poles/nodes of the rest of the circuit. + \pgfpathcircle{\pgfpoint + {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen} + {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \ifpgf@circuit@pmos@emptycircle + \pgfsetfillcolor{white} + \fi + \pgfusepath{draw,fill} + \fi +} +%% HEMT FET Transistor +\pgfcircdeclaretransistor{hemt}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/hemt/gate height}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/hemt/gate height}\pgf@y + } + }{% + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} +} + +\long\def\drawfetcore#1{ + \pgftransformationadjustments + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + + %top connection + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} + \ifpgf@circuit@trans@depletiontype + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} + \else + + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.45}} + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.25}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down*0.25}} + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/nfet/base height}\pgf@circ@res@down*0.45}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} + \fi + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + %Bulk connection line + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\pgf@circ@res@up+\pgf@circ@res@down}} + + %bottom connection + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + %draw thick gate line + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + % arrows + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \ifpgf@circuit@trans@arrowatend + \ifpgf@circuit@trans@ntype + \edef\@@anchor{tip} + \edef\@@pos{1.0} + \else + \edef\@@anchor{btip} + \edef\@@pos{0.0} + \fi + \else + \edef\@@anchor{center}\edef\@@pos{0.6} + \fi + \pgftransformlineattime{\@@pos}{% + \pgfpoint + {\pgf@circ@res@right}% + {\pgf@circ@res@up+\pgf@circ@res@down}% + }{% + \pgfpoint% + {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% + {\pgf@circ@res@up+\pgf@circ@res@down}% + } + \ifpgf@circuit@trans@ntype + \else + \pgftransformrotate{180} + \fi + \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + \endpgfscope + +% GATE CONNECTION +\ifpgf@circuit@bpt@drawgate + \ifpgf@circuit@trans@ntype + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} + \else + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} + \fi + \pgfusepath{draw} +\fi + +} + +\long\def\pgfdeclaretransistorwrapperaddbulk#1#2#3 +{\pgfcircdeclaretransistor{#1}{ + \anchor{bulk}{\left\pgf@x=0pt} + \anchor{B}{\left\pgf@x=0pt}%override Base anchor from npn&igbt + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y + } + #2 + } + {#3} +} + +\pgfdeclaretransistorwrapperaddbulk{nfet}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{nfet} +} + +\pgfdeclaretransistorwrapperaddbulk{pfet}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{pfet} +} + +\pgfdeclaretransistorwrapperaddbulk{nfetd}{}{% + \pgf@circuit@trans@depletiontypetrue + \drawfetcore{nfetd} +} + +\pgfdeclaretransistorwrapperaddbulk{pfetd}{}{% + \pgf@circuit@trans@depletiontypetrue + \drawfetcore{pfetd} +} +% N-CHANNEL IGFET ENHANCEMENT TYPE +\pgfdeclaretransistorwrapperaddbulk{nigfete}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{nigfete} + + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} +\fi +} + +% N-CHANNEL IGFET ENHANCEMENT TYPE with Bulk connector +\pgfdeclaretransistorwrapperaddbulk{nigfetebulk}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{nigfetebulk} + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \ctikzvalof{tripoles/nigfetebulk/gate height}\pgf@circ@res@down}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} + \fi +} + +% N-CHANNEL IGFET DEPLETION TYPE +\pgfdeclaretransistorwrapperaddbulk{nigfetd}{}{% + \pgf@circuit@trans@depletiontypetrue + \drawfetcore{nigfetd} + + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} + \fi +} + +% P-CHANNEL IGFET ENHANCEMENT TYPE +\pgfdeclaretransistorwrapperaddbulk{pigfete}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{pigfete} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \ctikzvalof{tripoles/pigfete/gate height}\pgf@circ@res@up}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope + \fi +} + +% P-CHANNEL IGFET ENHANCEMENT TYPE with bulk connector +\pgfdeclaretransistorwrapperaddbulk{pigfetebulk}{}{% + \pgf@circuit@trans@depletiontypefalse + \drawfetcore{pigfetebulk} +} + +% P-CHANNEL IGFET DEPLETION TYPE +\pgfdeclaretransistorwrapperaddbulk{pigfetd}{}{% + \pgf@circuit@trans@depletiontypetrue + \drawfetcore{pigfetd} + + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@up}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} + \fi +} + +\pgfcircdeclaretransistor{njfet}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y + } + }{% + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + % arrow + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip}\edef\@@pos{1.0} + \else + \edef\@@anchor{center}\edef\@@pos{0.6} + \fi + \pgftransformlineattime{\@@pos}{% + \pgfpoint{\pgf@circ@res@left}% + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}% + }{% + \pgfpoint + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}% + } + \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} + \pgfusepath{draw} +} + +\pgfcircdeclaretransistor{pjfet}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y + } + }{% + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{btip}\edef\@@pos{1.0} + \else + \edef\@@anchor{center}\edef\@@pos{0.4} + \fi + \pgftransformlineattime{\@@pos}{% + \pgfpoint% + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}% + }{% + \pgfpoint{\pgf@circ@res@left}% + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}% + } + \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} + {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + \pgfusepath{draw} +} + +\pgfdeclaretransistorwrapperaddbulk{isfet}{ + }{% + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + % DRAIN CONNECTION + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}} + % DRAIN + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}} + \pgfusepath{draw} + + % GATE, DEPLETION TYPE + \pgfscope %% added + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} %% added + \pgfusepath{draw} %% added + \endpgfscope %% added + + % BULK + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+.5\pgflinewidth} + {\pgf@circ@res@up+\pgf@circ@res@down}} + + % SOURCE + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}} + % SOURCE CONNECTION + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfusepath{draw} + + % SOLDER DOT at source-bulk connection + \ifpgf@circuit@fet@solderdot + \pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ + \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}} + \pgfnode{circ}{center}{}{}{} + \endpgfscope{} + \fi + % ARROW + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \ifpgf@circuit@trans@arrowatend + \edef\@@anchor{tip}\edef\@@pos{1.0} + \else + \edef\@@anchor{center}\edef\@@pos{0.6} + \fi + \pgftransformlineattime{\@@pos}{% + \pgfpoint + {\pgf@circ@res@right}% + {\pgf@circ@res@up+\pgf@circ@res@down}% + }{% + \pgfpoint% + {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}% + {\pgf@circ@res@up+\pgf@circ@res@down}% + } + \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + \endpgfscope + \pgfusepath{draw} + + % Wavy lines + \pgfscope + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +% end of transistors + +%%%%%%%%%%%%% +%% Switches +%%%%%%%%%%%%% + +\pgfcircdeclarebipole{ + \anchor{out 1}{ + \northeast + \pgf@y=0cm + } + \anchor{out 2}{ + \northeast + \pgf@y=.8\pgf@y + } +} +{\ctikzvalof{tripoles/toggleswitch/height 2}} +{toggleswitch} +{\ctikzvalof{tripoles/toggleswitch/height}} +{\ctikzvalof{tripoles/toggleswitch/width}} +{ + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} + \pgfusepath{draw} + \pgfscope + \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}} + \pgfusepath{draw} + + + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfsetdash{{.08\pgf@circ@res@up}{.04\pgf@circ@res@up}{.7\pgf@circ@res@up}{.04\pgf@circ@res@up}{.8\pgf@circ@res@up}}{0cm} + \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@left}{.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfsetdash{}{0cm} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% operational and instrumentation amplifiers +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\pgfdeclareshape{op amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\left{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \savedanchor\left{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=0pt + } + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/op amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + + % Triangle + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + % Negative input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} + + % Positive input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} + + % Output terminal + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}} + \pgfsetrectcap + \pgfusepath{draw} + } +} + +% Op amp shape as in european standard EN 60617 +\pgfdeclareshape{en amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\left{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \anchor{up}{ + \northwest + \pgf@x=0pt + } + \anchor{down}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/en amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/en amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + \pgfsetrectcap + \pgfusepath{draw} + + + \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\hbox{\ctikzvalof{tripoles/en amp/font2}\ctikzvalof{tripoles/en amp/text}}} + % \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font2}$\mathstrut{\triangleright}\,\mathrm{A}$} + } +} + +% Fully differential output op amp +% Contributed by Kristofer M. Monisit +\pgfdeclareshape{fd op amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor\outline{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y\pgf@x=0pt\relax + } + \anchor{north}{ + \northwest\pgf@x=0pt\relax + } + \savedanchor\left{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=0pt + } + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/fd op amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@right}{0pt}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out up}{ + \northwest + \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x + } + \anchor{out down}{ + \northwest + \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x + } + \anchor{out +}{ + \outline + \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x + } + \anchor{out -}{ + \outline + \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x + } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/fd op amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{bout +}{ + \outline + \pgf@xa=\pgf@x\pgf@ya=\pgf@y + \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}} + {\pgfpoint{\pgf@xa}{0pt}} + {\pgfpoint{0pt}{\pgf@ya}} + } + \anchor{bout -}{ + \outline + \pgf@xa=\pgf@x\pgf@ya=\pgf@y + \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}} + {\pgfpoint{\pgf@xa}{0pt}} + {\pgfpoint{0pt}{\pgf@ya}} + \pgf@y=-\pgf@y + } + \anchor{bout up}{ + \northwest + \pgf@xa=\pgf@x\pgf@ya=\pgf@y + \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}} + {\pgfpoint{\pgf@xa}{0pt}} + {\pgfpoint{0pt}{\pgf@ya}} + } + \anchor{bout down}{ + \northwest + \pgf@xa=\pgf@x\pgf@ya=\pgf@y + \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}} + {\pgfpoint{\pgf@xa}{0pt}} + {\pgfpoint{0pt}{\pgf@ya}} + \pgf@y=-\pgf@y + } + % end border anchors + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x + } + \anchor{out}{% should not be used + \left + \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x \pgf@y=-\pgf@y } + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + + % Triangle + % Includes output terminals in the traingular shape + % to ensure that diagonal joins are properly displayed + % we first draw the main triangle and the leads with normal thickness, + % and the redraw the main triangle with the component shape + \pgfscope + % shift origin a bit to ease calculations + \pgftransformxshift{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@step + + % Initial point (right vertex) + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + + % Negative output terminal + \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}} + + % Top vertex + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + + % Bottom vertex + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + + % Positive output terminal + \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}} + + % Right vertex + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + + \pgfpathclose + \pgfusepath{stroke} + + % ok, now we'll redraw the triangle with the class specific + % thickness and optionally fill + + \pgfscope + \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth} + + % Initial point (right vertex) + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + % Top vertex + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + % Bottom vertex + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope % thick and fill + \endpgfscope % shift + + % Negative input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} + + % Positive input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} + + % Negative output terminal label + \pgftext[right, bottom, x=3pt, y=1pt, at=\pgfpoint{0pt}{0.425\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@oplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} + + % Positive output terminal label + \pgftext[right, top, x=3pt, y=-1pt, at=\pgfpoint{0pt}{0.425\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@oplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} + + \pgfsetrectcap + \pgfusepath{draw} + } +} + + +% Instrumentation amplifier with differential output +\pgfdeclareshape{fd inst amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + % when tikz calls the anchor it wants the relative position in the lengths + % \pgf@x \pgf@y + % \pgfpoint* functions set that variables + % anchors are visible outside and run on use + \anchor{center}{\pgfpointorigin} + % savedanchors are internals and run on node creation (not use) + % bounding-box top left + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{nw}{ + \northwest + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y\pgf@x=0pt\relax + } + \anchor{north}{ + \northwest\pgf@x=0pt\relax + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x + } + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/fd inst amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + % reference voltage input anchors. + \savedanchor\refv{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/fd inst amp/refv pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}} + } + % we need both because they are normally drawn under the amp, and if you + % mirror it vertically you need them + \anchor{refv up}{ + \refv + } + \anchor{refv down}{ + \refv + \pgf@y=-\pgf@y + } + \savedanchor\outport{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=-.5\pgf@x + \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi + } + \anchor{out}{ + \outport + \pgf@y=0pt + } + \anchor{out +}{ + \outport + } + \anchor{out -}{ + \outport + \pgf@y=-\pgf@y + } + \savedanchor\outportfixed{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=-.5\pgf@x + } + \anchor{out up}{ + \outportfixed + } + \anchor{out down}{ + \outportfixed + \pgf@y=-\pgf@y + } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@x=-\pgf@x \pgf@y=0pt + } + \anchor{bout +}{ + \outport + \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya + } + \anchor{bout -}{ + \outport + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya + } + \anchor{bout up}{ + \outportfixed + \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya + } + \anchor{bout down}{ + \outportfixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya + } + % end border anchors + % + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + + % let's start drawing the component + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + % + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + % main component, normally in thicker lines + \pgfscope + \newdimen\pgf@circ@res@right@double + \pgf@circ@res@right@double=2\pgf@circ@res@right + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@step + %first point (near output) + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{0}} + %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}} + % and then to the input "front up", "down", to the output short side "down" + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@down}} + % ...and close + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + % input terminal up + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}} + % + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} + + % input terminal down + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} + + % output leads down and up + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} % + \pgftext[right, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$-\;$\else$+\;$\fi} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}} % + \pgftext[right, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$+\;$\else$-\;$\fi} + % + \pgfsetrectcap + \pgfusepath{draw} + } +} + +% Transconductance amplifier (Transkonduktanzverstärker) +\pgfdeclareshape{gm amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x + } + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/gm amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/gm amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgfscope + \newdimen\pgf@circ@res@right@double + \pgf@circ@res@right@double=2\pgf@circ@res@right + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@step + %Umrandung: + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{0}} %geändert startpunkt neu am ausgangsstrich + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}}%vom Ausgang nach oben + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} %neu ecke links oben nach rechts oben + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} %bei deneigängen runter + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@down}}%ecke links unten nach rechts unten + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/gm amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} + + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/gm amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{0pt}} % + \pgfsetrectcap + \pgfusepath{draw} + + } +} + +% Instrumentation amplifier +\pgfdeclareshape{inst amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + % when tikz calls the anchor it wants the relative position in the lengths + % \pgf@x \pgf@y + % \pgfpoint* functions set that variables + % anchors are visible outside and run on use + \anchor{center}{\pgfpointorigin} + % savedanchors are internals and run on node creation (not use) + % bounding-box top left + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{nw}{ + \northwest + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x + } + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/inst amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + % reference voltage input anchors. + \savedanchor\refv{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/inst amp/refv pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}} + } + % we need both because they are normally drawn under the amp, and if you + % mirror it vertically you need them + \anchor{refv up}{ + \refv + } + \anchor{refv down}{ + \refv + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/inst amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + + % let's start drawing the component + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + % + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + + % main component, normally in thicker lines + \pgfscope + \newdimen\pgf@circ@res@right@double + \pgf@circ@res@right@double=2\pgf@circ@res@right + + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@step + %first point (near output) + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{0}} + %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}} + % and then to the input "front up", "down", to the output short side "down" + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@down}} + % ...and close + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + % Negative input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}} + % + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} + + % Positive input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} + + % Output terminal + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{0pt}} % + % + \pgfsetrectcap + \pgfusepath{draw} + } +} + +% Instrumentation amplifier with terminals for gain resistance between inputs +\pgfdeclareshape{inst amp ra} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + % bounding-box top left + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{nw}{ + \northwest + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y\pgf@x=0pt\relax + } + \anchor{north}{ + \northwest\pgf@x=0pt\relax + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{leftedge} + {\left + \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x + } + % inputs (+-) + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + % R ampli anchors. They are by default at 20% more than R-length distance + % you can change that with the `ra pos` key (use 0.5 for one-R). + \savedanchor\raOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\pgf@circ@scaled@Rlen + \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{ra up}{ + \raOneFixed + } + \anchor{ra down}{ + \raOneFixed + \pgf@y=-\pgf@y + } + \savedanchor\raOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\pgf@circ@scaled@Rlen + \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \anchor{ra-}{ + \raOne + } + \anchor{ra+}{ + \raOne + \pgf@y=-\pgf@y + } + % power supplies + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/inst amp ra/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + % reference voltage input anchors. + \savedanchor\refv{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen + \pgf@y=0.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=0.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/inst amp ra/refv pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}} + } + % we need both because they are normally drawn under the amp, and if you + % mirror it vertically you need them + \anchor{refv up}{ + \refv + } + \anchor{refv down}{ + \refv + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/inst amp ra/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bra up}{ + \raOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bra down}{ + \raOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bra-}{ + \raOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bra+}{ + \raOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors + \anchor{west}{ + \left + } + \anchor{east}{ + \left + \pgf@x=-\pgf@x + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + + % drawing of the component + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + + \newdimen\pgf@circ@res@right@double + \pgf@circ@res@right@double=2\pgf@circ@res@right + + % main component, normally in thicker lines + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@step + %primer punto: la linea de salida (lado componente) + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{0}} + %from the exit to the top (short side)... (note that the .6 must be copied in \up anchor + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}} + % and then to the input "front up", "down", to the output short side "down" + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@down}} + % ...and close + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + % ra terminal - + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + % ra terminal + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}} + + % Negative input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}} + % + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} + + % Positive input terminal + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}} + % + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} + + % Output terminal + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{0pt}} % + % + \pgfsetrectcap + \pgfusepath{draw} + } +} + +% Buffer +% Contributed by Danilo Piazzalunga +\pgfdeclareshape{buffer} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{bipoles/buffer/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/buffer/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{bin}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{bout}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } + + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \northwest + \pgfmathsetlength{\pgf@x}{0.7*\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + } +} + +% plain amplifier, no symbols +\pgfdeclareshape{plain amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \savedanchor\left{% + \pgf@y=0pt + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{-}{ + \inOne + } + \anchor{+}{ + \inOne + \pgf@y=-\pgf@y + } + \anchor{in up}{ + \inOneFixed + } + \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/plain amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}} + + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + } +} + +% plain amplifier, no symbols, one input +\pgfdeclareshape{plain mono amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \savedanchor\left{% + \pgf@y=0pt + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=0pt\relax + } + \anchor{in}{ + \inOne + } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/plain amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {0pt}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + {0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + } +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% electromechanical device (motor/generator) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\pgfdeclareshape{elmech} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{electromechanicals}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{text}{ + \pgfpointorigin + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \advance \pgf@y by -.5\ht\pgfnodeparttextbox + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{right}{% + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{top}{ + \northwest + \pgf@x=0pt + } + \anchor{pathstart}{ + \northwest + \pgf@x=0pt + } + \anchor{pathend}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{bottom}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \anchorborder{% + \@tempdima=\pgf@x\@tempdimb=\pgf@y + \northwest\pgf@circ@res@other=-\pgf@x + \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}{\pgfqpoint{\pgf@circ@res@other}{\pgf@circ@res@other}} + } + \anchor{block north west}{\northwest\pgf@x=0.5\pgf@x} + \anchor{block south west}{\northwest\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y} + \anchor{block north east}{\northwest\pgf@x=-0.5\pgf@x} + \anchor{block south east}{\northwest\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y} + \anchor{block up right}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@x=-0.5\pgf@x + } + \anchor{block up left}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@x=0.5\pgf@x + } + \anchor{block down right}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@y=-\pgf@y + \pgf@x=-0.5\pgf@x + } + \anchor{block down left}{ + \northwest + % remember that pgf@x is negative + % center of the block is at 0.5*H+W*cos(30)/2 + \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax + \pgf@y=-\pgf@y + \pgf@x=0.5\pgf@x + } + \behindbackgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope % clip the bar: whole size minus the circle + \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgfseteorule + \pgfusepath{clip} + \pgfpathrectangle{\pgfpoint{-.25\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfsetfillcolor{\ctikzvalof{color}} + \pgfusepath{fill, draw} + \endpgfscope + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white + \pgfsetfillcolor{white} + % ...but override it if the class is defined! + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \pgfusepath{draw, fill} + \fi + \endpgfscope + } +} + +%%%%%%%%%%%%%%%%%%% +%% Magnetron +%%%%%%%%%%%%%%%%%%% + +\pgfdeclareshape{magnetron} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} % class of these components + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{anode}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{cathode1}{ + \northwest + \pgf@circ@res@step=\pgf@y + \pgfmathparse{cos(105)} + \pgf@x=\pgfmathresult\pgf@circ@res@step + \pgfmathparse{sin(105)} + \pgf@y=\pgfmathresult\pgf@circ@res@step + %\pgfpointorigin + %\pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@step}}%not working in a scaled tikzpicture + } + \anchor{cathode2}{ + \northwest + \pgf@circ@res@step=\pgf@y + \pgfmathparse{cos(75)} + \pgf@x=\pgfmathresult\pgf@circ@res@step + \pgfmathparse{sin(75)} + \pgf@y=\pgfmathresult\pgf@circ@res@step + %\pgfpointorigin + %\pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@step}}%not working in a scaled tikzpicture + } + \anchor{text}{ + \pgfpointorigin + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \advance \pgf@y by -.5\ht\pgfnodeparttextbox + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{right}{% + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{top}{ + \northwest + \pgf@x=0pt + } + \anchor{pathstart}{ + \northwest + \pgf@x=0pt + } + \anchor{pathend}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{bottom}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfmathsetlength{\pgf@circ@res@other}{sin(15)*\pgf@circ@res@up} + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + %create outer circle + \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@right} + \pgf@circ@draworfill + %create chambers + \foreach \angle in {45,135,225,315}{ + \pgfpathmoveto{ \pgfpointpolar{\angle}{0.6\pgf@circ@res@right}} + \pgfpathlineto{ \pgfpointpolar{\angle}{\pgf@circ@res@right}} + } + \pgfsetroundcap + \pgfusepath{draw} + \pgfscope + %draw connection from outside + %anode + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{0\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0\pgf@circ@res@right}{.5\pgf@circ@res@down}} + %cathodes + \pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfusepath{draw} + \endpgfscope + %create cathode + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0}{.15\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + %create anode + \pgfpathmoveto{\pgfpoint{0.3\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{.5\pgf@circ@res@down}} + + \pgfsetbuttcap + \pgfusepath{draw} + \endpgfscope + } +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Electronic tubes, submitted by J. op den Brouw +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Draw tube outline +\def\pgf@circ@tubes@drawtube{% + \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfutil@tempdima=\pgf@circ@res@right + \advance\pgfutil@tempdima by -\pgf@circ@res@up + \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}} + \pgfpatharc{90}{-90}{\pgf@circ@res@up} + \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}} + \pgfpatharc{270}{90}{\pgf@circ@res@up} + \else + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}} + \pgfutil@tempdima=\pgf@circ@res@up + \advance\pgfutil@tempdima by -\pgf@circ@res@right + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} + \pgfpatharc{180}{0}{\pgf@circ@res@right} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}} + \pgfpatharc{180}{0}{-\pgf@circ@res@right} + \fi + \pgfpathclose +} + +%% The diode (tube), triode, tetrode and pentode only differ in the +%% number of grids. So we construct a generic declare function in +%% which we can put code for the grid anchors and grid drawing code +%% \pgfcircdeclaretube{tube name}{grid anchors}{grid drawing code} +\long\def\pgfcircdeclaretube#1#2#3{% + \pgfdeclareshape{#1}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{ + \pgfpointorigin + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen + % x and y should be half the Rlen + \pgf@y=\pgf@circ@res@up + \pgf@y=.5\pgf@y + \pgf@x=-\pgf@circ@res@right + \pgf@x=.5\pgf@x + } + \anchor{north} {% + \northwest + \pgf@x=0pt + } + \anchor{east}{% + \northwest + \pgf@x=-\pgf@x + \pgf@y=0pt + } + \anchor{south}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{west}{% + \northwest + \pgf@y=0pt + } + \anchor{north west}{% + \northwest + } + \anchor{north east}{% + \northwest + \pgf@x=-\pgf@x + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{anode} {% + \northwest + \pgf@x=0pt + } + \anchor{cathode}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x + } + \anchor{cathode 1}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x + } + \anchor{cathode 2}{% + \northwest + \pgf@y=-\pgf@y + \pgf@x=-\ctikzvalof{tubes/cathode width}\pgf@x + } + \anchor{filament 1}{% + \northwest + \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgf@x=\pgfmathresult\pgf@x + \pgf@y=-\pgf@y + } + \anchor{filament 2}{% + \northwest + \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgf@x=-\pgfmathresult\pgf@x + \pgf@y=-\pgf@y + } + + % Extra anchors + #2 + + \backgroundpath{ + \pgfscope + % Line width for tripoles + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgf@circ@scaled@Rlen=\scaledRlen + + % Setup to draw tube + \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up + \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + + % Tube outline + \pgf@circ@tubes@drawtube + + % Setup to draw grid, filament, anode and cathode + \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen + \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@up=0.5\pgf@circ@res@up + \pgf@circ@res@right=0.5\pgf@circ@res@right + + % Tube fill color (if any) + \pgf@circ@draworfill + + % Grid drawing + #3 + + % Filament (is not drawn by default) + \ifpgf@circuit@tubes@filament + \pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up + \advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up + \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgf@xa=\pgfmathresult\pgf@circ@res@right + \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}} + \pgf@ya=\pgfmathresult\pgf@circ@res@up + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}} + \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}} + \pgf@circuit@tubes@filamentfalse + \fi + + % Anode (or plate) + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north + \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} + + % Cathode + \ifpgf@circuit@tubes@nocathode + \pgf@circuit@tubes@nocathodefalse + \else + \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} + \ifpgf@circuit@tubes@fullcathode + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgf@circuit@tubes@fullcathodefalse + \else + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-\ctikzvalof{tubes/cathode right extend}\pgf@circ@res@up}} + \fi + \fi + + % Draw the background + \pgfusepath{draw} + \endpgfscope + } + } +} + +\pgfcircdeclaretube{diodetube}{}{} % shape diode already exists + +\pgfcircdeclaretube{triode} +{ + \anchor{grid} {% should not be used + \northwest + \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y + } + \anchor{control} {% + \northwest + \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y + } +} +{ + % Grid protrusion + \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} + % Grid dashes: calculations + \pgf@xb=2\pgf@circ@res@right + \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 + \multiply\pgf@circ@count@a by 2\relax + \advance\pgf@circ@count@a by 1\relax + \advance\pgf@circ@res@step by -\pgf@xa + \divide\pgf@circ@res@step by \pgf@circ@count@a + % Grid dashes: draw + \pgf@circ@res@temp=\pgf@xa + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} + \loop + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} + \advance\pgf@circ@count@a by-1 + \ifnum\pgf@circ@count@a>0\relax + \repeat +} + +\pgfcircdeclaretube{tetrode} +{ + \anchor{grid} {% should not be used + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \pgf@y=0.5\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{control} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \pgf@y=0.5\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{screen} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y + \pgf@y=0.5\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } +} +{ + % Grid x/y points + \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right + \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up + \pgfutil@tempdimb=-\pgfutil@tempdima + \pgfutil@tempdima=0.5\pgfutil@tempdima + \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \pgfutil@tempdimb=0.5\pgfutil@tempdimb + \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + % Grid protrusion + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}} + % Grid dashes: calculations + \pgf@xb=2\pgf@circ@res@right + \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 + \multiply\pgf@circ@count@a by 2\relax + \advance\pgf@circ@count@a by 1\relax + \advance\pgf@circ@res@step by -\pgf@xa + \divide\pgf@circ@res@step by \pgf@circ@count@a + % Grid dashes: draw + \pgf@circ@res@temp=\pgf@xa + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} + \loop + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}} + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \advance\pgf@circ@count@a by-1 + \ifnum\pgf@circ@count@a>0\relax + \repeat +} + +\pgfcircdeclaretube{pentode} +{ + \anchor{grid} {% should not be used + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{control} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{screen} {% + \northwest + \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y + } + \anchor{suppressor} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } +} +{ + % Grid x/y points + \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right + \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up + \pgfutil@tempdimb=-\pgfutil@tempdima + \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up + % Grid protrusion + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}} + % Grid dashes: calculations + \pgf@xb=2\pgf@circ@res@right + \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 + \multiply\pgf@circ@count@a by 2\relax + \advance\pgf@circ@count@a by 1\relax + \advance\pgf@circ@res@step by -\pgf@xa + \divide\pgf@circ@res@step by \pgf@circ@count@a + % Grid dashes: draw + \pgf@circ@res@temp=\pgf@xa + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} + \loop + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}} + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \advance\pgf@circ@count@a by-1 + \ifnum\pgf@circ@count@a>0\relax + \repeat +} + +\pgfcircdeclaretube{pentode suppressor to cathode} +{ + \anchor{grid} {% should not be used + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{control} {% + \northwest + \pgfutil@tempdima=\pgf@y + \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y + \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima + } + \anchor{screen} {% + \northwest + \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y + } +} +{ + % Grid x/y points + \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right + \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right + \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up + \pgfutil@tempdimb=-\pgfutil@tempdima + \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up + \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up + % Grid protrusion + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}} + % Grid dashes: calculations + \pgf@xb=2\pgf@circ@res@right + \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 + \multiply\pgf@circ@count@a by 2\relax + \advance\pgf@circ@count@a by 1\relax + \advance\pgf@circ@res@step by -\pgf@xa + \divide\pgf@circ@res@step by \pgf@circ@count@a + % Grid dashes: draw + \pgf@circ@res@temp=\pgf@xa + \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} + \loop + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \ifnum\pgf@circ@count@a>1\relax + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}} + \fi + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}} + \advance\pgf@circ@res@temp by\pgf@circ@res@step + \advance\pgf@circ@count@a by-1 + \ifnum\pgf@circ@count@a>0\relax + \repeat + % Grid: connection from suppressor to cathode + \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima-2*\ctikzvalof{tubes/grid separation}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right-0.4142136*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-0.4142136*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} + +} + +%%%---------- close: tex/pgfcirctripoles +%%%%%%%%%%% Springe nach tex/pgfcircquadpoles +%%%---------- open: tex/pgfcircquadpoles.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Quadripoles + +\long\def\pgfcircdeclarequadpole#1#2#3{ + \pgfdeclareshape{#1} + { + \savedmacro{\ctikzclass}{\edef\ctikzclass{inductors}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + % shapename + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + \anchor{center}{ + \northwest + \pgf@x=0pt + \pgf@y=0pt + } + \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=.5\pgf@circ@scaled@Rlen + \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x + } + %% we define the upper right (positive coord) dot (which is B1) + \savedanchor{\innerdot}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@xa=.5\pgf@circ@scaled@Rlen + \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa + % by default use the cute inductor size + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2} + % check if it's american + \edef\pgf@circ@temp{\ctikzvalof{inductor}} + \edef\pgf@temp{american} + \ifx\pgf@circ@temp\pgf@temp + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2} + \fi + % check if it's european + \edef\pgf@temp{european} + \ifx\pgf@circ@temp\pgf@temp + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2} + \fi + \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen} + } + \savedanchor{\outerdot}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@xa=.5\pgf@circ@scaled@Rlen + \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa + % by default use the cute inductor size + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2} + % check if it's american + \edef\pgf@circ@temp{\ctikzvalof{inductor}} + \edef\pgf@temp{american} + \ifx\pgf@circ@temp\pgf@temp + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2} + \fi + % check if it's european + \edef\pgf@temp{european} + \ifx\pgf@circ@temp\pgf@temp + \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2} + \fi + \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen} + } + \anchor{A2}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{B1}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{A1}{ + \northwest + } + \anchor{B2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + %% dot's anchors + \anchor{inner dot A1}{\innerdot\pgf@x=-\pgf@x} + \anchor{outer dot A1}{\outerdot\pgf@x=-\pgf@x} + \anchor{inner dot A2}{\innerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{outer dot A2}{\outerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{inner dot B1}{\innerdot} + \anchor{outer dot B1}{\outerdot} + \anchor{inner dot B2}{\innerdot\pgf@y=-\pgf@y} + \anchor{outer dot B2}{\outerdot\pgf@y=-\pgf@y} + % geographical + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{base}{ + \northwest + \pgf@x=0pt + } + #3 + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + #2 + } + } +} + + +\def\pgf@circ@drawtransformerbasicanchor{ + \ctikzvalof{quadpoles/trans/height} + \anchor{AA2}{ + \northwest + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=-\pgf@y + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y + } + \anchor{BB1}{ + \northwest + \pgf@x=-\pgf@x + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y + } + \anchor{AA1}{ + \northwest + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y + } + \anchor{BB2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x + \pgf@x=.7\pgf@x + \pgf@y=-\pgf@y + \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y + } +} + +%% Null styles that can be used to change individually the L1 and L2 +%% inductors of the transformer. + +\ctikzset{transformer L1/.style={}} +\ctikzset{transformer L2/.style={}} + +\def\pgf@circ@drawtransformerbasicbody{ + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgftransformlineattime{.5}{% + \pgfpoint% + {\stretto\pgf@circ@res@left}% + {\pgf@circ@res@up}% + }{% + \pgfpoint + {\stretto\pgf@circ@res@left}% + {\pgf@circ@res@down}% + } + + \pgfkeys{\circuitikzbasekey/.cd, transformer L1} + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{fullgenericshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}} + \else% + \def\pgf@temp{cute} + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{cuteinductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}} + \else% + \pgfnode{americaninductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}} + \fi% + \fi% + + + \endpgfscope + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgftransformlineattime{.5}{% + \pgfpoint% + {\stretto\pgf@circ@res@right}% + {\pgf@circ@res@down}% + }{% + \pgfpoint + {\stretto\pgf@circ@res@right}% + {\pgf@circ@res@up}% + } + + \pgfkeys{\circuitikzbasekey/.cd, transformer L2} + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{fullgenericshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}} + \else% + \def\pgf@temp{cute} + \ifx\pgf@temp\pgf@circ@temp% + \pgfnode{cuteinductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}} + \else% + \pgfnode{americaninductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}} + \fi% + \fi% + + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{\thisshape-L1}{b}} + + \pgfpathmoveto{\pgfpointanchor{\thisshape-L1}{a}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{\thisshape-L2}{a}} + + \pgfpathmoveto{\pgfpointanchor{\thisshape-L2}{b}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfusepath{draw} + +} + + +\pgfcircdeclarequadpole{transformer}{ + \pgf@circ@drawtransformerbasicbody +}{\pgf@circ@drawtransformerbasicanchor} + +\pgfcircdeclarequadpole{transformer core}{ + + \pgf@circ@drawtransformerbasicbody + + % use the chocke line thickness + \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth} + + % Find the distance from center for the lines representing the core + % the 2.5 is for backward compatibility --- the distance was calculated as a fraction + % of the whole component, now as a fraction of the distance between coils, to be + % compatible with the quadpoles "inner" style. + \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@right} + + \pgfmoveto{\pgfpoint% + {\pgf@circ@res@other}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}% + } + \pgflineto{ + \pgfpoint% + {\pgf@circ@res@other}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}% + } + + %% this should be just -\pgf@circ@res@other, but in case someone define an asymmetric trafo someday... + \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@left} + \pgfmoveto{\pgfpoint% + {\pgf@circ@res@other}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}% + } + \pgflineto{ + \pgfpoint% + {\pgf@circ@res@other}% + {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}% + } + + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgfusepath{draw} +}{\pgf@circ@drawtransformerbasicanchor} + + +\pgfcircdeclarequadpole{gyrator}{ + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth} + \pgfmathsetlength{\pgf@circ@res@other}{min(.7*\stretto*\pgf@circ@res@up, .8*\pgf@circ@res@right)} % radius + \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{-\pgf@circ@res@other}} + \pgfpatharc{-90}{90}{\pgf@circ@res@other} + \pgfpathclose + \pgf@circ@draworfill + + \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@other}} + \pgfpatharc{90}{270}{\pgf@circ@res@other} + \pgfpathclose + \pgf@circ@draworfill +}{} + +%%%%%%%%%%%%%%%%%%%% +%% Block elements +%%%%%%%%%%%%%%%%%%%% + +\pgfdeclareshape{mixer} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@boxed + \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \else + \pgf@y=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{right}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{1}{ + \northwest + \pgf@y=0pt + } + \anchor{2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{3}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{4}{ + \northwest + \pgf@y=\pgf@y + \pgf@x=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{in1}{ + \northwest + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{in2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{e}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{w}{ + \northwest + \pgf@y=0pt + } + \anchor{s}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{n}{ + \northwest + \pgf@x=0pt + } + \anchor{down}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{up}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{\ctikzvalof{tripoles/mixer/width}*\scaledRlen/2}{\ctikzvalof{tripoles/mixer/width}*\scaledRlen/2}} + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgf@circ@res@step=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed + \pgf@circ@res@step=.7\pgf@circ@res@step + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{135}{0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{-45}{0.5\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{45}{0.5\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{-135}{0.5\pgf@circ@res@step}} + \pgfusepath{draw} + + \endpgfscope + } +} + +\pgfdeclareshape{adder} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@boxed + \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \else + \pgf@y=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{right}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{1}{ + \northwest + \pgf@y=0pt + } + \anchor{2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{3}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{4}{ + \northwest + \pgf@y=\pgf@y + \pgf@x=0pt + } + \anchor{in 1}{ + \northwest + \pgf@y=0pt + } + \anchor{in1}{ + \northwest + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{in 2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{in2}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{e}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{w}{ + \northwest + \pgf@y=0pt + } + \anchor{s}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{n}{ + \northwest + \pgf@x=0pt + } + \anchor{down}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{up}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{\ctikzvalof{tripoles/adder/width}*\scaledRlen/2}{\ctikzvalof{tripoles/adder/width}*\scaledRlen/2}} + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgf@circ@res@step=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed + \pgf@circ@res@step=.7\pgf@circ@res@step{} + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpointorigin} + \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf@circ@res@step}} + \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf@circ@res@step}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + + \endpgfscope + } +} + +\pgfdeclareshape{oscillator} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@boxed + \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \else + \pgf@y=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{north}{ + \northwest + \pgf@x=.5\pgf@x + } + \anchor{south}{ + \northwest + \pgf@x=.5\pgf@x + \pgf@y=-\pgf@y + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{up}{ + \northwest + \pgf@x=.5\pgf@x + } + \anchor{down}{ + \northwest + \pgf@x=.5\pgf@x + \pgf@y=-\pgf@y + } + \anchor{n}{ + \northwest + \pgf@x=.5\pgf@x + } + \anchor{s}{ + \northwest + \pgf@x=.5\pgf@x + \pgf@y=-\pgf@y + } + \anchor{e}{ + \northwest + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{w}{ + \northwest + \pgf@y=0pt + } + \anchor{up}{ + \northwest + \pgf@x=.5\pgf@x + } + \anchor{down}{ + \northwest + \pgf@x=.5\pgf@x + \pgf@y=-\pgf@y + } + \anchor{right}{ + \northwest + \pgf@y=0pt + \pgf@x=0pt + } + \anchor{left}{ + \northwest + \pgf@y=0pt + } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y} + \anchor{north east}{ \northwest \pgf@x=0pt\relax} + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{text}{ + \pgf@x=-2\pgf@x + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \advance \pgf@y by -1.5\ht\pgfnodeparttextbox + } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{\ctikzvalof{tripoles/oscillator/width}*\scaledRlen/2}{\ctikzvalof{tripoles/oscillator/width}*\scaledRlen/2}} + \pgfmathsetlength{\pgf@x}{\pgf@x-\ctikzvalof{tripoles/oscillator/width}*\scaledRlen/2} + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgf@circ@res@step=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen{} + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + \pgftransformxshift{-0.5\pgf@circ@res@step} % The oscillator is shifted to the left, so a connection comes out of the anchor "east" + + % draw outer box + \ifpgf@circuit@boxed{} + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed + \pgf@circ@res@step=.7\pgf@circ@res@step{} + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % draw inner sine waves + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners! + \pgfpathmoveto{\pgfpoint{-0.3\pgf@circ@res@step}{0\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}} + \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}} + \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}} + + \pgfusepath{draw} + + \endpgfscope + } +} + +\pgfdeclareshape{circulator} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circuit@boxed + \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \else + \pgf@y=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \fi + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{left}{% + \northwest + \pgf@y=0pt + } + \anchor{right}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{1}{ + \northwest + \pgf@y=0pt + } + \anchor{2}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{3}{ + \northwest + \pgf@y=-\pgf@y + \pgf@x=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{e}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{w}{ + \northwest + \pgf@y=0pt + } + \anchor{s}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{n}{ + \northwest + \pgf@x=0pt + } + \anchor{down}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{up}{ + \northwest + \pgf@x=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up} + }{\pgfpoint{\ctikzvalof{tripoles/circulator/width}*\scaledRlen/2}{\ctikzvalof{tripoles/circulator/width}*\scaledRlen/2}} + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgf@circ@res@step=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen + + \pgfscope + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \ifpgf@circuit@boxed + \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}} + \fi + + % draw outer circle + \ifpgf@circuit@boxed{} + \pgf@circ@res@step=.7\pgf@circ@res@step{} + \pgfsetdash{}{0pt} % draw solid circle if boxed + \else + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \fi + \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} + \pgf@circ@draworfill + + % inner arrow + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfsetarrowsend{latex} + \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0}} + \pgfpatharc{180}{-90} {0.25\pgf@circ@res@step} + \pgfpathlineto{\pgfpoint{-5pt}{-0.2\pgf@circ@res@step}} + \pgfusepath{draw} + + \endpgfscope + } +} + +%% gridnode +\pgfdeclareshape{gridnode} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{up}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{down}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{right}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{left}{ + \northwest + \pgf@y=0pt + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + \relax + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{text}{ + \pgf@x=-2\pgf@x + \advance \pgf@x by -.5\wd\pgfnodeparttextbox + \advance \pgf@y by -1.5\ht\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgf@circ@res@step=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgf@circ@res@step = \ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{0.05mm} + + % draw grid + \foreach \line in {-1,-.5,...,1} + { + \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@down}} + } + + %prevent from draw the inner cross twice + \foreach \line in {-.5,0,...,.5} + { + \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@down}} + } + \pgfusepath{draw} + } +} + + +% Wilkinson divider +\pgfdeclareshape{wilkinson}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x= \pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x + } + \anchor{center}{ + \northwest + \pgf@x=0pt + \pgf@y=0pt + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out1}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-0.5\pgf@y + } + \anchor{out2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0.5\pgf@y + } + \anchor{text}{ + \northwest + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \pgf@circ@twoportbox + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + % draw inner resisitor - european or american style is recognised + { + \pgftransformshift{\pgfpoint{0.5\pgf@circ@res@right}{0pt}} + \pgftransformrotate{90} + + % calculate size of resistor + \ifpgf@circuit@europeanresistor + \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2} + \pgftransformscale{\pgfmathresult} + \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}} + \else + \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2} + \pgftransformscale{\pgfmathresult} + \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}} + \fi + } + + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}} + + \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfusepath{draw} + + } +} + +%% resistive splitter +\pgfdeclareshape{splitter}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x= \pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x + } + \anchor{center}{ + \northwest + \pgf@x=0pt + \pgf@y=0pt + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out1}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-0.5\pgf@y + } + \anchor{out2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0.5\pgf@y + } + \anchor{text}{ + \northwest + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \pgf@circ@twoportbox + + % draw inner stuff + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + % draw inner resisitors - european or american style is recognised + \foreach \respt/\resang/\linepta/\lineptb in % + { \pgfpoint{0.5\pgf@circ@res@right}{0pt}/90/% + \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down},% + \pgfpoint{0}{0.25\pgf@circ@res@up}/25/% + \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@left}{0},% + \pgfpoint{0}{0.25\pgf@circ@res@down}/-25/% + \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}/\pgfpoint{0.5\pgf@circ@res@left}{0}} + { + { + \pgftransformshift{\respt} + \pgftransformrotate{\resang} + + % calculate size of resistor + \ifpgf@circuit@europeanresistor + \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2} + \pgftransformscale{\pgfmathresult} + \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}} + \else + \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2} + \pgftransformscale{\pgfmathresult} + \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}} + \fi + } + + \pgfpathmoveto{\linepta} + \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}} + + \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}} + \pgfpathlineto{\lineptb} + \pgfusepath{draw} + } + } +} + +%% couplers generics +\long\def\pgfcircdeclarefourport#1#2{ + + \pgfdeclareshape{#1}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{ + \northwest + \pgf@x=0pt + \pgf@y=0pt + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=.5\pgf@circ@scaled@Rlen + \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{port1}{ + \northwest + \pgf@y=-0.5\pgf@y + } + \anchor{port2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-0.5\pgf@y + } + \anchor{port3}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0.5\pgf@y + } + \anchor{port4}{ + \northwest + \pgf@y=0.5\pgf@y + } + \anchor{left down}{ + \northwest + \pgf@y=-0.5\pgf@y + } + \anchor{right down}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-0.5\pgf@y + } + \anchor{right up}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0.5\pgf@y + } + \anchor{left up}{ + \northwest + \pgf@y=0.5\pgf@y + } + \anchor{1}{ + \northwest + \pgf@y=-0.5\pgf@y + } + \anchor{2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-0.5\pgf@y + } + \anchor{3}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0.5\pgf@y + } + \anchor{4}{ + \northwest + \pgf@y=0.5\pgf@y + } + + \anchor{text}{ + \northwest + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + + % draw inner stuff + #2 + + % draw inner text + \pgftext[center,x=-0.15\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}} + } + } +} + +% four-port +\pgfcircdeclarefourport{fourport}{} + +% straight coupler +\pgfcircdeclarefourport{coupler}{ + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@up}} + \pgfsetarrows{latex-latex} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@down}} + \pgfsetarrows{latex-latex} + \pgfusepath{draw} +} + +% "bended" coupler +\pgfcircdeclarefourport{coupler2}{ + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfscope + \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}} + \pgfpatharc{0}{90} {0.4\pgf@circ@res@up} + \pgfsetarrowsend{latex} + \pgfusepath{draw} + \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}} + \pgfpatharc{0}{-90} {0.4\pgf@circ@res@up} + \pgfsetarrowsend{latex} + \pgfusepath{draw} + \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}} + \pgfpatharc{180}{90} {0.4\pgf@circ@res@up} + \pgfsetarrowsend{latex} + \pgfusepath{draw} + \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}} + \pgfpatharc{-180}{-90} {0.4\pgf@circ@res@up} + \pgfsetarrowsend{latex} + \pgfusepath{draw} + \endpgfscope +} + +% mach zehnder modulator +\pgfdeclareshape{mzm}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/mzm/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x= \pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x=-\ctikzvalof{tripoles/mzm/width}\pgf@x + } + \anchor{center}{ + \northwest + \pgf@x=0pt + \pgf@y=0pt + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{south}{ + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y + } + \anchor{west}{ + \northwest + \pgf@y=0pt + } + \anchor{east}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{mod}{ + \northwest + \pgf@x=0pt + } + \anchor{out}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=0pt + } + \anchor{text}{ + \northwest + \advance \pgf@y by 0.5\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@scaled@Rlen=\scaledRlen + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfstartlinewidth=\pgflinewidth + + % draw outer box + \pgf@circ@twoportbox + + % draw inner stuff + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{0.35\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.25\pgf@circ@res@right}{0.1\pgf@circ@res@up}} + \pgfusepath{draw} + + } +} +%%%---------- close: tex/pgfcircquadpoles +%%%%%%%%%%% Springe nach tex/pgfcircmultipoles +%%%---------- open: tex/pgfcircmultipoles.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Multipoles by Romano Giannetti +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%% +%% Chips +%%%%%%%%% + +% let's use the same shifts everywhere, no magic numbers +\def\pgf@circ@dip@pin@shift{0.5} +\def\pgf@circ@qfp@pin@shift{0.25} + +% derived from https://tex.stackexchange.com/a/146753/38080 +% original author Mark Wibrow +% Thanks also to John Kormylo https://tex.stackexchange.com/a/372996/38080 +% a lot of thanks to @marmot for the un-rotation hint +% https://tex.stackexchange.com/a/473571/38080 + +% DIP (dual in line package) chips + +\pgfdeclareshape{dipchip}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro\numpins{% + \pgf@circ@count@a=\ctikzvalof{multipoles/dipchip/num pins}% + \def\numpins{\the\pgf@circ@count@a} + } + \savedanchor\centerpoint{% + \pgf@x=-.5\wd\pgfnodeparttextbox% + \pgf@y=-.5\ht\pgfnodeparttextbox% + \advance\pgf@y by+.5\dp\pgfnodeparttextbox% + }% + \savedanchor\origin{\pgfpoint{0pt}{0pt}} + \anchor{center}{\origin} + \anchor{text}{\centerpoint}% to adjust text + \saveddimen\height{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{((\numpins) + *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}% + }% + \saveddimen{\chipspacing}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/pin spacing}}} + \saveddimen{\width}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}} + \saveddimen{\extshift}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}} + % standard anchors + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{0.5*((\numpins) + *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}% + \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}} + } + \anchor{dot}{\northwest + \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing} + \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing} + } + \anchor{nw}{\northwest} + \anchor{ne}{\northwest\pgf@x=-\pgf@x} + \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{sw}{\northwest\pgf@y=-\pgf@y} + \anchor{north west}{\northwest} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{n}{\northwest\pgf@x=0pt } + \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{w}{\northwest\pgf@y=0pt } + \anchor{north}{\northwest\pgf@x=0pt } + \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{west}{\northwest\pgf@y=0pt } + % start drawing + \backgroundpath{% + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step = \ctikzvalof{multipoles/dipchip/pin spacing}\pgf@circ@scaled@Rlen + \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen + \pgfscope% (for the line width) + \pgf@circ@setlinewidth{multipoles}{\pgflinewidth} + \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}% + \pgf@circ@draworfill + %% upside mark + \ifpgf@circuit@chip@topmark + \pgfpathmoveto{\pgfpoint{0.2*\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpatharc{0}{180}{0.2*\pgf@circ@res@left} + \fi + \pgfusepath{stroke}% + \pgfsetcolor{\ctikzvalof{color}} + % Adding the pin number + \ifpgf@circuit@chip@shownumbers + \pgf@circ@count@a=\numpins\relax + \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a + % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080 + \ifpgf@circuit@chip@straightnumbers + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)} + \else + \pgfmathsetmacro{\rot}{0} + \pgfmathsetmacro{\quadrant}{0} + \fi + \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax} + \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space} + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \ifcase\quadrant % rotation 0 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or % rotation -90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or %rotation 180 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or % rotation +90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \fi + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + \fi + \endpgfscope + \ifdim\pgf@circ@res@other>0pt + \pgfscope + \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} + \pgf@circ@count@a=\numpins\relax + \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}} + \ifnum\padfrac>0 + \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac + % left side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % right side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \else + % left side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % right side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \fi + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop + \pgfusepath{stroke} + \endpgfscope + \fi + }% + % \pgf@sh@s@ contains all the code for the shape + % and is executed just before a node is drawn. + \pgfutil@g@addto@macro\pgf@sh@s@dipchip{% + % Start with the maximum pin number and go backwards. + \pgf@circ@count@a=\numpins\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `pin 1` for the + % electrical contact, and the "border one" like `bpin 1` for labels. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@dipchip@pin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@dipchip@bpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + }% + } + +% QFP (quad flat package) chips + +\pgfdeclareshape{qfpchip}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro\numpins{% + \pgf@circ@count@a=\ctikzvalof{multipoles/qfpchip/num pins}% + \def\numpins{\the\pgf@circ@count@a} + } + \savedanchor\centerpoint{% + \pgf@x=-.5\wd\pgfnodeparttextbox% + \pgf@y=-.5\ht\pgfnodeparttextbox% + \advance\pgf@y by+.5\dp\pgfnodeparttextbox% + }% + \savedanchor\origin{\pgfpoint{0pt}{0pt}} + \anchor{center}{\origin} + \anchor{text}{\centerpoint}% to adjust text + \saveddimen\height{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{((\numpins+2) + *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}% + }% + \saveddimen\width{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{((\numpins+2) + *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}% + }% + \saveddimen{\chipspacing}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/qfpchip/pin spacing}}} + \saveddimen{\extshift}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}} + % standard anchors + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{0.5*((\numpins+2) + *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}% + \pgf@x=-\pgf@y + } + \anchor{dot}{\northwest + \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing} + \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing} + } + \anchor{nw}{\northwest} + \anchor{ne}{\northwest\pgf@x=-\pgf@x} + \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{sw}{\northwest\pgf@y=-\pgf@y} + \anchor{north west}{\northwest} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{n}{\northwest\pgf@x=0pt } + \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{w}{\northwest\pgf@y=0pt } + \anchor{north}{\northwest\pgf@x=0pt } + \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{west}{\northwest\pgf@y=0pt } + % start drawing + \backgroundpath{% + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step = \ctikzvalof{multipoles/qfpchip/pin spacing}\pgf@circ@scaled@Rlen + \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen + \pgfscope% (for the line width) + \pgf@circ@setlinewidth{multipoles}{\pgflinewidth} + %% upside mark + \ifpgf@circuit@chip@topmark + \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2-\pgf@circ@res@step/2}} + \pgfpathlineto{\pgfpoint{-\width/2+\pgf@circ@res@step/2}{\height/2}} + \else + \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2}} + \fi + %% rest of the shape + \pgfpathlineto{\pgfpoint{\width/2}{\height/2}} + \pgfpathlineto{\pgfpoint{\width/2}{-\height/2}} + \pgfpathlineto{\pgfpoint{-\width/2}{-\height/2}} + \pgfpathclose + \pgf@circ@draworfill + % Adding the pin number + \pgfsetcolor{\ctikzvalof{color}} + \ifpgf@circuit@chip@shownumbers + \pgf@circ@count@a=\numpins% + \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a + % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080 + \ifpgf@circuit@chip@straightnumbers + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)} + \else + \pgfmathsetmacro{\rot}{0} + \pgfmathsetmacro{\quadrant}{0} + \fi + \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax} + \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space} + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \ifcase\quadrant % rotation 0 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % bottom + \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % top + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}, + rotate=\rot]{\mytext} + \or % rotation -90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % bottom + \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % top + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}, + rotate=\rot]{\mytext} + \or %rotation 180 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % bottom + \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % top + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}, + rotate=\rot]{\mytext} + \or % rotation +90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % bottom + \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % top + \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}, + rotate=\rot]{\mytext} + \fi + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + \fi + \endpgfscope + \ifdim\pgf@circ@res@other>0pt + \pgfscope + \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} + \pgf@circ@count@a=\numpins% + \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}} + \ifnum\padfrac>0 + \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac + % left side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % bottom side pads + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}} + % right side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % top side pads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}} + \else + % left side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % bottom side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}} + % right side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + % top side pins + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}} + \fi + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + \pgfusepath{stroke} + \endpgfscope + \fi + }% + % \pgf@sh@s@ contains all the code for the shape + % and is executed just before a node is drawn. + \pgfutil@g@addto@macro\pgf@sh@s@qfpchip{% + % Start with the maximum pin number and go backwards. + \pgf@circ@count@a=\numpins% + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + \expandafter\xdef\csname pgf@anchor@qfpchip@pin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@qfpchip@bpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop% + }% + } + +%% anchors for DIP +\def\pgf@circ@dippinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \c@pgf@countc=\numpins\relax + \divide\c@pgf@countc by 2 + \ifnum #1 > \the\c@pgf@countc + % right side + \pgfpoint{\width/2+#2*\extshift}{-\height/2+(\pgf@circ@dip@pin@shift-\c@pgf@countc+#1-1)*\chipspacing} + \else + \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@dip@pin@shift-#1)*\chipspacing} +\fi +} + +%% anchors for QFP +\def\pgf@circ@qfppinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \c@pgf@countc=\numpins\relax + \divide\c@pgf@countc by 4 + \ifnum #1 > \the\c@pgf@countc + \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 2 + \ifnum #1 > \the\c@pgf@countb + \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 3 + \ifnum #1 > \the\c@pgf@countb + % 3*npins/4 < pin, top side + \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift+\c@pgf@countb-#1)*\chipspacing}{\height/2+#2*\extshift}% + \else + % 2*npins/4 < pin <= 3*npins/4, right side + \pgfpoint{\width/2+#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}% + \fi + \else + % npins/4 < pin <= 2*npins/4, bottom side + \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}{-\height/2-#2*\extshift}% + \fi + \else + % <= npins/4, left side + \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}% + \fi +} + +%%%%%%%%%%%%%%%%% +%% Rotary Switch +%%%%%%%%%%%%%%%%% + +\pgfdeclareshape{rotaryswitch} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedanchor\northeast{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt + % the magic number is 0.25/cos(35) + % try to recalculate it for the actual switch + \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=.3052\pgf@circ@res@temp + \edef\a{\ctikzvalof{multipoles/rotary/angle}} + \edef\r{\ctikzvalof{nodes width}} + \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@x}{\r*\pgf@circ@scaled@Rlen + \pgf@circ@res@temp} + } + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt + % the magic number is 0.25/cos(35) + % try to recalculate it for the actual switch + \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=.3052\pgf@circ@res@temp + \edef\a{\ctikzvalof{multipoles/rotary/angle}} + \edef\r{\ctikzvalof{nodes width}} + \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@x}{-\r*\pgf@circ@scaled@Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf@circ@res@temp} + } + \savedanchor\central{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt + % the magic number is 0.25/cos(35) + % try to recalculate it for the actual switch + \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen + \pgf@circ@res@temp=.3052\pgf@circ@res@temp + \edef\a{\ctikzvalof{multipoles/rotary/angle}} + \edef\r{\ctikzvalof{nodes width}} + \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@x}{(\a<90 ? 0 : cos(\a))*\pgf@circ@res@temp} + } + % external square limits + \savedanchor\extnorthwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen + % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt + \pgf@x=.3052\pgf@x % the magic number is 0.25/cos(35) + \pgf@x=2.5\pgf@x % external square size + \pgf@y=-\pgf@x %square thing when angle=180? + } + \saveddimen{\width}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{0.3052*\pgf@circ@scaled@Rlen*\ctikzvalof{tripoles/spdt/width}}} + % radius of the connector + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}} + % shapename + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + % shape type + \savedmacro{\cshape}{\def\cshape{\ctikzvalof{multipoles/rotary/shape}}} + \savedmacro{\channels}{\def\channels{\ctikzvalof{multipoles/rotary/channels}}} + \savedmacro{\angle}{\def\angle{\ctikzvalof{multipoles/rotary/angle}}} + \savedmacro{\wiper}{\def\wiper{\ctikzvalof{multipoles/rotary/wiper}}} + \savedmacro{\stepa}{\pgfmathsetmacro{\stepa}{2*\ctikzvalof{multipoles/rotary/angle}/(\ctikzvalof{multipoles/rotary/channels}-1)}} + % mid of the lever, to stack switches + %\anchor{mid}{\midlever} + \anchor{mid}{\northwest + \pgf@circ@res@temp=-\pgf@x + \pgfmathsetlength{\pgf@x}{\pgf@circ@res@temp*(-1+cos(\wiper))} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp*sin(\wiper)} + } + % center anchors + \anchor{cin}{ \northwest \pgf@y=0pt\advance\pgf@x by \radius} + % horizontal angles + \anchor{in}{ \northwest \pgf@y=0pt} + \anchor{ain}{ \northwest \pgf@y=0pt} + + \anchor{center}{ \central \pgf@y=0pt } + \anchor{east}{ \northeast \pgf@y=0pt } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \central \pgf@y=-\pgf@y } + \anchor{north}{ \central } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northeast } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northeast \pgf@y=-\pgf@y } + + \anchor{ext center}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width} + \anchor{ext east}{ \extnorthwest \pgf@y=0pt \pgf@x=-\pgf@x \advance\pgf@x by -\width} + \anchor{ext west}{ \extnorthwest \pgf@y=0pt \advance\pgf@x by -\width} + \anchor{ext south}{ \extnorthwest \pgf@x=0pt \pgf@y=-\pgf@y \advance\pgf@x by -\width} + \anchor{ext north}{ \extnorthwest \pgf@x=0pt \advance\pgf@x by -\width} + \anchor{ext south west}{ \extnorthwest \pgf@y=-\pgf@y \advance\pgf@x by -\width} + \anchor{ext north east}{ \extnorthwest \pgf@x=-\pgf@x \advance\pgf@x by -\width} + \anchor{ext north west}{ \extnorthwest \advance\pgf@x by -\width} + \anchor{ext south east}{ \extnorthwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y \advance\pgf@x by -\width} + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@res@right = \width + \pgf@circ@res@left = -\width + + \pgfscope %wiper + % This is the radius of the "ocirc" shape (see pgfcircshapes.tex) + \pgf@circ@res@temp=\radius\relax + \pgf@circ@res@temp=\ctikzvalof{multipoles/rotary/thickness}\pgf@circ@res@temp + \pgfsetlinewidth{2\pgf@circ@res@temp} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\wiper}{2\pgf@circ@res@right}}} + \pgfsetroundcap\pgfusepath{draw} + \endpgfscope + + \ifpgf@circ@rotaryarrow + \pgfscope % arrow + \ifpgf@circ@rotaryarrow@ccw\pgfsetarrowsstart{latexslim}\fi + \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % center of cin node + \pgftransformrotate{\wiper} + \pgfpathmoveto{\pgfpointpolar{50}{1.0\pgf@circ@res@right}} + \pgfpatharc{50}{-50}{1.0\pgf@circ@res@right} + \ifpgf@circ@rotaryarrow@cw\pgfsetarrowsend{latexslim}\fi + \pgfusepath{draw} + \endpgfscope + \fi + + % \typeout{CHANNELS\space\channels\space ANGLE\space\angle STEPA\space\stepa} + \pgf@circ@count@a=\channels\relax + \pgfmathsetmacro{\currenta}{-\angle} + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % \typeout{LOOPIN\space\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right} + \pgfscope + \pgftransformshift{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\currenta}{2\pgf@circ@res@right}}} + \pgfnode{\cshape}{center}{}{\thisshape-out \the\pgf@circ@count@a}{\pgfusepath{stroke}} + \endpgfscope + \pgfmathsetmacro{\currenta}{\currenta+\stepa} + % \typeout{LOOPOUT\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right} + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop + + \pgfscope % input + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}} + \endpgfscope + } + % \pgf@sh@s@ contains all the code for the shape + % and is executed just before a node is drawn. + \pgfutil@g@addto@macro\pgf@sh@s@rotaryswitch{% + % Start with the maximum pin number and go backwards. + \pgf@circ@count@a=\channels\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `pin 1` for the + % electrical contact, and the "border one" like `bpin 1` for labels. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@rotaryswitch@out\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{1}{0}% + } + \expandafter\xdef\csname pgf@anchor@rotaryswitch@cout\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{0}% + } + \expandafter\xdef\csname pgf@anchor@rotaryswitch@aout\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{1}% + } + \expandafter\xdef\csname pgf@anchor@rotaryswitch@sqout\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@rotarysqanchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + }% +} + +\def\pgf@circ@rotaryanchor#1#2#3{% #1: numero del pin; #2: 1 - x pos, 0 - center; #3 0: inner, 1 outer + \pgf@circ@res@temp=\width + \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa} + \pgfmathsetlength{\pgf@x}{2*(\pgf@circ@res@temp+#3*\radius/2)*cos(\myangle))+#2*\radius} + \pgfmathsetlength{\pgf@y}{2*(\pgf@circ@res@temp+#3*\radius/2)*sin(\myangle)} + \advance\pgf@x by -\pgf@circ@res@temp +} + +\def\pgf@circ@rotarysqanchor#1{% external square anchors + \pgf@circ@res@temp=\width + \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa} + \pgfpointborderrectangle{\pgfpointpolar{\myangle}{1pt}}{\pgfpoint{2.5\pgf@circ@res@temp}{2.5\pgf@circ@res@temp}} + \advance\pgf@x by -\pgf@circ@res@temp +} + +%%%%%%%%%%%%%%%%%%%%%%%%%% +% Seven segments displays +%%%%%%%%%%%%%%%%%%%%%%%%%% + +\pgfdeclareshape{bare7seg}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{displays}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\dotstatus}{\edef\dotstatus{\pgf@circ@sevenseg@dotstate}} + \saveddimen{\dotspace}{% the dot is on the right, and occupy the same as the thickness + \ifpgf@circ@sevenseg@dot + \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/thickness}} + \else + \pgf@x=0pt + \fi + } + % The object extension is more or less (-width/2,-width) to (width/2,width) + % and adjusted for line thickness (both sides) and eventually the dot + \saveddimen{\width}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}} + \saveddimen{\gap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/segment sep}}} + \saveddimen{\boxgap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/box sep}}} + \savedanchor{\southwest}{% both negative + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen + -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}} + \pgfmathsetlength{\pgf@y}{-\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen + -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}} + } + \savedanchor{\northeast}{% both positive + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \ifpgf@circ@sevenseg@dot + \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{seven seg/thickness}} + \else + \pgf@circ@res@other=0pt + \fi + \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen + +0.5*\ctikzvalof{seven seg/thickness}+\pgf@circ@res@other+\ctikzvalof{seven seg/box sep}} + \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen + +0.5*\ctikzvalof{seven seg/thickness}+\ctikzvalof{seven seg/box sep}} + } + \savedanchor{\topright}{% anchor without the box sep and the thickness + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen} + \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen} + } + \anchor{center}{\pgfpointorigin} + \anchor{north west}{\southwest\pgf@y=-\pgf@y} + \anchor{north east}{\northeast} + \anchor{south east}{\northeast\pgf@y=-\pgf@y} + \anchor{south west}{\southwest} + \anchor{north}{\northeast\pgf@x=0pt} + \anchor{east}{\northeast\pgf@y=0pt} + \anchor{south}{\southwest\pgf@x=0pt} + \anchor{west}{\southwest\pgf@y=0pt} + \anchor{a}{\topright\pgf@x=0pt} + \anchor{b}{\topright\pgf@y=0.5\pgf@y} + \anchor{c}{\topright\pgf@y=-0.5\pgf@y} + \anchor{d}{\topright\pgf@y=-\pgf@y\pgf@x=0pt} + \anchor{e}{\topright\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y} + \anchor{f}{\topright\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y} + \anchor{g}{\pgfpointorigin} + \anchor{dot}{\topright\pgf@y=-\pgf@y\advance\pgf@x by \dotspace} + \behindbackgroundpath{% + \southwest % I do not want the dot here, it will stick out + \pgf@circ@res@up = -\pgf@y + \pgf@circ@res@down = \pgf@y + \pgf@circ@res@right = \pgf@x + \pgf@circ@res@left = -\pgf@x + \pgfscope + \pgf@circ@setlinewidth{multipoles}{\pgflinewidth} + \pgfsetcolor{\ctikzvalof{color}} + \pgfpathrectanglecorners% + {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@left+\dotspace}{\pgf@circ@res@up}} + \ifpgf@circ@sevenseg@box + \pgf@circ@draworfill + \else + \pgf@circ@maybefill + \fi + \endpgfscope + \edef\bits{\ctikzvalof{seven seg/bits}} + \pgfscope + \pfg@circ@sseg@drawbits{\bits} + \endpgfscope + \pgfscope + \ifpgf@circ@sevenseg@dot + \pgf@circ@sseg@drawdots + \fi + \endpgfscope + } +} + +\def\pgf@circ@sseg@splitbits#1#2#3#4#5#6#7\relax{%split the seven bits + \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}\edef\@@e{#5}\edef\@@f{#6}\edef\@@g{#7}% +} +\def\pgf@circ@sseg@drawone#1#2#3#4#5{% #1 on off the x1, y1, x2 , y2 + \ifnum #1 > 0\relax + \pgfsetcolor{\ctikzvalof{seven seg/color on}} + \else + \pgfsetcolor{\ctikzvalof{seven seg/color off}} + \fi + \pgfpathmoveto{\pgfpoint{#2}{#3}} + \pgfpathlineto{\pgfpoint{#4}{#5}} + \pgfusepath{draw} +} +\def\pfg@circ@sseg@drawbits#1{% #1 must be 7 bits + \expandafter\pgf@circ@sseg@splitbits#1\relax% a bit of magic... + \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}} + \pgfsetlinewidth{\ctikzvalof{seven seg/thickness}} + % \pgfsetroundcap + \pgfsetarrowsstart{Triangle Cap[]} + \pgfsetarrowsend{Triangle Cap[]} + % segments + \pgf@circ@sseg@drawone{\@@a}{-\width/2+\gap}{\width}{\width/2-\gap}{\width} + \pgf@circ@sseg@drawone{\@@b}{\width/2}{\width-\gap}{\width/2}{0pt+\gap} + \pgf@circ@sseg@drawone{\@@c}{\width/2}{0pt-\gap}{\width/2}{-\width+\gap} + \pgf@circ@sseg@drawone{\@@d}{\width/2-\gap}{-\width}{-\width/2+\gap}{-\width} + \pgf@circ@sseg@drawone{\@@e}{-\width/2}{-\width+\gap}{-\width/2}{0pt-\gap} + \pgf@circ@sseg@drawone{\@@f}{-\width/2}{0pt+\gap}{-\width/2}{\width-\gap} + \pgf@circ@sseg@drawone{\@@g}{-\width/2+\gap}{0pt}{\width/2-\gap}{0pt} +} +\def\pgf@circ@sseg@drawdots{% dots + \edef\what{empty} + \ifx\what\pgf@circ@sevenseg@dotstate + % do nothing + \else + \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}} + \edef\what{off} + \ifx\what\pgf@circ@sevenseg@dotstate + % dot off + \pgfsetfillcolor{\ctikzvalof{seven seg/color off}} + \pgfsetcolor{\ctikzvalof{seven seg/color off}} + \else + % dot on + \pgfsetfillcolor{\ctikzvalof{seven seg/color on}} + \pgfsetcolor{\ctikzvalof{seven seg/color on}} + \fi + \pgfpathcircle{\pgfpoint{\width/2+2*\pgf@circ@res@other}{-\width}}{\pgf@circ@res@other} + \pgfusepath{draw,fill} + \fi +} + + +%%%%%% +%%%%%% Flip-flops +%%%%%% + +% Flip flops are a specialized kind of dipchip. +% they have a class by themselves + +%% flip flop definitions --- by default empty +%% pin texts +\ctikzset{multipoles/flipflop/t1/.initial={}} +\ctikzset{multipoles/flipflop/t2/.initial={}} +\ctikzset{multipoles/flipflop/t3/.initial={}} +\ctikzset{multipoles/flipflop/t4/.initial={}} +\ctikzset{multipoles/flipflop/t5/.initial={}} +\ctikzset{multipoles/flipflop/t6/.initial={}} +\ctikzset{multipoles/flipflop/tu/.initial={}} +\ctikzset{multipoles/flipflop/td/.initial={}} +% pin clock wedge flags +\ctikzset{multipoles/flipflop/c1/.initial={0}} +\ctikzset{multipoles/flipflop/c2/.initial={0}} +\ctikzset{multipoles/flipflop/c3/.initial={0}} +\ctikzset{multipoles/flipflop/c4/.initial={0}} +\ctikzset{multipoles/flipflop/c5/.initial={0}} +\ctikzset{multipoles/flipflop/c6/.initial={0}} +\ctikzset{multipoles/flipflop/cu/.initial={0}} +\ctikzset{multipoles/flipflop/cd/.initial={0}} +% pin negation circle flags +\ctikzset{multipoles/flipflop/n1/.initial={0}} +\ctikzset{multipoles/flipflop/n2/.initial={0}} +\ctikzset{multipoles/flipflop/n3/.initial={0}} +\ctikzset{multipoles/flipflop/n4/.initial={0}} +\ctikzset{multipoles/flipflop/n5/.initial={0}} +\ctikzset{multipoles/flipflop/n6/.initial={0}} +\ctikzset{multipoles/flipflop/nu/.initial={0}} +\ctikzset{multipoles/flipflop/nd/.initial={0}} + + +% Thanks to @marmot +\tikzset{flipflop def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/flipflop}{#1}} + +% default set of flip flops +\tikzset{ + % async + latch/.style={flipflop, flipflop def={t1=D, t6=Q, t3=CLK, t4=\ctikztextnot{Q}}}, + flipflop SR/.style={flipflop, flipflop def={t1=S, t3=R, t6=Q, t4=\ctikztextnot{Q}}}, + % sync + flipflop D/.style={flipflop, flipflop def={t1=D, t6=Q, c3=1, t4=\ctikztextnot{Q}}}, + flipflop T/.style={flipflop, flipflop def={t1=T, t6=Q, c3=1, t4=\ctikztextnot{Q}}}, + flipflop JK/.style={flipflop, flipflop def={t1=J, t3=K, c2=1, t6=Q, t4=\ctikztextnot{Q}}}, + % additional features + add async SR/.style={flipflop def={tu={\ctikztextnot{SET}}, td={\ctikztextnot{RST}}}}, + dot on notQ/.style={flipflop def={t4={Q}, n4=1}}, +} + +% +% commodity macro to draw the clock wedges. They leave the size of the +% wedge in \pgf@circ@res@temp so that a possible label can be displaced. +% +\def\pgf@circ@do@wedge@left{ + \pgf@circ@res@temp=0pt\relax + \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step+\wedge}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\wedge}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step-\wedge}} + \pgfusepath{stroke} + \pgf@circ@res@temp=\wedge + \fi +} +\def\pgf@circ@do@wedge@right{ + \pgf@circ@res@temp=0pt\relax + \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step+\wedge}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\wedge}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step-\wedge}} + \pgfusepath{stroke} + \pgf@circ@res@temp=-\wedge + \fi +} +\def\pgf@circ@do@wedge@up{ + \pgf@circ@res@temp=0pt\relax + \ifnum\ctikzvalof{multipoles/flipflop/cu}>0 + \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up-\wedge}} + \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@up}} + \pgfusepath{stroke} + \pgf@circ@res@temp=-\wedge + \fi +} +\def\pgf@circ@do@wedge@down{ + \pgf@circ@res@temp=0pt\relax + \ifnum\ctikzvalof{multipoles/flipflop/cd}>0 + \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down+\wedge}} + \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@down}} + \pgfusepath{stroke} + \pgf@circ@res@temp=\wedge + \fi +} +% generic flip-flop shape +\pgfdeclareshape{flipflop}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{flipflops}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + \savedmacro\numpins{\def\numpins{6}} + \savedanchor\centerpoint{% + \pgf@x=-.5\wd\pgfnodeparttextbox% + \pgf@y=-.5\ht\pgfnodeparttextbox% + \advance\pgf@y by+.5\dp\pgfnodeparttextbox% + }% + \savedanchor\origin{\pgfpoint{0pt}{0pt}} + \anchor{center}{\origin} + \anchor{text}{\centerpoint}% to adjust text + \saveddimen\height{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{((\numpins) + *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}% + }% + \saveddimen{\chipspacing}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/pin spacing}}} + \saveddimen{\width}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}} + \saveddimen{\extshift}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}} + % standard anchors + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{0.5*((\numpins) + *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}% + \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}} + } + \anchor{dot}{\northwest + \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing} + \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing} + } + \anchor{nw}{\northwest} + \anchor{ne}{\northwest\pgf@x=-\pgf@x} + \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{sw}{\northwest\pgf@y=-\pgf@y} + \anchor{north west}{\northwest} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{n}{\northwest\pgf@x=0pt } + \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{w}{\northwest\pgf@y=0pt } + \anchor{north}{\northwest\pgf@x=0pt } + \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{west}{\northwest\pgf@y=0pt } + % upper and lower pin + \anchor{up}{\northwest\pgf@x=0pt\advance\pgf@y by\extshift } + \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y\advance\pgf@y by-\extshift} + \anchor{bup}{\northwest\pgf@x=0pt } + \anchor{bdown}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + % start drawing + \backgroundpath{% + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step = \ctikzvalof{multipoles/flipflop/pin spacing}\pgf@circ@scaled@Rlen + \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen + \pgfsetcolor{\ctikzvalof{color}} + \pgfscope% (for the line width) + \pgf@circ@setlinewidth{multipoles}{\pgflinewidth} + \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}% + \pgf@circ@draworfill + \pgfusepath{stroke}% + \endpgfscope + % Adding the pin number + \pgf@circ@count@a=\numpins\relax + \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a + % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080 + \ifpgf@circuit@chip@straightnumbers + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)} + \else + \pgfmathsetmacro{\rot}{0} + \pgfmathsetmacro{\quadrant}{0} + \fi + \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax} + % text + \def\mytext{\ctikzvalof{multipoles/flipflop/font}\space + \ctikzvalof{multipoles/flipflop/t\the\pgf@circ@count@c}% + \pgf@circ@strut\space} + % \typeout{TEXT\space\mytext} + \pgfmathloop% + \def\wedge{\ctikzvalof{multipoles/flipflop/clock wedge size}\pgf@circ@res@step} + \pgf@circ@res@temp=0pt\relax + \ifnum\pgf@circ@count@a>0 + \ifcase\quadrant % rotation 0 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgf@circ@do@wedge@left + % \typeout{TEXT Left Q1\space\mytext} + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgf@circ@do@wedge@right + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or % rotation -90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgf@circ@do@wedge@left + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgf@circ@do@wedge@right + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or %rotation 180 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgf@circ@do@wedge@left + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgf@circ@do@wedge@right + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or % rotation +90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgf@circ@do@wedge@left + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgf@circ@do@wedge@right + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \fi + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + % Now the up and down text + % up + \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/tu}\space} + \pgf@circ@do@wedge@up + \ifcase\quadrant % rotation 0 + \pgftext[top, + at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \or % rotation -90 + \pgftext[right, + at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \or %rotation 180 + \pgftext[bottom, + at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \or % rotation +90 + \pgftext[left, + at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \fi + % down + \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/td}\space} + \pgf@circ@do@wedge@down + \ifcase\quadrant % rotation 0 + \pgftext[bottom, + at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \or % rotation -90 + \pgftext[left, + at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \or %rotation 180 + \pgftext[top, + at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \or % rotation +90 + \pgftext[right, + at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \fi + % external pins + \ifdim\pgf@circ@res@other>0pt + \pgfscope + \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} + \pgf@circ@count@a=\numpins\relax + \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % left side pins + \pgf@circ@count@c=\pgf@circ@count@a + %% we draw the pin only if it's defined either a text, a clock wedge or a not pin + %% Or'ing tests in core TeX is tough + \edef\@@or{0} + % Just expand the key the minimum needed + \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x} + \ifx\@@tmp\@@x\else\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + \ifnum\@@or>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfusepath{stroke} + \fi + % right side pins + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \edef\@@or{0} + \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x} + \ifx\@@tmp\@@x\else\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + % \typeout{TEST\space\@@tmp\space\@@x} + \ifnum\@@or>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfusepath{stroke} + \fi + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop + % up side + \edef\@@or{0} + \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/tu}}\edef\@@x{x} + \ifx\@@tmp\@@x\else\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cu}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + % \typeout{TEST\space\@@tmp\space\@@x} + \ifnum\@@or>0 + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@other}} + \pgfusepath{stroke} + \fi + % down side + \edef\@@or{0} + \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/td}}\edef\@@x{x} + \ifx\@@tmp\@@x\else\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cd}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + % \typeout{TEST\space\@@tmp\space\@@x} + \ifnum\@@or>0 + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down-\pgf@circ@res@other}} + \pgfusepath{stroke} + \fi + \endpgfscope + \fi % external pin width >0 + % + % draw "inverting" circles on outputs, they must be last + % + \pgfscope + \ifpgf@circuit@ieeelogicport + \def\@@notcirc{notcirc} + \else + \ifpgf@circ@european@port@circle@ieee + \def\@@notcirc{notcirc} + \else + \def\@@notcirc{ocirc} + \fi + \fi + \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} + \pgf@circ@count@a=\numpins\relax + \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % left side pins + \pgf@circ@count@c=\pgf@circ@count@a + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}} + \ifnum\@@tmp>0\pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfnode{\@@notcirc}{east}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}} + \endpgfscope\fi + % right side pins + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}} + \ifnum\@@tmp>0\pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfnode{\@@notcirc}{west}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}} + \endpgfscope\fi + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop + % up side + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}} + \ifnum\@@tmp>0\pgfscope + \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfnode{\@@notcirc}{south}{}{\thisshape-Nu}{\pgfusepath{stroke}} + \endpgfscope\fi + % down side + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}} + \ifnum\@@tmp>0\pgfscope + \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfnode{\@@notcirc}{north}{}{\thisshape-Nd}{\pgfusepath{stroke}} + \endpgfscope\fi + \endpgfscope + }% + % \pgf@sh@s@ contains all the code for the shape + % and is executed just before a node is drawn. + \pgfutil@g@addto@macro\pgf@sh@s@flipflop{% + % Start with the maximum pin number and go backwards. + \pgf@circ@count@a=\numpins\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `pin 1` for the + % electrical contact, and the "border one" like `bpin 1` for labels. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@flipflop@pin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@flipflop@bpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + }% +} + +% +% MUX-DEMUXES +% +% Thanks to @marmot +\tikzset{muxdemux def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/muxdemux}{#1}} +\tikzset{demux/.style={muxdemux, muxdemux def={Lh=4, Rh=8, NL=1, NB=3, NR=8}}} +\tikzset{one bit adder/.style={muxdemux, + muxdemux def={Lh=4, NL=2, Rh=2, NR=1, NB=1, w=1.5, + inset w=0.5, inset Lh=2, inset Rh=1.5}}} +\tikzset{ALU/.style={muxdemux, + muxdemux def={Lh=5, NL=2, Rh=2, NR=1, NB=2, NT=1, w=2, + inset w=1, inset Lh=2, inset Rh=0, square pins=1}}} +%generic mux-demux shape +\pgfdeclareshape{muxdemux}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + % pins on the four sides + % \savedmacro\NL{% + % \pgf@circ@count@a=\ctikzvalof{multipoles/muxdemux/NL}% + % \def\NL{\the\pgf@circ@count@a} + % } + \savedmacro\NL{\edef\NL{\ctikzvalof{multipoles/muxdemux/NL}}} + \savedmacro\NR{\edef\NR{\ctikzvalof{multipoles/muxdemux/NR}}} + \savedmacro\NT{\edef\NT{\ctikzvalof{multipoles/muxdemux/NT}}} + \savedmacro\NB{\edef\NB{\ctikzvalof{multipoles/muxdemux/NB}}} + \savedmacro\squarepins{\edef\squarepins{\ctikzvalof{multipoles/muxdemux/square pins}}} + % topleft and topright sizes + \savedanchor{\topleft}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Lh}*\pgf@circ@scaled@Rlen/2} + \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2} + } + \savedanchor{\topright}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Rh}*\pgf@circ@scaled@Rlen/2} + \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2} + } + \savedanchor{\insetnortheast}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Lh}*\pgf@circ@scaled@Rlen/2} + \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}* + (\ctikzvalof{multipoles/muxdemux/w}-2*\ctikzvalof{multipoles/muxdemux/inset w})*\pgf@circ@scaled@Rlen/2} + } + \saveddimen{\insethright}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Rh}*\pgf@circ@scaled@Rlen/2}} + \saveddimen{\extshift}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}} + \savedanchor{\northwest}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*max(\ctikzvalof{multipoles/muxdemux/Rh},\ctikzvalof{multipoles/muxdemux/Lh})*\pgf@circ@scaled@Rlen/2} + \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2} + } + \anchor{nw}{\northwest} + \anchor{ne}{\northwest\pgf@x=-\pgf@x} + \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{sw}{\northwest\pgf@y=-\pgf@y} + \anchor{north west}{\northwest} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{n}{\northwest\pgf@x=0pt } + \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{w}{\northwest\pgf@y=0pt } + \anchor{north}{\northwest\pgf@x=0pt } + \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{west}{\northwest\pgf@y=0pt } + \anchor{center}{\pgfpointorigin} + \anchor{top right}{\topright} + \anchor{bottom right}{\topright\pgf@y=-\pgf@y} + \anchor{right}{\topright\pgf@y=0pt\relax} + \anchor{top left}{\topleft} + \anchor{bottom left}{\topleft\pgf@y=-\pgf@y} + \anchor{left}{\topleft\pgf@y=0pt\relax} + \anchor{top}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya + \divide\pgf@y by 2 \pgf@x=0pt\relax} + \anchor{bottom}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya + \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax} + \anchor{inset top right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya} + \anchor{inset bottom right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya\pgf@y=-\pgf@y} + \anchor{inset right}{\insetnortheast\pgf@y=0pt\relax} + \anchor{inset top left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=\pgf@ya} + \anchor{inset bottom left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=-\pgf@ya} + \anchor{inset left}{\topleft\pgf@y=0pt\relax} + \anchor{inset bottom}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright + \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x + \pgfpoint{(\pgf@xa+\pgf@xb)/2}{-\pgf@ya+\pgf@yb/2}} + \anchor{inset top}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright + \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x + \pgfpoint{(\pgf@xa+\pgf@xb)/2}{\pgf@ya-\pgf@yb/2}} + \anchor{inset center}{\topleft\pgf@xa=\pgf@x\insetnortheast + \advance\pgf@x by \pgf@xa \divide\pgf@x by 2 \pgf@y=0pt\relax} + \anchor{narrow center}{\insetnortheast\pgf@xa=\pgf@x\topright + \advance\pgf@x by \pgf@xa \divide\pgf@x by 2\pgf@y=0pt\relax} + \anchor{center up}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya + \divide\pgf@y by 2 + \pgf@yb = \insethright \advance\pgf@y by \pgf@yb + \divide\pgf@y by 2 \pgf@x=0pt\relax} + \anchor{center down}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya + \divide\pgf@y by 2 + \pgf@yb = \insethright \advance\pgf@y by \pgf@yb + \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax} + \anchor{text}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}* + \ctikzvalof{multipoles/muxdemux/inset w}*\pgf@circ@scaled@Rlen/2} + \advance\pgf@x by -.5\wd\pgfnodeparttextbox% + \pgf@y=-.5\ht\pgfnodeparttextbox% + \advance\pgf@y by+.5\dp\pgfnodeparttextbox% + }% + \backgroundpath{% + \topleft + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@left = \pgf@x + \topright + \pgf@circ@res@other = \pgf@y + \pgf@circ@res@right = \pgf@x + \insetnortheast + \pgf@circ@res@step = \pgf@x + \pgf@circ@res@temp = \pgf@y + % + % external block + % + \pgfscope% (for the line width) + \pgf@circ@setlinewidth{multipoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + % inset, starting down + \ifdim\pgf@circ@res@temp>0pt % inset + % \typeout{INSETw\space\the\pgf@circ@res@right\space x\space\the\pgf@circ@res@step\space y\space\the\pgf@circ@res@temp} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\insethright}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\insethright}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}} + \fi + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + % now we have to draw the pins, if needed + \ifdim\extshift>0pt\ifpgfcirc@draw@input@leads\pgfscope % let's avoid too much indent + % Ok, we have to draw the leads (a.k.a. pins) + \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} + % We mimic the anchors here --- probably there is a better way + % left pins + \ifnum\NL>0\relax % not indented, closed on \repeatpgfmathloop + \pgf@circ@count@a=\NL\relax + \pgf@circ@count@b=\NL \divide\pgf@circ@count@b by 2 % see https://tex.stackexchange.com/questions/146523/why-does-numexpr-integer-division-round-rather-than-truncate + \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y + \insetnortheast\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y + \ifdim\pgf@circ@res@down>0pt % check if we have an inset + % we have to check oddity + \ifodd\NL + \ifnum\NL=1 + % only centerpin, step should not be used, but anyway... + \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL)} + \else + \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL-1)} + \fi + \else + \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/\NL} + \fi + \else % no inset + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NL} + \fi + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + %%%%% + \ifdim\pgf@circ@res@down>0pt % check if we have an inset + \ifnum\pgf@circ@count@a>\pgf@circ@count@b\relax + % for lower pins we have to shift them down + % \typeout{DEBUGTEST1\space #1\space entering\space \NL} + \ifodd\NL + % odd number of pins + \ifnum\pgf@circ@count@a=\numexpr\the\pgf@circ@count@b+1\relax + % centerpin! + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \ifnum\squarepins>0 + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{0pt}} + \else + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\extshift}{0pt}} + \fi + \else + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a+1)*\pgf@circ@res@step-2*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a+1)*\pgf@circ@res@step-2*\pgf@circ@res@down}} + \fi + \else + % even numer of pins: just go down + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step-2*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step-2*\pgf@circ@res@down}} + \fi + \else + % nothing need for #1<=NL/2 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}} + \fi + \else + % no inset + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}} + \fi + %%%%% + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop\fi% + % right pins + \ifnum\NR>0\pgf@circ@count@a=\NR\relax + \pgfmathloop% + \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@up=\pgf@y + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NR} + \ifnum\pgf@circ@count@a>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}} + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop\fi% + % bottom pins + \ifnum\NB>0\pgf@circ@count@a=\NB\relax %%% + \pgfmathloop% + \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y + \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NB} + \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@res@down-\pgf@circ@res@up)/(\pgf@circ@res@right-\pgf@circ@res@left)*\pgf@circ@res@step} + \ifnum\pgf@circ@count@a>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step} + {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}} + \ifnum\squarepins>0 + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step} + {-max(\pgf@circ@res@down, \pgf@circ@res@up)-\extshift}} + \else + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step} + {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other-\extshift}} + \fi + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop\fi% + % top pins + \ifnum\NT>0\pgf@circ@count@a=\NT\relax + \pgfmathloop% + \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y + \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NT} + \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@res@down-\pgf@circ@res@up)/(\pgf@circ@res@right-\pgf@circ@res@left)*\pgf@circ@res@step} + \ifnum\pgf@circ@count@a>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step} + {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}} + \ifnum\squarepins>0 + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step} + {max(\pgf@circ@res@down, \pgf@circ@res@up)+\extshift}} + \else + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step} + {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other+\extshift}} + \fi + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop\fi% + % end drawing pins; stroke them + \pgfusepath{stroke} + \endpgfscope\fi\fi + } + % let's start adding anchors + \pgfutil@g@addto@macro\pgf@sh@s@muxdemux{% + % left side anchors + \pgf@circ@count@a=\NL\relax + % \typeout{STARTGENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL} + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % \typeout{GENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL} + % we will create two anchors per pin: the "normal one" like `lpin 1` for the + % external leads, and the "border one" like `blpin 1` for internal ones. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@muxdemux@lpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@L@anchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@muxdemux@blpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@L@anchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + % right anchors + \pgf@circ@count@a=\NR\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `rpin 1` for the + % external leads, and the "border one" like `brpin 1` for internal ones. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@muxdemux@rpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@R@anchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@muxdemux@brpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@R@anchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + % bottom anchors + \pgf@circ@count@a=\NB\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `bpin 1` for the + % external leads, and the "border one" like `bbpin 1` for internal ones. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@muxdemux@bpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@B@anchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@muxdemux@bbpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@B@anchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + % top anchors + \pgf@circ@count@a=\NT\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `tpin 1` for the + % external leads, and the "border one" like `btpin 1` for internal ones. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@muxdemux@tpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@T@anchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@muxdemux@btpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@T@anchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + }% +} + +%% left anchors for muxdemux + +\def\pgf@circ@muxdemux@L@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \topleft + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \insetnortheast + \pgf@xb=\pgf@x + \pgf@yb=\pgf@y + \ifnum#1>\NL + \PackageError{circuitikz}{% + You requested left pin #1 for mux/demux shape \thisshape\space \MessageBreak + which has been defined with \NL\space left pins% + }{Please check the manual about mux/demux shapes; if you press return I'll try to continue} + \fi + \pgf@circ@count@a=\NL \divide\pgf@circ@count@a by 2 % see https://tex.stackexchange.com/questions/146523/why-does-numexpr-integer-division-round-rather-than-truncate + % \typeout{LEFT \the\pgf@xa \space \the\pgf@ya \space \NL} + \ifnum\NL>1 + \ifdim\pgf@yb>0pt % check if we have an inset + % we have to check oddity + \ifodd\NL + \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/(\NL-1)} + \else + \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/\NL} + \fi + \else % no inset + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NL} + \fi + \ifdim\pgf@yb>0pt % check if we have an inset + \ifnum#1>\pgf@circ@count@a\relax + % for lower pins we have to shift them down + % \typeout{DEBUGTEST1\space #1\space entering\space \NL} + \ifodd\NL + % odd number of pins + \ifnum#1=\numexpr\the\pgf@circ@count@a+1\relax + % centerpin! + \ifnum#2=0\relax + \pgfpoint{\pgf@xb}{0pt} + \else + \ifnum\squarepins>0 + \pgfpoint{\pgf@xa-#2*\extshift}{0pt} + \else + \pgfpoint{\pgf@xb-#2*\extshift}{0pt} + \fi + \fi + \else + \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1+1)*\pgf@circ@res@step-2*\pgf@yb} + \fi + \else + % even numer of pins: just go down + \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step-2*\pgf@yb} + \fi + \else + % nothing need for #1<=NL/2 + \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step} + \fi + \else + % no inset + \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step} + \fi + \else + \pgfpoint{\pgf@xa-#2*\extshift}{0pt} + \fi +} + +% right anchors +\def\pgf@circ@muxdemux@R@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \topright + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \ifnum#1>\NR + \PackageError{circuitikz}{% + You requested right pin #1 for mux/demux shape \thisshape\space \MessageBreak + which has been defined with \NR\space right pins% + }{Please check the manual about mux/demux shapes; if you press return I'll try to continue} + \fi + \ifnum\NR>1 + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NR} + \pgfpoint{\pgf@xa+#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step} + \else + \pgfpoint{\pgf@xa+#2*\extshift}{0pt} + \fi +} + +% bottom anchors +\def\pgf@circ@muxdemux@B@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \topleft + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \topright + \pgf@xb=\pgf@x + \pgf@yb=\pgf@y + \ifnum#1>\NB + \PackageError{circuitikz}{% + You requested bottom pin #1 for mux/demux shape \thisshape\space \MessageBreak + which has been defined with \NB\space bottom pins% + }{Please check the manual about mux/demux shapes; if you press return I'll try to continue} + \fi + \ifnum\NB>0 + % \typeout{DEBUGTESTtopleft\space\the\pgf@ya \space topright\space\the\pgf@yb \space\NB} + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NB} + \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step} + \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step} + \ifnum#2=0\relax + \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other} + \else + \ifnum\squarepins>0\relax + \pgfmathsetlength\pgf@y{-max(\pgf@ya,\pgf@yb)-\extshift} + \else + \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other-\extshift} + \fi + \fi + \else + % should not happen, give the same as pin 1 anyway + \ifnum#2=0\relax + \pgfpoint{0pt}{-\pgf@yb+(\pgf@yb-\pgf@ya)/2} + \else + \pgfpoint{0pt}{-max(\pgf@ya,\pgf@yb)-\extshift} + \fi + \fi +} + +% top anchors +\def\pgf@circ@muxdemux@T@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \topleft + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \topright + \pgf@xb=\pgf@x + \pgf@yb=\pgf@y + \ifnum#1>\NT + \PackageError{circuitikz}{% + You requested top pin #1 for mux/demux shape \thisshape\space \MessageBreak + which has been defined with \NT\space top pins% + }{Please check the manual about mux/demux shapes; if you press return I'll try to continue} + \fi + \ifnum\NT>0 + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NT} + \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step} + \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step} + \ifnum#2=0\relax + \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other} + \else + \ifnum\squarepins>0 + \pgfmathsetlength\pgf@y{max(\pgf@ya,\pgf@yb)+\extshift} + \else + \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other+\extshift} + \fi + \fi + \else + % should not happen, give the same as pin 1 anyway + \ifnum#2=0\relax + \pgfpoint{0pt}{\pgf@yb-(\pgf@yb-\pgf@ya)/2} + \else + \pgfpoint{0pt}{max(\pgf@ya,\pgf@yb)+\extshift} + \fi + \fi +} + +%% IEEE standard logic ports module +%% +%% Original multi-input code from John Kormylo at tex.stackexchange.com +%% Help by TheTeXnician <38565529+TheTeXnician@users.noreply.github.com> +%% Suggested idea and example code by Jason Sachs +%% Please see https://github.com/circuitikz/circuitikz/issues/383 for a lot of details +%% Most of the code, all errors and bugs by Romano Giannetti +%% Everything is in the same place here --- more or less; first step to move towards +%% a module interface for circutikz +%% + +% base parameters for ieeestd ports. + +\ctikzset{ieeestd ports/.is family} +% baselen is relative to pgfcirc@Rlen as ever; scaled if the class says so. +% the value of 0.4 is the standard pin distance for a port with height=num pins +% and matches the chip distance +\ctikzset{ieeestd ports/baselen/.initial=0.4} +% these are in term of baselen; width depends on height (fixed proportions) +\ctikzset{ieeestd ports/height/.initial=2} +\ctikzset{ieeestd ports/pin length/.initial=0.7} +% the standard "not" circle should be 1/6.5 of height (diameter); +% so radius/baselen=1/3.25/2 --- using 0.1 and no scaling is as a pole +\ctikzset{ieeestd ports/not radius/.initial=0.154} +\ctikzset{ieeestd ports/not radius fill/.initial=1}% change ony if you know why +% the suggested xnor distance is is 1.24, so 1.25/3.25/2 +% xor/xnor leads go full in in IEEE; let this be optional +\ctikzset{ieeestd ports/xor bar distance/.initial=0.192}% +\ctikzset{ieeestd ports/xor leads in/.initial=1}% +% +% base size of a small external schmitt symbol +% +\ctikzset{ieeestd ports/schmitt symbol size/.initial=0.3}% +% +% input management +% we are using the same /tikz/number inputs than the legacy ports +% +\tikzset{/tikz/inner inputs/.initial=0} % using 0 means that all inputs are inner +% +% integrate with the other logic ports +% +% +\newif\ifpgf@circuit@ieeelogicport\pgf@circuit@ieeelogicportfalse +\ctikzset{logic ports/ieee/.code= {% + \pgf@circuit@ieeelogicporttrue + \pgf@circuit@europeanlogicportfalse + \tikzset{and port/.style={shape=ieeestd and port}}% + \tikzset{or port/.style={shape=ieeestd or port}}% + \tikzset{xor port/.style={shape=ieeestd xor port}}% + \tikzset{buffer port/.style={shape=ieeestd buffer port}}% + \tikzset{not port/.style={shape=ieeestd not port}}% + \tikzset{nand port/.style={shape=ieeestd nand port}}% + \tikzset{nor port/.style={shape=ieeestd nor port}}% + \tikzset{xnor port/.style={shape=ieeestd xnor port}}% + \tikzset{schmitt port/.style={shape=ieeestd schmitt port}}% + \tikzset{invschmitt port/.style={shape=ieeestd invschmitt port}}% +}} +% add code to be compatible with the other ports +\ctikzset{logic ports/european/.add code={\pgf@circuit@ieeelogicportfalse}} +\ctikzset{logic ports/american/.add code={\pgf@circuit@ieeelogicportfalse}} +\tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}} +% +% the base angle for the or port. See the drawings. This will not change with height +% +\pgfmathsetmacro{\pgf@circ@orangle}{atan(3.25/6.5)} +% \typeout{ANGLE-IS\space\pgf@circ@orangle} +\def\pgf@circ@ieeeport@input#1% #1 = \pgfmathcounter +{% + \ifnum#1>\inputs + \PackageError{circuitikz}{% + You requested input pin #1 for logic port shape \thisshape\space \MessageBreak + which has been defined with \inputs\space pins% + }{Please check the manual about logic ports; if you press return I'll try to continue} + \fi + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgf@circ@res@step=\pind + \pgf@y=\pgf@circ@res@up\advance\pgf@y by -#1\pgf@circ@res@step\relax + \pgf@x=\pgf@circ@res@left\advance\pgf@x by -\pinlen +}% + +% #1 = \pgfmathcounter #2=type +% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor +\def\pgf@circ@ieeeport@baseinput#1#2% +{% + \ifnum#1>\inputs + \PackageError{circuitikz}{% + You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak + which has been defined with \inputs\space pins% + }{Please check the manual about logic ports; if you press return I'll try to continue} + \fi + % Find the vertical position (this is the same for any port) + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port + \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax + % rack (extended) pins; they are the same for all the ports + % call K = (inputs-inner)/2, rounded up; pins on the rack are: + % above: 1..K (included) + % below: inputs-K..inputs + % Find the pins on the rack; they are 1... + \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! + \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1 + % border anchors for rack should be ok + \pgfextractx{\pgf@circ@res@left}{\topleft} + \pgfextractx{\pgf@circ@res@right}{\bodyleft} + \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left + % we have finished if we are in the rack + \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b + % we are on the inner ports; we have to do the hard work here + % and and nand + \ifnum #2=1 + \relax % It's an and/nand, all border ports are on the rack line + \fi + % or and nor + \ifnum #2=2 + \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} + \fi + % xor and xnor + \ifnum #2=3\relax + \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-\xorbar-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} + \fi + \fi\fi +}% +% inner base ports for xor types port +% #1 = \pgfmathcounter #2=type +% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor +\def\pgf@circ@ieeeport@innerbaseinput#1% +{% + \ifnum#1>\inputs + \PackageError{circuitikz}{% + You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak + which has been defined with \inputs\space pins% + }{Please check the manual about logic ports; if you press return I'll try to continue} + \fi + % Find the vertical position (this is the same for any port) + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port + \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax + % rack (extended) pins; they are the same for all the ports + % call K = (inputs-inner)/2, rounded up; pins on the rack are: + % above: 1..K (included) + % below: inputs-K..inputs + % Find the pins on the rack; they are 1... + \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! + \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1 + % border anchors for rack should be ok + \pgfextractx{\pgf@circ@res@left}{\topleft} + \pgfextractx{\pgf@circ@res@right}{\bodyleft} + \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left + % we have finished if we are in the rack + \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b + % we are on the inner ports; we have to do the hard work here + \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} + \fi\fi +}% + +%%% macro to find basic lenghts --- they leave it in \pgf@circ@res@temp +\def\pgf@circ@ieeestd@baselen{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*\pgf@circ@scaled@Rlen} +} +\def\pgf@circ@ieeestd@stdH{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@temp}{0.5*\ctikzvalof{ieeestd ports/baselen}* + \ctikzvalof{ieeestd ports/height}*\pgf@circ@scaled@Rlen} +} +\def\pgf@circ@ieeestd@pinlen{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}* + \ctikzvalof{ieeestd ports/pin length}*\pgf@circ@scaled@Rlen} +} +\def\pgf@circ@ieeestd@xorbar{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}* + \ctikzvalof{ieeestd ports/xor bar distance}*\pgf@circ@scaled@Rlen} +} +%% Not circle +\def\pgf@circ@notradius{ + \pgf@circ@ieeestd@stdH % got the standard length. Notice that his is 3.25H for IEEE + \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/not radius}*\pgf@circ@res@temp} + % \typeout{NOTRADIUS\space\the\pgf@circ@res@temp} +} +%% Find (in ...@other) the height of the rack +\def\pgf@circ@findrackH{% + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax% + \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax% + \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins + \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % + \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi% + \pgf@circ@ieeestd@stdH + \multiply\pgf@circ@res@temp by 2\relax% full height + \divide\pgf@circ@res@temp by \pgf@circ@count@b % the pin spacing + \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@count@a/2)*\pgf@circ@res@temp} %top of the rack/port + % \typeout{RACK-\thisshape\space\the\pgf@circ@res@other} +} +%% +\def\pgf@circ@find@ieeeport@up{% leave it in up + % Normal port limits + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@circ@res@up}{\pgf@circ@res@temp} + % rack top size + \pgf@circ@findrackH + \ifdim\pgf@circ@res@other > \pgf@circ@res@up + \pgf@circ@res@up=\pgf@circ@res@other + \else + \fi +} +\def\pgf@circ@find@ieeeport@left#1{% leave it in left; #1 is type + % Normal port limits + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@circ@res@left}{8*\pgf@circ@res@temp/6.5} + \pgf@circ@res@right=\pgf@circ@res@left % save the border value + \pgf@circ@res@step=\pgf@circ@res@temp % save the stdH value + \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@left by \pgf@circ@res@temp + % \typeout{LEFT1-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + % this is the normal left border + % For the or or xor port, the limit can be the pointy thing (in case the + % pinlen is zero or too small) + % add to the body margin the or/nor peak: + \ifnum #1 > 1\relax% "or", "nor", "xor", "xnor" gates. + \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@step*(1-cos(\pgf@circ@orangle))} + \advance\pgf@circ@res@right by \pgf@circ@res@other + % \typeout{LEFT2-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + \fi + % add to the body margin the xor/xnor distance + \ifnum #1 = 3\relax% "xor" or "xnor" gates. + \pgf@circ@ieeestd@xorbar + \advance\pgf@circ@res@right by \pgf@circ@res@temp + % \typeout{LEFT3-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + \fi + % and if this exceeds the normal margin, this is it + % \typeout{LEFT4-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + \ifdim \pgf@circ@res@right > \pgf@circ@res@left + \pgf@circ@res@left=\pgf@circ@res@right + \fi + % \typeout{LEFT5-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} + \pgf@circ@res@left=-\pgf@circ@res@left +} +\def\pgf@circ@find@ieeeport@right#1{% leave it in right; #1 is plain or negated + % Normal port limits + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@circ@res@right}{8*\pgf@circ@res@temp/6.5} + \pgf@circ@notradius + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp} + \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp + \ifdim\pgf@circ@res@other > \pgf@circ@res@right + \pgf@circ@res@right=\pgf@circ@res@other + \fi +} +\def\pgf@circ@find@ieeeport@not@right#1{% leave it in right; #1 is plain or negated + % Normal port limits + \pgf@circ@ieeestd@stdH + % notice 0.8660254 is cos(30) + \pgfmathsetlength{\pgf@circ@res@right}{0.8660254*\pgf@circ@res@temp} + \pgf@circ@notradius + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp} + \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp + \ifdim\pgf@circ@res@other > \pgf@circ@res@right + \pgf@circ@res@right=\pgf@circ@res@other + \fi +} + + +%%% ieeestd multi-input ports +%%% #1: name +%%% #2: type: 1 for and,nand; 2 for or,nor; 3 for xor,xnor +%%% #3: polarity: 0 for direct, 1 for inverted (not at the output) +%%% #4: drawing for the port +\long\def\pgfcircdeclareieeeport#1#2#3#4{% + \pgfdeclareshape{ieeestd #1 port}% + {% + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + \saveddimen{\baselen}{% + \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\stdH}{% This is HALF the height of the inner port + \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\notdiameter}{ + \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp + } + \saveddimen{\pind}{% pin distance; + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax% + \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax% + \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins + \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % + \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi% + \pgf@circ@ieeestd@stdH\pgf@x=2\pgf@circ@res@temp % full height + \divide\pgf@x by \pgf@circ@count@b + } + \saveddimen{\pinlen}{% + \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\xorbar}{% + \pgf@circ@ieeestd@xorbar\pgf@x=\pgf@circ@res@temp + } + % anchors for the body (no pins included here) + \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\topleft}{% + \pgf@circ@ieeestd@xorbar\pgf@circ@res@right=\pgf@circ@res@temp % save \xorbar + \pgf@circ@ieeestd@stdH + \pgf@circ@res@other=0pt\relax + \ifnum #2 = 2\relax% "or" or "nor" gates. + \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))} + \fi + \ifnum #2 = 3\relax% "xor" or "xnor" gates. + \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle)) + +\pgf@circ@res@right} + \fi + \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5-\pgf@circ@res@other} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5} + \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} + } + \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle + \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp + \pgf@circ@ieeestd@stdH + % #3 is =1 if the port is a negated output one + \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5+#3*2*\pgf@circ@res@other} + \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} + } + % geographical anchors --- must be rectangulars! + \savedanchor{\northwest}{% + \pgf@circ@find@ieeeport@up + \pgf@circ@find@ieeeport@left{#2} + % \typeout{ANCH5-\thisshape\space L\space\the\pgf@circ@res@left\space U\space\the\pgf@circ@res@up} + \pgf@x=\pgf@circ@res@left + \pgf@y=\pgf@circ@res@up + } + \savedanchor{\southwest}{% + \pgf@circ@find@ieeeport@up + \pgf@circ@find@ieeeport@left{#2} + \pgf@x=\pgf@circ@res@left + \pgf@y=-\pgf@circ@res@up + } + \savedanchor{\southeast}{% + \pgf@circ@find@ieeeport@up + \pgf@circ@find@ieeeport@right{#3} + \pgf@x=\pgf@circ@res@right + \pgf@y=-\pgf@circ@res@up + } + \savedanchor{\northeast}{% + \pgf@circ@find@ieeeport@up + \pgf@circ@find@ieeeport@right{#3} + \pgf@x=\pgf@circ@res@right + \pgf@y=\pgf@circ@res@up + } + \savedmacro\inputs{% get number of inputs + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax + \ifnum\pgf@circ@count@a=0\pgf@circ@count@a=2\fi % default + \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins + % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi + \def\inputs{\the\pgf@circ@count@a}% + }% + \savedmacro\inners{% get number of "inner" inputs (for racks) + \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax + \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax + \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins + \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins + \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi + % \typeout{INNER is \the\pgf@circ@count@b}% + % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi + \def\inners{\the\pgf@circ@count@b}% + }% + \anchor{center}{\pgfpointorigin} + \anchor{text}{ + \ifpgf@circ@center@text + \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \else + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@circ@res@left}{-8*\pgf@circ@res@temp/6.5} % left border + \pgfpoint{\pgf@circ@res@left + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \fi + } + % create input anchors + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@ieeestd #1 port\endcsname{% + \pgf@circ@count@a=\inputs + \pgfmathloop% + \ifnum\pgfmathcounter>\pgf@circ@count@a% + \else% + %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{% + \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@in \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@ieeeport@input{\pgfmathcounter}% defined above + }% + \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@bin \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@ieeeport@baseinput{\pgfmathcounter}{#2}% defined above + }% + \ifnum #2 = 3\relax % xor/xnor inner border pins + \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@ibin \pgfmathcounter\endcsname{% + \noexpand\pgf@circ@ieeeport@innerbaseinput{\pgfmathcounter}% defined above + }% + \fi + %}{}% + \repeatpgfmathloop% + } + % output anchor + \anchor{out}{% + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball + \advance\pgf@circ@res@other by\pinlen + \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border + \ifdim \pgf@circ@res@temp > \pgf@circ@res@other + \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... + \fi + \pgf@x=\pgf@circ@res@other\pgf@y=0pt + } + \anchor{bout}{\bottomright\pgf@y=0pt} + + \anchor{body right}{\bodyright\pgf@y=0pt} + \anchor{right}{\bottomright\pgf@y=0pt} + \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body + \anchor{left}{% central edge of the component + \bodyleft\pgf@y=0pt + \ifnum #2=3\relax + \advance\pgf@x by -\xorbar + \fi + } + \anchor{up}{% + \bodyleft + \ifnum #2 > 1 % pointy shapes + \pgf@circ@ieeestd@stdH + % horizontal coordinate where the right semicircle starts + \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)} + % vertical drop of the circle at the above coordinate + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))} + \advance \pgf@y by -\pgf@circ@res@step + \fi + \pgf@x=0pt + } + \anchor{down}{% + \bodyleft + \ifnum #2 > 1 % pointy shapes + \pgf@circ@ieeestd@stdH + % horizontal coordinate where the right semicircle starts + \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)} + % vertical drop of the circle at the above coordinate + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))} + \advance \pgf@y by -\pgf@circ@res@step + \fi + \pgf@y=-\pgf@y\pgf@x=0pt + } + + % geographical anchors + \anchor{nw}{\northwest} + \anchor{ne}{\northeast} + \anchor{se}{\southeast} + \anchor{sw}{\southwest} + \anchor{north west}{\northwest} + \anchor{north east}{\northeast} + \anchor{south east}{\southeast} + \anchor{south west}{\southwest} + % over 0,0 even if asymmetric + % will break if the geocoords are not rectangular + \anchor{n}{\northwest\pgf@x=0pt\relax} + \anchor{e}{\northeast\pgf@y=0pt\relax} + \anchor{s}{\southwest\pgf@x=0pt\relax} + \anchor{w}{\northwest\pgf@y=0pt\relax} + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{east}{\northeast\pgf@y=0pt\relax} + \anchor{south}{\southwest\pgf@x=0pt\relax} + \anchor{west}{\northwest\pgf@y=0pt\relax} + + \backgroundpath{ + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + #4 + \endpgfscope + % output lead: + \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball + \advance\pgf@circ@res@other by \pinlen\relax + \ifdim \pgf@circ@res@other > \pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + \fi + \ifnum #3=1\relax\pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}} + \endpgfscope\fi + } + } +} + +%%% #1 direct name #2 negated name #3 type #4 drawing (without output) +\long\def\pgfcircdeclareieeeportpair#1#2#3#4{% + \pgfcircdeclareieeeport{#1}{#3}{0}{#4}% direct + \pgfcircdeclareieeeport{#2}{#3}{1}{#4}% negated +} +% +% ieeestd "and" and "nand" +% +\pgfcircdeclareieeeportpair{and}{nand}{1}{% + \pgf@circ@count@a = \inputs\relax + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@down}{\bodyleft} + \ifpgfcirc@draw@input@leads + %input leads --- all the same for AND ports + \loop\ifnum\pgf@circ@count@a>0 + \advance\pgf@circ@res@temp by -\pind + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}% + \advance\pgf@circ@count@a by -1 + \repeat + \fi + \pgfusepath{draw} + %% Body. let's start from the top left + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}} + \pgfpathlineto{\pgfpoint{1.5*\stdH/6.5}{\stdH}} + \pgfpatharc{90}{-90}{\stdH} + \pgfpathlineto{\pgfpoint{-8*\stdH/6.5}{-\stdH}} + \pgfpathclose + \pgf@circ@draworfill + % rack now; skip if not needed. + % \typeout{WHAT\space \inputs\space \inners} + \ifnum\inputs>\inners + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + \fi + \endpgfscope +} +% +% or/nor and xor/xnor are practically the same. Let factor out everything +% the argument #1 is put just before the drawing of the inner pins +% the argument #2 is put after the drawing of the body +% +\long\def\pgf@circ@ieeeport@orxor#1#2{% + \pgf@circ@count@a = \inputs\relax + \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@down}{\bodyleft} + % rack (extended) pins; they are the same for all the ports + % call K = (inputs-inner)/2, rounded up; pins on the rack are: + % above: 1..K (included) + % below: inputs-K..inputs + % Find the pins on the rack; they are 1... + \pgf@circ@count@b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! + \pgf@circ@count@c=\numexpr \inputs - \pgf@circ@count@b +1 \relax % =inputs - K +1 + \ifpgfcirc@draw@input@leads + %input leads --- for or ports + \loop\ifnum\pgf@circ@count@a>0 + \pgfextractx{\pgf@circ@res@right}{\topleft} + \advance\pgf@circ@res@temp by -\pind + % this is the height; let's find the "right" position + \ifnum \pgf@circ@count@a > \pgf@circ@count@b \ifnum \pgf@circ@count@a < \pgf@circ@count@c + % inner pins + % \typeout{INNER\space\pgf@circ@count@a} + \pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@left-2*\stdH*(1-cos(atan(\pgf@circ@res@temp/(2*\stdH))))} + % hook for xor/xnor + #1 + \fi\fi + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}% + \pgfusepath{draw} + \advance\pgf@circ@count@a by -1 + \repeat + \fi + %% Body. let's start from the top left + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + % it should start here, but with this trick the close comes out better. + % \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} + \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}} + \pgfpathlineto{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{\stdH}} % + \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5}{0pt}} + \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{-\stdH}} + \pgfpathlineto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}} + %% this should be 2 and 2; but the round part is not a perfect circle that way + %% so the 2.15 is ajusted "by taste" to touch the anchors exactly. + \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} + \pgfpathclose + \pgf@circ@draworfill + % hook for xor/xnor + #2 + % rack now; skip if not needed. + % \typeout{WHAT\space \inputs\space \inners} + \ifnum\inputs>\inners + \pgfextractx{\pgf@circ@res@left}{\topleft} + \pgfextracty{\pgf@circ@res@down}{\topleft} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + \fi + \endpgfscope +} +% +% ieeestd "or" and "nor" +% +\pgfcircdeclareieeeportpair{or}{nor}{2}{% + \pgf@circ@ieeeport@orxor{}{} +} +\pgfcircdeclareieeeportpair{xor}{xnor}{3}{% + \pgf@circ@ieeeport@orxor{ + \edef\@@tmp{\ctikzvalof{ieeestd ports/xor leads in}} + \ifnum\@@tmp=0\relax + % move pin start to the left to leave the xor gap free (not standard) + \advance\pgf@circ@res@right by -\xorbar + \fi + }{% + % add the xor/xnor bar + \pgfpathmoveto{\pgfpoint{-\xorbar-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}} + % see the comment on the main body about the 2.2 + \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-\xorbar -8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} + \pgfusepath{draw} + } +} +% +% Buffer and inverters +% +% #1: name +% #2: polarity +% #3: content +\long\def\pgfcircdeclareieeebufferport#1#2#3{% + \pgfdeclareshape{ieeestd #1 port}% + {% + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + \saveddimen{\baselen}{% + \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\stdH}{% This is HALF the height of the inner port + \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\notdiameter}{ + \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp + } + \saveddimen{\pinlen}{% + \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp + } + % anchors for the body (no pins included here) + % Notice that 0.8660254 is cos(30) + \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\topleft}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle + \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp + \pgf@circ@ieeestd@stdH + % #2 is =1 if the port is a negated output one + \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp+#2*2*\pgf@circ@res@other} + \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} + } + % geographical anchors --- must be rectangulars! + \savedanchor{\northwest}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} + } + \savedanchor{\southwest}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} + \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} + } + \savedanchor{\southeast}{% + \pgf@circ@ieeestd@stdH + \pgf@circ@res@up=\pgf@circ@res@temp + \pgf@circ@find@ieeeport@not@right{#2} + \pgf@x=\pgf@circ@res@right + \pgf@y=-\pgf@circ@res@up + } + \savedanchor{\northeast}{% + \pgf@circ@ieeestd@stdH + \pgf@circ@res@up=\pgf@circ@res@temp + \pgf@circ@find@ieeeport@not@right{#2} + \pgf@x=\pgf@circ@res@right + \pgf@y=\pgf@circ@res@up + } + \anchor{center}{\pgfpointorigin} + \anchor{text}{ + \ifpgf@circ@center@text + \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \else + \pgf@circ@ieeestd@stdH + \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \fi + } + % input anchors + \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} + \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} + \anchor{bin}{\bodyleft\pgf@y=0pt\relax} + \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax} + % output anchors + \anchor{out}{% + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball + \advance\pgf@circ@res@other by\pinlen + \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border + \ifdim \pgf@circ@res@temp > \pgf@circ@res@other + \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... + \fi + \pgf@x=\pgf@circ@res@other\pgf@y=0pt + } + \anchor{bout}{\bottomright\pgf@y=0pt} + + \anchor{body right}{\bodyright\pgf@y=0pt} + \anchor{right}{\bottomright\pgf@y=0pt} + \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body + \anchor{left}{\bodyleft\pgf@y=0pt} + \anchor{up}{% + \bodyleft + \pgf@y=+0.5\pgf@y\pgf@x=0pt + } + \anchor{down}{% + \bodyleft + \pgf@y=-0.5\pgf@y\pgf@x=0pt + } + % this is for when it's used as a bipole + % we use the enclosing rectangle (see below) + \anchorborder{% + %% This (commented out) is the correct border anchor. But if we use the correct + %% border anchor there is no horizontal space for the label ;-) because + %% the triangle is too steep. So we will use a simple square border + %% + %% find the border anchor of a triangle (like a not port or an + %% amplifier) --- + %% + %% -----^ up + %% I --- | + %% I -|-- + %%left I | --- right + %% ----I-----|-------I----- + %% + %% + %\pgf@xa=\pgf@x + %% it's simmetrical w/ vertical side, use only positive y + %\pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)} + %\pgfmathsetlength{\pgf@ya}{abs(\pgf@y)} + %\pgfextracty{\pgf@circ@res@up}{\bodyleft} + %\pgfextractx{\pgf@circ@res@left}{\bodyleft} + %\pgfextractx{\pgf@circ@res@right}{\bodyright} + %% limit angle for the left (vertical) side + %\pgfmathsetmacro{\@@phimax}{atan2(\pgf@circ@res@up,\pgf@circ@res@left)} + %\pgfmathsetmacro{\@@phi}{atan2(\pgf@ya,\pgf@xa)} + %\pgfmathsetmacro{\@@leftside}{ifthenelse(\@@phi>\@@phimax,1,0)} + %% find the border + %\ifnum\@@leftside>0 + % % vertical side + % \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + % {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + %\else + % % triangle upper line + % \pgfpointintersectionoflines + % {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}} + % {\pgfqpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@right}{0pt}} + %\fi + %% readjust y sign + %\pgf@y=\@@switchy\pgf@y + % + % this is the square border to position the path label with a bit of horizontal space + % + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + } + % geographical anchors + \anchor{nw}{\northwest} + \anchor{ne}{\northeast} + \anchor{se}{\southeast} + \anchor{sw}{\southwest} + \anchor{north west}{\northwest} + \anchor{north east}{\northeast} + \anchor{south east}{\southeast} + \anchor{south west}{\southwest} + % over 0,0 even if asymmetric + % will break if the geocoords are not rectangular + \anchor{n}{\northwest\pgf@x=0pt\relax} + \anchor{e}{\northeast\pgf@y=0pt\relax} + \anchor{s}{\southwest\pgf@x=0pt\relax} + \anchor{w}{\northwest\pgf@y=0pt\relax} + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{east}{\northeast\pgf@y=0pt\relax} + \anchor{south}{\southwest\pgf@x=0pt\relax} + \anchor{west}{\northwest\pgf@y=0pt\relax} + + \backgroundpath{ + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + #3 + \endpgfscope + % output lead: + \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball + \advance\pgf@circ@res@other by \pinlen\relax + \ifdim \pgf@circ@res@other > \pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + \fi + \ifnum #2=1\relax\pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}} + \endpgfscope\fi + } + } +} + +%%% #1 direct name #2 negated name #3 drawing (without output) +\long\def\pgfcircdeclareieeebufferportpair#1#2#3{% + \pgfcircdeclareieeebufferport{#1}{0}{#3}% direct + \pgfcircdeclareieeebufferport{#2}{1}{#3}% negated +} + +\pgfcircdeclareieeebufferportpair{buffer}{not}{% + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@right}{\bodyright} + % \draw input pin + \ifpgfcirc@draw@input@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} + \pgfusepath{draw} + \fi + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope +} + +\pgfcircdeclareieeebufferportpair{schmitt}{invschmitt}{% + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@right}{\bodyright} + % \draw input pin + \ifpgfcirc@draw@input@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} + \pgfusepath{draw} + \fi + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + % draw schmitt symbol in normal line thickness + \pgfpathmoveto{\pgfpoint{0.75*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.00*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{0.25*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.25*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} + \pgfusepath{draw} +} + + +\pgfdeclareshape{schmitt symbol}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@circ@ieeestd@stdH + \pgf@y=\ctikzvalof{ieeestd ports/schmitt symbol size}\pgf@circ@res@temp + \pgf@x=-1.5\pgf@y + } + \anchor{center}{\pgf@y=0pt \pgf@x=0pt} + \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x} + \anchor{west}{\northwest\pgf@y=0pt} + \anchor{w}{\northwest \pgf@y=0pt} + \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{north}{\northwest\pgf@x=0pt} + \anchor{n}{\northwest\pgf@x=0pt} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{north west}{\northwest} + \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \backgroundpath{ + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + \pgfextractx{\pgf@circ@res@left}{\northwest} + \pgfextracty{\pgf@circ@res@up}{\northwest} + \pgf@circ@res@left=0.7\pgf@circ@res@left + \pgf@circ@res@up=0.7\pgf@circ@res@up + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left/3}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left/3}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + } +} + +\pgfdeclareshape{notcirc}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@circ@notradius + \pgf@y=\pgf@circ@res@temp + \pgf@x=-\pgf@y + } + \anchor{center}{\pgf@y=0pt \pgf@x=0pt} + \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} + \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x} + \anchor{left}{\northwest\pgf@y=0pt} + \anchor{west}{\northwest\pgf@y=0pt} + \anchor{w}{\northwest \pgf@y=0pt} + \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{north}{\northwest\pgf@x=0pt} + \anchor{n}{\northwest\pgf@x=0pt} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{north west}{\northwest} + \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + \northwest\pgf@circ@res@temp=\pgf@y + \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}% + {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} + } + \behindforegroundpath{ + \pgfscope + \northwest\pgf@circ@res@temp=\pgf@y + \pgfsetcolor{\ctikzvalof{color}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@temp} + \ifx\tikz@fillcolor\pgfutil@empty + % set the default fill color to white + \pgfsetfillcolor{white} + % ...but override it if the class is defined! + \pgf@circ@setifdefinedfill{draw, fill}{draw, fill} + \else + \pgfsetfillcolor{\tikz@fillcolor} + \fi + \pgfsetfillopacity{\ctikzvalof{ieeestd ports/not radius fill}}% normally 1.0 + \pgfusepath{draw,fill} + \endpgfscope + } +} + +%%%% Transmission gates +% tgates are only ieee style for now +\tikzset{% + tgate/.style ={shape=ieee tgate}, + double tgate/.style ={shape=ieee double tgate}, +} +\ctikzset{tgate scale/.initial=0.7} +% Buffer and inverters +% +% #1: name +% #2: 1: one-not, 2:double-not +% #3: content +\long\def\pgfcircdeclareieeetgate#1#2#3{% + \pgfdeclareshape{ieee #1}% + {% + \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + \saveddimen{\baselen}{% + \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\stdH}{% This is HALF the height of the inner port + \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\notdiameter}{ + \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp + } + \saveddimen{\notradius}{ + \pgf@circ@notradius\pgf@x=\pgf@circ@res@temp + } + \saveddimen{\pinlen}{% + \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp + } + % anchors for the body (no pins included here) + % Notice that 0.8660254 is cos(30) + \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\topleft}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\bodyright}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\bottomright}{% Here it is the same as \bodyright + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + % geographical anchors --- must be rectangulars! + \savedanchor{\northwest}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\southwest}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\southeast}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \savedanchor{\northeast}{% + \pgf@circ@ieeestd@stdH + \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} + } + \anchor{center}{\pgfpointorigin} + \anchor{text}{ + \ifpgf@circ@center@text + \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \else + \pgf@circ@ieeestd@stdH + \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} + \fi + } + % input anchors + \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} + \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} + \anchor{bin}{\bodyleft\pgf@y=0pt\relax} + \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax} + % gates + \anchor{gate}{\bodyleft\pgf@circ@res@up=\pgf@y + \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}} + \anchor{bgate}{\bodyleft\pgf@circ@res@up=\pgf@y + \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up}} + % gate (up) (2.1547 = 1+1/cos(30) + \anchor{notgate}{\bodyleft\pgf@circ@res@up=\pgf@y + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius} + \ifdim\pinlen>\pgf@circ@res@temp + \pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen} + \else + \pgf@y=\pgf@circ@res@temp + \fi + } + \anchor{bnotgate}{\bodyleft\pgf@circ@res@up=\pgf@y + \pgf@x=0pt\pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+2.1547*\notradius}} + + % output anchors + \anchor{out}{% + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball + \advance\pgf@circ@res@other by\pinlen + \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border + \ifdim \pgf@circ@res@temp > \pgf@circ@res@other + \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... + \fi + \pgf@x=\pgf@circ@res@other\pgf@y=0pt + } + \anchor{bout}{\bottomright\pgf@y=0pt} + + \anchor{body right}{\bodyright\pgf@y=0pt} + \anchor{right}{\bottomright\pgf@y=0pt} + \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body + \anchor{left}{\bodyleft\pgf@y=0pt} + \anchor{up}{% + \bodyleft + \pgf@x=0pt + \ifnum#2=1\relax + \pgf@y=0pt + \else + \pgf@y=.5\pgf@y + \fi + \advance\pgf@y by \notdiameter + } + \anchor{down}{% + \bodyleft + \pgf@x=0pt + \ifnum#2=1\relax + \pgf@y=0pt + \else + \pgf@y=-.5\pgf@y + \fi + } + % this is for when it's used as a bipole + % we use the enclosing rectangle (see below) + \anchorborder{% + % + % this is the square border to position the path label with a bit of horizontal space + % + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + } + % geographical anchors + \anchor{nw}{\northwest} + \anchor{ne}{\northeast} + \anchor{se}{\southeast} + \anchor{sw}{\southwest} + \anchor{north west}{\northwest} + \anchor{north east}{\northeast} + \anchor{south east}{\southeast} + \anchor{south west}{\southwest} + % over 0,0 even if asymmetric + % will break if the geocoords are not rectangular + \anchor{n}{\northwest\pgf@x=0pt\relax} + \anchor{e}{\northeast\pgf@y=0pt\relax} + \anchor{s}{\southwest\pgf@x=0pt\relax} + \anchor{w}{\northwest\pgf@y=0pt\relax} + \anchor{north}{\northwest\pgf@x=0pt\relax} + \anchor{east}{\northeast\pgf@y=0pt\relax} + \anchor{south}{\southwest\pgf@x=0pt\relax} + \anchor{west}{\northwest\pgf@y=0pt\relax} + + \backgroundpath{ + \pgfscope + \pgfsetcolor{\ctikzvalof{color}} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@right}{\bodyright} + % \draw input pins + \ifpgfcirc@draw@input@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} + % gate (down) + \pgfpathmoveto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}} + % gate (up) (2.1547 = 1+1/cos(30) + \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius} + \ifdim\pinlen>\pgf@circ@res@temp + \pgfpathmoveto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}} + \fi + \pgfusepath{draw} + \fi + #3 + \endpgfscope + % output lead: + \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border + \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball + \advance\pgf@circ@res@other by \pinlen\relax + \ifdim \pgf@circ@res@other > \pgf@circ@res@right + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi + \fi + } + } +} + +\pgfcircdeclareieeetgate{tgate}{1}{% + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfscope + % 1.1547 is 1/cos(30) + \pgftransformshift{\pgfpoint{0pt}{1.1547*\notradius}} + \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}} + \endpgfscope +} + +\pgfcircdeclareieeetgate{double tgate}{2}{% + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + % bottom triangles + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfscope + % 1.1547 is 1/cos(30) + \pgftransformshift{\pgfpoint{0pt}{.5*\pgf@circ@res@up+1.1547*\notradius}} + \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}} + \endpgfscope +} + +%%%---------- close: tex/pgfcircmultipoles + +%%%%%%%%%%% Springe nach tex/pgfcirclabel +%%%---------- open: tex/pgfcirclabel.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Bipole label positioning + +%% bipole labels and annotation extra style + +\ctikzset{bipole label style/.style={}} +\tikzset{bipole label style/.code={ + \ctikzset{bipole label style/.style={#1}} +}} +\tikzset{bipole label append style/.code={ + \ctikzset{bipole label style/.append style={#1}} +}} +\ctikzset{bipole annotation style/.style={}} +\tikzset{bipole annotation style/.code={ + \ctikzset{bipole annotation style/.style={#1}} +}} +\tikzset{bipole annotation append style/.code={ + \ctikzset{bipole annotation style/.append style={#1}} +}} + +%% Options +\ctikzset{label/.style = { l=#1 } } +\ctikzset{l/.code = { + \pgfkeys{/tikz/circuitikz/bipole/label/name=#1} + \ctikzsetvalof{bipole/label/unit}{} + \ifpgf@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp} + \else + \fi + \else + \fi +}} + +\ctikzset{label above/.code = { + l=#1, + \circuitikzbasekey/bipole/label/position=90 } +} + +\ctikzset{l^/.style = { + l=#1, + \circuitikzbasekey/bipole/label/position=90 } +} + +\ctikzset{label below/.code = { + l=#1, + \circuitikzbasekey/bipole/label/position=-90 } +} + +\ctikzset{l_/.style = { + l=#1, + \circuitikzbasekey/bipole/label/position=-90 } +} + +\ctikzset{annotation/.style = { a=#1 } } +\ctikzset{a/.code = { + \pgfkeys{/tikz/circuitikz/bipole/annotation/name=#1} + \ctikzsetvalof{bipole/annotation/unit}{} + \ifpgf@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/annotation/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/annotation/unit}{\pgf@temp} + \else + \fi + \else + \fi +}} + +\ctikzset{annotation above/.code = { + a=#1, + \circuitikzbasekey/bipole/annotation/position=90 } +} + +\ctikzset{a^/.style = { + a=#1, + \circuitikzbasekey/bipole/annotation/position=90 } +} + +\ctikzset{annotation below/.code = { + a=#1, + \circuitikzbasekey/bipole/annotation/position=-90 } +} +\ctikzset{a_/.style = { + a=#1, + \circuitikzbasekey/bipole/annotation/position=-90 } +} + +% This is to adjust spacing for the labels so that they are not cramped on components +\def\pgf@circ@ls{.75ex} % labelspace to have just one point to change + +\def\pgf@circ@drawlabels#1{ + \pgfextra{ + % This function will be called with argument #1 equal + % to "label" or "annotation" form pgfcircpath.tex. + % pgf@circ@direction is the direction of the path, + % its value is set in pgfcircpath.tex + \pgfmathsubtract{\pgf@circ@direction}{90} + \pgfmathround{\pgfmathresult} % avoid precision loss errors + \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + + \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/position}} + \ifnum \pgf@circ@temp < 0 + \pgfmathadd{\pgf@circ@labanc}{180} + \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \fi + % \typeout{INI: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc} + % + % normalize the angle values + % + \pgfmathmod{\pgf@circ@labanc}{360} + \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + % + \ifpgf@circuit@bipole@inverted + \pgfmathadd{\pgf@circ@temp}{180} %If shape is inverted, use opposite anchor + \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \fi + % + \ifnum \ctikzvalof{mirror value} = -1 + \pgfmathadd{\pgf@circ@temp}{180} %If shape is mirrored, use opposite anchor + \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \fi + % \typeout{FIN: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc} + } + %Firstly, place a coordinate directly at the edge of the shape + (\ctikzvalof{bipole/name}.\pgf@circ@temp) coordinate (pgfcirc@labelcoor) + %now decide, which labels should be drawn + \pgfextra{ + \edef\pgf@temp{\ctikzvalof{label/align}} + \def\pgf@circ@temp{straight} + } + \ifx\pgf@temp\pgf@circ@temp %straight + \pgf@circ@drawreglabels{#1} + \else + \pgfextra{\def\pgf@circ@temp{rotate}} + \ifx\pgf@temp\pgf@circ@temp %rotate + \pgf@circ@drawrotlabels{#1} + \else% smart + \pgf@circ@drawsmartlabels{#1} + \fi + \fi +} + + +\def\pgf@circ@drawsmartlabels#1{ + \pgfextra{ + \pgfmathmod{\pgf@circ@direction}{90} + \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + } + \ifnum \pgfcircmathresult > 20 + \ifnum \pgfcircmathresult < 70 + \pgf@circ@drawrotlabels{#1} + \else + \pgf@circ@drawreglabels{#1} + \fi + \else + \pgf@circ@drawreglabels{#1} + \fi + } + + +\def\pgf@circ@drawrotlabels#1{ + \pgfextra{ + % scale the distances in function of zoom, so that they are not + % dependent on it but on font size. Thanks to @marmot + % https://tex.stackexchange.com/a/476018/38080 + % the coeffcient is adjusted so that the distance is more or less + % the same for rotated labels and straight ones (although it will + % depend on the font, so it's not exact). + \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}% + \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed + % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale} + \pgfmathsetlength\pgf@circ@res@temp{1.5*\pgf@circ@ls/\myscale} + \ifnum \ctikzvalof{bipole/#1/position}>0 + %we need some more space for placement below, due to mid-anchor + \else % we do not have <= in \ifnum... + \pgf@circ@res@temp=1.5\pgf@circ@res@temp + \fi + %Calculate rotation of the label from direction and strip decimals + \pgfmathsetmacro{\pgfcirclabrot}{round(\pgf@circ@direction)} + \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfcirclabrot\pgf@nil} + % rotate the label at second or third quadrant: + \ifnum \pgfcirclabrot > 90 \ifnum \pgfcirclabrot < 270 + \pgfmathsubtract{\pgf@circ@direction}{180} + \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + %invert the space relationships due to rotated strings + \ifnum \ctikzvalof{bipole/#1/position}>0 + \pgf@circ@res@temp=1.5\pgf@circ@res@temp + \fi + \fi\fi + \pgfmathparse{\ctikzvalof{bipole/#1/position}>0?\pgf@circ@direction+90:\pgf@circ@direction-90}% + \edef\pgf@circ@labposangle{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}% + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix#1-direction\endcsname{\pgfcirclabrot}% + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-#1-anchor\endcsname{mid}% + } + % reset cm is not working correctly here + (pgfcirc@labelcoor)++(\pgf@circ@labposangle:\the\pgf@circ@res@temp) coordinate(pgfcirc@labelcoor) + node[anchor=mid, rotate=\pgfcirclabrot, \circuitikzbasekey/bipole #1 style] + (\ctikzvalof{bipole/name}#1){\pgf@circ@finallabels{#1}} +} + +\def\pgf@circ@drawreglabels#1{ + %Now calculate all shape positions + %Use mid-anchor at x-axis and base-anchor at y-axis, respectively. + %All points between will be addressed by angled-anchors: + \pgfextra{ + % scale ex-distance to make it independent on scale + % thanks @marmot see https://tex.stackexchange.com/a/476018/38080 + \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}% + \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed + % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale} + \pgfmathsetlength\pgf@circ@res@temp{\pgf@circ@ls/\myscale} + \pgfmathadd{\pgf@circ@labanc}{90} + \pgfmathround{\pgfmathresult} + \def\pgf@circ@labanctext{\pgf@circ@labanc} + \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \pgfmathparse{mod(\pgf@circ@temp,180)>135?mod(\pgf@circ@temp,180)-180:mod(\pgf@circ@temp,180)} + \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + } + %Values around 90 are at both y-axis + \ifnum \pgfcircmathresult > 84 \ifnum \pgfcircmathresult< 96 + \pgfextra{\edef\pgf@circ@labpos{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}} + \ifnum \pgf@circ@labpos > 180 + \ifnum \ctikzvalof{bipole/#1/position} > 0 + \pgfextra{\def\pgf@circ@labanctext{mid west}} + \else + \pgfextra{\def\pgf@circ@labanctext{mid east}} + \fi + \else + \ifnum \ctikzvalof{bipole/#1/position} > 0 + \pgfextra{\def\pgf@circ@labanctext{mid east}} + \else + \pgfextra{\def\pgf@circ@labanctext{mid west}} + \fi + \fi + \fi\fi + %Values between -5 and 5 are at pos /neg x-axis + \ifnum \pgfcircmathresult <6 \ifnum \pgfcircmathresult > -6 + \ifnum \ctikzvalof{bipole/#1/position} < 0 + \ifnum \pgf@circ@labanc > 90 + % using base coordinate instead of south to naturally align + % symbols with descendants; but this invalidate the effect of + % the inner sep, so recover it by shifting the anchor + % reset cm is not working sometime, use @marmot solution + % see https://tex.stackexchange.com/a/476018/38080 + (pgfcirc@labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(pgfcirc@labelcoor) + \pgfextra{\def\pgf@circ@labanctext{base}}%base + \else + \pgfextra{\def\pgf@circ@labanctext{north}}%north + \fi + \else + \ifnum \pgf@circ@labanc < 90 + % shift, as above + (pgfcirc@labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(pgfcirc@labelcoor) + \pgfextra{\def\pgf@circ@labanctext{base}}%base + \else + \ifnum \pgf@circ@labanc > 180 + % this shouldn't happen, but somehow it does (270 degree anchors) + % shift, as above + (pgfcirc@labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(pgfcirc@labelcoor) + \pgfextra{\def\pgf@circ@labanctext{base}}%base + \else + \pgfextra{\def\pgf@circ@labanctext{north}}%north + \fi + \fi + \fi + \fi\fi + \pgfextra{% + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix#1-direction\endcsname{0}% + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-#1-anchor\endcsname{\pgf@circ@labanctext}% + } + (pgfcirc@labelcoor) node[anchor=\pgf@circ@labanctext, + inner sep=0.5\pgf@circ@res@temp, outer sep=0pt, \circuitikzbasekey/bipole #1 style, + ](\ctikzvalof{bipole/name}#1){\strut\pgf@circ@finallabels{#1}% + } +} + +\def\pgf@circ@finallabels#1{% + \edef\pgf@temp{}% + \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/unit}}% + \ifx\pgf@temp\pgf@circ@temp% + \ctikzvalof{bipole/#1/name}% + \else% + $\SI{\ctikzvalof{bipole/#1/name}}{\ctikzvalof{bipole/#1/unit}}$% + \fi% +} + + +%%%% Stacked labels +% +% stacked labels by Romano Giannetti romano@rgtti.com +% heavily based on Claudo Fiandrinos's https://tex.stackexchange.com/a/65792/38080 +% \expandafter trick inspired by Matthew Leingang's https://tex.stackexchange.com/a/12272/38080 +% +% labels are in a tabular, globally aligned: +% vertically with key l2 valign (default c) +% c: center t: top b: bottom +% horizontally with key l2 align (default l) +% l: left c: centered r: right +% you can switch sides using l2_=... and l2^=... +% syntax is l2_ = line1 and line2 (same for l2^) +% +\ctikzset{% + l2 valign/.store in=\ltwo@valign, l2 valign=c, + l2 halign/.store in=\ltwo@halign, l2 halign=l, +} +\ctikzset{l2base/.code n args={2}{ + \pgfkeys{/tikz/circuitikz/bipole/label/name=% + \bgroup + \setlength{\tabcolsep}{2pt}% + \def\ltwo@tabu{\tabular[\ltwo@valign]}% + \expandafter\ltwo@tabu\expandafter{\ltwo@halign}% + #1\\ #2% + \endtabular + \egroup + }% + \ctikzsetvalof{bipole/label/unit}{} + \ifpgf@circ@siunitx + \pgf@circ@handleSI{#2} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp} + \else + \fi + \else + \fi +}} +\ctikzset{l2/.style args={#1 and #2}{ + l2base={#1}{#2}, + \circuitikzbasekey/bipole/label/position=90 } +} +\ctikzset{l2 above/.style args={#1 and #2}{ + l2base={#1}{#2}, + \circuitikzbasekey/bipole/label/position=90 } +} +\ctikzset{l2^/.style args={#1 and #2}{ + l2base={#1}{#2}, + \circuitikzbasekey/bipole/label/position=90 } +} +\ctikzset{l2 below/.style args={#1 and #2}{ + l2base={#1}{#2}, + \circuitikzbasekey/bipole/label/position=-90 } +} +\ctikzset{l2_/.style args={#1 and #2}{ + l2base={#1}{#2}, + \circuitikzbasekey/bipole/label/position=-90 } +} + +%%%---------- close: tex/pgfcirclabel +%%%%%%%%%%% Springe nach tex/pgfcircvoltage +%%%---------- open: tex/pgfcircvoltage.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Voltage management + +%% styles +\ctikzset{bipole voltage style/.style={}} +\tikzset{bipole voltage style/.code={ + \ctikzset{bipole voltage style/.style={#1}} +}} +\tikzset{bipole voltage append style/.code={ + \ctikzset{bipole voltage style/.append style={#1}} +}} + +\ctikzset{v^>/.style = { + v = #1, + \circuitikzbasekey/bipole/voltage/direction = forward, + \circuitikzbasekey/bipole/voltage/position = above + } +} + +\ctikzset{v^/.style = { + v = #1, + \circuitikzbasekey/bipole/voltage/direction = forward, + \circuitikzbasekey/bipole/voltage/position = below + } +} + +\ctikzset{v_/.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = forward} } +\ctikzset{v4 \ifnum\pgfcircmathresult <86 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north west} + \else + \def\pgf@circ@bipole@voltage@label@anchor{south east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{west} + \else + \def\pgf@circ@bipole@voltage@label@anchor{east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{south west} + \else \def\pgf@circ@bipole@voltage@label@anchor{north east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{south} + \else\def\pgf@circ@bipole@voltage@label@anchor{north} + \fi + \fi\fi + \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{south east} + \else\def\pgf@circ@bipole@voltage@label@anchor{north west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{east} + \else \def\pgf@circ@bipole@voltage@label@anchor{west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north east} + \else\def\pgf@circ@bipole@voltage@label@anchor{south west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >-1 \ifnum\pgfcircmathresult <5 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north} + \else\def\pgf@circ@bipole@voltage@label@anchor{south} + \fi + \fi\fi + \ifnum\pgfcircmathresult >355 \ifnum\pgfcircmathresult <361 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north} + \else\def\pgf@circ@bipole@voltage@label@anchor{south} + \fi + \fi\fi + + % export anchor position (if not needed, is always the same macro) + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Vlab-anchor\endcsname{\pgf@circ@bipole@voltage@label@anchor} + % this must be set *before* changing for mirroring and inverting; in that case + % the xscale/yscale parameters take it into account + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@where{-90} + \else + \def\pgf@circ@bipole@voltage@label@where{90} + \fi + + % magic to counteract the scale and yscale effects (there should be a better way...) + \ifnum \ctikzvalof{mirror value}=-1 + \ifpgf@circuit@bipole@voltage@below + \pgf@circuit@bipole@voltage@belowfalse + \else + \pgf@circuit@bipole@voltage@belowtrue + \fi + \fi + + \ifpgf@circuit@bipole@inverted + \ifpgf@circuit@bipole@voltage@below + \pgf@circuit@bipole@voltage@belowfalse + \else + \pgf@circuit@bipole@voltage@belowtrue + \fi + \fi + + % take into account scaling + \setscaledRlenforclass + + \ifpgf@circuit@europeanvoltage + \ifpgf@circuit@bipole@voltage@straight + % check for straight + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance} + \pgfkeysifdefined{\pgf@temp}{% + \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}}% + % \typeout{ST:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \stdist} + }{\edef\labeldist{\ctikzvalof{voltage/straight label distance}}} + \ifpgf@circ@debugv\edef\whichtypeshift{STR}\fi + \else + % check for european + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance} + \pgfkeysifdefined{\pgf@temp}{% + \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}}% + % \typeout{EU:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \eudist} + }{ \edef\labeldist{\ctikzvalof{voltage/european label distance}}} + \ifpgf@circ@debugv\edef\whichtypeshift{EUR}\fi + \fi + \else + % check for american + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance} + \pgfkeysifdefined{\pgf@temp}{% + \ifpgf@circuit@bipole@voltage@raised + % do not apply the shift if we are using raised american style + \edef\labeldist{1.4}% default value + \else + \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}}% + \fi + % \typeout{AL:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \aldist} + }{\edef\labeldist{\ctikzvalof{voltage/american label distance}}} + \ifpgf@circ@debugv\edef\whichtypeshift{AME}\fi + \fi + % find the height of the bipole or use a default value + \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height} + \pgfkeysifdefined{\pgf@temp} + {\pgfmathsetmacro{\partheightf}{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}} + \edef\partheight{\partheightf\pgf@circ@scaled@Rlen}} + {\edef\partheight{(.5\pgf@circ@scaled@Rlen)}} %fallback to fixed value + + \ifpgf@circuit@bipole@isvoltage + \pgfmathsetlength{\pgfcirc@labelshift}{(\labeldist-1.2)*\partheight} + \else + \pgfmathsetlength{\pgfcirc@labelshift}{(\labeldist-1.4)*\partheight} + \fi + % the value for the european was by default 1.4 + \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners! + % set the macro for detecting open + \edef\@@kind{\ctikzvalof{bipole/kind}}\edef\@@open{open} + \ifpgf@adjust@open@voltage\else\edef\@@open{this-will-nEver-match}\fi + % \typeout{KIND\space\@@kind} + }%end pgfextra + + \ifpgf@circuit@bipole@isvoltage + \pgf@circ@drawvoltagegenerator + % add fake cont1 and cont2 anchors for export + coordinate (\pgfcirc@a@prefix-Vcont1) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$) + coordinate (\pgfcirc@a@prefix-Vcont2) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$) + \else + \pgf@circ@drawvoltagegeneric + \fi + % % debugging + % \pgfextra{% + % \typeout{LABEL\space KIND:\@@kind\space EU:\the\pgfcirc@eushift\space AL:\the\pgfcirc@alshift\space + % DIRECTION:\pgf@circ@bipole@voltage@label@where} + % \pgf@circ@debugvtrue} + + % move a bit if requested + coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vlab) ! \pgfcirc@labelshift ! \pgf@circ@bipole@voltage@label@where :(pgfcirc@Vdir)$) + + % check for the case of american AND open + \ifpgf@circuit@europeanvoltage + \else + \ifx\@@kind\@@open + % override pgfcirc@Vlab + coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@Vfrom@flat)!0.5!(pgfcirc@Vto@flat)$)\fi + \fi + + \ifpgf@circ@debugv + node [odiamondpole, color=blue] at (\pgfcirc@a@prefix-Vlab) {} + node [odiamondpole, color=red] at (pgfcirc@Vdir) {} + node [overlay, red, font=\tiny, anchor=south east, align=right] at(pgfcirc@Vdir) + {\whichtypeshift:\the\pgfcirc@labelshift\\ DIR:\pgf@circ@bipole@voltage@label@where} + \fi + + % put the node only if it's not empty + \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else + node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt, + \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage) + at (\pgfcirc@a@prefix-Vlab) {\pgf@circ@finallabels{voltage/label}} + \fi + + \ifpgfcirc@v@curved\else + % fake Vcont1 and Vcont2 for when they are exported --- in the middle of Vto and Vfrom + coordinate (\pgfcirc@a@prefix-Vcont1) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$) + coordinate (\pgfcirc@a@prefix-Vcont2) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$) + \fi + % revert from and to (and c1 - c2) if needed (simpler than rework the positioning above...) + \ifpgf@circuit@bipole@voltage@backward + \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Vfrom}{\pgfcirc@a@prefix-Vto} + \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Vcont1}{\pgfcirc@a@prefix-Vcont2} + \fi + +}%end drawvoltages +%%%---------- close: tex/pgfcircvoltage +%%%%%%%%%%% Springe nach tex/pgfcirccurrent +%%%---------- open: tex/pgfcirccurrent.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Current handling + +%% styles +\ctikzset{bipole current style/.style={}} +\tikzset{bipole current style/.code={ + \ctikzset{bipole current style/.style={#1}} +}} +\tikzset{bipole current append style/.code={ + \ctikzset{bipole current style/.append style={#1}} +}} + +%% Options +\ctikzset{i^>/.style = { + i = #1, + \circuitikzbasekey/bipole/current/direction = forward, + \circuitikzbasekey/bipole/current/x position = after, + \circuitikzbasekey/bipole/current/y position = above + } +} + +\ctikzset{i_>/.style = { + i = #1, + \circuitikzbasekey/bipole/current/direction = forward, + \circuitikzbasekey/bipole/current/x position = after, + \circuitikzbasekey/bipole/current/y position = below + } +} + +\ctikzset{i>^/.style = { + i = #1, + \circuitikzbasekey/bipole/current/direction = forward, + \circuitikzbasekey/bipole/current/x position = before, + \circuitikzbasekey/bipole/current/y position = above + } +} + +\ctikzset{i>_/.style = { + i = #1, + \circuitikzbasekey/bipole/current/direction = forward, + \circuitikzbasekey/bipole/current/x position = before, + \circuitikzbasekey/bipole/current/y position = below + } +} + +\ctikzset{i^/.style = {i = #1, \circuitikzbasekey/bipole/current/direction = forward } } +\ctikzset{i^/.style = { i= #1, \circuitikzbasekey/bipole/current/y position = above } } + +%% Output routine +\def\pgf@circ@drawcurrent{ + \pgfextra{ + \edef\pgf@circ@rounded@dir{\pgf@circ@direction} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@rounded@dir\pgf@nil} + + \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north} + \fi + \fi\fi + \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west} + \fi + \fi\fi + \ifnum\pgfcircmathresult <5 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} + \fi + \fi + \ifnum\pgfcircmathresult >355 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} + \fi + \fi + % export anchor position (if not needed, is always the same macro) + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Ilab-anchor\endcsname{\pgf@circ@dir} + + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@bipole@current@label@where{-90} + \else + \def\pgf@circ@bipole@current@label@where{+90} + \fi + } + + % + \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}} + \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line + coordinate (\pgfcirc@a@prefix-Ifrom) at (\tikztostart) + coordinate (\pgfcirc@a@prefix-Ito) at (\tikztotarget) + \else% normal bipole or source + \ifpgf@circuit@bipole@current@before + coordinate (\pgfcirc@a@prefix-Ifrom) at (\tikztostart) + coordinate (\pgfcirc@a@prefix-Ito) at (pgfcirc@anchorstartnode) + \else + coordinate (\pgfcirc@a@prefix-Ifrom) at (pgfcirc@anchorendnode) + coordinate (\pgfcirc@a@prefix-Ito) at (\tikztotarget) + \fi + \fi + \ifpgf@circuit@bipole@current@backward + \pgfextra{ + \pgfmathsubtract{\pgf@circ@rounded@dir}{180} + \edef\pgf@circ@rounded@dir{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + } + \fi + coordinate (\pgfcirc@a@prefix-Ipos) at ($(\pgfcirc@a@prefix-Ifrom)! \ctikzvalof{current/distance} !(\pgfcirc@a@prefix-Ito)$) + % if the current label is not empty (in which case we have already all the anchors) + \pgf@circ@ifkeyempty{bipole/current/label/name}\else + % put the arrow node + node[currarrow, rotate=\pgf@circ@rounded@dir, anchor=center](Iarrow) at (\pgfcirc@a@prefix-Ipos) {} + % put the label + node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole current style] + (\ctikzvalof{bipole/name}current) + at (Iarrow.\pgf@circ@bipole@current@label@where){\pgf@circ@finallabels{current/label}} + \fi % end ifempty + \ifpgf@circuit@bipole@current@backward + \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Ifrom}{\pgfcirc@a@prefix-Ito} + \fi +} + +%%%---------- close: tex/pgfcirccurrent +%%%%%%%%%%% Springe nach tex/pgfcircflow +%%%---------- open: tex/pgfcircflow.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% flow handling + + +%% styles +\ctikzset{bipole flow style/.style={}} +\tikzset{bipole flow style/.code={ + \ctikzset{bipole flow style/.style={#1}} +}} +\tikzset{bipole flow append style/.code={ + \ctikzset{bipole flow style/.append style={#1}} +}} + +%% Options +\ctikzset{f^>/.style = { + f = #1, + \circuitikzbasekey/bipole/flow/direction = forward, + \circuitikzbasekey/bipole/flow/x position = after, + \circuitikzbasekey/bipole/flow/y position = above + } +} + +\ctikzset{f_>/.style = { + f = #1, + \circuitikzbasekey/bipole/flow/direction = forward, + \circuitikzbasekey/bipole/flow/x position = after, + \circuitikzbasekey/bipole/flow/y position = below + } +} + +\ctikzset{f>^/.style = { + f = #1, + \circuitikzbasekey/bipole/flow/direction = forward, + \circuitikzbasekey/bipole/flow/x position = before, + \circuitikzbasekey/bipole/flow/y position = above + } +} + +\ctikzset{f>_/.style = { + f = #1, + \circuitikzbasekey/bipole/flow/direction = forward, + \circuitikzbasekey/bipole/flow/x position = before, + \circuitikzbasekey/bipole/flow/y position = below + } +} + +\ctikzset{f^/.style = { f = #1, \circuitikzbasekey/bipole/flow/direction = forward } } +\ctikzset{f^/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = above } } + +\ctikzset{f/.code = { + \pgfcirc@has@ftrue + \pgfkeys{\circuitikzbasekey/bipole/flow/direction = forward, + \circuitikzbasekey/bipole/flow/x position = after, + \circuitikzbasekey/bipole/flow/y position = above } + \pgfkeys{/tikz/circuitikz/bipole/flow/label/name=#1} + \ctikzsetvalof{bipole/flow/label/unit}{} + \ifpgf@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/unit}{\pgf@temp} + \else + \fi + \else + \fi +} +} + +%% Output routine + +\def\pgf@circ@drawflow{ + \pgfextra{ + \edef\pgf@circ@rounded@dir{\pgf@circ@direction} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@rounded@dir\pgf@nil} + + \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north} + \fi + \fi\fi + \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west} + \fi + \fi\fi + \ifnum\pgfcircmathresult <5 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} + \fi + \fi + \ifnum\pgfcircmathresult >355 + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} + \fi + \fi + + \ifpgf@circuit@bipole@flow@below + \def\pgf@circ@bipole@flow@label@where{-90} + \else + \def\pgf@circ@bipole@flow@label@where{+90} + \fi + % export anchor position (if not needed, is always the same macro) + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Flab-anchor\endcsname{\pgf@circ@dir} + } + + \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}} + \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line + coordinate (pgfcirc@Ffrom@flat) at (\tikztostart) + coordinate (pgfcirc@Fto@flat) at (\tikztotarget) + \else% normal bipole or source + \ifpgf@circuit@bipole@flow@before + coordinate (pgfcirc@Ffrom@flat) at (\tikztostart) + coordinate (pgfcirc@Fto@flat) at (pgfcirc@anchorstartnode) + \else + coordinate (pgfcirc@Ffrom@flat) at (pgfcirc@anchorendnode) + coordinate (pgfcirc@Fto@flat) at (\tikztotarget) + \fi + \fi + \pgfextra{ + \newdimen{\absfshift} + \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen} + \absfshift=\flow@offset + \ifpgf@circuit@bipole@flow@backward + \pgfmathsubtract{\pgf@circ@rounded@dir}{180} + \edef\pgf@circ@rounded@dir{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil} + \fi + } + \ifpgf@circuit@bipole@flow@below + coordinate (pgfcirc@Ffrom@up) at ($(pgfcirc@Ffrom@flat) ! \absfshift !-90: (pgfcirc@Fto@flat)$) + coordinate (pgfcirc@Fto@up) at ($(pgfcirc@Fto@flat) ! \absfshift !90: (pgfcirc@Ffrom@flat)$) + \else + coordinate (pgfcirc@Ffrom@up) at ($(pgfcirc@Ffrom@flat) ! \absfshift !90: (pgfcirc@Fto@flat)$) + coordinate (pgfcirc@Fto@up) at ($(pgfcirc@Fto@flat) ! \absfshift !-90: (pgfcirc@Ffrom@flat)$) + \fi + coordinate (\pgfcirc@a@prefix-Fpos) at ($(pgfcirc@Ffrom@up) ! \ctikzvalof{flow/distance} !(pgfcirc@Fto@up)$) + \pgfextra{ + \absfshift=0.25\pgf@circ@Rlen% This is half size of the "flowarrow" shape! + } + coordinate (\pgfcirc@a@prefix-Ffrom) at ($(\pgfcirc@a@prefix-Fpos)!\absfshift!(pgfcirc@Ffrom@up)$) + coordinate (\pgfcirc@a@prefix-Fto) at ($(\pgfcirc@a@prefix-Fpos)!\absfshift!(pgfcirc@Fto@up) $) + % + % coordinate (\pgfcirc@a@prefix-Fpos) at + % ([yshift=\flow@offset]$(\pgfcirc@a@prefix-Ffrom)! \ctikzvalof{flow/distance} !(\pgfcirc@a@prefix-Fto)$) + % if the flow label is not empty (in which case we have already all the anchors) + \pgf@circ@ifkeyempty{bipole/flow/label/name}\else + % the flow arrow is really a node "flowarrow", not a real arrow + node[flowarrow, rotate=\pgf@circ@rounded@dir, anchor=center](Farrowpos) at (\pgfcirc@a@prefix-Fpos) {} + + node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole flow style] + (\ctikzvalof{bipole/name}flow) at (Farrowpos.\pgf@circ@bipole@flow@label@where) {\pgf@circ@finallabels{flow/label}} + \fi + + % adjust from and to before exporting --- it's much more simple like this then rework the algorithm above + \ifpgf@circuit@bipole@flow@backward + \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Ffrom}{\pgfcirc@a@prefix-Fto} + \fi + +} + +%%%---------- close: tex/pgfcircflow + +% defaults + +\setupmodule + [current=european, + voltage=european, + resistor=american, + inductor=cute, + logic=american, + siunitx=true, + arrowmos=false] + +\processaction + [\currentmoduleparameter{voltage}] + [european=>\ctikzset{voltage=european}, + american=>\ctikzset{voltage=american}] + +\processaction + [\currentmoduleparameter{current}] + [european=>\ctikzset{ current=european}, + american=>\ctikzset{ current=american}] + +\processaction + [\currentmoduleparameter{label}] + [straight=>\ctikzset{label/align = straight}, + align=>\ctikzset{label/align = rotate}, + smart=>\ctikzset{label/align = smart}] + +\processaction + [\currentmoduleparameter{resistor}] + [european=>\ctikzset{ resistor=european}, + american=>\ctikzset{ resistor=american}] + +\processaction + [\currentmoduleparameter{inductor}] + [european=>\ctikzset{ inductor=european}, + american=>\ctikzset{ inductor=american}, + cute=>\ctikzset{ inductor=cute}] + +\processaction + [\currentmoduleparameter{diode}] + [full=>\ctikzset{ diode=full}, + empty=>\ctikzset{ diode=empty}] + +\processaction + [\currentmoduleparameter{logic}] + [european=>\ctikzset{ logic ports=european}, + american=>\ctikzset{ logic ports=american}] + +\processaction + [\currentmoduleparameter{siunitx}] + [true=>\def\SI#1#2{#1\,#2} + \def\ampere{\rm{A}} + \def\volt{\rm{V}} + \def\ohm{\Omega} + \def\siemens{\rm{S}} + \def\farad{\rm{F}} + \def\henry{\rm{H}} + \def\second{\rm{s}} + \def\coulomb{\rm{C}} + \def\siemens{\rm{S}} + \def\radians{\rm{rad}} + \def\milli{\rm{m}} + \def\micro{\mu} + \def\nano{\rm{n}} + \def\pico{\rm{p}} + \def\kilo{\rm{k}} + \def\mega{\rm{M}} + \def\giga{\rm{G}} + \def\tera{\rm{T}}, + false=>] +% \s!default=>\pgf@circ@siunitxtrue, + +\processaction + [\currentmoduleparameter{arrowmos}] + [true=>\pgf@circuit@mos@arrowstrue, + false=>\pgf@circuit@mos@arrowsfalse] +% \s!default=>\pgf@circuit@mos@arrowstrue, + + +\ifpgf@circ@siunitx + % nothing! siunitx and xstrings don't work in context +\fi + + +% Context specific + +\ctikzset{tripoles/op amp/font/.initial=\switchtobodyfont[small]} + +%%%%%%%%%%% Springe nach tex/pgfcircpath +%%%---------- open: tex/pgfcircpath.tex +% Copyright 2018-2020 by Romano Giannetti +% Copyright 2015-2020 by Stefan Lindner +% Copyright 2013-2020 by Stefan Erhardt +% Copyright 2007-2020 by Massimo Redaelli +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. + + +\def\pgf@circ@direction{0.0} + +% swap two coordinates +\def\pgfcirc@swap@coordinates#1#2{% + coordinate (pgfcirc@tmp@swap) at (#1) + coordinate (#1) at (#2) + coordinate (#2) at (pgfcirc@tmp@swap) +} + +% Names +\ctikzset{name/.style = { n=#1 } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@ +\ctikzset{n/.code = { + \pgfkeys{/tikz/circuitikz/bipole/name=#1} +}} + +% Reflect the node along +\ctikzset{mirrored/.is choice} +\ctikzset{mirror value/.initial=1} +\ctikzset{mirrored/true/.code = {\ctikzsetvalof{mirror value}{-1}} } +\ctikzset{mirrored/false/.code = {\ctikzsetvalof{mirror value}{1}} } +\ctikzset{mirror/.style = {/tikz/circuitikz/mirrored=true}} + +% Invert node along path +\ctikzset{inverted/.is choice} +\ctikzset{invert value/.initial=1} +\ctikzset{inverted/true/.code = {\ctikzsetvalof{invert value}{-1}\pgf@circuit@bipole@invertedtrue}} +\ctikzset{inverted/false/.code = {\ctikzsetvalof{invert value}{1}\pgf@circuit@bipole@invertedfalse}} +\ctikzset{invert/.style = {/tikz/circuitikz/inverted=true}} +\newif\ifpgf@circuit@bipole@inverted +\ctikzset{bipole/inverted/.is if=pgf@circuit@bipole@inverted} + +\newif\ifpgf@circuit@bipole@voltage@backward +\ctikzset{bipole/voltage/direction/.is choice} +\ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}} +\ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}} + +% Initialize paths +\def\pgfcircresetpath{ + \ctikzset{bipole/name=, bipole/label/name=, bipole/label/position=90, ,bipole/annotation/name=, bipole/annotation/position=-90, + bipole/inverted=false, bipole/kind=, + bipole/voltage/direction=backward, bipole/voltage/label/name=, bipole/voltage/position=below, + bipole/nodes/left=none, bipole/nodes/right=none, bipole/is voltage=false,bipole/is voltageoutsideofsymbol=false,bipole/is strokedsymbol=false, + bipole/is current=false, bipole/current/label/name=, bipole/current/x position=after, + bipole/current/y position=above, bipole/current/direction=forward, + mirrored=false + } +} + +% +% expandable IF for the extra nodes (thanks to Henri Menke) +% see https://chat.stackexchange.com/transcript/message/56560808#56560808 +% +\def\pgfcirc@if@has@i{% + \ifpgfcirc@has@i + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi} +\def\pgfcirc@if@has@v{% + \ifpgfcirc@has@v + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi} +\def\pgfcirc@if@has@f{% + \ifpgfcirc@has@f + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi} + + + +%% Generic bipole path +\def\pgf@circ@bipole@path#1#2{ + % Create a bipole path from the shapes defined with \pgfcircdeclarebipole + % or \pgfcircdeclarebipolescaled; the node shapes are named with a "shape" + % appended to the main (path-style) name + % #1 path-style node name + % #2 the argument passed from the to-path structure; don't touch + % + % Example: + % \def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}} + % + \pgf@circ@bipole@path@base{shape}{}{#1}{#2} +} +% +% this is used for components that are mainly node-style but have a path-style form +% +\def\pgfcirc@node@to@path#1#2#3{% + % add a path-style component based on a node-style one without mangling the name + % of the shape. + % #1: node-type shape name (existing) + % #2: path-type name (to be created) + % #3: additional options to add to the path style + % + \expandafter\def\csname pgf@circ@#1@path\endcsname##1{\pgf@circ@bipole@path@base{}{##1}{#1}{}}% + \compattikzset{#2/.style = {\circuitikzbasekey, + /tikz/to path=\csname pgf@circ@#1@path\endcsname{##1}, + #3}}% + \ctikzset{bipoles/#1/height/.initial=1}% +} +%% +%% ultra-generic bipole path +%% I am not sure what the last argument is needed for, but don't touch it or everything explodes +%% +\def\pgf@circ@bipole@path@base#1#2#3#4{% + % + % Create a path-style component based on a node-style shape + % #1: postfix to be added to the name path to obtain the main shape name + % #2: text to be passed as text to the node + % #3: name of the bipole component + % #4: this will be filled by the argument of the to-path + % + \pgfextra{ + \ctikzset{bipole/kind = #3} + \edef\pgf@temp{\ctikzvalof{bipole/name}} + \def\pgf@circ@temp{} + \ifx\pgf@temp\pgf@circ@temp % if it has not a name + \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999} + \ctikzset{bipole/name = pgfcirc@#3\pgf@circ@rand} % create it (re-usage should not create problem, but...) + \edef\pgfcirc@a@prefix{pgfcirc}% do not pollute the namespace for nothing + \else + \edef\pgfcirc@a@prefix{\ctikzvalof{bipole/name}}% for exporting v-i-f anchors + \fi + } + % save start and stop values + % notice that we DO NOT MOVE the path position at all! + coordinate (\ctikzvalof{bipole/name}start) at (\tikztostart) + coordinate (\ctikzvalof{bipole/name}end) at (\tikztotarget) + \pgfextra{ + % find the direction (angle) of the path + \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}} + {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}} + \edef\pgf@circ@direction{\pgfmathresult} + \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-direction\endcsname{\pgf@circ@direction} + } + % position the component in the middle of the path. We DO NOT MOVE the current position! + node[#3#1, rotate=\pgf@circ@direction, yscale=\ctikzvalof{mirror value}, + xscale=\ctikzvalof{invert value}] (\ctikzvalof{bipole/name}) + at ($(\tikztostart) ! .5 ! (\tikztotarget)$) {#2} + % set start and end labels + \ifpgf@circuit@bipole@inverted + \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them! + coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.pathend) + coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.pathstart) + \else + coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.right) + coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.left) + \fi + \else + \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them! + coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.pathstart) + coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.pathend) + \else + coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.left) + coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.right) + \fi + \fi + % draw the leads unless it's an open circuit + % stop at the component + \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}} + \ifx\pgf@temp\pgf@circ@temp % if it is an open do nothing + \else + % it is important to start the path with -- to have correct line joins! + -- (\tikztostart) -- (pgfcirc@anchorstartnode) + \fi + % Add all the "ornaments": labels, annotations, voltages, currents and flows + \drawpoles + \pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabels{label}\fi + \pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi + % the following must be made in their own path scope to avoid crash in TikZ 3.1.8/3.1.8a + % it should be logically safe for older version too --- even if TikZ reverted the change + % use explandable ifs too, thanks to Henri Menke + {\pgfcirc@if@has@v{\pgf@circ@drawvoltage}{}}% + {\pgfcirc@if@has@i{\pgf@circ@drawcurrent}{}}% + {\pgfcirc@if@has@f{\pgf@circ@drawflow}{}}% + % finish the path from the component to the final target + % you never know --- re-set \pgf@temp to detect open + \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}} + \ifx\pgf@temp\pgf@circ@temp % if it is an open do nothing + (\tikztotarget) + \else + (pgfcirc@anchorendnode) -- (\tikztotarget) + \fi + % reset internal circuit keys + \pgfextra{\pgfcircresetpath} + %draw pending nodes an path + \tikztonodes +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Handling of terminals + +\ctikzset{bipole/nodes/.is family} +\ctikzset{bipole/nodes/left/.initial=none} +\ctikzset{bipole/nodes/right/.initial=none} +\tikzset{bipole nodes/.style n args={2}{% + \circuitikzbasekey/bipole/nodes/left=#1, + \circuitikzbasekey/bipole/nodes/right=#2 + } +} + +%% Easily usable styles + +\ctikzset{o-o/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=ocirc}} +\ctikzset{-o/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=ocirc}} +\ctikzset{o-/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=none}} +\ctikzset{*-o/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=ocirc}} +\ctikzset{o-*/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=circ}} +\ctikzset{d-o/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=ocirc}} +\ctikzset{o-d/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=diamondpole}} +\ctikzset{*-/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=none}} +\ctikzset{-*/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=circ}} +\ctikzset{d-/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=none}} +\ctikzset{-d/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=diamondpole}} +\ctikzset{*-*/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=circ}} +\ctikzset{d-*/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=circ}} +\ctikzset{*-d/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=diamondpole}} +\ctikzset{d-d/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=diamondpole}} + +% rectjoinfill workarounds + +\ctikzset{.-/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=none}} +\ctikzset{.-*/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=circ}} +\ctikzset{.-o/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=ocirc}} +\ctikzset{.-d/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=diamondpole}} +\ctikzset{-./.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}} +\ctikzset{o-./.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}} +\ctikzset{*-./.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}} +\ctikzset{d-./.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}} +\ctikzset{.-./.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}} + +\tikzset{reversed/.style = {\circuitikzbasekey/bipole/inverted=true}} + +\def\drawpoles{ + \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{none}} + \ifx\pgf@temp\pgf@circ@temp\else(\tikztostart) node[\pgf@circ@temp] {}\fi + \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} } + \ifx\pgf@temp\pgf@circ@temp\else(\tikztotarget) node[\pgf@circ@temp] {}\fi +} + +%% Path definitions +\def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi} +\def\pgf@circ@vresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{tgeneric}{#1}\else\pgf@circ@bipole@path{vresistor}{#1}\fi} +\def\pgf@circ@sresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{thermistor}{#1}\else\pgf@circ@bipole@path{resistivesens}{#1}\fi} +\def\pgf@circ@potentiometer@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{genericpotentiometer}{#1}\else\pgf@circ@bipole@path{potentiometer}{#1}\fi} +\def\pgf@circ@thermistor@path#1{\pgf@circ@bipole@path{thermistor}{#1}} +\def\pgf@circ@thermistorptc@path#1{\pgf@circ@bipole@path{thermistorptc}{#1}} +\def\pgf@circ@thermistorntc@path#1{\pgf@circ@bipole@path{thermistorntc}{#1}} +\def\pgf@circ@varistor@path#1{\pgf@circ@bipole@path{varistor}{#1}} +\def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}} +\def\pgf@circ@capacitivesens@path#1{\pgf@circ@bipole@path{capacitivesens}{#1}} +\def\pgf@circ@ecapacitor@path#1{\pgf@circ@bipole@path{ecapacitor}{#1}} +%% polar capacitor is deprectaed, use curved capacitor instead +\def\pgf@circ@polarcapacitor@path#1{\pgf@circ@bipole@path{polarcapacitor}{#1}} +\def\pgf@circ@ccapacitor@path#1{\pgf@circ@bipole@path{ccapacitor}{#1}} +\def\pgf@circ@vcapacitor@path#1{\pgf@circ@bipole@path{vcapacitor}{#1}} +\def\pgf@circ@piezoelectric@path#1{\pgf@circ@bipole@path{piezoelectric}{#1}} +\def\pgf@circ@battery@path#1{\pgf@circ@bipole@path{battery}{#1}} +\def\pgf@circ@batteryone@path#1{\pgf@circ@bipole@path{battery1}{#1}} +\def\pgf@circ@batterytwo@path#1{\pgf@circ@bipole@path{battery2}{#1}} +\def\pgf@circ@europeaninductor@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}} +\def\pgf@circ@americaninductor@path#1{\pgf@circ@bipole@path{americaninductor}{#1}} +\def\pgf@circ@cuteinductor@path#1{\pgf@circ@bipole@path{cuteinductor}{#1}} +\def\pgf@circ@cutechoke@path#1{\pgf@circ@bipole@path{cutechoke}{#1}} +\def\pgf@circ@inductor@path#1{% + \pgfextra{ + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + } + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@europeaninductor@path{#1}% + \else% + \pgfextra{ \def\pgf@temp{cute} }% + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@cuteinductor@path{#1}% + \else% + \pgf@circ@americaninductor@path{#1}% + \fi% + \fi% +} +\def\pgf@circ@vinductor@path#1{ + \pgfextra{ + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + } + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@veuropeaninductor@path{#1}% + \else% + \pgfextra{ \def\pgf@temp{cute} }% + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@vcuteinductor@path{#1}% + \else% + \pgf@circ@vamericaninductor@path{#1}% + \fi% + \fi% +} +\def\pgf@circ@inductivesens@path#1{% + \pgfextra{ + \edef\pgf@circ@temp{\ctikzvalof{inductor}}% + \def\pgf@temp{european}% + } + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@europeaninductivesens@path{#1}% + \else% + \pgfextra{ \def\pgf@temp{cute} }% + \ifx\pgf@temp\pgf@circ@temp% + \pgf@circ@cuteinductivesens@path{#1}% + \else% + \pgf@circ@americaninductivesens@path{#1}% + \fi% + \fi% +} +\def\pgf@circ@veuropeaninductor@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}} +\def\pgf@circ@vamericaninductor@path#1{\pgf@circ@bipole@path{vamericaninductor}{#1}} +\def\pgf@circ@vcuteinductor@path#1{\pgf@circ@bipole@path{vcuteinductor}{#1}} +\def\pgf@circ@europeaninductivesens@path#1{\pgf@circ@bipole@path{sfullgeneric}{#1}} +\def\pgf@circ@americaninductivesens@path#1{\pgf@circ@bipole@path{samericaninductor}{#1}} +\def\pgf@circ@cuteinductivesens@path#1{\pgf@circ@bipole@path{scuteinductor}{#1}} +\def\pgf@circ@lamp@path#1{\pgf@circ@bipole@path{lamp}{#1}} +\def\pgf@circ@bulb@path#1{\pgf@circ@bipole@path{bulb}{#1}} +\def\pgf@circ@esource@path#1{\pgf@circ@bipole@path{esource}{#1}} +\def\pgf@circ@pvsource@path#1{\pgf@circ@bipole@path{pvsource}{#1}} +\def\pgf@circ@vsource@path#1{\pgf@circ@bipole@path{vsource}{#1}} +\def\pgf@circ@dcvsource@path#1{\pgf@circ@bipole@path{dcvsource}{#1}} +\def\pgf@circ@vsourceam@path#1{\pgf@circ@bipole@path{vsourceAM}{#1}} +\def\pgf@circ@vsourcesin@path#1{\pgf@circ@bipole@path{vsourcesin}{#1}} +\def\pgf@circ@isource@path#1{\pgf@circ@bipole@path{isource}{#1}} +\def\pgf@circ@oosource@path#1{\pgf@circ@bipole@path{oosource}{#1}} +\def\pgf@circ@oosourcetrans@path#1{\pgf@circ@bipole@path{oosourcetrans}{#1}} +\def\pgf@circ@ooosource@path#1{\pgf@circ@bipole@path{ooosource}{#1}} +\def\pgf@circ@dcisource@path#1{\pgf@circ@bipole@path{dcisource}{#1}} +\def\pgf@circ@isourcesin@path#1{\pgf@circ@bipole@path{isourcesin}{#1}} +\def\pgf@circ@vsourcesquare@path#1{\pgf@circ@bipole@path{vsourcesquare}{#1}} +\def\pgf@circ@vsourcetri@path#1{\pgf@circ@bipole@path{vsourcetri}{#1}} +\def\pgf@circ@isourceam@path#1{\pgf@circ@bipole@path{isourceAM}{#1}} +\def\pgf@circ@ecsource@path#1{\pgf@circ@bipole@path{ecsource}{#1}} +\def\pgf@circ@cvsource@path#1{\pgf@circ@bipole@path{cvsource}{#1}} +\def\pgf@circ@cvsourceam@path#1{\pgf@circ@bipole@path{cvsourceAM}{#1}} +\def\pgf@circ@cvsourcesin@path#1{\pgf@circ@bipole@path{cvsourcesin}{#1}} +\def\pgf@circ@cisource@path#1{\pgf@circ@bipole@path{cisource}{#1}} +\def\pgf@circ@cisourceam@path#1{\pgf@circ@bipole@path{cisourceAM}{#1}} +\def\pgf@circ@cisourcesin@path#1{\pgf@circ@bipole@path{cisourcesin}{#1}} +\def\pgf@circ@short@path#1{\pgf@circ@bipole@path{short}{#1}} +\def\pgf@circ@cspst@path#1{\pgf@circ@bipole@path{cspst}{#1}} +\def\pgf@circ@ospst@path#1{\pgf@circ@bipole@path{ospst}{#1}} +\def\pgf@circ@nos@path#1{\pgf@circ@bipole@path{nos}{#1}} +\def\pgf@circ@ncs@path#1{\pgf@circ@bipole@path{ncs}{#1}} +\def\pgf@circ@pushbutton@path#1{\pgf@circ@bipole@path{pushbutton}{#1}} +\def\pgf@circ@ncpushbutton@path#1{\pgf@circ@bipole@path{ncpushbutton}{#1}} +\def\pgf@circ@pushbuttonc@path#1{\pgf@circ@bipole@path{pushbuttonc}{#1}} +\def\pgf@circ@ncpushbuttono@path#1{\pgf@circ@bipole@path{ncpushbuttono}{#1}} +\def\pgf@circ@open@path#1{\pgf@circ@bipole@path{open}{#1}} +\def\pgf@circ@generic@path#1{\pgf@circ@bipole@path{generic}{#1}} +\def\pgf@circ@ageneric@path#1{\pgf@circ@bipole@path{ageneric}{#1}} +\def\pgf@circ@tgeneric@path#1{\pgf@circ@bipole@path{tgeneric}{#1}} +\def\pgf@circ@xgeneric@path#1{\pgf@circ@bipole@path{xgeneric}{#1}} +\def\pgf@circ@fullgeneric@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}} +\def\pgf@circ@tfullgeneric@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}} +\def\pgf@circ@ammeter@path#1{\pgf@circ@bipole@path{ammeter}{#1}} +\def\pgf@circ@ohmmeter@path#1{\pgf@circ@bipole@path{ohmmeter}{#1}} +\def\pgf@circ@voltmeter@path#1{\pgf@circ@bipole@path{voltmeter}{#1}} +\def\pgf@circ@oscope@path#1{\pgf@circ@bipole@path{oscope}{#1}} +\def\pgf@circ@empty@path#1{} +\def\pgf@circ@photoresistor@path#1{\pgf@circ@bipole@path{photoresistor}{#1}} +\def\pgf@circ@emptythyristor@path#1{\pgf@circ@bipole@path{emptythyristor}{#1}} +\def\pgf@circ@fullthyristor@path#1{\pgf@circ@bipole@path{fullthyristor}{#1}} +\def\pgf@circ@toggleswitch@path#1{\pgf@circ@bipole@path{toggleswitch}{#1}} +\def\pgf@circ@memristor@path#1{\pgf@circ@bipole@path{memristor}{#1}} +\def\pgf@circ@emptytriac@path#1{\pgf@circ@bipole@path{emptytriac}{#1}} +\def\pgf@circ@fulltriac@path#1{\pgf@circ@bipole@path{fulltriac}{#1}} +\def\pgf@circ@tline@path#1{\pgf@circ@bipole@path{tline}{#1}} +\def\pgf@circ@mstline@path#1{\pgf@circ@bipole@path{mstline}{#1}} +\def\pgf@circ@squid@path#1{\pgf@circ@bipole@path{squid}{#1}} +\def\pgf@circ@barrier@path#1{\pgf@circ@bipole@path{barrier}{#1}} +\def\pgf@circ@openbarrier@path#1{\pgf@circ@bipole@path{openbarrier}{#1}} +\def\pgf@circ@thermocouple@path#1{\pgf@circ@bipole@path{thermocouple}{#1}} +\def\pgf@circ@fuse@path#1{\pgf@circ@bipole@path{fuse}{#1}} +\def\pgf@circ@afuse@path#1{\pgf@circ@bipole@path{afuse}{#1}} + +\def\pgf@circ@gfsurgearrester@path#1{\ifpgf@circuit@europeangfsurgearrester\pgf@circ@europeangfsurgearrester@path{#1}\else\pgf@circ@americangfsurgearrester@path{#1}\fi} +\def\pgf@circ@europeangfsurgearrester@path#1{\pgf@circ@bipole@path{european gas filled surge arrester}{#1}} +\def\pgf@circ@americangfsurgearrester@path#1{\pgf@circ@bipole@path{american gas filled surge arrester}{#1}} + +\def\pgf@circ@twoport@path#1{\pgf@circ@bipole@path{twoport}{#1}} +\def\pgf@circ@twoportsplit@path#1{\pgf@circ@bipole@path{twoportsplit}{#1}} +\def\pgf@circ@vco@path#1{\pgf@circ@bipole@path{vco}{#1}} +\def\pgf@circ@bandpass@path#1{\pgf@circ@bipole@path{bandpass}{#1}} +\def\pgf@circ@bandstop@path#1{\pgf@circ@bipole@path{bandstop}{#1}} +\def\pgf@circ@highpass@path#1{\pgf@circ@bipole@path{highpass}{#1}} +\def\pgf@circ@lowpass@path#1{\pgf@circ@bipole@path{lowpass}{#1}} +\def\pgf@circ@allpass@path#1{\pgf@circ@bipole@path{allpass}{#1}} +\def\pgf@circ@adc@path#1{\pgf@circ@bipole@path{adc}{#1}} +\def\pgf@circ@dac@path#1{\pgf@circ@bipole@path{dac}{#1}} +\def\pgf@circ@dsp@path#1{\pgf@circ@bipole@path{dsp}{#1}} +\def\pgf@circ@fft@path#1{\pgf@circ@bipole@path{fft}{#1}} +\def\pgf@circ@amp@path#1{\pgf@circ@bipole@path{amp}{#1}} +\def\pgf@circ@vamp@path#1{\pgf@circ@bipole@path{vamp}{#1}} +\def\pgf@circ@piattenuator@path#1{\pgf@circ@bipole@path{piattenuator}{#1}} +\def\pgf@circ@vpiattenuator@path#1{\pgf@circ@bipole@path{vpiattenuator}{#1}} +\def\pgf@circ@tattenuator@path#1{\pgf@circ@bipole@path{tattenuator}{#1}} +\def\pgf@circ@vtattenuator@path#1{\pgf@circ@bipole@path{vtattenuator}{#1}} +\def\pgf@circ@phaseshifter@path#1{\pgf@circ@bipole@path{phaseshifter}{#1}} +\def\pgf@circ@vphaseshifter@path#1{\pgf@circ@bipole@path{vphaseshifter}{#1}} +\def\pgf@circ@detector@path#1{\pgf@circ@bipole@path{detector}{#1}} +% +\def\pgf@circ@sacdc@path#1{\pgf@circ@bipole@path{sacdc}{#1}} +\def\pgf@circ@sdcac@path#1{\pgf@circ@bipole@path{sdcac}{#1}} +\def\pgf@circ@tacdc@path#1{\pgf@circ@bipole@path{tacdc}{#1}} +\def\pgf@circ@tdcac@path#1{\pgf@circ@bipole@path{tdcac}{#1}} + +%%Mechanical +\def\pgf@circ@spring@path#1{\pgf@circ@bipole@path{spring}{#1}} +\def\pgf@circ@inerter@path#1{\pgf@circ@bipole@path{inerter}{#1}} +\def\pgf@circ@mass@path#1{\pgf@circ@bipole@path{mass}{#1}} +\def\pgf@circ@damper@path#1{\pgf@circ@bipole@path{damper}{#1}} +\def\pgf@circ@viscoe@path#1{\pgf@circ@bipole@path{viscoe}{#1}} + +%% Styles + +\def\comnpatname{\ifpgf@circuit@compat *\else\fi} +\def\compattikzset#1{% + % \typeout{BIPOLEDEF:\space \detokenize{#1}}% + \tikzset{\comnpatname#1}} + +%\def\ctikzsetbipole#1#2{% +% \tikzset{#1/.style= {to path=#2, \circuitikzbasekey, l=##1}}% +%} + +\compattikzset{spring/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@spring@path, l=#1}} +\compattikzset{inerter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inerter@path, l=#1}} +\compattikzset{mass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mass@path, l=#1}} +\compattikzset{damper/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@damper@path, l=#1}} +\compattikzset{viscoe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@viscoe@path, l=#1}} +\compattikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l=#1}} +\compattikzset{american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{resistor}{#1}, l=#1}} +\compattikzset{european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{generic}{#1}, l=#1}} +\compattikzset{potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@potentiometer@path, l=#1}} +\compattikzset{varistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@varistor@path, l=#1}} +\compattikzset{photoresistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@photoresistor@path, l=#1}} +\compattikzset{thermistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistor@path, l=#1}} +\compattikzset{thermistor ptc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorptc@path, l=#1}} +\compattikzset{thermistor ntc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}} +\compattikzset{american potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{potentiometer}{#1}, l=#1}} +\compattikzset{european potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{genericpotentiometer}{#1}, l=#1}} +\compattikzset{variable resistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vresistor@path, l=#1}} +\compattikzset{variable american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{vresistor}{#1}, l=#1}} +\compattikzset{variable european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{tgeneric}{#1}, l=#1}} +\compattikzset{capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitor@path, l=#1}} +\compattikzset{elko/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}} +\compattikzset{ecapacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}} +% polar capacitor is deprecated, use curved capacitor instead +\compattikzset{polar capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@polarcapacitor@path, l=#1}} +\compattikzset{curved capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ccapacitor@path, l=#1}} +\compattikzset{variable capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcapacitor@path, l=#1}} +\compattikzset{piezoelectric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piezoelectric@path, l=#1}} +\compattikzset{battery/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@battery@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{battery1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batteryone@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{battery2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batterytwo@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductor@path, l=#1}} +\compattikzset{gf surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}} +\compattikzset{american gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americangfsurgearrester@path, l=#1}} +\compattikzset{european gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeangfsurgearrester@path, l=#1}} +\compattikzset{gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}} +\compattikzset{american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductor@path, l=#1}} +\compattikzset{cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductor@path, l=#1}} +\compattikzset{cute choke/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cutechoke@path, l=#1}} +\compattikzset{european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductor@path, l=#1}} +\compattikzset{variable inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vinductor@path, l=#1}} +\compattikzset{variable european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@veuropeaninductor@path, l=#1}} +\compattikzset{variable american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamericaninductor@path, l=#1}} +\compattikzset{variable cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcuteinductor@path, l=#1}} +\compattikzset{tline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tline@path, l=#1}} +\compattikzset{transmission line/.style = {tline = #1}} +\compattikzset{TL/.style = {tline = #1}} +\compattikzset{mstline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mstline@path, l=#1}} +\compattikzset{european voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{american voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\compattikzset{european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isource@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{american current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{empty controlled source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{american controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\compattikzset{european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisource@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{american controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{sinusoidal voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcesin@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }} +\compattikzset{square voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcesquare@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }} +\compattikzset{triangle voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcetri@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }} +\compattikzset{sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{controlled sinusoidal voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourcesin@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{controlled sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}} + +\compattikzset{voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\compattikzset{current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi current source = #1, \circuitikzbasekey/bipole/is current=true}} +\compattikzset{controlled voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi controlled voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\compattikzset{controlled current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi controlled current source = #1, \circuitikzbasekey/bipole/is current=true}} + + +\compattikzset{generic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@generic@path, l=#1}} +\compattikzset{xgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@xgeneric@path, l=#1}} +\compattikzset{ageneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ageneric@path, l=#1}} +\compattikzset{tgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tgeneric@path, l=#1}} +\compattikzset{fullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullgeneric@path, l=#1}} +\compattikzset{tfullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tfullgeneric@path, l=#1}} +\compattikzset{short/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@short@path}} +\compattikzset{open/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@open@path}} + +\compattikzset{lamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lamp@path}} +\compattikzset{bulb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bulb@path, l=#1}} + +\compattikzset{squid/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@squid@path}} +\compattikzset{barrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@barrier@path}} +\compattikzset{openbarrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@openbarrier@path}} +\compattikzset{thermocouple/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermocouple@path}} +\compattikzset{fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fuse@path}} +\compattikzset{asymmetric fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@afuse@path}} + +\compattikzset{twoport/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@twoport@path}} +\compattikzset{twoportsplit/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@twoportsplit@path}} +\compattikzset{vco/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vco@path}} +\compattikzset{bandpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandpass@path}} +\compattikzset{bandstop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandstop@path}} +\compattikzset{highpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@highpass@path}} +\compattikzset{lowpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lowpass@path}} +\compattikzset{allpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@allpass@path}} +\compattikzset{adc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@adc@path}} +\compattikzset{dac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dac@path}} +\compattikzset{dsp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dsp@path}} +\compattikzset{fft/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fft@path}} +\compattikzset{amp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@amp@path}} +\compattikzset{vamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamp@path}} +\compattikzset{piattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piattenuator@path}} +\compattikzset{vpiattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vpiattenuator@path}} +\compattikzset{tattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tattenuator@path}} +\compattikzset{vtattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vtattenuator@path}} +\compattikzset{phaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@phaseshifter@path}} +\compattikzset{vphaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vphaseshifter@path}} +\compattikzset{detector/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@detector@path}} +% +\compattikzset{sacdc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@sacdc@path, l=#1}} +\compattikzset{sdcac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@sdcac@path, l=#1}} +\compattikzset{tacdc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tacdc@path, l=#1}} +\compattikzset{tdcac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tdcac@path, l=#1}} + +% % % % % % +% % Begin of Diodes +% % % % % % + +\def\pgf@circ@fulldiode@path#1{\pgf@circ@bipole@path{fulldiode}{#1}} +\def\pgf@circ@fullzdiode@path#1{\pgf@circ@bipole@path{fullzdiode}{#1}} +\def\pgf@circ@fullzzdiode@path#1{\pgf@circ@bipole@path{fullzzdiode}{#1}} +\def\pgf@circ@fullsdiode@path#1{\pgf@circ@bipole@path{fullsdiode}{#1}} +\def\pgf@circ@fulltdiode@path#1{\pgf@circ@bipole@path{fulltdiode}{#1}} +\def\pgf@circ@fulllediode@path#1{\pgf@circ@bipole@path{fulllediode}{#1}} +\def\pgf@circ@fullpdiode@path#1{\pgf@circ@bipole@path{fullpdiode}{#1}} +\def\pgf@circ@fullvarcap@path#1{\pgf@circ@bipole@path{fullvarcap}{#1}} +\def\pgf@circ@fullbidirectionaldiode@path#1{\pgf@circ@bipole@path{fullbidirectionaldiode}{#1}} +\def\pgf@circ@emptydiode@path#1{\pgf@circ@bipole@path{emptydiode}{#1}} +\def\pgf@circ@emptyzdiode@path#1{\pgf@circ@bipole@path{emptyzdiode}{#1}} +\def\pgf@circ@emptyzzdiode@path#1{\pgf@circ@bipole@path{emptyzzdiode}{#1}} +\def\pgf@circ@emptysdiode@path#1{\pgf@circ@bipole@path{emptysdiode}{#1}} +\def\pgf@circ@emptytdiode@path#1{\pgf@circ@bipole@path{emptytdiode}{#1}} +\def\pgf@circ@emptylediode@path#1{\pgf@circ@bipole@path{emptylediode}{#1}} +\def\pgf@circ@emptypdiode@path#1{\pgf@circ@bipole@path{emptypdiode}{#1}} +\def\pgf@circ@emptyvarcap@path#1{\pgf@circ@bipole@path{emptyvarcap}{#1}} +\def\pgf@circ@emptybidirectionaldiode@path#1{\pgf@circ@bipole@path{emptybidirectionaldiode}{#1}} + +\compattikzset{full diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulldiode@path}} +\compattikzset{full Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullsdiode@path}} +\compattikzset{full Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzdiode@path}} +\compattikzset{full ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzzdiode@path}} +\compattikzset{full tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltdiode@path}} +\compattikzset{full photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullpdiode@path}} +\compattikzset{full led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulllediode@path}} +\compattikzset{full varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullvarcap@path}} +\compattikzset{full bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullbidirectionaldiode@path}} +\compattikzset{full thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullthyristor@path}} +\compattikzset{full triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltriac@path}} + +\compattikzset{empty diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptydiode@path}} +\compattikzset{empty Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptysdiode@path}} +\compattikzset{empty Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzdiode@path}} +\compattikzset{empty ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzzdiode@path}} +\compattikzset{empty tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytdiode@path}} +\compattikzset{empty photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptypdiode@path}} +\compattikzset{empty led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptylediode@path}} +\compattikzset{empty varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyvarcap@path}} +\compattikzset{empty bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptybidirectionaldiode@path}} +\compattikzset{empty thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptythyristor@path}} +\compattikzset{empty triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytriac@path}} + +\compattikzset{stroke diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptydiode@path}} +\compattikzset{stroke Schottky diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptysdiode@path}} +\compattikzset{stroke Zener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzdiode@path}} +\compattikzset{stroke ZZener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzzdiode@path}} +\compattikzset{stroke tunnel diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytdiode@path}} +\compattikzset{stroke photodiode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptypdiode@path}} +\compattikzset{stroke led/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptylediode@path}} +\compattikzset{stroke varcap/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyvarcap@path}} +\compattikzset{stroke thyristor/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptythyristor@path}} +%\compattikzset{stroke triac/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytriac@path}} + +\def\pgfcircdiodestylemacro{\ifpgf@circuit@strokediode stroke \else\ifpgf@circuit@fulldiode full \else empty \fi\fi} + +\compattikzset{Schottky diode/.style = {\comnpatname \pgfcircdiodestylemacro Schottky diode}} +\compattikzset{Zener diode/.style = {\comnpatname \pgfcircdiodestylemacro Zener diode}} +\compattikzset{ZZener diode/.style = {\comnpatname \pgfcircdiodestylemacro ZZener diode}} +\compattikzset{tunnel diode/.style = {\comnpatname \pgfcircdiodestylemacro tunnel diode}} +\compattikzset{photodiode/.style = {\comnpatname \pgfcircdiodestylemacro photodiode}} +\compattikzset{led/.style = {\comnpatname \pgfcircdiodestylemacro led}} +\compattikzset{varcap/.style = {\comnpatname \pgfcircdiodestylemacro varcap}} +\compattikzset{diode/.style = {\comnpatname \pgfcircdiodestylemacro diode}} +\compattikzset{thyristor/.style = {\comnpatname \pgfcircdiodestylemacro thyristor}} +\compattikzset{triac/.style = {\comnpatname \ifpgf@circuit@fulldiode full \else empty \fi triac}}%no stroke triac! +\compattikzset{bidirectionaldiode/.style = {\comnpatname \ifpgf@circuit@fulldiode full \else empty \fi bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac) + +%% Define Shortcuts +\compattikzset{Do/.style = {\comnpatname empty diode}} +\compattikzset{tDo/.style = {\comnpatname empty tunnel diode}} +\compattikzset{zDo/.style = {\comnpatname empty Zener diode}} +\compattikzset{zzDo/.style = {\comnpatname empty ZZener diode}} +\compattikzset{sDo/.style = {\comnpatname empty Schottky diode}} +\compattikzset{pDo/.style = {\comnpatname empty photodiode}} +\compattikzset{leDo/.style = {\comnpatname empty led}} +\compattikzset{VCo/.style = {\comnpatname empty varcap}} +\compattikzset{biDo/.style = {\comnpatname empty bidirectionaldiode}} +\compattikzset{Tyo/.style = {\comnpatname empty thyristor}} +\compattikzset{Tro/.style = {\comnpatname empty triac}} + +\compattikzset{D*/.style = {\comnpatname full diode}} +\compattikzset{tD*/.style = {\comnpatname full tunnel diode}} +\compattikzset{zD*/.style = {\comnpatname full Zener diode}} +\compattikzset{zzD*/.style = {\comnpatname full ZZener diode}} +\compattikzset{sD*/.style = {\comnpatname full Schottky diode}} +\compattikzset{pD*/.style = {\comnpatname full photodiode}} +\compattikzset{leD*/.style = {\comnpatname full led}} +\compattikzset{VC*/.style = {\comnpatname full varcap}} +\compattikzset{biD*/.style = {\comnpatname full bidirectionaldiode}} +\compattikzset{Ty*/.style = {\comnpatname full thyristor}} +\compattikzset{Tr*/.style = {\comnpatname full triac}} + +\compattikzset{D/.style = {\comnpatname diode}} +\compattikzset{tD/.style = {\comnpatname tunnel diode}} +\compattikzset{zD/.style = {\comnpatname Zener diode}} +\compattikzset{zzD/.style = {\comnpatname ZZener diode}} +\compattikzset{sD/.style = {\comnpatname Schottky diode}} +\compattikzset{pD/.style = {\comnpatname photodiode}} +\compattikzset{leD/.style = {\comnpatname led}} +\compattikzset{VC/.style = {\comnpatname varcap}} +\compattikzset{biD/.style = {\comnpatname bidirectionaldiode}} +\compattikzset{Ty/.style = {\comnpatname thyristor}} +\compattikzset{Tr/.style = {\comnpatname triac}} + +\compattikzset{D-/.style = {\comnpatname stroke diode}} +\compattikzset{tD-/.style = {\comnpatname stroke tunnel diode}} +\compattikzset{zD-/.style = {\comnpatname stroke Zener diode}} +\compattikzset{zzD-/.style = {\comnpatname stroke ZZener diode}} +\compattikzset{sD-/.style = {\comnpatname stroke Schottky diode}} +\compattikzset{pD-/.style = {\comnpatname stroke photodiode}} +\compattikzset{leD-/.style = {\comnpatname stroke led}} +\compattikzset{VC-/.style = {\comnpatname stroke varcap}} +\compattikzset{Ty-/.style = {\comnpatname stroke thyristor}} +\compattikzset{Tr-/.style = {\comnpatname empty triac}}%no stroke triac! +\compattikzset{biD-/.style = {\comnpatname empty bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac) + +% % % % % % +% % End of Diodes +% % % % % % + + +\compattikzset{memristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@memristor@path}} +\compattikzset{closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}} +\compattikzset{opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ospst@path, l=#1}} +\compattikzset{ncs/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}} +\compattikzset{nos/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}} +\compattikzset{normal closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}} +\compattikzset{normal open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}} +\compattikzset{switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}} +\compattikzset{push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}} +\compattikzset{nopb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}} +\compattikzset{normally open push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}} +\compattikzset{ncpb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}} +\compattikzset{normally closed push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}} +\compattikzset{nopbc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbuttonc@path, l=#1}} +\compattikzset{normally open push button closed/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbuttonc@path, l=#1}} +\compattikzset{ncpbo/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbuttono@path, l=#1}} +\compattikzset{normally closed push button open/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbuttono@path, l=#1}} +\compattikzset{toggle switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@toggleswitch@path}} + +\compattikzset{ammeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ammeter@path}} +\compattikzset{voltmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@voltmeter@path}} +\compattikzset{ohmmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ohmmeter@path}} +\tikzset{oscope/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@oscope@path, l=#1}} + +% cute switches +%% closed cute switch +\def\pgf@circ@cuteclosedswitch@path#1{\pgf@circ@bipole@path{cuteclosedswitch}{#1}} +\compattikzset{cute closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosedswitch@path, l=#1}} +\compattikzset{ccsw/.style= {\comnpatname cute closed switch= #1}} + +%% open cute switch +\def\pgf@circ@cuteopenswitch@path#1{\pgf@circ@bipole@path{cuteopenswitch}{#1}} +\compattikzset{cute open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopenswitch@path, l=#1}} +\compattikzset{cosw/.style= {\comnpatname cute open switch= #1}} + +%% closing cute switch +\def\pgf@circ@cuteclosingswitch@path#1{\pgf@circ@bipole@path{cuteclosingswitch}{#1}} +\compattikzset{cute closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosingswitch@path, l=#1}} +\compattikzset{ccgsw/.style= {\comnpatname cute closing switch= #1}} + +%% opening cute switch +\def\pgf@circ@cuteopeningswitch@path#1{\pgf@circ@bipole@path{cuteopeningswitch}{#1}} +\compattikzset{cute opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopeningswitch@path, l=#1}} +\compattikzset{cogsw/.style= {\comnpatname cute opening switch= #1}} + + +% short forms +\compattikzset{esource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@esource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{pvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{dcvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{dcisource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcisource@path, \circuitikzbasekey/bipole/is current=true, l=#1}} + +\compattikzset{ioosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is current=true,/tikz/to path=\pgf@circ@oosource@path, i=#1}} +\compattikzset{voosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@oosource@path, v=#1}} +\compattikzset{oosourcetrans/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@oosourcetrans@path, v=#1}} +\compattikzset{ooosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@ooosource@path, v=#1}} + +\compattikzset{vsource/.style = {\comnpatname voltage source = #1}} +\compattikzset{isource/.style = {\comnpatname current source = #1}} +\compattikzset{cisource/.style = {\comnpatname controlled current source = #1}} +\compattikzset{ecsource/.style = {\comnpatname empty controlled source = #1}} +\compattikzset{cvsource/.style = {\comnpatname controlled voltage source = #1}} +\compattikzset{vsourcesin/.style = {\comnpatname sinusoidal voltage source = #1}} +\compattikzset{vsourcesquare/.style = {\comnpatname square voltage source = #1}} +\compattikzset{vsourcetri/.style = {triangle voltage source = #1}} +\compattikzset{isourcesin/.style = {\comnpatname sinusoidal current source = #1}} +\compattikzset{cisourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}} +\compattikzset{cvsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}} + +\compattikzset{controlled vsource/.style = {\comnpatname controlled voltage source = #1}} +\compattikzset{controlled isource/.style = {\comnpatname controlled current source = #1}} +\compattikzset{controlled vsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}} +\compattikzset{controlled isourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}} + +\compattikzset{R/.style= {\comnpatname resistor = #1}} +\compattikzset{vR/.style= {\comnpatname variable resistor = #1}} +\compattikzset{phR/.style= {\comnpatname photoresistor = #1}} +\compattikzset{thR/.style= {\comnpatname thermistor = #1}} +\compattikzset{thRp/.style= {\comnpatname thermistor ptc= #1}} +\compattikzset{thRn/.style= {\comnpatname thermistor ntc= #1}} +\compattikzset{pR/.style= {\comnpatname potentiometer = #1}} +\compattikzset{C/.style = {\comnpatname capacitor = #1}} +\compattikzset{eC/.style = {\comnpatname ecapacitor = #1}} +%% pC is deprecated, use cC instead +\compattikzset{pC/.style = {\comnpatname polar capacitor = #1}} +\compattikzset{cC/.style = {\comnpatname curved capacitor = #1}} +\compattikzset{vC/.style = {\comnpatname variable capacitor = #1}} +\compattikzset{PZ/.style = {\comnpatname piezoelectric = #1}} +\compattikzset{L/.style = {\comnpatname inductor = #1}} +\compattikzset{vL/.style = {\comnpatname variable inductor = #1}} +\compattikzset{V/.style = {\comnpatname voltage source = #1}} +\compattikzset{cV/.style = {\comnpatname controlled voltage source = #1}} +\compattikzset{sV/.style = {\comnpatname sinusoidal voltage source = #1}} +\compattikzset{sqV/.style = {\comnpatname square voltage source = #1}} +\compattikzset{tV/.style = {\comnpatname triangle voltage source = #1}} +\compattikzset{csV/.style = {\comnpatname controlled sinusoidal voltage source = #1}} +\def\pgf@temp#1{ + \compattikzset{V#1/.style = {\comnpatname voltage source, v#1=##1} } + \compattikzset{cV#1/.style = {\comnpatname controlled voltage source, v#1=##1} } + \compattikzset{sV#1/.style = {\comnpatname sinusoidal voltage source, v#1=##1} } + \compattikzset{csV#1/.style = {\comnpatname controlled sinusoidal voltage source, v#1=##1} } +} +\pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<} +\pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_} + +%current sources +\compattikzset{I/.style = {\comnpatname current source = #1}} +\compattikzset{cI/.style = {\comnpatname controlled current source = #1}} +\compattikzset{sI/.style = {\comnpatname sinusoidal current source = #1}} +\compattikzset{csI/.style = {\comnpatname controlled sinusoidal current source = #1}} +\def\pgf@temp#1{ + \compattikzset{I#1/.style = {\comnpatname current source, i#1=##1} } + \compattikzset{cI#1/.style = {\comnpatname controlled current source, i#1=##1} } + \compattikzset{sI#1/.style = {\comnpatname sinusoidal current source, i#1=##1} } + \compattikzset{csI#1/.style = {\comnpatname controlled sinusoidal current source, i#1=##1} } +} +\pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<} +\pgf@temp{>_} \pgf@temp{<_} \pgf@temp{>^} \pgf@temp{<^} +\pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_} + +% cute sources +\def\pgf@circ@vsourceC@path#1{\pgf@circ@bipole@path{vsourceC}{#1}} +\compattikzset{cute european voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceC@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{vsourceC/.style= {\comnpatname cute european voltage source= #1}} +\compattikzset{ceV/.style= {\comnpatname cute european voltage source= #1}} + +\def\pgf@circ@isourceC@path#1{\pgf@circ@bipole@path{isourceC}{#1}} +\compattikzset{cute european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceC@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{isourceC/.style= {\comnpatname cute european current source= #1}} +\compattikzset{ceI/.style= {\comnpatname cute european current source= #1}} + +\def\pgf@circ@cvsourceC@path#1{\pgf@circ@bipole@path{cvsourceC}{#1}} +\compattikzset{cute european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceC@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{cvsourceC/.style= {\comnpatname cute european controlled voltage source= #1}} +\compattikzset{cceV/.style= {\comnpatname cute european controlled voltage source= #1}} + +\def\pgf@circ@cisourceC@path#1{\pgf@circ@bipole@path{cisourceC}{#1}} +\compattikzset{cute european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceC@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{cisourceC/.style= {\comnpatname cute european controlled current source= #1}} +\compattikzset{cceI/.style= {\comnpatname cute european controlled current source= #1}} + +% noise sources +\def\pgf@circ@vsourceN@path#1{\pgf@circ@bipole@path{vsourceN}{#1}} +\compattikzset{noise voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceN@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{vsourceN/.style= {\comnpatname noise voltage source= #1}} +\compattikzset{nV/.style= {\comnpatname noise voltage source= #1}} + +\def\pgf@circ@isourceN@path#1{\pgf@circ@bipole@path{isourceN}{#1}} +\compattikzset{noise current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceN@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\compattikzset{isourceN/.style= {\comnpatname noise current source= #1}} +\compattikzset{nI/.style= {\comnpatname noise current source= #1}} + +% resistive sensor american style +\def\pgf@circ@resistivesens@path#1{\pgf@circ@bipole@path{resistivesens}{#1}} +\compattikzset{american resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistivesens@path, l=#1}} +\compattikzset{european resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}} +\compattikzset{resistive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@sresistor@path, l=#1}} +\compattikzset{sR/.style= {\comnpatname resistive sensor= #1}} + +\compattikzset{capacitive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitivesens@path, l=#1}} +\compattikzset{sC/.style= {\comnpatname capacitive sensor= #1}} + +\compattikzset{cute inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductivesens@path, l=#1}} +\compattikzset{european inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductivesens@path, l=#1}} +\compattikzset{american inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductivesens@path, l=#1}} +\compattikzset{inductive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductivesens@path, l=#1}} +\compattikzset{sL/.style= {\comnpatname inductive sensor= #1}} + +\compattikzset{Mr/.style = {\comnpatname memristor}} + +\compattikzset{cspst/.style = {\comnpatname closing switch = #1}} +\compattikzset{ospst/.style = {\comnpatname opening switch = #1}} +\compattikzset{spst/.style = {\comnpatname switch = #1}} + +\compattikzset{afuse/.style = {\comnpatname asymmetric fuse=#1}} + +\compattikzset{vdd/.style = {\comnpatname vcc = #1}} +\compattikzset{vss/.style = {\comnpatname vee = #1}} + +% activate the to-style crossing +\def\pgf@circ@crossing@path#1{\pgf@circ@bipole@path{crossing}{#1}} +\compattikzset{crossing/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@crossing@path, l=#1}} +\compattikzset{xing/.style= {\comnpatname crossing= #1}} + +%% loudspeaker and microphone + +\def\pgf@circ@loudspeaker@path#1{\pgf@circ@bipole@path{loudspeaker}{#1}} +\compattikzset{loudspeaker/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@loudspeaker@path, l=#1}} + +\def\pgf@circ@mic@path#1{\pgf@circ@bipole@path{mic}{#1}} +\compattikzset{mic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mic@path, l=#1}} + +% more instrument +\def\pgf@circ@rmeter@path#1{\pgf@circ@bipole@path{rmeter}{#1}} +\compattikzset{rmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeter@path, l=#1}} +\def\pgf@circ@rmeterwa@path#1{\pgf@circ@bipole@path{rmeterwa}{#1}} +\compattikzset{rmeterwa/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeterwa@path, l=#1}} +\def\pgf@circ@smeter@path#1{\pgf@circ@bipole@path{smeter}{#1}} +\compattikzset{smeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@smeter@path, l=#1}} +% current loop probes +\def\pgf@circ@iloop@path#1{\pgf@circ@bipole@path{iloop}{#1}} +\compattikzset{iloop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop@path, l=#1}} +\def\pgf@circ@iloop2@path#1{\pgf@circ@bipole@path{iloop2}{#1}} +\compattikzset{iloop2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop2@path, l=#1}} +% qucs-style probes +\def\pgf@circ@qiprobe@path#1{\pgf@circ@bipole@path{qiprobe}{#1}} +\compattikzset{qiprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qiprobe@path, l=#1}} +\def\pgf@circ@qvprobe@path#1{\pgf@circ@bipole@path{qvprobe}{#1}} +\compattikzset{qvprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qvprobe@path, l=#1}} +\def\pgf@circ@qpprobe@path#1{\pgf@circ@bipole@path{qpprobe}{#1}} +\compattikzset{qpprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qpprobe@path, l=#1}} +% multiwire(s) +\def\pgf@circ@bmultiwire@path#1{\pgf@circ@bipole@path{bmultiwire}{#1}} +\compattikzset{bmultiwire/.style = {\circuitikzbasekey, +/tikz/to path=\pgf@circ@bmultiwire@path, l=#1}} +\def\pgf@circ@multiwire@path#1{\pgf@circ@bipole@path{multiwire}{#1}} +\compattikzset{multiwire/.style = {\circuitikzbasekey, +/tikz/to path=\pgf@circ@multiwire@path, l=#1}} +\def\pgf@circ@tmultiwire@path#1{\pgf@circ@bipole@path{tmultiwire}{#1}} +\compattikzset{tmultiwire/.style = {\circuitikzbasekey, +/tikz/to path=\pgf@circ@tmultiwire@path, l=#1}} + +% reed switches +\def\pgf@circ@reed@path#1{\pgf@circ@bipole@path{reed}{#1}} +\compattikzset{reed/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@reed@path, l=#1}} + +% Transistor like bipoles + +\def\pgf@circ@trans@path#1#2{ + \pgfextra{ + \edef\pgf@temp{\ctikzvalof{bipole/name}} + \def\pgf@circ@temp{#2} + \ifx\pgf@temp\pgf@circ@temp % if it has not a name + \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999} + \ctikzset{bipole/name = trans\pgf@circ@rand} % create it + \fi + } + \ifpgf@circuit@bipole@inverted + (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}end) {} + (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}start) {} + \else + (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}start) {} + (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}end) {} + \fi + \pgfextra{ + \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}} + {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}} + \pgfmathadd{\pgfmathresult}{-90} + \pgfmathround{\pgfmathresult} + \edef\pgf@circ@direction{\pgfmathresult} + } + ($(\tikztostart) ! .5 ! (\tikztotarget)$) + node[#1, /tikz/rotate=\pgf@circ@direction, xscale=\ctikzvalof{mirror value}] + (\ctikzvalof{bipole/name}) {} + node {\ctikzvalof{bipole/label/name}} + \ifcsname pgf@anchor@#1@pathstart\endcsname%if special path-anchors are defined, use them! + (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.pathstart) + (\ctikzvalof{bipole/name}.pathend) -- (\ctikzvalof{bipole/name}end.center) + \else + (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.left) + (\ctikzvalof{bipole/name}.right) -- (\ctikzvalof{bipole/name}end.center) + \fi + \drawpoles + \pgfextra{ + \pgfcircresetpath + } + (\tikztotarget) \tikztonodes % e si continua +} + + +\def\pgf@circ@definetranspath#1{ + \compattikzset{T#1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@trans@path{#1}{}, l=##1}} +} + +\pgf@circ@definetranspath{elmech} +\pgf@circ@definetranspath{nmos} +\pgf@circ@definetranspath{pmos} +\pgf@circ@definetranspath{nmosd} +\pgf@circ@definetranspath{pmosd} +\pgf@circ@definetranspath{hemt} +\pgf@circ@definetranspath{npn} +\pgf@circ@definetranspath{pnp} +\pgf@circ@definetranspath{nfet} +\pgf@circ@definetranspath{nigfete} +\pgf@circ@definetranspath{nigfetd} +\pgf@circ@definetranspath{nigfetebulk} +\pgf@circ@definetranspath{pfet} +\pgf@circ@definetranspath{pigfete} +\pgf@circ@definetranspath{pigfetd} +\pgf@circ@definetranspath{pigfetebulk} +\pgf@circ@definetranspath{njfet} +\pgf@circ@definetranspath{pjfet} +\pgf@circ@definetranspath{pigbt} +\pgf@circ@definetranspath{nigbt} +\pgf@circ@definetranspath{Lpigbt} +\pgf@circ@definetranspath{Lnigbt} +% +% Path-style logical ports +% +% create path-style element for one input --- one output logical ports +% +\def\pgfcirc@port@node@to@path#1#2{% + % + % add a logic port path style component --- we need to suppress leads + % and use the correct center + % + \pgfcirc@node@to@path{#1}{#2}{/tikz/no leads, \circuitikzbasekey/logic ports origin=center}% +} +\pgfcirc@port@node@to@path{not port}{inline not} +\pgfcirc@port@node@to@path{buffer port}{inline buffer} +\pgfcirc@port@node@to@path{schmitt port}{inline schmitt} +\pgfcirc@port@node@to@path{invschmitt port}{inline invschmitt} + +\pgfcirc@port@node@to@path{tgate}{inline tgate} +\pgfcirc@port@node@to@path{double tgate}{inline double tgate} + +%%%---------- close: tex/pgfcircpath + +\catcode`\@=\tikzatcode +\catcode`\|=\tikzbarcode +\catcode`\!=\tikzexclaimcode + +% define the environment +\long\def\startcircuitikz#1\stopcircuitikz{\starttikzpicture#1\stoptikzpicture} + +\protect + +\stopmodule + +\endinput diff --git a/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex b/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex index 6af1ae4ed5..9876b8f290 100644 --- a/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex +++ b/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex @@ -1,7 +1,7 @@ -% Copyright 2018-2020 by Romano Giannetti -% Copyright 2015-2020 by Stefan Lindner -% Copyright 2013-2020 by Stefan Erhardt -% Copyright 2007-2020 by Massimo Redaelli +% Copyright 2018-2021 by Romano Giannetti +% Copyright 2015-2021 by Stefan Lindner +% Copyright 2013-2021 by Stefan Erhardt +% Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % @@ -10,8 +10,8 @@ % % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. -\def\pgfcircversion{1.2.7} -\def\pgfcircversiondate{2020/12/27} +\def\pgfcircversion{1.3.0} +\def\pgfcircversiondate{2021/01/19} \writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion} \usemodule[tikz] @@ -32,6 +32,7 @@ \input pgfcirc.defines.tex \input pgfcircutils.tex +\input pgfcircpath.tex \input pgfcircshapes.tex \input pgfcircmonopoles.tex @@ -133,7 +134,6 @@ \ctikzset{tripoles/op amp/font/.initial=\switchtobodyfont[small]} -\input pgfcircpath.tex \catcode`\@=\tikzatcode \catcode`\|=\tikzbarcode diff --git a/macros/latex/contrib/asmeconf/README.md b/macros/latex/contrib/asmeconf/README.md index e9385d88d1..caa2ea960b 100644 --- a/macros/latex/contrib/asmeconf/README.md +++ b/macros/latex/contrib/asmeconf/README.md @@ -1,7 +1,7 @@ #asmeconf: A template for ASME conference papers# - Version 1.22 dated 2021/01/14. + Version 1.23 dated 2021/01/18. ####Overview#### This class provides a template to format ASME Conference papers according to @@ -77,6 +77,9 @@ ####Change log#### + v1.23 (2021/01/18): + - Several minor edits and corrections + v1.22 (2021/01/14): - New command \\EntryHeading to produce subheadings in the nomenclature list; - New syntax for \\CorrespondingAuthor command with the authorgrid option (**not backward compatible**) diff --git a/macros/latex/contrib/asmeconf/asmeconf-sample.bib b/macros/latex/contrib/asmeconf/asmeconf-sample.bib index 0085c89e57..669addfc34 100644 --- a/macros/latex/contrib/asmeconf/asmeconf-sample.bib +++ b/macros/latex/contrib/asmeconf/asmeconf-sample.bib @@ -1,6 +1,6 @@ %% Sample bibliography file for asmeconf.bst and asmeconf.cls %% -%% Revised 14 January 2021 +%% Revised 18 January 2021 %% Copyright John H. Lienhard, MIT %% Offered under the MIT license: https://ctan.org/license/mit @@ -185,7 +185,7 @@ organization = {Comprehensive \TeX\ Archive Network}, year = {2021}, url = {https://www.ctan.org/pkg/asmeconf}, - urldate = {Pre-publication}, + urldate = {January 18, 2021}, } @book{fourier1822, diff --git a/macros/latex/contrib/asmeconf/asmeconf-template.pdf b/macros/latex/contrib/asmeconf/asmeconf-template.pdf index 883948a8b9..7749450f4c 100644 Binary files a/macros/latex/contrib/asmeconf/asmeconf-template.pdf and b/macros/latex/contrib/asmeconf/asmeconf-template.pdf differ diff --git a/macros/latex/contrib/asmeconf/asmeconf-template.tex b/macros/latex/contrib/asmeconf/asmeconf-template.tex index 638a8e11f0..728d9b7d51 100644 --- a/macros/latex/contrib/asmeconf/asmeconf-template.tex +++ b/macros/latex/contrib/asmeconf/asmeconf-template.tex @@ -4,7 +4,7 @@ %% This file is asmeconf-template.tex, a template to format ASME Conference papers according to %% the requirements on ASME's conference web pages, and including hypertext support for the pdf. %% -%% This file is version 1.22 dated 2021/1/14 +%% This file is version 1.23 dated 2021/1/18 %% %% As of version 1.11, this template follows ASME's newer conference guidelines first posted July 2019. %% The new guidelines have changed the requested author block formatting to be inline. @@ -79,7 +79,7 @@ %% Class options are described above. If you are not using the languages options, remove them. -\documentclass[upint,subscriptcorrection,varvw,mathalfa=cal=euler,pdf-a,balance,spanish,french,greek,russian,vietnamese,colorlinks]{asmeconf} % <=== remove colorlinks before your *final* submission to ASME! But keep it for other purposes. +\documentclass[upint,subscriptcorrection,varvw,mathalfa=cal=euler,pdf-a,balance,spanish,french,greek,russian,vietnamese,fontspec,japanese,colorlinks]{asmeconf} % <=== remove colorlinks before your *final* submission to ASME! But keep it for other purposes. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% Fields to be completed %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -576,20 +576,22 @@ Este es el resumen del artículo. Escribimos en español. Se describen el proble \end{abstract*} \end{selectlanguage}% edited by Aarón Montoya-Moraga -%% If you have trouble with the passages, your file may not be saved in utf-8 format. You can delete this stuff to resolve the issue. - -%% Examples of abstracts in other languages. The first three are intended for pdflatex, not lualatex. -\begin{selectlanguage}{greek}% -\begin{abstract*} -Αυτή είναι η περίληψη του άρθρου. Χρησιμοποιούμε την ελληνική γλώσσα. Περιγράφεται το πρόβλημα, οι μέθοδοι και τα αποτελέσματα. Περιλαμβάνονται επίσης αναφορές. -\end{abstract*} -\end{selectlanguage}% Edited by George Barbastathis - -\begin{selectlanguage}{russian} -\begin{abstract*} -Это резюме статьи. Пишем по русски. Описаны проблема, методы и результаты. Библиография также включена.% -\end{abstract*} -\end{selectlanguage}% edited by Steven Gerasimoff +%% If you have trouble with the following passages, your file may not be saved in utf-8 format. You can delete this stuff to resolve the issue. +\typeout{If you have trouble with the following passages, your file may not be saved in utf-8 format. You can delete those lines to resolve the issue.} +%% Examples of abstracts in other languages. The first two are intended for pdflatex, not lualatex. +\ifpdftex + \begin{selectlanguage}{greek}% + \begin{abstract*} + Αυτή είναι η περίληψη του άρθρου. Χρησιμοποιούμε την ελληνική γλώσσα. Περιγράφεται το πρόβλημα, οι μέθοδοι και τα αποτελέσματα. Περιλαμβάνονται επίσης αναφορές. + \end{abstract*} + \end{selectlanguage}% Edited by George Barbastathis + + \begin{selectlanguage}{russian} + \begin{abstract*} + Это резюме статьи. Пишем по русски. Описаны проблема, методы и результаты. Библиография также включена.% + \end{abstract*} + \end{selectlanguage}% edited by Steven Gerasimoff +\fi \begin{selectlanguage}{vietnamese} \begin{abstract*} @@ -599,7 +601,19 @@ Este es el resumen del artículo. Escribimos en español. Se describen el proble \iffontspecloaded % - \begin{selectlanguage}{japanese} + \begin{selectlanguage}{greek}% + \begin{abstract*} + Αυτή είναι η περίληψη του άρθρου. Χρησιμοποιούμε την ελληνική γλώσσα. Περιγράφεται το πρόβλημα, οι μέθοδοι και τα αποτελέσματα. Περιλαμβάνονται επίσης αναφορές. + \end{abstract*} + \end{selectlanguage}% Edited by George Barbastathis +% + \begin{selectlanguage}{russian} + \begin{abstract*} + Это резюме статьи. Пишем по русски. Описаны проблема, методы и результаты. Библиография также включена.% + \end{abstract*} + \end{selectlanguage}% edited by Steven Gerasimoff +% + \begin{selectlanguage}{japanese}% be sure to call class option [japanese] \begin{abstract*} %論文の要約です。日本語で記述します。問題、方法、および結果について説明します。また、参考文献も含めます。 この論文の日本語での要約は以下のとおりです。問題、方法、および結果が説明されています。参考資料も添付してあります。 diff --git a/macros/latex/contrib/asmeconf/asmeconf.cls b/macros/latex/contrib/asmeconf/asmeconf.cls index e7de2c9dfb..c5b01acb43 100644 --- a/macros/latex/contrib/asmeconf/asmeconf.cls +++ b/macros/latex/contrib/asmeconf/asmeconf.cls @@ -5,8 +5,8 @@ %% ASME conference requirements as represented on ASME's conference web pages in 2020. %% %% This file's version and date: - \def\versionno{1.22} - \def\versiondate{2021/01/14\space} + \def\versionno{1.23} + \def\versiondate{2021/01/18\space} %% %% Author: John H. Lienhard, V %% Department of Mechanical Engineering @@ -205,7 +205,7 @@ \PassOptionsToPackage{japanese}{babel}% \ac@japanesetrue \else - \ClassWarningNoLine{asmeconf}{japanese option is supported only with the [fontspec] option + LuaLaTeX. It will be ignored.}% + \ClassWarningNoLine{asmeconf}{japanese option is supported only with the [fontspec] option + LuaLaTeX. It will be ignored}% \fi } @@ -222,23 +222,23 @@ % Several languages do not have .ldf files to load. Babel will call these on demand. % -\DeclareOption{arabic}{\ClassError{asmeconf}{Do not specify "arabic" as a class option.}{Instead, give the option [bidi=basic] and specify "arabic" when you call the language within your document.}} +\DeclareOption{arabic}{\ClassError{asmeconf}{Do not specify "arabic" as a class option}{Instead, give the option [bidi=basic] and specify "arabic" when you call the language within your document.}} % -\DeclareOption{bengali}{\ClassError{asmeconf}{Do not specify "bengali" as a class option.}{Babel does not have an ldf file for Bengali. Instead, specify "bengali" when you call the language within your document. No class option is needed.}} +\DeclareOption{bengali}{\ClassError{asmeconf}{Do not specify "bengali" as a class option}{Babel does not have an ldf file for Bengali. Instead, specify "bengali" when you call the language within your document. No class option is needed.}} % \DeclareOption{chinese-simplified}{\ClassError{asmeconf}{Do not specify "chinese-simplified" as class option}{Babel does not have an ldf file for simplified Chinese. Instead, specify "chinese-simplified" when you call the language within your document. No class option is needed.}} % \DeclareOption{chinese-traditional}{\ClassError{asmeconf}{Do not specify "chinese-traditional" as class option}{Babel does not have an ldf file for traditional Chinese. Instead, specify "chinese-traditional" when you call the language within your document. No class option is needed.}} % -\DeclareOption{chinese}{\ClassError{asmeconf}{Do not specify "chinese" as a class option.}{Instead, specify either "chinese-simplified" or "chinese-traditional" when you call the language within your document. No class option is needed.}} +\DeclareOption{chinese}{\ClassError{asmeconf}{Do not specify "chinese" as a class option}{Instead, specify either "chinese-simplified" or "chinese-traditional" when you call the language within your document. No class option is needed.}} % -\DeclareOption{hindi}{\ClassError{asmeconf}{Do not specify "hindi" as a class option.}{Babel does not have an ldf file for Hindi. Instead, specify "hindi" when you call the language within your document. No class option is needed.}} +\DeclareOption{hindi}{\ClassError{asmeconf}{Do not specify "hindi" as a class option}{Babel does not have an ldf file for Hindi. Instead, specify "hindi" when you call the language within your document. No class option is needed.}} % -\DeclareOption{marathi}{\ClassError{asmeconf}{Do not specify "marathi" as a class option.}{Babel does not have an ldf file for Marathi. Instead, specify "marathi" when you call the language within your document. No class option is needed.}} +\DeclareOption{marathi}{\ClassError{asmeconf}{Do not specify "marathi" as a class option}{Babel does not have an ldf file for Marathi. Instead, specify "marathi" when you call the language within your document. No class option is needed.}} % \DeclareOption{korean}{\ClassError{asmeconf}{Do not specify "korean" as class option}{Babel does not have an ldf file for Korean. Instead, specify "korean"when you call the language within your document. No class option is needed.}} % -\DeclareOption{tamil}{\ClassError{asmeconf}{Do not specify "tamil" as a class option.}{Babel does not have an ldf file for Tamil. Instead, specify "tamil" when you call the language within your document. No class option is needed.}} +\DeclareOption{tamil}{\ClassError{asmeconf}{Do not specify "tamil" as a class option}{Babel does not have an ldf file for Tamil. Instead, specify "tamil" when you call the language within your document. No class option is needed.}} %%%%%%% PDF/A Compliance Options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.pdf b/macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.pdf index 3827579635..fb724951f0 100644 Binary files a/macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.pdf and b/macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.pdf differ diff --git a/macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.tex b/macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.tex index 4377134c69..5dc8d1b90d 100644 --- a/macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.tex +++ b/macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.tex @@ -79,7 +79,7 @@ %% Class options are described above. If you are not using the languages options, remove them. -\documentclass[authorgrid,upint,subscriptcorrection,varvw,mathalfa=cal=euler,pdf-a,balance,spanish,french,greek,russian,colorlinks]{asmeconf} % <=== remove colorlinks before your *final* submission to ASME! But keep it for other purposes. +\documentclass[authorgrid,upint,subscriptcorrection,varvw,mathalfa=cal=euler,pdf-a,spanish,french,greek,russian,japanese,fontspec,colorlinks]{asmeconf} % <=== remove colorlinks before your *final* submission to ASME! But keep it for other purposes. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% Fields to be completed %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -102,8 +102,8 @@ \ConfName{Proceedings of the \texttt{asmeconf}\linebreak International Examples Congress and Exposition} \ConfAcronym{AIECE21} -\ConfDate{November 1-4, 2021} -\ConfCity{Virtual Conference, Online} +\ConfDate{January 20, 2021} +\ConfCity{Cambridge, MA} \PaperNo{AIECE2021-0003} @@ -576,28 +576,32 @@ Les causes primordiales ne nous sont point con­nues; mais elles sont assujettie La chale ur pénètre, comme la gravité, toutes les substances de l'univers, ses rayons occupent toutes les parties de l'espace. Le but de notre ouvrage est d'exposer les lois mathématiques que suit cet élé­ment. Cette théorie formera désormais une des branches les plus importantes de la physique gé­nérale~\cite{fourier1822}. \end{selectlanguage} - -\begin{selectlanguage}{spanish} -\begin{abstract*} -Este es el resumen del artículo. Escribimos en español. Se describen el problema, los métodos y los resultados. También se incluyen referencias. -\end{abstract*} -\end{selectlanguage}% edited by Aarón Montoya-Moraga -%% If you have trouble with the passages, your file may not be saved in utf-8 format. You can delete this stuff to resolve the issue. %% Examples of abstracts in other languages. The first three are intended for pdflatex, not lualatex. -\begin{selectlanguage}{greek}% -\begin{abstract*} -Αυτή είναι η περίληψη του άρθρου. Χρησιμοποιούμε την ελληνική γλώσσα. Περιγράφεται το πρόβλημα, οι μέθοδοι και τα αποτελέσματα. Περιλαμβάνονται επίσης αναφορές. -\end{abstract*} -\end{selectlanguage}% Edited by George Barbastathis - -\begin{selectlanguage}{russian} -\begin{abstract*} -Это резюме статьи. Пишем по русски. Описаны проблема, методы и результаты. Библиография также включена.% -\end{abstract*} -\end{selectlanguage}% edited by Steven Gerasimoff - +\ifpdftex + \begin{selectlanguage}{spanish} + \begin{abstract*} + Este es el resumen del artículo. Escribimos en español. Se describen el problema, los métodos y los resultados. También se incluyen referencias. + \end{abstract*} + \end{selectlanguage}% edited by Aarón Montoya-Moraga +% +% If you have trouble with the following passages, your file may not be saved in utf-8 format. You can delete this stuff to resolve the issue. +% + \begin{selectlanguage}{greek}% + \begin{abstract*} + Αυτή είναι η περίληψη του άρθρου. Χρησιμοποιούμε την ελληνική γλώσσα. Περιγράφεται το πρόβλημα, οι μέθοδοι και τα αποτελέσματα. Περιλαμβάνονται επίσης αναφορές. + \end{abstract*} + \end{selectlanguage}% Edited by George Barbastathis +% + \begin{selectlanguage}{russian} + \begin{abstract*} + Это резюме статьи. Пишем по русски. Описаны проблема, методы и результаты. Библиография также включена.% + \end{abstract*} + \end{selectlanguage}% edited by Steven Gerasimoff +% +\fi +% \iffontspecloaded % \begin{selectlanguage}{japanese} @@ -645,6 +649,3 @@ Este es el resumen del artículo. Escribimos en español. Se describen el proble \SetAffiliation{4}{Massachusetts Institute of Technology, Cambridge, MA } % Note: Luis and Maria are not real people. Henry and Catherine have been dead for >450 years. - -% To instead use the [authorgrid] option, follow the syntax in Appendix B. - diff --git a/macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.pdf b/macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.pdf index aa48eec92c..51a514f86a 100644 Binary files a/macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.pdf and b/macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.pdf differ diff --git a/macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.tex b/macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.tex index e77fb2d346..5a10b7ccd5 100644 --- a/macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.tex +++ b/macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.tex @@ -60,10 +60,10 @@ author = {John H. Lienhard, V}, title = {{\texttt{asmeconf}}: A template for {ASME} conference papers}, organization = {Comprehensive \TeX\ Archive Network}, - version = {1.22}, + version = {{\versionno}}, year = {2021}, url = {https://ctan.org/pkg/asmeconf}, - urldate = {pre-release}, + urldate = {{\today}}, } @online{bezos2020, author = {Johannes L. Braams and Javier Bezos}, diff --git a/macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.pdf b/macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.pdf index ebef2df8cb..faeba45607 100644 Binary files a/macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.pdf and b/macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.pdf differ diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/README.md b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/README.md index 086d623f8e..3443a0e554 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/README.md +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/README.md @@ -1,1184 +1,1197 @@ -Date of last change: 2020-07-21 to version v1.0v - - -# biblatex-gb7714-2015: a biblatex style package ---------------------------------------------------------- -[使用入门](#jumptotutorial) |==| [说明文档](biblatex-gb7714-2015.pdf) |==| [WIKI](https://github.com/hushidong/biblatex-gb7714-2015/wiki) - - -## Introduction - -Maintainer: huzhenzhen - -Homepage: - -ctan-pkg: - -License: LaTeX Project Public License 1.3 or later - - -A biblatex implementation of the `GB/T 7714-2015` bibliography style for Chinese users - -The biblatex-gb7714-2015 package provides an implementation of the bibliography style of the `GB/T 7714-2015` bibliography style. This implementation follows `GB/T 7714-2015` standard, and can be used simply by loading biblatex with the appropriate option - - -biblatex-gb7714-2015 宏包是中文参考文献著录/标注标准 `GB/T 7714-2015` 的 biblatex 实现。它本质上是一个样式包,提供了顺序编码制和著者年份制样式,在 tex 文档中配合 biblatex 宏包使用,以生成满足《GB/T 7714-2015 信息与文献 参考文献著录规则》要求的参考文献。除了具备 biblatex 提供的不同于传统基于 bibtex 的参考文献解决方案的特点外,还具有如下特点: - -* 较强的兼容性。能够兼容 biblatex v2.8 以上版本;能够兼容国标样式的一些常用条目类型、数据域。 - -* 较高的易用性。标注/著录格式完全由样式实现,不必为排序、多语言等问题手动处理bib文件;提供了丰富的标注(引用)命令,包括一些中文中习惯的命令;提供了多语言对照,多语言文献表等功能。 - -* 较大的灵活性。提供丰富的选项来帮助用户进行排序调整、著录项(姓名、出版项、文献标识符、标题超链接)格式调整、文献表格式(标签对齐、标签格式、条目格式、字体、段落格式)调整、编码兼容。 - -* 较好的维护性。样式代码主要是在标准样式基础上提供的中文国标解决方案,保持与标准样式一致的结构、风格和习惯,并提供详尽的注释,用户可轻松理解,并可在其基础上进一步修改以实现其它要求的样式,比如宏包附带的chinese-erj样式,就是基于本样式实现的经济学研究期刊的参考文献样式。 - -简单使用说明见:[使用入门](#jumptotutorial) - ---------------------------------------------------------- - -## Need to do: - - * special characters in all fields? - * entry without author: the delimiter between title and year? - * TEST FOR texlive 2015,2016,2017 - - -## Applications - -* [SJTUThesis(上海交通大学学位论文模板)](https://github.com/sjtug/SJTUThesis)(母校的论文模板,不得不说缘分真的很神奇) -* [fduthesis(复旦大学论文模板)](https://github.com/Stone-Zeng/fduthesis) -* [Zhejiang University thesis(浙江大学毕业设计/论文模板)](https://github.com/TheNetAdmin/zjuthesis) -* [UCASthesis(中国科学院大学学位论文模板**国科大新版标准**)](https://github.com/xiaoyao9933/UCASthesis) -* [UCASthesis(ucasthesis 国科大学位论文 LaTeX 模板 [最新样式])](https://github.com/mohuangrui/ucasthesis) -* [TongjiThesis(同济大学硕博士论文LaTeX模板)](https://github.com/marquistj13/TongjiThesis) -* [neuthesis(东北大学博士学位论文Latex模板)](https://github.com/mervin0502/neuthesis) -* [nwafuthesis(西北农林科技大学学位论文LaTeX文档类)](https://github.com/registor/nwafuthesis) -* [nudtpaper(nudt学位论文模板)](https://github.com/liubenyuan/nudtpaper) -* [ECNU-Undergraduate-LaTeX(华东师范大学本科毕业论文模板)](https://github.com/YijunYuan/ECNU-Undergraduate-LaTeX) -* [fjnu-bathesis (福建师范大学本科毕业论文LaTeX 模板)](https://github.com/fjnuer/fjnu-bathesis) -* [Thesis-Template-for-XJTU (西安交大毕业设计模板)](https://github.com/DXie123/Thesis-Template-for-XJTU) -* [CAUTemplate(中国农业大学课程论文模板)](https://github.com/Cdmium/CAUTemplate) -* [Yet anoter BUPT Thesis LaTeX class (北邮研究生学位设计的LaTeX文档类)](https://github.com/qcts33/BUPTthesis-ctex) -* [Study-LaTeX(LaTeX学习笔记)](https://github.com/Zousiyu/Study-LaTeX) -* [ElegantBook](https://github.com/ElegantLaTeX/ElegantBook) -* [《经济研究》杂志 LaTeX 论文模板)](https://github.com/EthanDeng/Chinese-ERJ) -* [...] - - -## Related Links - -* [Biblatex 宏包](https://github.com/plk/biblatex) -* [Beamer 文档类](https://github.com/josephwright/beamer) -* [biblatex 宏包中文手册 ](https://github.com/hushidong/biblatex-zh-cn) -* [biblatex 简明使用手册](https://github.com/hushidong/biblatex-solution-to-latex-bibliography) -* [biblatex-tutorial 摘译](https://github.com/hushidong/biblatex-tutorial-cn) -* [biblatex-map bib文件修改工具](https://github.com/hushidong/biblatex-map/) -* [biblatex-check bib文件检查工具](https://github.com/Pezmc/BibLatex-Check) -* [biblatex-caspervector: caspervector 设计的中文参考文献样式](https://github.com/CasperVector/biblatex-caspervector) -* [gbt7714-bibtex-style: GB/T7714-2015 标准的bst实现版本](https://github.com/zepinglee/gbt7714-bibtex-style) -* [LaTeX学习网站](http://www.latexstudio.net/) -* [LaTeX交流论坛](http://www.ctex.org/) - ---------------------------------------------------------- - -

Tutorial/使用入门

-[//]: # "这里这种方式不适合可能主要是因为标题所导致,因此用上面的方式进行处理" - - -

0. pacakge usage/宏包加载方式

-样式包配合biblatex使用,即在biblatex调用时加载样式包: - -* 使用顺序编码制: - -``` - \usepackage[backend=biber,style=gb7714-2015]{biblatex} -``` - -* 使用著者-出版年制: - -``` - \usepackage[backend=biber,style=gb7714-2015ay]{biblatex} -``` - -* 使用宏包提供的选项: - -``` - %设置gbalign选项以改变文献表序号标签对齐方式, - %设置gbpub=false取消缺省出版项自填补信息,比如: - \usepackage[backend=biber,style=gb7714-2015,gbalign=gb7714-2015,gbpub=false]{biblatex} -``` - -* 使用同一文献表中不同语言区分著录格式的样式(gb7714-2015ms): - -``` - %设置gbstyle=false,中文文献使用GB/T 7714-2015著录格式,而其它语言文献使用biblatex标准样式 - \usepackage[backend=biber,style=gb7714-2015ms,gbstyle=false]{biblatex} -``` - -* 同一文档中不同文献分节区分不同著录格式的样式(gb7714-2015mx): - -``` - %gb7714-2015mx默认使用顺序编码制样式 - \usepackage[backend=biber,style=gb7714-2015mx]{biblatex} - %如需在某一参考文件分节使用著者年份制样式,比如第2个refsection中使用时,则在导言区设置: - \setaystylesection{2} -``` - -更多宏包选项的说明见:[biblatex-gb7714-2015.pdf](biblatex-gb7714-2015.pdf) - -宏包加载的完整文档示例见:[tex文档一般结构](#jumptotexsrcf) - -

1. Tex source file/tex文档一般结构

-注意其中加载biblatex宏包的代码: - -``` -\documentclass{article}%文档类%导言区开始: - -\usepackage{ctex}%加载ctex宏包,中文支持 - -\usepackage[left=20mm,right=20mm,top=25mm, bottom=15mm]{geometry}%加载geometry宏包,定义版面 - -\usepackage[colorlinks=true,pdfstartview=FitH,% -linkcolor=blue,anchorcolor=violet,citecolor=magenta]{hyperref}%加载hyperref宏包,使用超链接 - -\usepackage[backend=biber,bibstyle=gb7714-2015,%nature,%%加载biblatex宏包,使用参考文献 -citestyle=gb7714-2015%,backref=true%%其中后端backend使用biber -]{biblatex}%标注(引用)样式citestyle,著录样式bibstyle都采用gb7714-2015样式 - -\usepackage{filecontents} -\begin{filecontents}{egbibdata.bib} -@Book{Peebles2001-100-100, - Title = {Probability, random variable, and random signal Principles and \LaTeX{}}, - Address = {New York}, - Author = {von Peebles, Jr., P. Z.}, - Edition = {4}, - Pages = {100}, - Publisher = {McGraw-Hill}, - Year = {2001} -} - -@Book{蔡敏2006--, - Title = {UML基础和Rose建模教程},27 - Address = {北京}, - Author = {蔡敏 and 徐慧慧 and 黄柄强}, - Publisher = {人民邮电出版社}, - Year = {2006}, - Month = {1} -} -\end{filecontents} - -\addbibresource[location=local]{egbibdata.bib}%biblatex宏包的参考文献数据源加载方式 - -\begin{document}%正文区开始: - -%正文内容,引用参考文献 - -1. 不带页码的引用(顺序编码制上标,方括号包围;作者年制行内,括号包围):\\ - 见文献\cite{Peebles2001-100-100}\\ - 见文献\upcite{Peebles2001-100-100}\\ - 见文献\supercite{Peebles2001-100-100} - -2. 不带页码的引用(顺序编码制非上标,方括号包围;作者年制行内,括号包围):\\ - 见文献\parencite{Peebles2001-100-100} - -3. 带页码的引用(标准命令,默认样式; 增加命令,GB/T 7714-2015样式):\\ - 见文献\cite[见][49页]{蔡敏2006--}\\ - 见文献\parencite[见][49页]{Peebles2001-100-100}\\ - 见文献\pagescite{Peebles2001-100-100}\\ - 见文献\pagescite[201-301]{Peebles2001-100-100} - -4. 顺序编码制中同时输出作者和顺序编码标签,比如:\\ - 见\citeauthor{蔡敏2006--}\cite{蔡敏2006--}\\ - 见\authornu*mcite{蔡敏2006--}\\ - 见\textcite{蔡敏2006--} (顺序编码标签不上标) - -5. 作者年制文中已有作者还需要年份和页码(顺序编码制与pagescite作用相同,作者年制年份行内页码上标):\\ - 见蔡敏\yearpagescite[][205]{蔡敏2006--}和Peebles\yearpagescite[][15]{Peebles2001-100-100} - -6. 作者年制文中已有作者只需要年份(顺序编码制与pagescite作用相同,作者年制年份行内):\\ - 见赵耀东\yearcite{蔡敏2006--}\\ - 见赵耀东(\cite*{蔡敏2006--})\\ - 见赵耀东(\citeyear{蔡敏2006--}) - -7. 作者年制中由标注命令给出作者年份信息,作者以主语方式作为正文内容:\\ - 见\textcite{蔡敏2006--} - -8. 在页脚中引用和打印文献表:\\ - 见文献\footnote{在脚注中引用\footcite{蔡敏2006--}}\\ - 见文献\footfullcite{蔡敏2006--} - - -%打印参考文献表 - \printbibliography[heading=bibliography,title=参考文献] -\end{document} -``` - -### 2. Compile method/文档编译方式 - -``` - xelatex jobname.tex - biber jobname - xelatex jobname.tex - xelatex jobname.tex -``` - -或者 - -``` - latexmk -xelatex jobname.tex -``` - -编译引擎使用lualatex也是可以的,只要该引擎编译时ctex宏包能够正确支持中文。 - - -### 3. Recommended environment/推荐使用环境 - -- Texlive+Winedt -- Texlive+Texstudio -- texlive及其它发行版安装见[安装指南](https://github.com/sjtug/SJTUThesis/wiki/%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97) - - -### 4. Common questions/常见问题 - -#### 4.1 Installation and use/安装和使用 - -* 怎么利用biblatex生成国标GB/T 7714-2015格式的参考文献表? - -(1)在导言区加载biblatex宏包,并使用gb7714-2015样式: - -``` \usepackage[backend=biber,style=gb7714-2015]{biblatex}``` - -(2)正文中引用参考文献: - -``` 见文献\cite{referencbibtexkey}``` - -(3)在需要的地方打印参考文献表: - -```\printbibliography``` -更直接的例子见前述的[tex源文档](#jumptotexsrcf) - - - - -* 请问我应该怎么安装和更新biblatex-gb7714-2015宏包? - - -biblatex-gb7714-2015宏包是基于biblatex的样式宏包,目前texlive,miktex都已收录,因此可以直接使用,一般不需要安装。 - -如果使用时,系统提示找不gb7714-2015.bbx或gb7714-2015ay.bbx文件的错误,说明当前tex系统未安装biblatex-gb7714-2015样式包,这时需要安装它。 - -最简单的方法是从本项目源码中下载 gb7714-2015.bbx, gb7714-2015ay.bbx, gb7714-2015.cbx, gb7714-2015ay.cbx 四个文件放到你要编译的主文档所在目录,如果需要使用gbk编码,则还需复制 gb7714-2015-gbk.def 文件。对于已经安装的用户需要更新到最新版,也可以下载这些文件替换系统已经安装的文件。 - - - -* 请问使用时biblatex-gb7714-2015宏包时出现错误“ Package xkeyval Error: gb****** ' undefined in families blx@opt@pre'. [\blx@processoptions] ”? - - - -因为宏包的功能不断增加和完善,当在tex源文档中,使用新版中的一些选项时,而系统中的biblatex-gb7714-2015宏包是旧版时,就会出现`gb****`选项未定义的错误。解决方法就是更新biblatex-gb7714-2015宏包。更新方法见上一个问题。 - - - -* 为什么我之前使用样式`style=caspervector`进行编译没有问题,换成`style=gb7714-2015`后,编译就出现错误? - -可能有三个原因: - -(1) 辅助文件没有清理导致,当采用caspervector样式时编译产生的辅助文件中可能带有该样式的一些特有信息,由此产生一些不兼容。因此需要的操作是,清除辅助文件,然后再进行编译。清除命令为(下面的命令是windows下的,linux下的是类似的只需把删除命令换成`rm -f`): - -```del /q *.aux *.bbl *.blg *.log *.out *.toc *.bcf *.xml *.synctex *.nlo *.nls *.bak *.ind *.idx *.ilg *.lof *.lot *.ent-x *.tmp *.ltx *.los *.lol *.loc *.listing *.gz *.synctex(busy) *.nav *.snm *.vrb *.fls *.xdv *.fdb_latexmk``` - -(2) biblatex-gb7714-2015 版本过于陈旧,旧版本对于一些特殊情况可能考虑不全面。因此需要的操作是更新biblatex-gb7714-2015,方法见上一个问题。 - -(3) 编译命令问题,通常情况下tex文档和bib文档是utf8编码的,因此最好采用xelatex编译,而不用pdflatex。因此如果编译时用pdflatex出现错误,请换成xelatex。 - - -* 为什么我编译文档后没有出现参考文献表? - -当编译过程出现错误时,那么检查错误的原因,并解决它。 -当编译过程没有出现错误,那么很有可能是没有采用正确的命令进行文献编译,比如采用了传统的bibtex而不是biber。那么采用正确的编译命令重新编译即可: -``` -xelatex jobname.tex -biber jobname -xelatex jobname.tex -``` - - -* 为什么利用 ctex2.9 套装进行编译时,出现错误? - - -由于ctex2.9套装多年未更新,其中的biblatex宏包过于陈旧,所以需要更新 biblatex。 - - - -* 请问除了利用xelatex进行编译外,能不能用pdflatex进行编译? - - -能用pdflatex进行编译。但要注意的是因为某些样式比如authoryear等使用了xstring宏包中的一些命令,所以会产生错误,但numeric类样式通常没有问题。这一问题在biblatex更新到3.12版本后取消xstring宏包后得以解决。 - -中文用户需要注意一些编码的问题: - -utf-8编码的文档,采用xelatex编译没有任何注意事项,但使用pdflatex编译时,需要给ctex宏包加载UTF8选项,比如`\usepackage[UTF8]{ctex}`或者在文档类加载时给出也可以比如`\documentclass[[UTF8]{article}`,同时引用文献时使用的引用关键词应使用英文。 - -当文档使用其他编码时,xelatex编译通常需要指定一个文档编码,比如windows环境下的GB2312编码的文档需要指定`\XeTeXinputencoding "GBK"`, 否则显示乱码。使用pdflatex进行编译,如果biblatex不能正确的处理编码问题,那么需要为其明确的指定texencoding和bibencoding选项。比如windows环境下的GB2312编码的文档,需要指定`\usepackge[texencoding=GBK]{biblatex}`。 - - -* 请问使用backref=true选项后,某个反向超链接总是链接到封面页是怎么回事? - - -对页码进行正确超链接需要一个前提是,当前链接的页码是唯一的。当有两页具有相同的页码时,超链接总是链接到第一各具有该页码的页面上。比如封面页页码是1,正文第一页页码也是1,那么到正文第一页的反向超链接总会链接到封面页上。解决该问题就是要解决页码的唯一性问题。当页码的表示形式不是同一种时,那么也会得到正确的区分。比如封面页用罗马字母I表示,而正文第一页用阿拉伯数字1表示,那么就能得到正确的反向超链接。类似于: - -``` -\pagenumbering{roman} -\title{title} -\maketitle -\clearpage - -\pagenumbering{arabic} -\section{文献表} -``` - - -* 我希望参考文献表中的文献不是按引用顺序而是以文献作者的字母顺序排序,怎么实现? - - -一般情况下文献表是按引用顺序进行排列,标签是顺序的数字,这种方式称为顺序编码制。 -如果要以文献作者字母顺序排列,那么可以换一种编制方式,称为作者年制: - -```\usepackage[backend=biber,style=gb7714-2015ay]{biblatex}``` - -如果要求使用顺序编码制文献表,又要以文献作者字母顺序排列,那么可以增加排序选项`sorting=nyt`,意为按照姓名、年份、标题的字母顺序进行排序: - -```\usepackage[backend=biber,style=gb7714-2015,sorting=nyt]{biblatex}``` - - - -* 作者年制中英文文献能按字母顺序排列,那么中文文献能否以拼音或者笔画进行排序呢? - - -能,有两种方式实现: - -(1)通过编译时给biber设置选项来实现: - -``` -%按拼音排序,biber命令 -biber -l zh__pinyin jobname -%按笔画排序,biber命令 -biber -l zh__stroke jobname -``` - -(2)通过增加 biblatex 选项来实现(此时biber编译无需另加选项),比如: - -```\usepackage[backend=biber,style=gb7714-2015ay,sortlocale=zh__pinyin]{biblatex}``` - - - -* 作者年制参考文献表目前的排序时升序排列,能不能改成降序排序? - - -能,通过修改sorting选项实现: - - -```\usepackage[backend=biber,style=gb7714-2015ay,sorting=gbnytd]{biblatex}``` - -可用的选项值包括: -``` -nty 按照姓名、标题、年份排序。 -nyt 按照姓名、年份、标题排序。 -nyvt 按照姓名、年份、卷数、标题排序。 -anyt 按照字母标签、姓名、年份、标题排序。 -anyvt 按照字母标签、姓名、年份、卷数、标题排序。 -ynt 按照年份、姓名、标题排序。 -ydnt 按照年份(降序)、姓名、标题排序。 -none 不进行排序。所有的条目按照引用顺序处理。 -gb7714-2015 以语言、作者、年份、标题、升序排列 -gbnytd 以语言、作者、年份、标题、降序排列 -gbynta 以语言、年份、作者、标题、升序排列 -gbyntd 以语言、年份、作者、标题、降序排列 -``` - -* 如果我还希望顺序编码的文献著录表以拼音排序,请问该怎么操作? - -顺序编码文献著录表默认是按引用顺序排序,但可以通过设置sorting选项进行调整,比如sorting=nyt表示按作者姓名年份以及文献标题进行排序。要使中文能按拼音排序,可以设置本地化排序调整方案,即sortlocale选项,比如: - -```\usepackage[backend=biber,citestyle=gb7714-2015ay,bibstyle=gb7714-2015,sorting=nyt,sortlocale=zh__pinyin]{biblatex}``` - - - - - -* 我希望文献表以阿拉伯数字编号,而正文中的引用标签使用作者和年份标注而不是数字,请问我该如何处理? - -可以设置不同的标注和著录样式,比如标注样式用作者年制,而著录样式用顺序编码制,比如: - -```\usepackage[backend=biber,citestyle=gb7714-2015ay,bibstyle=gb7714-2015]{biblatex}``` - -参见:[issue:参考文献的顺序](https://github.com/sjtug/SJTUThesis/issues/300) - - - - - - -​ -* 请问如果参考文献中存在一些特殊字符比如&或者一些特殊命令比如\LaTex{}等,是不是会出现问题? - - -通常不会出现问题,直接输入即可,当出现问题时可以手动调整比如修改为`\&`和`{\LaTex{}}` - - - -* 如果希望在参考文献中直接使用一些unicode字符比如希腊字母等而不想用数学环境中的命令,请问该怎么处理? - - -直接显示希腊字母等unicode字符需要字体的支持,比如CMU Serif等,可以在整个文档全局使用该字体,也可以仅在文献表中使用该字体,比如: - -``` -{ -\newcommand{\ftcmu}{\fontspec{CMU Serif}\selectfont} -\renewcommand{\bibfont}{\ftcmu}%设置英文字体不影响中文字体 -\printbibliography -} -``` - -当然字体设置需要fontspec宏包的支持。 - - - -* 如何修改参考文献文献表的垂直间距(竖直间距)? - -设置如下尺寸即可 - -``` -% 间距的控制 -\setlength{\bibitemsep}{0ex} -\setlength{\bibnamesep}{0ex} -\setlength{\bibinitsep}{0ex} - -``` -其中itemsep设置各条文献之间的间隔,一般够用,后面两个常在西文中使用。具体意义参考biblatex-zh-cn - - - -* 如何修参考文献表的缩进? - -对于著者-出版年制文献表,设置如下尺寸即可: -``` -% 文献表中各条文献的缩进控制 -\setlength{\bibitemindent}{0em} % bibitemindent表示一条文献中第一行相对后面各行的缩进 -\setlength{\bibhang}{0pt} % 著者-出版年制中 bibhang 表示的各行起始位置到页边的距离 -``` - -对于顺序编码制文献表,可以采用如下方法: - -由于顺序编码制存在数字标签,且其宽度与参考文献数量相关的,在biblatex中这个宽度是一个动态变量,不是提前设定的,而是在文献表生成时给出,所以设定缩进需要更复杂的操作。 - -对于采用list环境的文献表,即设置gbalign=left、right、center时,那么需要修改文献表环境来设定缩进,比如: - -``` -%调整顺序标签与文献内容的间距 -\setlength{\biblabelsep}{2mm} -%修改对齐环境-使不缩进 -\defbibenvironment{bibliography} - {\list - {\printtext[labelnumberwidth]{% - \printfield{labelprefix}% - \printfield{labelnumber}}} - {%这里是所做的调整,通过设置\bibitemindent,\bibhang调整缩进 - \addtolength{\bibitemindent}{\labelnumberwidth}% - \addtolength{\bibitemindent}{\biblabelsep}% - \addtolength{\bibhang}{-\labelnumberwidth} % - \addtolength{\bibhang}{-\biblabelsep}% - %以下是默认的设置 - \setlength{\labelwidth}{\labelnumberwidth}% - \setlength{\labelsep}{\biblabelsep}% - \setlength{\leftmargin}{\bibhang}% - \addtolength{\leftmargin}{\labelnumberwidth}% - \setlength{\itemindent}{\bibitemindent}% - \setlength{\itemsep}{\bibitemsep}% - \setlength{\parsep}{\bibparsep}}% - \renewcommand*{\makelabel}[1]{\hss##1}} - {\endlist} - {\item} -``` - -对于不采用list环境的文献表,即设置gbalign=gb7714-2015时,可以采用如下设定: - -``` -%调整顺序标签与文献内容的间距 -\setlength{\biblabelsep}{2mm} -%修改对齐环境-使不缩进 -\renewcommand{\itemcmd}{% -\settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}} -%%这里是所做的调整,以下两句通过调整\lengthid来调整缩进 -\setlength{\lengthid}{0pt} -\addtolength{\lengthid}{-\biblabelsep} -%如下是默认设置 -\addtolength{\lengthid}{\biblabelsep} -\setlength{\lengthlw}{\textwidth} -\addtolength{\lengthlw}{-\lengthid} -\addvspace{\bibitemsep}%恢复\bibitemsep的作用 -%\parshape 2 0em \textwidth \lengthid \lengthlw -\hangindent\lengthid -\mkgbnumlabel{\printfield{labelnumber}}% -\hspace{\biblabelsep}} -``` - -示例见:https://github.com/hushidong/biblatex-gb7714-2015/issues/62 - - - - -* 如何修改参考文献表的字体字号? - -通过修改如下命令实现 - -``` -% 字体的控制: \textit, sl, emph-楷体, \textbf, sf-黑体, \texttt-仿宋, \textsc, md, up-宋体 -% 全局字体 -\renewcommand{\bibfont}{\zihao{-5}}%\fangsong -% 题名字体 -\renewcommand{\bibauthorfont}{\bfseries\color{teal}}% -\renewcommand{\bibtitlefont}{\ttfamily\color{blue}}% -\renewcommand{\bibpubfont}{\itshape\color{violet}}% -% url和doi字体 -\def\UrlFont{\ttfamily} %\urlstyle{sf} %\def\UrlFont{\bfseries} -``` - -​ -* 我习惯用传统的bst文件来生成参考文献,有没有GB/T 7714-2015标准的实现版本? - - -GB/T 7714-2015标准实现的bst版本,已经由[zeping lee](https://github.com/zepinglee/gbt7714-bibtex-style)开发完毕,直接使用即可。 - - - -* 我在使用过程中遇到了一些无法理解和无法解决的问题,怎么办? - - -请邮件联系hzzmail@163.com或在项目内发issue提问即可。 - - -#### 4.2 Bibliography format/文献表著录格式 - -* 请问可以在参考文献表中实现类似于word那样的与文献内容等间距标签对齐格式么? - - -可以,latex的列表通常用list来实现,因此一般列表的内容都是对齐的, -此时如果标签右对齐的,那么标签和内容等间距,但标签左侧是不对齐的。 -如果标签是左对齐的,那么标签和内容的间距不相等。 -如果要求标签左侧对齐,且标签与内容等间距必须放弃使用list。 -biblatex-7714-2015的顺序编码制样式特别设计了这样的环境,以保持和word一致。通过设置选项gbalign来实现: - -```\usepackage[backend=biber,bibstyle=gb7714-2015,gbalign=gb7714-2015]{biblatex}``` - - - -* 如果不希望在参考文献表中出现类似“出版地不详”“出版者不详”等信息时,请问该怎么处理? - - -设置选项gbpub可以实现,当gbpub=false时,biblatex-gb7714-2015宏包会放弃国标的要求,不使用“出版地不详”等补充信息: - -```\usepackage[backend=biber,bibstyle=gb7714-2015,gbpub=false]{biblatex}``` - - -​ -* 我觉得文献表中英文作者全部用大写不好看,请问能换一种大小写方式么? - - -能,通过设置gbnamefmt可以实现,默认情况下gbnamefmt=uppercase,作者姓名字母全部大写。 -当设置gbnamefmt=lowercase时,biblatex-gb7714-2015宏包对于bib文件中的作者姓名的大小写不做改变, -这时可以在bib文件中手动设置想要的大小写方式。 -当要实现类似ZHAO Yu-xin这样的拼音方式,则可以设置gbnamefmt=pinyin: - -```\usepackage[backend=biber,bibstyle=gb7714-2015,gbnamefmt=lowercase]{biblatex}``` - - - -* 如果不希望在参考文献表中出现类似“[M]”“[J]”等文献类型标识符时,请问该怎么处理? - - -可通过设置选项gbtype=false实现: - -```\usepackage[backend=biber,bibstyle=gb7714-2015,gbtype=false]{biblatex}``` - - - -* 如果不希望在参考文献表中出现网址信息时,请问该怎么处理? - - -可通过设置选项url=false实现: - -```\usepackage[backend=biber,bibstyle=gb7714-2015,url=false]{biblatex}``` - - - -* 如果不希望在参考文献表中出现DOI信息时,请问该怎么处理? - - -可通过设置选项doi=false实现: - -```\usepackage[backend=biber,bibstyle=gb7714-2015,doi=false]{biblatex}``` - - - -* 如果对当前文献中的url或doi显示效果(包括间距和断行)不满意,能否进行调整? - - -能,可以通过设置三个计数器的值来调整,取值范围0到9999,计数器的值越大则越容易在相应的内容后断行: - -``` -\setcounter{biburlnumpenalty}{100}%大于0允许在数字后面断行 -\setcounter{biburlucpenalty}{100}%大于0允许在大写字母后面断行 -\setcounter{biburllcpenalty}{100}%大于0允许在小写字母后面断行 - -``` - - -​ -* 当参考文献没有作者时,希望用佚名或Anon代替作者时,请问该怎么处理? - - -可通过设置选项gbnoauthor=true实现,注意该处理主要用在作者年制中: - -```\usepackage[backend=biber,bibstyle=gb7714-2015,gbnoauthor=true]{biblatex}``` - - - -* 如果希望参考文献表中文献作者数量超过国标规定的3个时,请问该怎么处理? - - -可通过设置选项maxbibnames,minbibnames实现,比如下面的设置用于显示5个作者: - -```\usepackage[backend=biber,bibstyle=gb7714-2015,maxbibnames=5,minbibnames=5]{biblatex}``` - - -* 请问如何将作者之间的分隔符调整为and而不是用逗号? - - -可以通过重设两个分隔符来实现,分别是multinamedelim和finalnamedelim。低版本的biblatex直接重定义命令`\multinamedelim`和`\finalnamedelim`,高版本的biblatex可以使用分隔符环境,这样可以在标注、文献表等不同位置直接使用不同的分隔符,而不像低版本biblatex那样只能在不同的位置修改局部定义。比如: - -``` -\DeclareDelimFormat[bib]{multinamedelim}{\addspace and \addspace} -\DeclareDelimFormat[bib]{finalnamedelim}{\addspace and \addspace} -\DeclareDelimFormat[cite]{multinamedelim}{\addcomma\addspace} -\DeclareDelimFormat[cite]{finalnamedelim}{\addcomma\addspace} -``` - - -​ -* 请问如何使文献表中文献标题的是句首字母大写而其它所有字母均小写? - - -默认情况下,biblatex-gb7714-2015仅对标题首字母做调整,使其变成为大写,而其他字母大小写不做处理,因此要得到想要的字母大小写格式,需要在bib文件输入参考文献信息时给出需要的除首字母外的其它字母的大小写格式。 - -若有特殊情况,需要首字母为小写,可采用如下两种方法: - -(1)根据字符大小写更换命令比如 - -`{\MakeLowercase i}FogSim title contents` - -(2)修改titlecase域格式,即将如下命令放到导言区中,放biblatex后面 - -``` -\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{% -\iffieldundef{url}{#1}{% -\href{\thefield{url}}{#1}}}{#1}}%重设标题格式,将去除首字母大写 -``` - -​ -* 请问如何使文献表中的期刊名是单词首字母大写的? - - -默认情况下,biblatex-gb7714-2015不对期刊名的字母大小写做处理, -因此需要在bib文件输入参考文献信息时给出需要的大小写格式。 - - -​ -* 我想得到中英文对照的双语参考文献,请问该如何处理? - - -biblatex-gb7714-2015设计了两种多语言对照参考文献的实现方式, -一种是利用条目集的概念,另一种是利用关联条目的概念。 -因此有两种方法: - -(1)方法一,动态定义条目集: -在导言区或正文中定义: -```\defbibentryset{易仕和,等,2013}{易仕和2013--,Yi2013--}``` - -在正文中引用: -```双语文献引用\cite{易仕和,等,2013}``` - -(2)方法二,动态定义关联条目: -在导言区定义: -```\defdoublelangentry{易仕和2013--}{Yi2013--}``` - -在正文中引用: -```双语文献引用\cite{易仕和2013--}``` - - - - -* 我想修改文献条目的日期项诸如格式,请问该如何处理? - -参考文献中日期格式主要有四种修改方式: -(1) 利用biblatex选项全局的修改日期格式 -(2) 修改日期输出宏,使根据条目类型输出不同的日期格式 -(3) 修改日期输出宏,使根据具体条目输出不同的日期格式 -(4) 修改参考文献信息,使当前条目原样输出需要的格式 - -具体示例见:[biblatex中如何修改参考文献中日期的著录格式](https://blog.csdn.net/xenonhu/article/details/86933525) - - -​ -#### 4.3 Citation format/正文引用的标注格式 - -* 我希望在正文中同时使用上标和非上标的引用标签,请问该怎么操作? - - -可以使用不同的命令来实现上标和非上标的标签, -上标标签的命令为`\cite{bibtexkey}` ,非上标标签的命令为 `\parencite{bibtexkey}`。 -当希望上标的标签也给出国标要求的页码时,则可以使用`\cite[50-55]{bibtexkey}`、`\pagescite[50-55]{bibtexkey}`给出指定页码 或者`\pagescite{bibtexkey}` 直接使用bib文件中的页码。 - - -​ -* 我在引用文献时已经给出作者信息,希望引用标签仅包含年份和页码信息或者仅包含年份信息时,该怎么操作? - - - 需要给出年份的标签是作者年制的标签,可以使用命令`\yearpagescite{bibtexkey}`给出包含年份和页码信息的标签, - 使用命令`\yearcite{bibtexkey}`给出仅包含年份的标签。 - - - -* 在使用作者年制时,我希望文献表是按作者年份标题排序,而正文某处一个cite命令引用多个参考文献,且这些文献的标签是按年份作者标题排序,该怎么操作? - - - 有两种方法: - -(1) 一是自动排序 - - 宏包加载时使用: - -```\usepackage[backend=biber,style=gb7714-2015ay,sortcites,sorting=ynt]{biblatex}``` - - 正文中引用: - -```\cite{refa2010,refb2008,refc2009}``` - - 然后在文献打印前加 - -```\newrefcontext[sorting=nyt]``` - -(2) 二是手动给出排序 - - 宏包加载时使用 - -```\usepackage[backend=biber,style=gb7714-2015ay]{biblatex}``` - - 引用多个文献时按照年份顺序给出引用关键字,即正文中引用: - -```\cite{refb2008,refc2009,refa2010}``` - - 参考:[issue:citation的顺序和bibliography的顺序如何不关联](https://github.com/hushidong/biblatex-gb7714-2015/issues/30) - - - -* 在使用作者年制时,我希望文献表同一位置引用同一作者的不同的文献实现作者姓名的压缩,该怎么操作? - -可以通过将gb7714-2015ay.cbx 中的引用的基础样式authoryear更换成authoryear-comp。 - - -​ -* 请问希望正文中作者年制的标注(引用)标签中作者数量超过国标规定的1个时,该怎么处理? - - -可通过设置选项maxcitenames,mincitenames实现,比如下面的设置用于显示5个作者: - -```\usepackage[backend=biber,style=gb7714-2015ay,maxcitenames=5,mincitenames=5]{biblatex}``` - - - -* 请问希望正文中作者年制的标注(引用)标签中作者数量只能是1个,而不管是否存在歧义时,该怎么处理? - - -可通过设置选项uniquelist=false实现,该设置标签中的作者只会是指定的1个: - -```\usepackage[backend=biber,style=gb7714-2015ay,uniquelist=false]{biblatex}``` - - - -* 请问希望正文中作者年制的标注(引用)标签中作者数量只能是1个,且只用其作者的姓而不管是否存在歧义时,该怎么处理? - - -可通过设置选项uniquelist=false, uniquename=false实现,该设置标签中的作者只会是指定的1个且只用该作者的姓: - -```\usepackage[backend=biber,style=gb7714-2015ay,uniquelist=false,uniquename=false]{biblatex}``` - - - - -* 请问上标的标注(引用)标签过长导致行溢出,该怎么处理? - - -上标的标注与行内的标注不一样,因此采用了上标的处理,所以上标的标注无法自动断行,因此在页边附近的长标注很有可能会溢出。由于上标标注的断行国标中并没有什么明确要求和说明,因此只能按照自己的方式进行处理,通常是将一个长标注手动分成两个短的标注,比如将: - -```\cite{key1,key2,key3,key4,key5,key6,key7}``` - -变换成: - -```\cite{key1,key2,key3}\linebreak\cite{key4,key5,key6,key7}``` - -如果两个cite之间还需要增加一个上标的逗号,那么可以手动处理比如增加`\textsuperscript{,}` - - - -* 在顺序编码制标签中,希望数字编码从两个连续编码就开始压缩,比如[1,2]压缩成[1-2],该怎么处理? - - -biblatex中处理顺序数字编码压缩的代码默认从3个连续编码开始压缩,比如[1,2,3]压缩成[1-3]。如果要修改为从2个连续编码开始压缩,只需要做一个很简单的修改即可: - -``` -%该宏的目的是抛弃压缩内部的编号,而仅输出最后一个编号,主要通过cbx@tempcnta来控制 -%一般情况下cbx@tempcnta为0,所以该宏不输出任何内容。当cbx@tempcnta在cite:comp:comp宏中更改变大后 -%说明开始进入需要压缩的范围,当到压缩终点时,cbx@tempcnta必然大于1,则输出内容。 -%修改第二行的数字1为0即可将默认的3个开始压缩变为2个开始压缩。 -\renewbibmacro*{cite:dump}{ - \ifnumgreater{\value{cbx@tempcnta}}{0} - {\ifnumgreater{\value{cbx@tempcnta}}{1}%1改为0,可以将压缩起始3个编号改为2个编号 - {\bibrangedash} - {\multicitedelim}% - \bibhyperref[\cbx@lastkey]{% - \ifdef\cbx@lastprefix - {\printtext[labelprefix]{\cbx@lastprefix}} - {}% - \printtext[labelnumber]{\cbx@lastnumber}}} - {}% - \setcounter{cbx@tempcnta}{0}% - \global\undef\cbx@lastprefix} -``` - -反之,从两个开始压缩改成3个连续压缩,方法是类似的,就是将中的0改回1。 - - - -* 在正文中的某一部分,希望取消顺序编码标签中的压缩,而其他部分保持这种压缩,该怎么处理? - - -顺序数字编码压缩的代码,主要有cite:comp:comp宏控制,因此需要局部取消压缩,可以局部的修改该宏。修改很简单,只需要注释掉其中的一行,在需要取消压缩的环境中,重定义该宏,比如: - -``` -\renewbibmacro*{cite:comp:comp}{% - \ifboolexpr{ - ( test {\iffieldundef{labelprefix}} and test {\ifundef\cbx@lastprefix} ) - or - test {\iffieldequals{labelprefix}{\cbx@lastprefix}} - } - {\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}} - {\savefield{entrykey}{\cbx@lastkey}% - \savefield{labelnumber}{\cbx@lastnumber}% - \addtocounter{cbx@tempcnta}{1}} - {\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}-1} - {} - {\usebibmacro{cite:dump}% - \ifnumgreater{\value{cbx@tempcntb}}{-1} - {\multicitedelim} - {}% - \printtext[bibhyperref]{% - \printfield{labelprefix}% - \printfield{labelnumber}}}}} - {\usebibmacro{cite:comp:end}}% - %\setcounter{cbx@tempcntb}{\thefield{labelnumber}}%%注释该行,以取消压缩 - \savefield{labelprefix}{\cbx@lastprefix}} -``` - - -​ -### 5. Examples/著录和标注结果示例 - -* 顺序编码制 - -![示例a](example/fig-style-numeric.png) - -* 作者年制 - -![示例b](example/fig-style-authoryear.png) - - -* 姓名的格式更改 - -对于bib文件中的如下条目,有: - -``` - @Article{Zhang2007-500-503, - Title = {The design and experimental investigations of supersonic length shorted nozzle}, - Author = {Zhang, Min-li and Yi, Shi-he and Zhao, Yu-xin}, - Journal = {ACTA AERODYNAMICA SINICA}, - Number = {4}, - Pages = {500-503}, - Volume = {25}, - Year = {2007} - } - - @Book{Yi2013--, - Title = {Supersonic and hypersonic nozzle design}, - Address = {Beijing}, - Author = {Yi, Shi he and Zhao, Yu xin and He, Lin and Zhang, Min li}, - Publisher = {National Defense Industry Press}, - Year = {2013} - } - - @Book{LIAO2012--, - Title = {Electronic countermeasure techniques for missile penetration}, - Address = {Beijing}, - Author = {LIAO, ping and JIANG, qin bo}, - Publisher = {National Defense Industry Press}, - Year = {2013} - } - - @Book{LIU2003--, - Title = {Introduction of Ballistic Misille Techniques}, - Address = {Beijing}, - Author = {LIU, shi Qiu}, - Publisher = {China Astronautic Publishing House}, - Year = {2003} - } -``` -![示例c](example/fig-nameformat.png) - - - ---------------------------------------------------------- - - -## Usage -* for numerical sequence style: gb7714-2015 - - `\usepackage[backend=biber,style=gb7714-2015]{biblatex}` - - - add an option `gbalign` to control the align style of the numerical label: - - `gbalign=right` for the label ragged left in a list environment, this is the default setting. - - `gbalign=center` for the same width label in a list environment with the number centered in a wrapper like bracket [] - - `gbalign=left` for the label ragged right in list environment - - `gbalign=gb7714-2015` for the label in paragraph with same separation space between label and content of the reference entry - - `\usepackage[backend=biber,style=gb7714-2015,gbalign=gb7714-2015]{biblatex}` - - - add an option `gbpub` for dealing publishing items (This option is also for author-year style): - - `gbpub = true` for gb7714 style, to print `[出版者不详]` and the like when publisher or address is absent, this is the default setting. - - `gbpub = false` for standard style, not to print the additional infomation. - - `\usepackage[backend=biber,style=gb7714-2015,gbpub=true]{biblatex}` - - - add an option `gbnamefmt` for dealing author name's letter case (This option is also for author-year style): - - `gbnamefmt = uppercase` for gb7714 style, to capitalize all the letters of the name, like: ZHANG M L, this is the default setting. - - `gbnamefmt = lowercase` for gb7714 style, do no case switch of the name, like: Zhang M L - - `gbnamefmt = givenahead` for standard style, given-family style, like: M. L. Zhang as the ieee style - - `gbnamefmt = familyahead` for standard style, family-given style, like: Zhang, M. L. as the apa style. - - `gbnamefmt = pinyin` for a common Chinese style, like: ZHANG Min-li, YI Shi-he and so on. - - `gbnamefmt = reserveorder` for standard style:family-given/given-family style - - the name format can be set per-entry using a field `nameformat`, add this field like `nameformat={pinyin}` to an entry in the bib file to set the entry's name format. - - `\usepackage[backend=biber,style=gb7714-2015,gbnamefmt=uppercase]{biblatex}` - - - add an option `gbbiblabel` to control the format of the numerical label: - - `gbbiblabel=bracket` for the numerical number in the label wrapped by bracket, like: [1], this is the default setting. - - `gbbiblabel=parens` for the numerical number in the label wrapped by parenthesis, like: (1) - - `gbbiblabel=plain` for the numerical number in the label wrapped by nothing, like: 1 - - `gbbiblabel=dot` for the numerical number in the label followed with dot, like: 1. - - `gbbiblabel=box` for the numerical number in the label wrapped by box which generated by `\framebox` - - `gbbiblabel=circle` for the numerical number in the label wrapped by circle which generated by `\textcircled` - - `\usepackage[backend=biber,style=gb7714-2015,gbbiblabel=bracket]{biblatex}` - - - add an option `gbtype` to control the output of the reference type and carrier identifier like [J/OL] (This option is also for author year style): - - `gbtype = true` for gb7714 style, print a title with the identifier, like: `an on-line article [J/OL]`, this is the default setting. - - `gbtype = false` for none identifier, print a title without identifier, like: `an on-line article` - - `\usepackage[backend=biber,style=gb7714-2015,gbtype=true]{biblatex}` - - - add an option `gbfieldtype` to control the output of field type: - - `gbfieldtype = true` to print type field, like the thesis type: `PHD thesis` or `博士学位论文`。please use `\DefineBibliographyStrings{english}{mathesis={str you want}}`,`\DefineBibliographyStrings{english}{phdthesis={str you want}}`, - `\DefineBibliographyStrings{english}{mathesiscn={str you want}}`,`\DefineBibliographyStrings{english}{phdthesiscn={str you want}}` to - define the output string, or set it in bibfile like: `type={str you want},` - - `gbfieldtype = false` not to print type field. - - `\usepackage[backend=biber,style=gb7714-2015,gbfieldtype=true]{biblatex}` - - - add an option `gbpunctin` to control the output of `//` before bookauthor for entrytypes like inbook/incollection/inproceedings(This option is also for author year style): - - `gbpunctin=true` for gb7714 style, to output `//`, this is the default setting - - `gbpunctin=false` for standard style, to output a bibstring, for English it is `IN:`, If you want to eliminate it at all, please redefine the bibstring like `\DefineBibliographyStrings{english}{in={}}` and `\DefineBibliographyStrings{english}{incn={}}`in the preamble. - - `\usepackage[backend=biber,style=gb7714-2015,gbpunctin=true]{biblatex}` - - - add an option `gbctexset` to control the bibliography heading's setting method (This option is also for author year style): - - `gbctexset=true` , the bibliography heading can be set by `\bibname` or `\refname`, this is the default setting. - - `gbpunctin=false`, the heading can be set by bibstring like `\DefineBibliographyStrings{english}{bibliography={title you want}}` or `\DefineBibliographyStrings{english}{references={title you want}}` - - or alternatively, it can also be set through the printbibliography option `title`, like `printbibliography[title=title you want]`. - - `\usepackage[backend=biber,style=gb7714-2015,gbctexset=true]{biblatex}` - - - add an option `gbcodegbk` to deal the tex source file encoded with GBK (This option is also for author year style): - - `gbcodegbk=true` , if you want to compile the GBK encoded source file with pdflatex or latex - - `gbcodegbk=false`, if you want to compile the utf-8 endcoded source file with xelatex, this is the default setting. - - `\usepackage[backend=biber,style=gb7714-2015,gbcodegbk=true]{biblatex}` - - - add an option `gbtitlelink` to control the hyperlink of title field (This option is also for author year style): - - `gbtitlelink = false` not to add hyperlink, this is the default setting. - - `gbtitlelink = true` to set the title as a hyperlink. - - `\usepackage[backend=biber,style=gb7714-2015,gbtitlelink=true]{biblatex}` - - - add an option `gbfootbib` to control the bibliography in footnote (This option is also for author year style): - - `gbfootbib = true` make patches to match the standard, this is the default setting. - - `gbfootbib = false` not to patch. - - `\usepackage[backend=biber,style=gb7714-2015,gbtitlelink=true]{biblatex}` - - - add options `gbcitelocal` `gbbiblocal` to control the local strings in citation and bibliography respectively, the `gblocal` set the both options (These options are also for author year style): - - `gbcitelocal = gb7714-2015` to output local strings according to the reference's language, this is the default setting. - - `gbcitelocal = chinese` to output local strings with chinese language word like "等". - - `gbcitelocal = english` to output local strings with western language word like "et al.". - - `\usepackage[backend=biber,style=gb7714-2015,gbcitelocal = chinese]{biblatex}` - - - add an option `gbstrict` to control the output of some unnecessary fields for GB/T7714-2015 (This option is also for author year style). - - `gbstrict=true`, not to print those fields such as language, eprint, this is the default setting. - - `gbstrict=false`, to output them as the standard style - - `\usepackage[backend=biber,style=gb7714-2015,gbstrict=true]{biblatex}` - - - add an option `gbfieldstd` to control the format of some fields such as title, url and pages (This option is also for author year style): - - `gbfieldstd = false` for gb7714 style, format of the fields follows the GB/T7714-2015 standard, this is the default setting. - - `gbfieldstd = true` for standard style. - - `\usepackage[backend=biber,style=gb7714-2015,gbfieldstd=true]{biblatex}` - - -* for multi-style: gb7714-2015ms - - In order to use two styles in a tex file, add a style gb7714-2015ms. option `gbstyle` is added to control the using mode. `gbstyle=true` means all references are printed with GB/T7714-2015 style, and `gbstyle=false` means the chinese references are printed with GB/T7714-2015 style while the other references are printed with standard style shipped by biblatex, and `gbstyle=true` is the default set. all the options for numerical sequence style gb7714-2015 can also be used in gb7714-2015ms. - - - `\usepackage[backend=biber,style=gb7714-2015ms,gbstyle=false]{biblatex}` - -* for author year style: gb7714-2015ay - - `\usepackage[backend=biber,style=gb7714-2015ay,gbpub=true]{biblatex}` - - - add an option `gbnoauthor` for dealing undefined author: - - `gbnoauthor = true` for gb7714 style, to print `佚名` or `Anon` when the author of the entry is absent. - - `gbnoauthor = false` for standard style, not to pring anything, this is the default setting. - - `\usepackage[backend=biber,style=gb7714-2015ay,gbnoauthor=true]{biblatex}` - - - add an option value `mergedate=none` to control the date in bibliography: - - `mergedate=true` to output date only after author,like:LAMPORT L, (1986). Document Preparation System[M]. [S.l.]: Addison-Wesley Reading, MA. - - `mergedate=false` to output date after author and in publish items,like:LAMPORT L, (1986). Document Preparation System[M]. [S.l.]: Addison-Wesley Reading, MA, 1986. - - `mergedate=none` to output date only in publish items,like:LAMPORT L. Document Preparation System[M]. [S.l.]: Addison-Wesley Reading, MA, 1986. - - do not set mergedate output like:LAMPORT L, 1986. Document Preparation System[M]. [S.l.]: Addison-Wesley Reading, MA. - - `\usepackage[backend=biber,style=gb7714-2015ay,mergedate=none]{biblatex}` - - - add an option `gblanorder` to control sequence of reference groups of different languagesin the bibliography: - - `gblanorder=chineseahead` to set the sequence as: cn;jp;kr;en;fr;ru - - `gblanorder=englishahead` to set the sequence as: en;fr;ru;cn;jp;kr - - `gblanorder=user defined string like: cn;en;jp;kr;fr;ru` to set the sequence as: cn;en;jp;kr;fr;ru. - - `\usepackage[backend=biber,style=gb7714-2015ay,gblanorder=cn;en;jp;fr;kr;ru]{biblatex}` - -* for perl script transformation tool(only for the numerical style) - - `perl gb7714texttobib.pl in=textfilename out=bibfilename` - -A demonstration database is provided to show how to format input for the style. The biblatex-gb7714-2015 style works with texlive2014, texlive2015, texlive2016, texlive2017 , texlive2018 and so on. - -please see the file 'biblatex-gb7714-2015.pdf' for further information! - - -## Version history: - -* 2016/05/20 v1.0 -* 2016/10/23 v1.0a -* 2016/11/11 v1.0b -* 2016/11/14 v1.0c -* 2016/11/24 v1.0d -* 2016/12/07 v1.0e -* 2017/02/26 v1.0g -* 2017/04/11 v1.0h -* 2017/11/21 v1.0i -* 2018/01/20 v1.0j -* 2018/04/03 v1.0k -* 2018/06/01 v1.0l -* 2018/08/14 v1.0m,CTAN -* 2018/11/04 v1.0n -* 2018/12/22 v1.0o -* 2019/01/19 v1.0p -* 2019/02/11 v1.0q -* 2019/03/28 v1.0r -* 2019/03/29 v1.0rm,rename erj to chinese-erj,ctan -* 2019/08/28 v1.0s -* 2020/03/04 v1.0t,ctan -* 2020/03/30 v1.0u -* 2020/07/21 v1.0v,ctan - - - ---------------------------------------------------------- -## Update history: - -[update: tex](example/updatehistory.tex) - -[update: tex](example/updatehistoryold.tex) - - - +Date of last change: 2021-01-19 to version v1.0w + + +# biblatex-gb7714-2015: a biblatex style package +--------------------------------------------------------- +[使用入门](#jumptotutorial) |==| [说明文档](biblatex-gb7714-2015.pdf) |==| [WIKI](https://github.com/hushidong/biblatex-gb7714-2015/wiki) + + +## Introduction + +Maintainer: huzhenzhen + +Homepage: + +ctan-pkg: + +License: LaTeX Project Public License 1.3 or later + + +A biblatex implementation of the `GB/T 7714-2015` bibliography style for Chinese users + +The biblatex-gb7714-2015 package provides an implementation of the bibliography style of the `GB/T 7714-2015` bibliography style. This implementation follows `GB/T 7714-2015` standard, and can be used simply by loading biblatex with the appropriate option + + +biblatex-gb7714-2015 宏包是中文参考文献著录/标注标准 `GB/T 7714-2015` 的 biblatex 实现。它本质上是一个样式包,提供了顺序编码制和著者年份制样式,在 tex 文档中配合 biblatex 宏包使用,以生成满足《GB/T 7714-2015 信息与文献 参考文献著录规则》要求的参考文献。除了具备 biblatex 提供的不同于传统基于 bibtex 的参考文献解决方案的特点外,还具有如下特点: + +* 较强的兼容性。能够兼容 biblatex v2.8 以上版本;能够兼容国标样式的一些常用条目类型、数据域。 + +* 较高的易用性。标注/著录格式完全由样式实现,不必为排序、多语言等问题手动处理bib文件;提供了丰富的标注(引用)命令,包括一些中文中习惯的命令;提供了多语言对照,多语言文献表等功能。 + +* 较大的灵活性。提供丰富的选项来帮助用户进行排序调整、著录项(姓名、出版项、文献标识符、标题超链接)格式调整、文献表格式(标签对齐、标签格式、条目格式、字体、段落格式)调整、编码兼容。 + +* 较好的维护性。样式代码主要是在标准样式基础上提供的中文国标解决方案,保持与标准样式一致的结构、风格和习惯,并提供详尽的注释,用户可轻松理解,并可在其基础上进一步修改以实现其它要求的样式,比如宏包附带的chinese-erj样式,就是基于本样式实现的经济学研究期刊的参考文献样式。 + +简单使用说明见:[使用入门](#jumptotutorial) + +--------------------------------------------------------- + +## Need to do: + + * special characters in all fields? + * entry without author: the delimiter between title and year? + * TEST FOR texlive 2015,2016,2017 + + +## Applications + +* [SJTUThesis(上海交通大学学位论文模板)](https://github.com/sjtug/SJTUThesis)(母校的论文模板,不得不说缘分真的很神奇) +* [fduthesis(复旦大学论文模板)](https://github.com/Stone-Zeng/fduthesis) +* [Zhejiang University thesis(浙江大学毕业设计/论文模板)](https://github.com/TheNetAdmin/zjuthesis) +* [UCASthesis(中国科学院大学学位论文模板**国科大新版标准**)](https://github.com/xiaoyao9933/UCASthesis) +* [UCASthesis(ucasthesis 国科大学位论文 LaTeX 模板 [最新样式])](https://github.com/mohuangrui/ucasthesis) +* [TongjiThesis(同济大学硕博士论文LaTeX模板)](https://github.com/marquistj13/TongjiThesis) +* [neuthesis(东北大学博士学位论文Latex模板)](https://github.com/mervin0502/neuthesis) +* [nwafuthesis(西北农林科技大学学位论文LaTeX文档类)](https://github.com/registor/nwafuthesis) +* [nudtpaper(nudt学位论文模板)](https://github.com/liubenyuan/nudtpaper) +* [ECNU-Undergraduate-LaTeX(华东师范大学本科毕业论文模板)](https://github.com/YijunYuan/ECNU-Undergraduate-LaTeX) +* [fjnu-bathesis (福建师范大学本科毕业论文LaTeX 模板)](https://github.com/fjnuer/fjnu-bathesis) +* [Thesis-Template-for-XJTU (西安交大毕业设计模板)](https://github.com/DXie123/Thesis-Template-for-XJTU) +* [CAUTemplate(中国农业大学课程论文模板)](https://github.com/Cdmium/CAUTemplate) +* [Yet anoter BUPT Thesis LaTeX class (北邮研究生学位设计的LaTeX文档类)](https://github.com/qcts33/BUPTthesis-ctex) +* [Study-LaTeX(LaTeX学习笔记)](https://github.com/Zousiyu/Study-LaTeX) +* [ElegantBook](https://github.com/ElegantLaTeX/ElegantBook) +* [《经济研究》杂志 LaTeX 论文模板)](https://github.com/EthanDeng/Chinese-ERJ) +* [WUTthesis(武汉理工大学研究生学位论文的 LaTeX 模板)](https://github.com/Jiayin-Gu/WUTthesis) +* [shtthesis (ShangHaiTech university THESIS)](https://github.com/lirundong/shtthesis) +* [LaTeX-SWUFE-Bachelor-Thesis (西南财经大学本科毕业论文 LaTeX 模板)](https://github.com/sukanka/LaTeX-SWUFE-Bachelor-Thesis) +* [NJU-thesis-esz(南京大学学位论文-微调整后适用于人文社科)](https://github.com/EdwardSaidZhou/NJU-thesis-esz) +* [NKThesis(南开大学硕士毕业论文(博士论文)Latex模板)](https://github.com/procuteboy/NKThesis) +* [NKUBachelorThesis(南开大学本科生毕业论文(毕业设计)LaTeX模板)](https://github.com/NKcqx/NKUBachelorThesis) +* [BIThesis(bachelor graduation thesis for Dept. of Undergraduate Academic Affairs of Beijing Institute of Technology.)](https://github.com/BITNP/BIThesis) +* [nputhesis(NPU 博士、硕士学位论文 \LaTeX 模板)](https://github.com/NPUSCG/nputhesis) +* [sustechthesis(Southern University of Science and Technology Thesis Template LaTeX Template)](https://github.com/Iydon/sustechthesis) +* [SHMTUThesis(上海海事大学 LaTeX 学位论文模板)](https://github.com/hellckt/SHMTUThesis) +* [LZUthesis(兰州大学本科毕业论文LaTeX模板)](https://github.com/szsdk/LZUthesis) +* [nuaa-thesis(南京航空航天大学本科、硕士和博士学位论文的样式模板)](https://github.com/nuaa803/nuaa-thesis) +* [...] + + +## Related Links + +* [Biblatex 宏包](https://github.com/plk/biblatex) +* [Beamer 文档类](https://github.com/josephwright/beamer) +* [biblatex 宏包中文手册 ](https://github.com/hushidong/biblatex-zh-cn) +* [biblatex 简明使用手册](https://github.com/hushidong/biblatex-solution-to-latex-bibliography) +* [biblatex-tutorial 摘译](https://github.com/hushidong/biblatex-tutorial-cn) +* [biblatex-map bib文件修改工具](https://github.com/hushidong/biblatex-map/) +* [biblatex-check bib文件检查工具](https://github.com/Pezmc/BibLatex-Check) +* [biblatex-caspervector: caspervector 设计的中文参考文献样式](https://github.com/CasperVector/biblatex-caspervector) +* [gbt7714-bibtex-style: GB/T7714-2015 标准的bst实现版本](https://github.com/zepinglee/gbt7714-bibtex-style) +* [LaTeX学习网站](http://www.latexstudio.net/) +* [LaTeX交流论坛](http://www.ctex.org/) + +--------------------------------------------------------- + +

Tutorial/使用入门

+[//]: # "这里这种方式不适合可能主要是因为标题所导致,因此用上面的方式进行处理" + + +

0. pacakge usage/宏包加载方式

+样式包配合biblatex使用,即在biblatex调用时加载样式包: + +* 使用顺序编码制: + +``` + \usepackage[backend=biber,style=gb7714-2015]{biblatex} +``` + +* 使用著者-出版年制: + +``` + \usepackage[backend=biber,style=gb7714-2015ay]{biblatex} +``` + +* 使用宏包提供的选项: + +``` + %设置gbalign选项以改变文献表序号标签对齐方式, + %设置gbpub=false取消缺省出版项自填补信息,比如: + \usepackage[backend=biber,style=gb7714-2015,gbalign=gb7714-2015,gbpub=false]{biblatex} +``` + +* 使用同一文献表中不同语言区分著录格式的样式(gb7714-2015ms): + +``` + %设置gbstyle=false,中文文献使用GB/T 7714-2015著录格式,而其它语言文献使用biblatex标准样式 + \usepackage[backend=biber,style=gb7714-2015ms,gbstyle=false]{biblatex} +``` + +* 同一文档中不同文献分节区分不同著录格式的样式(gb7714-2015mx): + +``` + %gb7714-2015mx默认使用顺序编码制样式 + \usepackage[backend=biber,style=gb7714-2015mx]{biblatex} + %如需在某一参考文件分节使用著者年份制样式,比如第2个refsection中使用时,则在导言区设置: + \setaystylesection{2} +``` + +更多宏包选项的说明见:[biblatex-gb7714-2015.pdf](biblatex-gb7714-2015.pdf) + +宏包加载的完整文档示例见:[tex文档一般结构](#jumptotexsrcf) + +

1. Tex source file/tex文档一般结构

+注意其中加载biblatex宏包的代码: + +``` +\documentclass{article}%文档类%导言区开始: + +\usepackage{ctex}%加载ctex宏包,中文支持 + +\usepackage[left=20mm,right=20mm,top=25mm, bottom=15mm]{geometry}%加载geometry宏包,定义版面 + +\usepackage[colorlinks=true,pdfstartview=FitH,% +linkcolor=blue,anchorcolor=violet,citecolor=magenta]{hyperref}%加载hyperref宏包,使用超链接 + +\usepackage[backend=biber,bibstyle=gb7714-2015,%nature,%%加载biblatex宏包,使用参考文献 +citestyle=gb7714-2015%,backref=true%%其中后端backend使用biber +]{biblatex}%标注(引用)样式citestyle,著录样式bibstyle都采用gb7714-2015样式 + +\usepackage{filecontents} +\begin{filecontents}{egbibdata.bib} +@Book{Peebles2001-100-100, + Title = {Probability, random variable, and random signal Principles and \LaTeX{}}, + Address = {New York}, + Author = {von Peebles, Jr., P. Z.}, + Edition = {4}, + Pages = {100}, + Publisher = {McGraw-Hill}, + Year = {2001} +} + +@Book{蔡敏2006--, + Title = {UML基础和Rose建模教程},27 + Address = {北京}, + Author = {蔡敏 and 徐慧慧 and 黄柄强}, + Publisher = {人民邮电出版社}, + Year = {2006}, + Month = {1} +} +\end{filecontents} + +\addbibresource[location=local]{egbibdata.bib}%biblatex宏包的参考文献数据源加载方式 + +\begin{document}%正文区开始: + +%正文内容,引用参考文献 + +1. 不带页码的引用(顺序编码制上标,方括号包围;作者年制行内,括号包围):\\ + 见文献\cite{Peebles2001-100-100}\\ + 见文献\upcite{Peebles2001-100-100}\\ + 见文献\supercite{Peebles2001-100-100} + +2. 不带页码的引用(顺序编码制非上标,方括号包围;作者年制行内,括号包围):\\ + 见文献\parencite{Peebles2001-100-100} + +3. 带页码的引用(标准命令,默认样式; 增加命令,GB/T 7714-2015样式):\\ + 见文献\cite[见][49页]{蔡敏2006--}\\ + 见文献\parencite[见][49页]{Peebles2001-100-100}\\ + 见文献\pagescite{Peebles2001-100-100}\\ + 见文献\pagescite[201-301]{Peebles2001-100-100} + +4. 顺序编码制中同时输出作者和顺序编码标签,比如:\\ + 见\citeauthor{蔡敏2006--}\cite{蔡敏2006--}\\ + 见\authornu*mcite{蔡敏2006--}\\ + 见\textcite{蔡敏2006--} (顺序编码标签不上标) + +5. 作者年制文中已有作者还需要年份和页码(顺序编码制与pagescite作用相同,作者年制年份行内页码上标):\\ + 见蔡敏\yearpagescite[][205]{蔡敏2006--}和Peebles\yearpagescite[][15]{Peebles2001-100-100} + +6. 作者年制文中已有作者只需要年份(顺序编码制与pagescite作用相同,作者年制年份行内):\\ + 见赵耀东\yearcite{蔡敏2006--}\\ + 见赵耀东(\cite*{蔡敏2006--})\\ + 见赵耀东(\citeyear{蔡敏2006--}) + +7. 作者年制中由标注命令给出作者年份信息,作者以主语方式作为正文内容:\\ + 见\textcite{蔡敏2006--} + +8. 在页脚中引用和打印文献表:\\ + 见文献\footnote{在脚注中引用\footcite{蔡敏2006--}}\\ + 见文献\footfullcite{蔡敏2006--} + + +%打印参考文献表 + \printbibliography[heading=bibliography,title=参考文献] +\end{document} +``` + +### 2. Compile method/文档编译方式 + +``` + xelatex jobname.tex + biber jobname + xelatex jobname.tex + xelatex jobname.tex +``` + +或者 + +``` + latexmk -xelatex jobname.tex +``` + +编译引擎使用lualatex也是可以的,只要该引擎编译时ctex宏包能够正确支持中文。 + + +### 3. Recommended environment/推荐使用环境 + +- Texlive+Winedt +- Texlive+Texstudio +- texlive及其它发行版安装见[安装指南](https://github.com/sjtug/SJTUThesis/wiki/%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97) + + +### 4. Common questions/常见问题 + +#### 4.1 Installation and use/安装和使用 + +* 怎么利用biblatex生成国标GB/T 7714-2015格式的参考文献表? + +(1)在导言区加载biblatex宏包,并使用gb7714-2015样式: + +``` \usepackage[backend=biber,style=gb7714-2015]{biblatex}``` + +(2)正文中引用参考文献: + +``` 见文献\cite{referencbibtexkey}``` + +(3)在需要的地方打印参考文献表: + +```\printbibliography``` +更直接的例子见前述的[tex源文档](#jumptotexsrcf) + + + + +* 请问我应该怎么安装和更新biblatex-gb7714-2015宏包? + + +biblatex-gb7714-2015宏包是基于biblatex的样式宏包,目前texlive,miktex都已收录,因此可以直接使用,一般不需要安装。 + +如果使用时,系统提示找不gb7714-2015.bbx或gb7714-2015ay.bbx文件的错误,说明当前tex系统未安装biblatex-gb7714-2015样式包,这时需要安装它。 + +最简单的方法是从本项目源码中下载 gb7714-2015.bbx, gb7714-2015ay.bbx, gb7714-2015.cbx, gb7714-2015ay.cbx 四个文件放到你要编译的主文档所在目录,如果需要使用gbk编码,则还需复制 gb7714-2015-gbk.def 文件。对于已经安装的用户需要更新到最新版,也可以下载这些文件替换系统已经安装的文件。 + + + +* 请问使用时biblatex-gb7714-2015宏包时出现错误“ Package xkeyval Error: gb****** ' undefined in families blx@opt@pre'. [\blx@processoptions] ”? + + + +因为宏包的功能不断增加和完善,当在tex源文档中,使用新版中的一些选项时,而系统中的biblatex-gb7714-2015宏包是旧版时,就会出现`gb****`选项未定义的错误。解决方法就是更新biblatex-gb7714-2015宏包。更新方法见上一个问题。 + + + +* 为什么我之前使用样式`style=caspervector`进行编译没有问题,换成`style=gb7714-2015`后,编译就出现错误? + +可能有三个原因: + +(1) 辅助文件没有清理导致,当采用caspervector样式时编译产生的辅助文件中可能带有该样式的一些特有信息,由此产生一些不兼容。因此需要的操作是,清除辅助文件,然后再进行编译。清除命令为(下面的命令是windows下的,linux下的是类似的只需把删除命令换成`rm -f`): + +```del /q *.aux *.bbl *.blg *.log *.out *.toc *.bcf *.xml *.synctex *.nlo *.nls *.bak *.ind *.idx *.ilg *.lof *.lot *.ent-x *.tmp *.ltx *.los *.lol *.loc *.listing *.gz *.synctex(busy) *.nav *.snm *.vrb *.fls *.xdv *.fdb_latexmk``` + +(2) biblatex-gb7714-2015 版本过于陈旧,旧版本对于一些特殊情况可能考虑不全面。因此需要的操作是更新biblatex-gb7714-2015,方法见上一个问题。 + +(3) 编译命令问题,通常情况下tex文档和bib文档是utf8编码的,因此最好采用xelatex编译,而不用pdflatex。因此如果编译时用pdflatex出现错误,请换成xelatex。 + + +* 为什么我编译文档后没有出现参考文献表? + +当编译过程出现错误时,那么检查错误的原因,并解决它。 +当编译过程没有出现错误,那么很有可能是没有采用正确的命令进行文献编译,比如采用了传统的bibtex而不是biber。那么采用正确的编译命令重新编译即可: +``` +xelatex jobname.tex +biber jobname +xelatex jobname.tex +``` + + +* 为什么利用 ctex2.9 套装进行编译时,出现错误? + + +由于ctex2.9套装多年未更新,其中的biblatex宏包过于陈旧,所以需要更新 biblatex。 + + + +* 请问除了利用xelatex进行编译外,能不能用pdflatex进行编译? + + +能用pdflatex进行编译。但要注意的是因为某些样式比如authoryear等使用了xstring宏包中的一些命令,所以会产生错误,但numeric类样式通常没有问题。这一问题在biblatex更新到3.12版本后取消xstring宏包后得以解决。 + +中文用户需要注意一些编码的问题: + +utf-8编码的文档,采用xelatex编译没有任何注意事项,但使用pdflatex编译时,需要给ctex宏包加载UTF8选项,比如`\usepackage[UTF8]{ctex}`或者在文档类加载时给出也可以比如`\documentclass[[UTF8]{article}`,同时引用文献时使用的引用关键词应使用英文。 + +当文档使用其他编码时,xelatex编译通常需要指定一个文档编码,比如windows环境下的GB2312编码的文档需要指定`\XeTeXinputencoding "GBK"`, 否则显示乱码。使用pdflatex进行编译,如果biblatex不能正确的处理编码问题,那么需要为其明确的指定texencoding和bibencoding选项。比如windows环境下的GB2312编码的文档,需要指定`\usepackge[texencoding=GBK]{biblatex}`。 + + +* 请问使用backref=true选项后,某个反向超链接总是链接到封面页是怎么回事? + + +对页码进行正确超链接需要一个前提是,当前链接的页码是唯一的。当有两页具有相同的页码时,超链接总是链接到第一各具有该页码的页面上。比如封面页页码是1,正文第一页页码也是1,那么到正文第一页的反向超链接总会链接到封面页上。解决该问题就是要解决页码的唯一性问题。当页码的表示形式不是同一种时,那么也会得到正确的区分。比如封面页用罗马字母I表示,而正文第一页用阿拉伯数字1表示,那么就能得到正确的反向超链接。类似于: + +``` +\pagenumbering{roman} +\title{title} +\maketitle +\clearpage + +\pagenumbering{arabic} +\section{文献表} +``` + + +* 我希望参考文献表中的文献不是按引用顺序而是以文献作者的字母顺序排序,怎么实现? + + +一般情况下文献表是按引用顺序进行排列,标签是顺序的数字,这种方式称为顺序编码制。 +如果要以文献作者字母顺序排列,那么可以换一种编制方式,称为作者年制: + +```\usepackage[backend=biber,style=gb7714-2015ay]{biblatex}``` + +如果要求使用顺序编码制文献表,又要以文献作者字母顺序排列,那么可以增加排序选项`sorting=nyt`,意为按照姓名、年份、标题的字母顺序进行排序: + +```\usepackage[backend=biber,style=gb7714-2015,sorting=nyt]{biblatex}``` + + + +* 作者年制中英文文献能按字母顺序排列,那么中文文献能否以拼音或者笔画进行排序呢? + + +能,有两种方式实现: + +(1)通过编译时给biber设置选项来实现: + +``` +%按拼音排序,biber命令 +biber -l zh__pinyin jobname +%按笔画排序,biber命令 +biber -l zh__stroke jobname +``` + +(2)通过增加 biblatex 选项来实现(此时biber编译无需另加选项),比如: + +```\usepackage[backend=biber,style=gb7714-2015ay,sortlocale=zh__pinyin]{biblatex}``` + + + +* 作者年制参考文献表目前的排序时升序排列,能不能改成降序排序? + + +能,通过修改sorting选项实现: + + +```\usepackage[backend=biber,style=gb7714-2015ay,sorting=gbnytd]{biblatex}``` + +可用的选项值包括: +``` +nty 按照姓名、标题、年份排序。 +nyt 按照姓名、年份、标题排序。 +nyvt 按照姓名、年份、卷数、标题排序。 +anyt 按照字母标签、姓名、年份、标题排序。 +anyvt 按照字母标签、姓名、年份、卷数、标题排序。 +ynt 按照年份、姓名、标题排序。 +ydnt 按照年份(降序)、姓名、标题排序。 +none 不进行排序。所有的条目按照引用顺序处理。 +gb7714-2015 以语言、作者、年份、标题、升序排列 +gbnytd 以语言、作者、年份、标题、降序排列 +gbynta 以语言、年份、作者、标题、升序排列 +gbyntd 以语言、年份、作者、标题、降序排列 +``` + +* 如果我还希望顺序编码的文献著录表以拼音排序,请问该怎么操作? + +顺序编码文献著录表默认是按引用顺序排序,但可以通过设置sorting选项进行调整,比如sorting=nyt表示按作者姓名年份以及文献标题进行排序。要使中文能按拼音排序,可以设置本地化排序调整方案,即sortlocale选项,比如: + +```\usepackage[backend=biber,citestyle=gb7714-2015ay,bibstyle=gb7714-2015,sorting=nyt,sortlocale=zh__pinyin]{biblatex}``` + + + + + +* 我希望文献表以阿拉伯数字编号,而正文中的引用标签使用作者和年份标注而不是数字,请问我该如何处理? + +可以设置不同的标注和著录样式,比如标注样式用作者年制,而著录样式用顺序编码制,比如: + +```\usepackage[backend=biber,citestyle=gb7714-2015ay,bibstyle=gb7714-2015]{biblatex}``` + +参见:[issue:参考文献的顺序](https://github.com/sjtug/SJTUThesis/issues/300) + + + + + + +​ +* 请问如果参考文献中存在一些特殊字符比如&或者一些特殊命令比如\LaTex{}等,是不是会出现问题? + + +通常不会出现问题,直接输入即可,当出现问题时可以手动调整比如修改为`\&`和`{\LaTex{}}` + + + +* 如果希望在参考文献中直接使用一些unicode字符比如希腊字母等而不想用数学环境中的命令,请问该怎么处理? + + +直接显示希腊字母等unicode字符需要字体的支持,比如CMU Serif等,可以在整个文档全局使用该字体,也可以仅在文献表中使用该字体,比如: + +``` +{ +\newcommand{\ftcmu}{\fontspec{CMU Serif}\selectfont} +\renewcommand{\bibfont}{\ftcmu}%设置英文字体不影响中文字体 +\printbibliography +} +``` + +当然字体设置需要fontspec宏包的支持。 + + + +* 如何修改参考文献文献表的垂直间距(竖直间距)? + +设置如下尺寸即可 + +``` +% 间距的控制 +\setlength{\bibitemsep}{0ex} +\setlength{\bibnamesep}{0ex} +\setlength{\bibinitsep}{0ex} + +``` +其中itemsep设置各条文献之间的间隔,一般够用,后面两个常在西文中使用。具体意义参考biblatex-zh-cn + + + +* 如何修参考文献表的缩进? + +对于著者-出版年制文献表,设置如下尺寸即可: +``` +% 文献表中各条文献的缩进控制 +\setlength{\bibitemindent}{0em} % bibitemindent表示一条文献中第一行相对后面各行的缩进 +\setlength{\bibhang}{0pt} % 著者-出版年制中 bibhang 表示的各行起始位置到页边的距离 +``` + +对于顺序编码制文献表,可以采用如下方法: + +由于顺序编码制存在数字标签,且其宽度与参考文献数量相关的,在biblatex中这个宽度是一个动态变量,不是提前设定的,而是在文献表生成时给出,所以设定缩进需要更复杂的操作。 + +对于采用list环境的文献表,即设置gbalign=left、right、center时,那么需要修改文献表环境来设定缩进,比如: + +``` +%调整顺序标签与文献内容的间距 +\setlength{\biblabelsep}{2mm} +%修改对齐环境-使不缩进 +\defbibenvironment{bibliography} + {\list + {\printtext[labelnumberwidth]{% + \printfield{labelprefix}% + \printfield{labelnumber}}} + {%这里是所做的调整,通过设置\bibitemindent,\bibhang调整缩进 + \addtolength{\bibitemindent}{\labelnumberwidth}% + \addtolength{\bibitemindent}{\biblabelsep}% + \addtolength{\bibhang}{-\labelnumberwidth} % + \addtolength{\bibhang}{-\biblabelsep}% + %以下是默认的设置 + \setlength{\labelwidth}{\labelnumberwidth}% + \setlength{\labelsep}{\biblabelsep}% + \setlength{\leftmargin}{\bibhang}% + \addtolength{\leftmargin}{\labelnumberwidth}% + \setlength{\itemindent}{\bibitemindent}% + \setlength{\itemsep}{\bibitemsep}% + \setlength{\parsep}{\bibparsep}}% + \renewcommand*{\makelabel}[1]{\hss##1}} + {\endlist} + {\item} +``` + +对于不采用list环境的文献表,即设置gbalign=gb7714-2015时,可以采用如下设定: + +``` +%调整顺序标签与文献内容的间距 +\setlength{\biblabelsep}{2mm} +%修改对齐环境-使不缩进 +\renewcommand{\itemcmd}{% +\settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}} +%%这里是所做的调整,以下两句通过调整\lengthid来调整缩进 +\setlength{\lengthid}{0pt} +\addtolength{\lengthid}{-\biblabelsep} +%如下是默认设置 +\addtolength{\lengthid}{\biblabelsep} +\setlength{\lengthlw}{\textwidth} +\addtolength{\lengthlw}{-\lengthid} +\addvspace{\bibitemsep}%恢复\bibitemsep的作用 +%\parshape 2 0em \textwidth \lengthid \lengthlw +\hangindent\lengthid +\mkgbnumlabel{\printfield{labelnumber}}% +\hspace{\biblabelsep}} +``` + +示例见:https://github.com/hushidong/biblatex-gb7714-2015/issues/62 + + + + +* 如何修改参考文献表的字体字号? + +通过修改如下命令实现 + +``` +% 字体的控制: \textit, sl, emph-楷体, \textbf, sf-黑体, \texttt-仿宋, \textsc, md, up-宋体 +% 全局字体 +\renewcommand{\bibfont}{\zihao{-5}}%\fangsong +% 题名字体 +\renewcommand{\bibauthorfont}{\bfseries\color{teal}}% +\renewcommand{\bibtitlefont}{\ttfamily\color{blue}}% +\renewcommand{\bibpubfont}{\itshape\color{violet}}% +% url和doi字体 +\def\UrlFont{\ttfamily} %\urlstyle{sf} %\def\UrlFont{\bfseries} +``` + +​ +* 我习惯用传统的bst文件来生成参考文献,有没有GB/T 7714-2015标准的实现版本? + + +GB/T 7714-2015标准实现的bst版本,已经由[zeping lee](https://github.com/zepinglee/gbt7714-bibtex-style)开发完毕,直接使用即可。 + + + +* 我在使用过程中遇到了一些无法理解和无法解决的问题,怎么办? + + +请邮件联系hzzmail@163.com或在项目内发issue提问即可。 + + +#### 4.2 Bibliography format/文献表著录格式 + +* 请问可以在参考文献表中实现类似于word那样的与文献内容等间距标签对齐格式么? + + +可以,latex的列表通常用list来实现,因此一般列表的内容都是对齐的, +此时如果标签右对齐的,那么标签和内容等间距,但标签左侧是不对齐的。 +如果标签是左对齐的,那么标签和内容的间距不相等。 +如果要求标签左侧对齐,且标签与内容等间距必须放弃使用list。 +biblatex-7714-2015的顺序编码制样式特别设计了这样的环境,以保持和word一致。通过设置选项gbalign来实现: + +```\usepackage[backend=biber,bibstyle=gb7714-2015,gbalign=gb7714-2015]{biblatex}``` + + + +* 如果不希望在参考文献表中出现类似“出版地不详”“出版者不详”等信息时,请问该怎么处理? + + +设置选项gbpub可以实现,当gbpub=false时,biblatex-gb7714-2015宏包会放弃国标的要求,不使用“出版地不详”等补充信息: + +```\usepackage[backend=biber,bibstyle=gb7714-2015,gbpub=false]{biblatex}``` + + +​ +* 我觉得文献表中英文作者全部用大写不好看,请问能换一种大小写方式么? + + +能,通过设置gbnamefmt可以实现,默认情况下gbnamefmt=uppercase,作者姓名字母全部大写。 +当设置gbnamefmt=lowercase时,biblatex-gb7714-2015宏包对于bib文件中的作者姓名的大小写不做改变, +这时可以在bib文件中手动设置想要的大小写方式。 +当要实现类似ZHAO Yu-xin这样的拼音方式,则可以设置gbnamefmt=pinyin: + +```\usepackage[backend=biber,bibstyle=gb7714-2015,gbnamefmt=lowercase]{biblatex}``` + + + +* 如果不希望在参考文献表中出现类似“[M]”“[J]”等文献类型标识符时,请问该怎么处理? + + +可通过设置选项gbtype=false实现: + +```\usepackage[backend=biber,bibstyle=gb7714-2015,gbtype=false]{biblatex}``` + + + +* 如果不希望在参考文献表中出现网址信息时,请问该怎么处理? + + +可通过设置选项url=false实现: + +```\usepackage[backend=biber,bibstyle=gb7714-2015,url=false]{biblatex}``` + + + +* 如果不希望在参考文献表中出现DOI信息时,请问该怎么处理? + + +可通过设置选项doi=false实现: + +```\usepackage[backend=biber,bibstyle=gb7714-2015,doi=false]{biblatex}``` + + + +* 如果对当前文献中的url或doi显示效果(包括间距和断行)不满意,能否进行调整? + + +能,可以通过设置三个计数器的值来调整,取值范围0到9999,计数器的值越大则越容易在相应的内容后断行: + +``` +\setcounter{biburlnumpenalty}{100}%大于0允许在数字后面断行 +\setcounter{biburlucpenalty}{100}%大于0允许在大写字母后面断行 +\setcounter{biburllcpenalty}{100}%大于0允许在小写字母后面断行 + +``` + + +​ +* 当参考文献没有作者时,希望用佚名或Anon代替作者时,请问该怎么处理? + + +可通过设置选项gbnoauthor=true实现,注意该处理主要用在作者年制中: + +```\usepackage[backend=biber,bibstyle=gb7714-2015,gbnoauthor=true]{biblatex}``` + + + +* 如果希望参考文献表中文献作者数量超过国标规定的3个时,请问该怎么处理? + + +可通过设置选项maxbibnames,minbibnames实现,比如下面的设置用于显示5个作者: + +```\usepackage[backend=biber,bibstyle=gb7714-2015,maxbibnames=5,minbibnames=5]{biblatex}``` + + +* 请问如何将作者之间的分隔符调整为and而不是用逗号? + + +可以通过重设两个分隔符来实现,分别是multinamedelim和finalnamedelim。低版本的biblatex直接重定义命令`\multinamedelim`和`\finalnamedelim`,高版本的biblatex可以使用分隔符环境,这样可以在标注、文献表等不同位置直接使用不同的分隔符,而不像低版本biblatex那样只能在不同的位置修改局部定义。比如: + +``` +\DeclareDelimFormat[bib]{multinamedelim}{\addspace and \addspace} +\DeclareDelimFormat[bib]{finalnamedelim}{\addspace and \addspace} +\DeclareDelimFormat[cite]{multinamedelim}{\addcomma\addspace} +\DeclareDelimFormat[cite]{finalnamedelim}{\addcomma\addspace} +``` + + +​ +* 请问如何使文献表中文献标题的是句首字母大写而其它所有字母均小写? + + +默认情况下,biblatex-gb7714-2015仅对标题首字母做调整,使其变成为大写,而其他字母大小写不做处理,因此要得到想要的字母大小写格式,需要在bib文件输入参考文献信息时给出需要的除首字母外的其它字母的大小写格式。 + +若有特殊情况,需要首字母为小写,可采用如下两种方法: + +(1)根据字符大小写更换命令比如 + +`{\MakeLowercase i}FogSim title contents` + +(2)修改titlecase域格式,即将如下命令放到导言区中,放biblatex后面 + +``` +\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{% +\iffieldundef{url}{#1}{% +\href{\thefield{url}}{#1}}}{#1}}%重设标题格式,将去除首字母大写 +``` + +​ +* 请问如何使文献表中的期刊名是单词首字母大写的? + + +默认情况下,biblatex-gb7714-2015不对期刊名的字母大小写做处理, +因此需要在bib文件输入参考文献信息时给出需要的大小写格式。 + + +​ +* 我想得到中英文对照的双语参考文献,请问该如何处理? + + +biblatex-gb7714-2015设计了两种多语言对照参考文献的实现方式, +一种是利用条目集的概念,另一种是利用关联条目的概念。 +因此有两种方法: + +(1)方法一,动态定义条目集: +在导言区或正文中定义: +```\defbibentryset{易仕和,等,2013}{易仕和2013--,Yi2013--}``` + +在正文中引用: +```双语文献引用\cite{易仕和,等,2013}``` + +(2)方法二,动态定义关联条目: +在导言区定义: +```\defdoublelangentry{易仕和2013--}{Yi2013--}``` + +在正文中引用: +```双语文献引用\cite{易仕和2013--}``` + + + + +* 我想修改文献条目的日期项诸如格式,请问该如何处理? + +参考文献中日期格式主要有四种修改方式: +(1) 利用biblatex选项全局的修改日期格式 +(2) 修改日期输出宏,使根据条目类型输出不同的日期格式 +(3) 修改日期输出宏,使根据具体条目输出不同的日期格式 +(4) 修改参考文献信息,使当前条目原样输出需要的格式 + +具体示例见:[biblatex中如何修改参考文献中日期的著录格式](https://blog.csdn.net/xenonhu/article/details/86933525) + + +​ +#### 4.3 Citation format/正文引用的标注格式 + +* 我希望在正文中同时使用上标和非上标的引用标签,请问该怎么操作? + + +可以使用不同的命令来实现上标和非上标的标签, +上标标签的命令为`\cite{bibtexkey}` ,非上标标签的命令为 `\parencite{bibtexkey}`。 +当希望上标的标签也给出国标要求的页码时,则可以使用`\cite[50-55]{bibtexkey}`、`\pagescite[50-55]{bibtexkey}`给出指定页码 或者`\pagescite{bibtexkey}` 直接使用bib文件中的页码。 + + +​ +* 我在引用文献时已经给出作者信息,希望引用标签仅包含年份和页码信息或者仅包含年份信息时,该怎么操作? + + + 需要给出年份的标签是作者年制的标签,可以使用命令`\yearpagescite{bibtexkey}`给出包含年份和页码信息的标签, + 使用命令`\yearcite{bibtexkey}`给出仅包含年份的标签。 + + + +* 在使用作者年制时,我希望文献表是按作者年份标题排序,而正文某处一个cite命令引用多个参考文献,且这些文献的标签是按年份作者标题排序,该怎么操作? + + + 有两种方法: + +(1) 一是自动排序 + + 宏包加载时使用: + +```\usepackage[backend=biber,style=gb7714-2015ay,sortcites,sorting=ynt]{biblatex}``` + + 正文中引用: + +```\cite{refa2010,refb2008,refc2009}``` + + 然后在文献打印前加 + +```\newrefcontext[sorting=nyt]``` + +(2) 二是手动给出排序 + + 宏包加载时使用 + +```\usepackage[backend=biber,style=gb7714-2015ay]{biblatex}``` + + 引用多个文献时按照年份顺序给出引用关键字,即正文中引用: + +```\cite{refb2008,refc2009,refa2010}``` + + 参考:[issue:citation的顺序和bibliography的顺序如何不关联](https://github.com/hushidong/biblatex-gb7714-2015/issues/30) + + + +* 在使用作者年制时,我希望文献表同一位置引用同一作者的不同的文献实现作者姓名的压缩,该怎么操作? + +可以通过将gb7714-2015ay.cbx 中的引用的基础样式authoryear更换成authoryear-comp。 + + +​ +* 请问希望正文中作者年制的标注(引用)标签中作者数量超过国标规定的1个时,该怎么处理? + + +可通过设置选项maxcitenames,mincitenames实现,比如下面的设置用于显示5个作者: + +```\usepackage[backend=biber,style=gb7714-2015ay,maxcitenames=5,mincitenames=5]{biblatex}``` + + + +* 请问希望正文中作者年制的标注(引用)标签中作者数量只能是1个,而不管是否存在歧义时,该怎么处理? + + +可通过设置选项uniquelist=false实现,该设置标签中的作者只会是指定的1个: + +```\usepackage[backend=biber,style=gb7714-2015ay,uniquelist=false]{biblatex}``` + + + +* 请问希望正文中作者年制的标注(引用)标签中作者数量只能是1个,且只用其作者的姓而不管是否存在歧义时,该怎么处理? + + +可通过设置选项uniquelist=false, uniquename=false实现,该设置标签中的作者只会是指定的1个且只用该作者的姓: + +```\usepackage[backend=biber,style=gb7714-2015ay,uniquelist=false,uniquename=false]{biblatex}``` + + + + +* 请问上标的标注(引用)标签过长导致行溢出,该怎么处理? + + +上标的标注与行内的标注不一样,因此采用了上标的处理,所以上标的标注无法自动断行,因此在页边附近的长标注很有可能会溢出。由于上标标注的断行国标中并没有什么明确要求和说明,因此只能按照自己的方式进行处理,通常是将一个长标注手动分成两个短的标注,比如将: + +```\cite{key1,key2,key3,key4,key5,key6,key7}``` + +变换成: + +```\cite{key1,key2,key3}\linebreak\cite{key4,key5,key6,key7}``` + +如果两个cite之间还需要增加一个上标的逗号,那么可以手动处理比如增加`\textsuperscript{,}` + + + +* 在顺序编码制标签中,希望数字编码从两个连续编码就开始压缩,比如[1,2]压缩成[1-2],该怎么处理? + + +biblatex中处理顺序数字编码压缩的代码默认从3个连续编码开始压缩,比如[1,2,3]压缩成[1-3]。如果要修改为从2个连续编码开始压缩,只需要做一个很简单的修改即可: + +``` +%该宏的目的是抛弃压缩内部的编号,而仅输出最后一个编号,主要通过cbx@tempcnta来控制 +%一般情况下cbx@tempcnta为0,所以该宏不输出任何内容。当cbx@tempcnta在cite:comp:comp宏中更改变大后 +%说明开始进入需要压缩的范围,当到压缩终点时,cbx@tempcnta必然大于1,则输出内容。 +%修改第二行的数字1为0即可将默认的3个开始压缩变为2个开始压缩。 +\renewbibmacro*{cite:dump}{ + \ifnumgreater{\value{cbx@tempcnta}}{0} + {\ifnumgreater{\value{cbx@tempcnta}}{1}%1改为0,可以将压缩起始3个编号改为2个编号 + {\bibrangedash} + {\multicitedelim}% + \bibhyperref[\cbx@lastkey]{% + \ifdef\cbx@lastprefix + {\printtext[labelprefix]{\cbx@lastprefix}} + {}% + \printtext[labelnumber]{\cbx@lastnumber}}} + {}% + \setcounter{cbx@tempcnta}{0}% + \global\undef\cbx@lastprefix} +``` + +反之,从两个开始压缩改成3个连续压缩,方法是类似的,就是将中的0改回1。 + + + +* 在正文中的某一部分,希望取消顺序编码标签中的压缩,而其他部分保持这种压缩,该怎么处理? + + +顺序数字编码压缩的代码,主要有cite:comp:comp宏控制,因此需要局部取消压缩,可以局部的修改该宏。修改很简单,只需要注释掉其中的一行,在需要取消压缩的环境中,重定义该宏,比如: + +``` +\renewbibmacro*{cite:comp:comp}{% + \ifboolexpr{ + ( test {\iffieldundef{labelprefix}} and test {\ifundef\cbx@lastprefix} ) + or + test {\iffieldequals{labelprefix}{\cbx@lastprefix}} + } + {\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}} + {\savefield{entrykey}{\cbx@lastkey}% + \savefield{labelnumber}{\cbx@lastnumber}% + \addtocounter{cbx@tempcnta}{1}} + {\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}-1} + {} + {\usebibmacro{cite:dump}% + \ifnumgreater{\value{cbx@tempcntb}}{-1} + {\multicitedelim} + {}% + \printtext[bibhyperref]{% + \printfield{labelprefix}% + \printfield{labelnumber}}}}} + {\usebibmacro{cite:comp:end}}% + %\setcounter{cbx@tempcntb}{\thefield{labelnumber}}%%注释该行,以取消压缩 + \savefield{labelprefix}{\cbx@lastprefix}} +``` + + +​ +### 5. Examples/著录和标注结果示例 + +* 顺序编码制 + +![示例a](example/fig-style-numeric.png) + +* 作者年制 + +![示例b](example/fig-style-authoryear.png) + + +* 姓名的格式更改 + +对于bib文件中的如下条目,有: + +``` + @Article{Zhang2007-500-503, + Title = {The design and experimental investigations of supersonic length shorted nozzle}, + Author = {Zhang, Min-li and Yi, Shi-he and Zhao, Yu-xin}, + Journal = {ACTA AERODYNAMICA SINICA}, + Number = {4}, + Pages = {500-503}, + Volume = {25}, + Year = {2007} + } + + @Book{Yi2013--, + Title = {Supersonic and hypersonic nozzle design}, + Address = {Beijing}, + Author = {Yi, Shi he and Zhao, Yu xin and He, Lin and Zhang, Min li}, + Publisher = {National Defense Industry Press}, + Year = {2013} + } + + @Book{LIAO2012--, + Title = {Electronic countermeasure techniques for missile penetration}, + Address = {Beijing}, + Author = {LIAO, ping and JIANG, qin bo}, + Publisher = {National Defense Industry Press}, + Year = {2013} + } + + @Book{LIU2003--, + Title = {Introduction of Ballistic Misille Techniques}, + Address = {Beijing}, + Author = {LIU, shi Qiu}, + Publisher = {China Astronautic Publishing House}, + Year = {2003} + } +``` +![示例c](example/fig-nameformat.png) + + + +--------------------------------------------------------- + + +## Usage +* for numerical sequence style: gb7714-2015 + + `\usepackage[backend=biber,style=gb7714-2015]{biblatex}` + + - add an option `gbalign` to control the align style of the numerical label: + + `gbalign=right` for the label ragged left in a list environment, this is the default setting. + + `gbalign=center` for the same width label in a list environment with the number centered in a wrapper like bracket [] + + `gbalign=left` for the label ragged right in list environment + + `gbalign=gb7714-2015` for the label in paragraph with same separation space between label and content of the reference entry + + `\usepackage[backend=biber,style=gb7714-2015,gbalign=gb7714-2015]{biblatex}` + + - add an option `gbpub` for dealing publishing items (This option is also for author-year style): + + `gbpub = true` for gb7714 style, to print `[出版者不详]` and the like when publisher or address is absent, this is the default setting. + + `gbpub = false` for standard style, not to print the additional infomation. + + `\usepackage[backend=biber,style=gb7714-2015,gbpub=true]{biblatex}` + + - add an option `gbnamefmt` for dealing author name's letter case (This option is also for author-year style): + + `gbnamefmt = uppercase` for gb7714 style, to capitalize all the letters of the name, like: ZHANG M L, this is the default setting. + + `gbnamefmt = lowercase` for gb7714 style, do no case switch of the name, like: Zhang M L + + `gbnamefmt = givenahead` for standard style, given-family style, like: M. L. Zhang as the ieee style + + `gbnamefmt = familyahead` for standard style, family-given style, like: Zhang, M. L. as the apa style. + + `gbnamefmt = pinyin` for a common Chinese style, like: ZHANG Min-li, YI Shi-he and so on. + + `gbnamefmt = reserveorder` for standard style:family-given/given-family style + + the name format can be set per-entry using a field `nameformat`, add this field like `nameformat={pinyin}` to an entry in the bib file to set the entry's name format. + + `\usepackage[backend=biber,style=gb7714-2015,gbnamefmt=uppercase]{biblatex}` + + - add an option `gbbiblabel` to control the format of the numerical label: + + `gbbiblabel=bracket` for the numerical number in the label wrapped by bracket, like: [1], this is the default setting. + + `gbbiblabel=parens` for the numerical number in the label wrapped by parenthesis, like: (1) + + `gbbiblabel=plain` for the numerical number in the label wrapped by nothing, like: 1 + + `gbbiblabel=dot` for the numerical number in the label followed with dot, like: 1. + + `gbbiblabel=box` for the numerical number in the label wrapped by box which generated by `\framebox` + + `gbbiblabel=circle` for the numerical number in the label wrapped by circle which generated by `\textcircled` + + `\usepackage[backend=biber,style=gb7714-2015,gbbiblabel=bracket]{biblatex}` + + - add an option `gbtype` to control the output of the reference type and carrier identifier like [J/OL] (This option is also for author year style): + + `gbtype = true` for gb7714 style, print a title with the identifier, like: `an on-line article [J/OL]`, this is the default setting. + + `gbtype = false` for none identifier, print a title without identifier, like: `an on-line article` + + `\usepackage[backend=biber,style=gb7714-2015,gbtype=true]{biblatex}` + + - add an option `gbfieldtype` to control the output of field type: + + `gbfieldtype = true` to print type field, like the thesis type: `PHD thesis` or `博士学位论文`。please use `\DefineBibliographyStrings{english}{mathesis={str you want}}`,`\DefineBibliographyStrings{english}{phdthesis={str you want}}`, + `\DefineBibliographyStrings{english}{mathesiscn={str you want}}`,`\DefineBibliographyStrings{english}{phdthesiscn={str you want}}` to + define the output string, or set it in bibfile like: `type={str you want},` + + `gbfieldtype = false` not to print type field. + + `\usepackage[backend=biber,style=gb7714-2015,gbfieldtype=true]{biblatex}` + + - add an option `gbpunctin` to control the output of `//` before bookauthor for entrytypes like inbook/incollection/inproceedings(This option is also for author year style): + + `gbpunctin=true` for gb7714 style, to output `//`, this is the default setting + + `gbpunctin=false` for standard style, to output a bibstring, for English it is `IN:`, If you want to eliminate it at all, please redefine the bibstring like `\DefineBibliographyStrings{english}{in={}}` and `\DefineBibliographyStrings{english}{incn={}}`in the preamble. + + `\usepackage[backend=biber,style=gb7714-2015,gbpunctin=true]{biblatex}` + + - add an option `gbctexset` to control the bibliography heading's setting method (This option is also for author year style): + + `gbctexset=true` , the bibliography heading can be set by `\bibname` or `\refname`, this is the default setting. + + `gbpunctin=false`, the heading can be set by bibstring like `\DefineBibliographyStrings{english}{bibliography={title you want}}` or `\DefineBibliographyStrings{english}{references={title you want}}` + + or alternatively, it can also be set through the printbibliography option `title`, like `printbibliography[title=title you want]`. + + `\usepackage[backend=biber,style=gb7714-2015,gbctexset=true]{biblatex}` + + - add an option `gbcodegbk` to deal the tex source file encoded with GBK (This option is also for author year style): + + `gbcodegbk=true` , if you want to compile the GBK encoded source file with pdflatex or latex + + `gbcodegbk=false`, if you want to compile the utf-8 endcoded source file with xelatex, this is the default setting. + + `\usepackage[backend=biber,style=gb7714-2015,gbcodegbk=true]{biblatex}` + + - add an option `gbtitlelink` to control the hyperlink of title field (This option is also for author year style): + + `gbtitlelink = false` not to add hyperlink, this is the default setting. + + `gbtitlelink = true` to set the title as a hyperlink. + + `\usepackage[backend=biber,style=gb7714-2015,gbtitlelink=true]{biblatex}` + + - add an option `gbfootbib` to control the bibliography in footnote (This option is also for author year style): + + `gbfootbib = true` make patches to match the standard, this is the default setting. + + `gbfootbib = false` not to patch. + + `\usepackage[backend=biber,style=gb7714-2015,gbtitlelink=true]{biblatex}` + + - add options `gbcitelocal` `gbbiblocal` to control the local strings in citation and bibliography respectively, the `gblocal` set the both options (These options are also for author year style): + + `gbcitelocal = gb7714-2015` to output local strings according to the reference's language, this is the default setting. + + `gbcitelocal = chinese` to output local strings with chinese language word like "等". + + `gbcitelocal = english` to output local strings with western language word like "et al.". + + `\usepackage[backend=biber,style=gb7714-2015,gbcitelocal = chinese]{biblatex}` + + - add an option `gbstrict` to control the output of some unnecessary fields for GB/T7714-2015 (This option is also for author year style). + + `gbstrict=true`, not to print those fields such as language, eprint, this is the default setting. + + `gbstrict=false`, to output them as the standard style + + `\usepackage[backend=biber,style=gb7714-2015,gbstrict=true]{biblatex}` + + - add an option `gbfieldstd` to control the format of some fields such as title, url and pages (This option is also for author year style): + + `gbfieldstd = false` for gb7714 style, format of the fields follows the GB/T7714-2015 standard, this is the default setting. + + `gbfieldstd = true` for standard style. + + `\usepackage[backend=biber,style=gb7714-2015,gbfieldstd=true]{biblatex}` + + +* for multi-style: gb7714-2015ms + + In order to use two styles in a tex file, add a style gb7714-2015ms. option `gbstyle` is added to control the using mode. `gbstyle=true` means all references are printed with GB/T7714-2015 style, and `gbstyle=false` means the chinese references are printed with GB/T7714-2015 style while the other references are printed with standard style shipped by biblatex, and `gbstyle=true` is the default set. all the options for numerical sequence style gb7714-2015 can also be used in gb7714-2015ms. + + + `\usepackage[backend=biber,style=gb7714-2015ms,gbstyle=false]{biblatex}` + +* for author year style: gb7714-2015ay + + `\usepackage[backend=biber,style=gb7714-2015ay,gbpub=true]{biblatex}` + + - add an option `gbnoauthor` for dealing undefined author: + + `gbnoauthor = true` for gb7714 style, to print `佚名` or `Anon` when the author of the entry is absent. + + `gbnoauthor = false` for standard style, not to pring anything, this is the default setting. + + `\usepackage[backend=biber,style=gb7714-2015ay,gbnoauthor=true]{biblatex}` + + - add an option value `mergedate=none` to control the date in bibliography: + + `mergedate=true` to output date only after author,like:LAMPORT L, (1986). Document Preparation System[M]. [S.l.]: Addison-Wesley Reading, MA. + + `mergedate=false` to output date after author and in publish items,like:LAMPORT L, (1986). Document Preparation System[M]. [S.l.]: Addison-Wesley Reading, MA, 1986. + + `mergedate=none` to output date only in publish items,like:LAMPORT L. Document Preparation System[M]. [S.l.]: Addison-Wesley Reading, MA, 1986. + + do not set mergedate output like:LAMPORT L, 1986. Document Preparation System[M]. [S.l.]: Addison-Wesley Reading, MA. + + `\usepackage[backend=biber,style=gb7714-2015ay,mergedate=none]{biblatex}` + + - add an option `gblanorder` to control sequence of reference groups of different languagesin the bibliography: + + `gblanorder=chineseahead` to set the sequence as: cn;jp;kr;en;fr;ru + + `gblanorder=englishahead` to set the sequence as: en;fr;ru;cn;jp;kr + + `gblanorder=user defined string like: cn;en;jp;kr;fr;ru` to set the sequence as: cn;en;jp;kr;fr;ru. + + `\usepackage[backend=biber,style=gb7714-2015ay,gblanorder=cn;en;jp;fr;kr;ru]{biblatex}` + +* for perl script transformation tool(only for the numerical style) + + `perl gb7714texttobib.pl in=textfilename out=bibfilename` + +A demonstration database is provided to show how to format input for the style. The biblatex-gb7714-2015 style works with texlive2014, texlive2015, texlive2016, texlive2017 , texlive2018 and so on. + +please see the file 'biblatex-gb7714-2015.pdf' for further information! + + +## Version history: + +* 2016/05/20 v1.0 +* 2016/10/23 v1.0a +* 2016/11/11 v1.0b +* 2016/11/14 v1.0c +* 2016/11/24 v1.0d +* 2016/12/07 v1.0e +* 2017/02/26 v1.0g +* 2017/04/11 v1.0h +* 2017/11/21 v1.0i +* 2018/01/20 v1.0j +* 2018/04/03 v1.0k +* 2018/06/01 v1.0l +* 2018/08/14 v1.0m,CTAN +* 2018/11/04 v1.0n +* 2018/12/22 v1.0o +* 2019/01/19 v1.0p +* 2019/02/11 v1.0q +* 2019/03/28 v1.0r +* 2019/03/29 v1.0rm,rename erj to chinese-erj,ctan +* 2019/08/28 v1.0s +* 2020/03/04 v1.0t,ctan +* 2020/03/30 v1.0u +* 2020/07/21 v1.0v,ctan +* 2021/01/19 v1.0w,ctan + + + +--------------------------------------------------------- +## Update history: + +[update: tex](example/updatehistory.tex) + +[update: tex](example/updatehistoryold.tex) + + + diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015-preamble.tex b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015-preamble.tex index 89a481574e..bca0153d42 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015-preamble.tex +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015-preamble.tex @@ -1,431 +1,431 @@ -\usepackage{expl3,etoolbox,ifthen,xstring} -\usepackage{xltxtra,mflogo,texnames,fontawesome} -%\usepackage{amstext} -\usepackage[zihao=-4]{ctex} -\ctexset{today=old} -\let\kaiti=\kaishu -\usepackage{xeCJKfntef} -%\setmainfont{CMU Serif} -\usepackage{fontspec} -%\usepackage{tgpagella} -\setmainfont[Ligatures=TeX]{TeX Gyre Pagella} -\setsansfont[Ligatures=TeX]{TeX Gyre Pagella} -\setmonofont[Ligatures=TeX]{TeX Gyre Pagella} -%\usepackage{unicode-math} -%\setmathfont[math-style=ISO,bold-style=ISO]{TeX Gyre Pagella Math} - -\setmainfont{CMU Serif} -\IfFileExists{SourceHanSerifSC-Regular.otf} -{\setCJKmainfont[BoldFont=SourceHanSansSC-Regular.otf, ItalicFont=simkai.ttf]{SourceHanSerifSC-Regular.otf}}{} - -\usepackage[dvipsnames]{xcolor} -\colorlet{examplefill}{yellow!80!black} -\definecolor{graphicbackground}{rgb}{0.96,0.96,0.8} -\definecolor{codebackground}{rgb}{0.9,0.9,1} -\definecolor{gbsteelblue}{RGB}{70,130,180} -\definecolor{gborange}{RGB}{255,138,88} -\definecolor{gbblue}{RGB}{23,74,117} -\definecolor{gbforestgreen}{RGB}{21,122,81} -\definecolor{gbyellow}{RGB}{255,185,88} -\definecolor{gbgrey}{RGB}{200,200,200} -\colorlet{gblabelcolor}{violet} -\colorlet{gbemphcolor}{blue!60!black} -%\colorlet{gbemphcolor}{violet} - -%定义版面,showframe, -\usepackage[paperwidth=210mm,paperheight=290mm,left=35mm,right=20mm,top=25mm, bottom=20mm,showcrop]{geometry}%,showframe -\renewcommand{\baselinestretch}{1.35} -%页面布局的标尺 -\usepackage[type=none]{fgruler} -%[unit=cm,type=lowerleft,showframe=true,hshift=3cm,vshift=2cm] -\rulerparams{}{}{gray!10}{}{0.2pt} -\fgrulerdefnum{}\fgrulercaptioncm{}%fgruler加数字后,导致基线对齐出现问题,所以这里去掉 - -\newlength{\skipheadrule} -\deflength{\skipheadrule}{3.5pt} -\newlength{\skipfootrule} -\deflength{\skipfootrule}{5.5pt} -\newlength{\ruletotalen} -\deflength{\ruletotalen}{\textheight} -\newlength{\ruleraised} -\deflength{\ruleraised}{\headsep+\textheight} -\usepackage{fancyhdr} -\fancyhf{} -%\fancyhead[LO]{% -%\raisebox{-\skipheadrule}{% -%\raisebox{-\headsep}[0pt][0pt]{\makebox[0pt][l]{\ruler{rightup}{\linewidth}}}% -%\raisebox{-\ruleraised}[0pt][0pt]{\makebox[0pt][r]{\ruler{upleft}{\ruletotalen}}}% -%}%HEAD LEFT% -%} -%\fancyhead[LE]{% -%\raisebox{-\skipheadrule}{% -%\raisebox{-\headsep}[0pt][0pt]{\makebox[0pt][l]{\ruler{rightup}{\linewidth}}}% -%\raisebox{-\ruleraised}[0pt][0pt]{\makebox[0pt][r]{\ruler{upleft}{\ruletotalen}}}% -%}\leftmark%HEAD LEFT% -%} -%\fancyhead[RO]{% -%%HEAD RIGHT% -%\raisebox{-\skipheadrule}{% -%\hfill\makebox[0pt][l]{\raisebox{-\ruleraised}[0pt][0pt]{\ruler{downright}{\ruletotalen}}\hss}% -%}} -%\fancyhead[RE]{% -%\rightmark%HEAD RIGHT% -%\raisebox{-\skipheadrule}{% -%\hfill\makebox[0pt][l]{\raisebox{-\ruleraised}[0pt][0pt]{\ruler{downright}{\ruletotalen}}\hss}% -%}} -\fancyhead[CO]{% -符合GB/T 7714-2015标准的biblatex参考文献样式%HEAD CENTER -} -%\fancyfoot[L]{% -%\raisebox{-\skipfootrule}{% -%\raisebox{\footskip}[0pt][0pt]{\makebox[0pt][l]{\ruler{rightdown}{\linewidth}}} -%}%FOOT LEFT -%} -\fancyfoot[C]{% -\thepage%FOOT CENTER -} -\fancyfoot[R]{% -%FOOT RIGHT -} -\renewcommand{\headrulewidth}{0.4pt} -\renewcommand{\footrulewidth}{0pt} -\pagestyle{fancy} - - -%超链接书签功能,选项去掉链接红色方框 -\usepackage[colorlinks=true,% -pdfstartview=FitH,allcolors=gbemphcolor, -bookmarksopenlevel=4,% -bookmarksdepth=4,]{hyperref} -%linkcolor=gbblue,anchorcolor=gbblue,citecolor=gbblue -%linkcolor=black,linkcolor=green,blue,red,cyan, magenta, -%yellow, black, gray,white, darkgray, lightgray, brown, -%lime, olive, orange, red,purple, teal, violet. -%CJKbookmarks,bookmarksnumbered=true, -\usepackage{titleref} %标题引用 - -%标题格式设置 -\usepackage{titlesec} -%\titlespacing*{hcommandi}{hlefti}{hbefore-sepi}{hafter-sepi}[hright-sepi] -\titlespacing*{\section}{0pt}{\baselineskip}{0.5\baselineskip} -\titlespacing*{\subsection}{0pt}{0.5\baselineskip}{0.5\baselineskip} -\titlespacing*{\subsubsection}{0pt}{0.5\baselineskip}{0pt} -\titlespacing{\paragraph}{2em}{0.5\baselineskip}{1em} -%这里利用titleformat*简单做设置,也可以利用titleformat做详细设置 -\titleformat*{\section}{\zihao{-3}\bfseries\heiti} -\titleformat*{\subsection}{\zihao{4}\bfseries\songti} -\titleformat*{\subsubsection}{\zihao{-4}\bfseries\kaiti} - -%参考文献 -\usepackage[backend=biber,style=gb7714-2015,gbalign=center,gbfootbib=true%,gbtype=true% -]{biblatex}%,backref=true% -\addbibresource[location=local]{example.bib} -\setlength{\bibitemsep}{1pt} -%\defbibheading{bibliography}[\bibname]{% -%%\phantomsection%解决链接指引出错的问题,相当于加入了一个引导点 -%%\addcontentsline{toc}{subsection}{#1} -% \centering\subsubsection*{#1}}% - - -%目录,图/表/例目录,图表题注 -\usepackage[bf]{subfigure} -\usepackage[subfigure]{tocloft} %注意其与titletoc共用时分页会有问题 -\usepackage{ccaption} -\captiondelim{. } %图序图题中间的间隔符号 -\captionnamefont{\zihao{-5}\heiti} %图序样式 -\captiontitlefont{\zihao{-5}\heiti} %图题样式 -\captionwidth{0.8\linewidth} %标题宽度 -\changecaptionwidth -\captionstyle{\centering} %\captionstyle{ - - - - -
-

BibLaTeX Check

-
- -
- - - - - - -
-
-
-
-""") - html.write("

Info

    ") - html.write("
  • bib file: " + options.bibFile + "
  • ") - html.write("
  • aux file: " + options.auxFile + "
  • ") - html.write("
  • # entries: " + str(len(problems)) + "
  • ") - html.write("
  • # problems: " + str(problemCount) + "
    • ") - html.write("
    • # missing fields: " + str(counterMissingFields) + "
    • ") - html.write("
    • # flawed names: " + str(counterFlawedNames) + "
    • ") - html.write("
    • # wrong types: " + str(counterWrongTypes) + "
    • ") - html.write("
    • # non-unique id: " + str(counterNonUniqueId) + "
    • ") - html.write("
    • # wrong field: " + str(counterWrongFieldNames) + "
    • ") - html.write("
") - - problems.sort() - for problem in problems: - html.write(problem) - html.write("") - html.close() - - if options.view: - import webbrowser - webbrowser.open(html.name) - - print("SUCCESS: Report {} has been generated".format(options.htmlOutput)) - -if problemCount > 0: - print("WARNING: Found {} problems.".format(problemCount)) - sys.exit(-1) diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/chinese-erj.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/chinese-erj.bbx index dbb03b854a..161dcacd8b 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/chinese-erj.bbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/chinese-erj.bbx @@ -1,237 +1,237 @@ -%% -%% --------------------------------------------------------------- -%% erj.bbx --- A bibliography style of Economic Research Journal in china -%% modified from gb7714-2015ay at the request of ddswhu -%% Maintained by huzhenzhen -%% E-mail: hzzmail@163.com -%% Released under the LaTeX Project Public License v1.3c or later -%% --------------------------------------------------------------- -%% -%%用法:类似于标准的样式在biblatex加载时设置样式 -%%文献表正常处理,标注命令主要用cite和textcite -\ProvidesFile{chinese-erj.bbx}[2019/03/28 v1.0 a biblatex bibliography style for ERJ] - - -%================================================== -%加载gb样式 -%================================================== -\RequireBibliographyStyle{gb7714-2015ay} -\RequirePackage{mfirstuc}%单词首字母大写的问题 -\MFUnocap{in}% -\MFUnocap{the}% -\MFUnocap{of}% -\MFUnocap{on}% -\MFUnocap{and}% -\MFUnocap{for}% - - -%================================================== -%考虑多音字增加multipinyin排序,是其可以根据key域添加拼音来排序 -%================================================== -\DeclareSortingTemplate{multipinyin}{ - \sort{ - \field{presort} - } - \sort{ - \field{lansortorder}%language - } - \sort{ - \field{sortkey} - } - \sort{%[direction=descending] - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sortyear} - \field{year} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field{volume} - \literal{0} - } - } - -%================================================== -%选项设置 -%================================================== - \ExecuteBibliographyOptions{ - maxbibnames=99, - gbtype=false, - gbpub=false, - gbnamefmt=reverseorder, - sorting=multipinyin, - doi=false, - url=false, - } - -%================================================== -%为标注和文献表中标点格式,重设and本地化字符串 -%================================================== -\DefineBibliographyStrings{english}{ - and = { and},%and后面的空格在finalnamedelim已经加过了,所以这里去掉20191009 - andcn = {、}, - andincitecn = {和},%将标注中的分开,便于与文献表中的区分 - andincite = {\&}, - %andotherscn={等}, - %mathesiscn={[硕士学位论文]}, - %phdthesiscn={[博士学位论文]}, -} - - -%================================================== -%设置一些标点格式为中文的标点 -%================================================== -\DeclareFieldFormat{titlecase}{\iffieldequalstr{userd}{chinese}{#1}{\capitalisewords{#1}}} -\DeclareFieldFormat*{title}{\iffieldequalstr{userd}{chinese}{《#1》}{#1\isdot}} -\DeclareFieldFormat[article]{title}{\iffieldequalstr{userd}{chinese}{《#1》}{\mkbibquote{#1}\isdot}} -\DeclareFieldFormat*{journaltitle}{\iffieldequalstr{userd}{chinese}{《#1》}{\textit{#1}}}% -%\DeclareFieldFormat*{booktitle}{《#1》} -\renewcommand*{\revsdnamepunct}{,}%%来源biblatex.def -\DeclareDelimFormat*{multinamedelim}{\iffieldequalstr{userd}{chinese}{、}{,}}%\addcomma\addspace -\DeclareDelimFormat{finalnamedelim}{% - %\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% - %\addspace% - \edef\userfieldabcde{userd}% - \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbcitelocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\space\bibstring{andincite}\space}{}% - \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% -%\space% - \or% - \bibstring{andincitecn}\space% - \or% - \bibstring{andincite}\space% - \fi} -\DeclareDelimFormat[bib,biblist]{finalnamedelim}{% -% \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% -% \addspace% - \edef\userfieldabcde{userd}% - \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbbiblocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}% - \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% -\space% - \or% - \bibstring{andcn}\space% - \or% - \bibstring{and}\space% - \fi} -\DeclareDelimFormat{nameyeardelim}{,}%\addcomma\addspace -\DeclareDelimFormat[bib,biblist]{nameyeardelim}{,}%\addcomma\addspace -\DeclareDelimFormat{bibpagespunct}{\iffieldequalstr{userd}{chinese}{}{,}}%\addcomma\addspace -\renewcommand*{\newunitpunct}{,}%\addcomma\space %, -\renewcommand*{\finentrypunct}{\iffieldequalstr{userd}{chinese}{。}{\adddot}} - -%================================================== -%调整部分域的输出格式 -%================================================== -% -% 修改number和volume的格式 -% -\newcounter{numberwithoutzero} -\DeclareFieldFormat[article,periodical]{number}% - {\iffieldequalstr{userd}{chinese}{% - \iffieldint{number}{\setcounter{numberwithoutzero}{#1}\printtext{\bibstring{serialcn}\addthinspace\arabic{numberwithoutzero}\addthinspace 期}} - {\printtext{\bibstring{serialcn}\addthinspace#1\addthinspace 期}}% - }% - {\printtext{(}#1\printtext{)}}}% % -\DeclareFieldFormat[article,periodical]{volume}% - {\iffieldequalstr{userd}{chinese}{}% - {#1}}% volume of a book - -% -% 调整期刊名的格式 -% -% 原理方法:因为作者年制年份提到前面,因此涉及到期刊名与后面的卷期的关系。 -% v1.0k,20180425,增加了字体控制命令,hzz -\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx - \usebibmacro{journal}% - %\setunit*{\addspace}% - %\setunit*{\addcomma\addspace}%修改为增加一个逗号 - \iffieldundef{series}% - {}% - {\newunit% - \printfield{series}% - \setunit{\addspace}}% - %\usebibmacro{volume+number+eid}% - %\setunit{\addspace}% - \usebibmacro{issue+date}% - %\setunit{\addcolon\space}% - %\iffieldundef{volume}{}{\setunit{\addcomma\space}}% - %换成逗号和空格 - \usebibmacro{issue}% - \usebibmacro{volume+number+eid}%把卷期放到年份后面 - %\newunit - } - -% 调整期刊卷和期的格式 -% -\renewbibmacro*{volume+number+eid}{%源来自standard.bbx -\iffieldequalstr{userd}{chinese}{%\printfield{volume}% - \iffieldundef{number}{}{\printfield{number}}%区别于顺序编码制 - } - {\newunit\printfield{volume}% - %\setunit*{\adddot\space}% - \printfield{number}% - \setunit{\addcomma\space}% - \printfield{eid}}} - -% -% 重设title的输出 -% -% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen -% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件 -% 利用toggle做标识符是否输出的判断 -\renewbibmacro*{title}{% - \ifboolexpr{% - test{\iffieldundef{title}}% - and - test{\iffieldundef{subtitle}}% - }% - {}% - {\setunit{:}\printtext[title]{\bibtitlefont%增加字体控制命令%增加了标点: - \printfield[titlecase]{title}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct}% - \printfield[titlecase]{subtitle}}% - \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 - {\setunit{\subtitlepunct}\printfield{titleaddon}}% - \iftoggle{bbx:gbtype}{% - \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 - {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 - {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}% 判断是否为报纸 - {\printfield[gbtypeflag]{usera}}}% 其它 - }}{}% - %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 - %\newunit - }% -}} - -\DeclareFieldFormat{pages}{\iffieldequalstr{userd}{chinese}{}{#1}}%页码引用格式的修改%去掉前面引导页码的pp.等字符 - -\setlength{\bibitemindent}{1.5\ccwd} % bibitemindent表示一条文献中第一行相对后面各行的缩进 -\setlength{\bibhang}{0pt} % 作者年制中 bibhang 表示的各行起始位置到页 - % 边的距离,顺序编码制中 - % bibhang+labelnumberwidth 表示各行起始位置 - % 到页边的距离 +%% +%% --------------------------------------------------------------- +%% erj.bbx --- A bibliography style of Economic Research Journal in china +%% modified from gb7714-2015ay at the request of ddswhu +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% +%%用法:类似于标准的样式在biblatex加载时设置样式 +%%文献表正常处理,标注命令主要用cite和textcite +\ProvidesFile{chinese-erj.bbx}[2019/03/28 v1.0 a biblatex bibliography style for ERJ] + + +%================================================== +%加载gb样式 +%================================================== +\RequireBibliographyStyle{gb7714-2015ay} +\RequirePackage{mfirstuc}%单词首字母大写的问题 +\MFUnocap{in}% +\MFUnocap{the}% +\MFUnocap{of}% +\MFUnocap{on}% +\MFUnocap{and}% +\MFUnocap{for}% + + +%================================================== +%考虑多音字增加multipinyin排序,是其可以根据key域添加拼音来排序 +%================================================== +\DeclareSortingTemplate{multipinyin}{ + \sort{ + \field{presort} + } + \sort{ + \field{lansortorder}%language + } + \sort{ + \field{sortkey} + } + \sort{%[direction=descending] + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sortyear} + \field{year} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field{volume} + \literal{0} + } + } + +%================================================== +%选项设置 +%================================================== + \ExecuteBibliographyOptions{ + maxbibnames=99, + gbtype=false, + gbpub=false, + gbnamefmt=reverseorder, + sorting=multipinyin, + doi=false, + url=false, + } + +%================================================== +%为标注和文献表中标点格式,重设and本地化字符串 +%================================================== +\DefineBibliographyStrings{english}{ + and = { and},%and后面的空格在finalnamedelim已经加过了,所以这里去掉20191009 + andcn = {、}, + andincitecn = {和},%将标注中的分开,便于与文献表中的区分 + andincite = {\&}, + %andotherscn={等}, + %mathesiscn={[硕士学位论文]}, + %phdthesiscn={[博士学位论文]}, +} + + +%================================================== +%设置一些标点格式为中文的标点 +%================================================== +\DeclareFieldFormat{titlecase}{\iffieldequalstr{userd}{chinese}{#1}{\capitalisewords{#1}}} +\DeclareFieldFormat*{title}{\iffieldequalstr{userd}{chinese}{《#1》}{#1\isdot}} +\DeclareFieldFormat[article]{title}{\iffieldequalstr{userd}{chinese}{《#1》}{\mkbibquote{#1}\isdot}} +\DeclareFieldFormat*{journaltitle}{\iffieldequalstr{userd}{chinese}{《#1》}{\textit{#1}}}% +%\DeclareFieldFormat*{booktitle}{《#1》} +\renewcommand*{\revsdnamepunct}{,}%%来源biblatex.def +\DeclareDelimFormat*{multinamedelim}{\iffieldequalstr{userd}{chinese}{、}{,}}%\addcomma\addspace +\DeclareDelimFormat{finalnamedelim}{% + %\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% + %\addspace% + \edef\userfieldabcde{userd}% + \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbcitelocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\space\bibstring{andincite}\space}{}% + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% +%\space% + \or% + \bibstring{andincitecn}\space% + \or% + \bibstring{andincite}\space% + \fi} +\DeclareDelimFormat[bib,biblist]{finalnamedelim}{% +% \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% +% \addspace% + \edef\userfieldabcde{userd}% + \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% +\space% + \or% + \bibstring{andcn}\space% + \or% + \bibstring{and}\space% + \fi} +\DeclareDelimFormat{nameyeardelim}{,}%\addcomma\addspace +\DeclareDelimFormat[bib,biblist]{nameyeardelim}{,}%\addcomma\addspace +\DeclareDelimFormat{bibpagespunct}{\iffieldequalstr{userd}{chinese}{}{,}}%\addcomma\addspace +\renewcommand*{\newunitpunct}{,}%\addcomma\space %, +\renewcommand*{\finentrypunct}{\iffieldequalstr{userd}{chinese}{。}{\adddot}} + +%================================================== +%调整部分域的输出格式 +%================================================== +% +% 修改number和volume的格式 +% +\newcounter{numberwithoutzero} +\DeclareFieldFormat[article,periodical]{number}% + {\iffieldequalstr{userd}{chinese}{% + \iffieldint{number}{\setcounter{numberwithoutzero}{#1}\printtext{\bibstring{serialcn}\addthinspace\arabic{numberwithoutzero}\addthinspace 期}} + {\printtext{\bibstring{serialcn}\addthinspace#1\addthinspace 期}}% + }% + {\printtext{(}#1\printtext{)}}}% % +\DeclareFieldFormat[article,periodical]{volume}% + {\iffieldequalstr{userd}{chinese}{}% + {#1}}% volume of a book + +% +% 调整期刊名的格式 +% +% 原理方法:因为作者年制年份提到前面,因此涉及到期刊名与后面的卷期的关系。 +% v1.0k,20180425,增加了字体控制命令,hzz +\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx + \usebibmacro{journal}% + %\setunit*{\addspace}% + %\setunit*{\addcomma\addspace}%修改为增加一个逗号 + \iffieldundef{series}% + {}% + {\newunit% + \printfield{series}% + \setunit{\addspace}}% + %\usebibmacro{volume+number+eid}% + %\setunit{\addspace}% + \usebibmacro{issue+date}% + %\setunit{\addcolon\space}% + %\iffieldundef{volume}{}{\setunit{\addcomma\space}}% + %换成逗号和空格 + \usebibmacro{issue}% + \usebibmacro{volume+number+eid}%把卷期放到年份后面 + %\newunit + } + +% 调整期刊卷和期的格式 +% +\renewbibmacro*{volume+number+eid}{%源来自standard.bbx +\iffieldequalstr{userd}{chinese}{%\printfield{volume}% + \iffieldundef{number}{}{\printfield{number}}%区别于顺序编码制 + } + {\newunit\printfield{volume}% + %\setunit*{\adddot\space}% + \printfield{number}% + \setunit{\addcomma\space}% + \printfield{eid}}} + +% +% 重设title的输出 +% +% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen +% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件 +% 利用toggle做标识符是否输出的判断 +\renewbibmacro*{title}{% + \ifboolexpr{% + test{\iffieldundef{title}}% + and + test{\iffieldundef{subtitle}}% + }% + {}% + {\setunit{:}\printtext[title]{\bibtitlefont%增加字体控制命令%增加了标点: + \printfield[titlecase]{title}% + \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 + {}{\setunit{\subtitlepunct}% + \printfield[titlecase]{subtitle}}% + \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 + {\setunit{\subtitlepunct}\printfield{titleaddon}}% + \iftoggle{bbx:gbtype}{% + \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 + {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 + {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}% 判断是否为报纸 + {\printfield[gbtypeflag]{usera}}}% 其它 + }}{}% + %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 + %\newunit + }% +}} + +\DeclareFieldFormat{pages}{\iffieldequalstr{userd}{chinese}{}{#1}}%页码引用格式的修改%去掉前面引导页码的pp.等字符 + +\setlength{\bibitemindent}{1.5\ccwd} % bibitemindent表示一条文献中第一行相对后面各行的缩进 +\setlength{\bibhang}{0pt} % 作者年制中 bibhang 表示的各行起始位置到页 + % 边的距离,顺序编码制中 + % bibhang+labelnumberwidth 表示各行起始位置 + % 到页边的距离 diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/chinese-erj.cbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/chinese-erj.cbx index 7fd829a0ee..53bb2e1177 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/chinese-erj.cbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/chinese-erj.cbx @@ -1,151 +1,151 @@ -%% -%% --------------------------------------------------------------- -%% erj.cbx --- A citation style of Economic Research Journal in china -%% modified from gb7714-2015ay for the request by ddswhu -%% Maintained by huzhenzhen -%% E-mail: hzzmail@163.com -%% Released under the LaTeX Project Public License v1.3c or later -%% --------------------------------------------------------------- -%% -%%用法:类似于标准的样式在biblatex加载时设置样式 -%%文献表正常处理,标注命令主要用cite和textcite - -\ProvidesFile{chinese-erj.cbx}[2019/03/28 v1.0 a biblatex citation style for ERJ] - -%================================================== -%加载gb样式 -%================================================== -\RequireCitationStyle{gb7714-2015ay} % - - - -%================================================== -%选项设置 -%================================================== -\ExecuteBibliographyOptions{ - maxcitenames=2, - mincitenames=1, -} - -%================================================== -%引用命令设置,主要用cite和textcite -%包括标点设置 -%================================================== -\renewcommand*{\multicitedelim}{;}%\addsemicolon\addspace; -\renewcommand*{\textcitedelim}{% - \iffinalcitedelim - {\ifnumgreater{\value{textcitetotal}}{2} - {}{}%\iftextcitepunct{\finalandsemicolon}{\finalandcomma} - \addspace 、}%\addspace\bibstring{andincitecn} - {\iftextcitepunct{\addsemicolon\space}{\addspace 、}}%\addcomma -}%\space - -\DeclareDelimFormat[textcite]{nameyeardelim}{\addspace}%\addcomma\space -\DeclareDelimFormat[textcite]{andothersdelim}{\iffieldequalstr{userf}{chinese}{}{\addspace}}% - -%之所以不用\DeclareDelimFormat{andothersdelim}{}这样的设置是因为gb7714-2015中为兼容老版本的biblatex做的处理就是这样的 -%所以用相同的方式 -\AtEveryCitekey{% -\iffieldequalstr{userf}{chinese}{\renewcommand*{\andothersdelim}{}}%\addthinspace - {\renewcommand*{\andothersdelim}{\addspace}}% -} - -%标注压缩时,直接用date+extradate代替extradate实现2006a,2006b的效果 -%\DeclareDelimFormat*{compcitedelim}{、}%\addcomma\addspace -\newbibmacro*{cite:extradate}{% - \iffieldundef{extradate} - {} - {\printtext[bibhyperref]{\addspace\printlabeldateextra}}}%\printfield{extradate}\printlabeldateextra \printfield{labelyear}\printfield{extradate} - -%\AtEveryCite{% -%\let\parentext=\parentexttrack% -%\let\bibopenparen=(% -%\let\bibcloseparen=)} - -%添加前后空格 -\DeclareCiteCommand{\cite}%[\mkbibparens] - {\usebibmacro{cite:init}% - \printtext{(}\usebibmacro{prenote}}%)\addspace - {\usebibmacro{citeindex}% - \usebibmacro{cite}} - {} - {\usebibmacro{postnote}%( - )}%\addspace - -%原版 -%\DeclareCiteCommand{\cite}[\mkbibparens] -% {\usebibmacro{cite:init}% -% \usebibmacro{prenote}}%) -% {\usebibmacro{citeindex}% -% \usebibmacro{cite}} -% {} -% {\usebibmacro{postnote}} - -% -%添加后面空格 -%\DeclareCiteCommand{\cbx@textcite} -% {\usebibmacro{cite:init}} -% {\usebibmacro{citeindex}% -% \usebibmacro{textcite}} -% {} -% {\usebibmacro{textcite:postnote}\addspace} - -\newbibmacro*{textcite}{% - \iffieldequals{namehash}{\cbx@lasthash} - {\iffieldundef{shorthand} - {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND - \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} - {\setunit{\addcomma}% - \usebibmacro{cite:extradate}} - {\setunit{\compcitedelim}% - \usebibmacro{cite:labeldate+extradate}% - \savefield{labelyear}{\cbx@lastyear}}} - {\setunit{\compcitedelim}% - \usebibmacro{cite:shorthand}% - \global\undef\cbx@lastyear}} - {\ifnameundef{labelname} - {\iffieldundef{shorthand} - {\usebibmacro{cite:label}% - \setunit{% - \global\booltrue{cbx:parens}% - \printdelim{nonameyeardelim}(}%\bibopenparen - \ifnumequal{\value{citecount}}{1} - {\usebibmacro{prenote}} - {}% - \usebibmacro{cite:labeldate+extradate}} - {\usebibmacro{cite:shorthand}}} - {\printnames{labelname}% - \setunit{% - \global\booltrue{cbx:parens}% - \printdelim{nameyeardelim}(}%\bibopenparen - \ifnumequal{\value{citecount}}{1} - {\usebibmacro{prenote}} - {}% - \iffieldundef{shorthand} - {\iffieldundef{labelyear} - {\usebibmacro{cite:label}} - {\usebibmacro{cite:labeldate+extradate}}% - \savefield{labelyear}{\cbx@lastyear}} - {\usebibmacro{cite:shorthand}% - \global\undef\cbx@lastyear}}% - \stepcounter{textcitecount}% - \savefield{namehash}{\cbx@lasthash}}% - \setunit{% - \ifbool{cbx:parens} - {)\global\boolfalse{cbx:parens}}%\bibcloseparen - {}% - \textcitedelim}} - -\newbibmacro*{textcite:postnote}{% - \usebibmacro{postnote}% - \ifthenelse{\value{multicitecount}=\value{multicitetotal}} - {\setunit{}% - \printtext{% - \ifbool{cbx:parens} - {)\global\boolfalse{cbx:parens}}%\bibcloseparen - {}}} - {\setunit{% - \ifbool{cbx:parens} - {)\global\boolfalse{cbx:parens}}%\bibcloseparen - {}% - \textcitedelim}}} +%% +%% --------------------------------------------------------------- +%% erj.cbx --- A citation style of Economic Research Journal in china +%% modified from gb7714-2015ay for the request by ddswhu +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% +%%用法:类似于标准的样式在biblatex加载时设置样式 +%%文献表正常处理,标注命令主要用cite和textcite + +\ProvidesFile{chinese-erj.cbx}[2019/03/28 v1.0 a biblatex citation style for ERJ] + +%================================================== +%加载gb样式 +%================================================== +\RequireCitationStyle{gb7714-2015ay} % + + + +%================================================== +%选项设置 +%================================================== +\ExecuteBibliographyOptions{ + maxcitenames=2, + mincitenames=1, +} + +%================================================== +%引用命令设置,主要用cite和textcite +%包括标点设置 +%================================================== +\renewcommand*{\multicitedelim}{;}%\addsemicolon\addspace; +\renewcommand*{\textcitedelim}{% + \iffinalcitedelim + {\ifnumgreater{\value{textcitetotal}}{2} + {}{}%\iftextcitepunct{\finalandsemicolon}{\finalandcomma} + \addspace 、}%\addspace\bibstring{andincitecn} + {\iftextcitepunct{\addsemicolon\space}{\addspace 、}}%\addcomma +}%\space + +\DeclareDelimFormat[textcite]{nameyeardelim}{\addspace}%\addcomma\space +\DeclareDelimFormat[textcite]{andothersdelim}{\iffieldequalstr{userf}{chinese}{}{\addspace}}% + +%之所以不用\DeclareDelimFormat{andothersdelim}{}这样的设置是因为gb7714-2015中为兼容老版本的biblatex做的处理就是这样的 +%所以用相同的方式 +\AtEveryCitekey{% +\iffieldequalstr{userf}{chinese}{\renewcommand*{\andothersdelim}{}}%\addthinspace + {\renewcommand*{\andothersdelim}{\addspace}}% +} + +%标注压缩时,直接用date+extradate代替extradate实现2006a,2006b的效果 +%\DeclareDelimFormat*{compcitedelim}{、}%\addcomma\addspace +\newbibmacro*{cite:extradate}{% + \iffieldundef{extradate} + {} + {\printtext[bibhyperref]{\addspace\printlabeldateextra}}}%\printfield{extradate}\printlabeldateextra \printfield{labelyear}\printfield{extradate} + +%\AtEveryCite{% +%\let\parentext=\parentexttrack% +%\let\bibopenparen=(% +%\let\bibcloseparen=)} + +%添加前后空格 +\DeclareCiteCommand{\cite}%[\mkbibparens] + {\usebibmacro{cite:init}% + \printtext{(}\usebibmacro{prenote}}%)\addspace + {\usebibmacro{citeindex}% + \usebibmacro{cite}} + {} + {\usebibmacro{postnote}%( + )}%\addspace + +%原版 +%\DeclareCiteCommand{\cite}[\mkbibparens] +% {\usebibmacro{cite:init}% +% \usebibmacro{prenote}}%) +% {\usebibmacro{citeindex}% +% \usebibmacro{cite}} +% {} +% {\usebibmacro{postnote}} + +% +%添加后面空格 +%\DeclareCiteCommand{\cbx@textcite} +% {\usebibmacro{cite:init}} +% {\usebibmacro{citeindex}% +% \usebibmacro{textcite}} +% {} +% {\usebibmacro{textcite:postnote}\addspace} + +\newbibmacro*{textcite}{% + \iffieldequals{namehash}{\cbx@lasthash} + {\iffieldundef{shorthand} + {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND + \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} + {\setunit{\addcomma}% + \usebibmacro{cite:extradate}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:labeldate+extradate}% + \savefield{labelyear}{\cbx@lastyear}}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:shorthand}% + \global\undef\cbx@lastyear}} + {\ifnameundef{labelname} + {\iffieldundef{shorthand} + {\usebibmacro{cite:label}% + \setunit{% + \global\booltrue{cbx:parens}% + \printdelim{nonameyeardelim}(}%\bibopenparen + \ifnumequal{\value{citecount}}{1} + {\usebibmacro{prenote}} + {}% + \usebibmacro{cite:labeldate+extradate}} + {\usebibmacro{cite:shorthand}}} + {\printnames{labelname}% + \setunit{% + \global\booltrue{cbx:parens}% + \printdelim{nameyeardelim}(}%\bibopenparen + \ifnumequal{\value{citecount}}{1} + {\usebibmacro{prenote}} + {}% + \iffieldundef{shorthand} + {\iffieldundef{labelyear} + {\usebibmacro{cite:label}} + {\usebibmacro{cite:labeldate+extradate}}% + \savefield{labelyear}{\cbx@lastyear}} + {\usebibmacro{cite:shorthand}% + \global\undef\cbx@lastyear}}% + \stepcounter{textcitecount}% + \savefield{namehash}{\cbx@lasthash}}% + \setunit{% + \ifbool{cbx:parens} + {)\global\boolfalse{cbx:parens}}%\bibcloseparen + {}% + \textcitedelim}} + +\newbibmacro*{textcite:postnote}{% + \usebibmacro{postnote}% + \ifthenelse{\value{multicitecount}=\value{multicitetotal}} + {\setunit{}% + \printtext{% + \ifbool{cbx:parens} + {)\global\boolfalse{cbx:parens}}%\bibcloseparen + {}}} + {\setunit{% + \ifbool{cbx:parens} + {)\global\boolfalse{cbx:parens}}%\bibcloseparen + {}% + \textcitedelim}}} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/example.bib b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/example.bib index 56ce4a5794..2956469499 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/example.bib +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/example.bib @@ -1,3838 +1,3838 @@ -% Encoding: UTF-8 - - -@Other{易仕和,2013, - Entryset = {易仕和2013--,Yi2013--} -} - -@book{李时珍--, -author={李时珍} -} - -@book{乔纳斯--, -author={乔纳斯} -} - -@Book{昂温1988--, - Author = {昂温, S.}, -} - -@Book{GPS1988--, - Title = {外国出版史}, - Author = {{昂温, G} and {昂温, P S}}, - Publisher = {中国书籍出版社}, - Translator = {陈生诤}, - Year = {1988}, - Location = {北京} -} - -@Book{丸山敏秋--, - Author = {丸山敏秋}, -} - -@Book{凯西尔--, - Author = {凯西尔}, -} - -@book{Einstein--, - author = {Einstein, Albert} -} - -@book{Williams-ellis--, - author = {Williams-ellis, Amabel} -} - -@book{morgan--, - author = {De Morgan, Augustus} -} - -@book{lijianning--a, - author = {{LI Jiangning}} -} - -@book{lijianning--b, - author = {Li, Jiang Ning} -} - -@book{钱学森--, - author = {钱学森 and 刘再复} -} - -@book{李四光--, - author = {李四光 and 华罗庚 and 茅以升} -} - -@book{印森林--, - author = {印森林 and 吴胜和 and 李俊飞 and 冯文杰} -} - -@book{fordham--, - author = {Evenst W. Fordham and Amiad Ali and David A. Truner and John R. Charters} -} - -@Article{anon1981-628, - title = {Coffee drinking and cancer of the pancreas}, - journal = {Br Med J}, - year = {1981}, - volume = {283}, - number = {6292}, - pages = {628} -} - -@book{中国科学院物理研究所--, - author = {{中国科学院物理研究所}} -} - -@book{贵州省土穰普查办公室--, - author = {{贵州省土穰普查办公室}} -} - -@book{AmericanChemicalSociety--, - author = {{American Chemical Society}} -} - - -@book{StanfordUniversity--, - author = {{Stanford University. Department of Civil Eng ineering}} -} - - -@book{王夫之的诠释--, - title = {王夫之“乾坤并建”的诠释面向} -} - -@book{张子正蒙注--, - title = {张子正蒙注} -} - -@book{化学动力学和反应器原理--, - title = {化学动力学和反应器原理} -} - -@book{袖珍神学--, - title = {袖珍神学,或,简明基督教词典} -} - -@article{北京师范大学学报--, - Journaltitle = {北京师范大学学报(自然科学版)} -} - -@book{Gasesinsea--, - title = {Gases in sea ice 1975-1979} -} - -@article{jmath--, - Journaltitle = {J Math \& Phys} -} - -@book{为人民服务--, - title = {为人民服务;纪念白求恩;愚公移山} -} - -@book{编者1964--, - title = {为人民服务;纪念白求恩;愚公移山}, - address= {北京}, - publisher={人民出版社}, - date ={1964}, - pages= {1-3;7-11;31-35} -} - -@book{大趋势--, - title = {大趋势} -} - -@book{地壳运动--, - title = {地壳运动假说:从大陆漂移到板块构造} -} - -@book{三松堂--, - title = {三松堂全集:第4卷} -} - -@book{世界出版业--, - title = {世界出版业:美国卷} -} - -@book{ECL集成电路--, - title = {ECL集成电路:原理与设计} -} - -@book{中国科学技术史--, - title = {中国科学技术史:第2卷~~~~科学思想史} -} - -@article{商鞅战秋菊--, - title = {商鞅战秋菊:法治转型的一个思想实验} -} - -@article{中国科学--, - title = {中国科学:D辑~~~~地球科学} -} - -@Standard{信息与文献--, - title = {信息与文献---都柏林核心元数据元素集:GB/T 25100—2010} -} - -@Standard{全国信息与文献标准化技术委员会2010-2-3, - author = {全国信息与文献标准化技术委员会}, - title = {信息与文献\ \ \ \ 都柏林核心元数据元素集: GB/T 25100—2010}, - year = {2010}, - address = {北京}, - pages = {2--3}, - publisher = {中国标准出版社}, -} - -@report{中子反射--, - title = {中子反射数据分析技术:CNIC-01887} -} - -@article{AsianPacificjournal--, - Journaltitle = {Asian Pacific journal of eancer prevention: e-only} -} - - -@book{egbookeda--, - title = {中文书}, - edition={3} -} - -@book{egbookedb--, - title = {中文书}, - edition={新1版} -} - -@book{egbookedc--, - title = {中文书}, - edition={明刻本} -} - -@book{egbookedd--, - title = {english book}, - edition={5} -} - -@book{egbookede--, - title = {english book}, - edition={Rev. ed.} -} - -@book{egbookpuba--, - title = {中文书}, - date = {2013}, - address = {北京}, - publisher = {人民出版社}, -} - -@book{egbookpubb--, - title = {english book}, - date = {2012}, - address = {New York}, - publisher = {Academic Press}, -} - -@book{egbookpubaddressa--, - title = {english book}, - address = {Cambridge, Eng.}, - publisher = {Academic Press}, -} - -@book{egbookpubaddressb--, - title = {english book}, - address = {Cambridge, Mass.}, - publisher = {Academic Press}, -} - -@book{egbookpubaddressc--, - title = {中文书}, - date = {2013}, - address = {北京 and 上海}, - publisher = {科学出版社}, -} - -@book{egbookpubaddressd--, - title = {english book}, - date = {2000}, - address = {London and Boston and Durban and Syngapore and Sydney and Toronto and Wellington}, - publisher = {Butterworths}, -} - -@book{egbookpubaddresse--, - title = {中文书}, - date = {1990}, - publisher = {三户图书刊行社}, -} - -@book{egbookpubaddressf--, - title = {english book}, - date = {1975}, - publisher = {MacMillan}, -} - -@online{egbookpubaddressg--, - date = {2011}, - pages ={105}, - url={http://lib.myilibrary.com/Open.aspx?id=312377}, - urldate={2014-06-16}, - publisher = {Open University Press}, -} - - - -@book{egbookpubpublishera--, - title = {中文书}, - address = {北京}, - publisher = {中国标准出版社}, -} - -@book{egbookpubpublisherb--, - title = {english book}, - address = {Cambridge}, - publisher = {Elsevier Science Publishers}, -} - -@book{egbookpubpublisherc--, - title = {english book}, - address = {Cambridge}, - publisher = {IRRI}, -} - -@book{egbookpubpublisherd--, - title = {english book}, - address = {Chicago}, - publisher = {ALA and CLA}, - date ={1978} -} - -@book{egbookpubpublishere--, - title = {中文书}, - address = {哈尔滨}, - date ={2013} -} - -@book{egbookpubpublisherf--, - title = {english book}, - address = {Salt Lake City}, - date ={1964} -} - - -@book{egbookpubdatea--, - title = {中文书}, - year ={1947(民国三十六年)} -} - -@book{egbookpubdateb--, - title = {中文书}, - year ={1705(康熙四十四年)} -} - -@newspaper{egbookpubdatec--, - title = {中文书}, - date ={2013-01-08} -} - -@book{egbookpubdated--, - title = {中文书}, - year ={c1988} -} - -@book{egbookpubdatee--, - title = {中文书}, - year ={1985印刷} -} - -@book{egbookpubdatef--, - title = {中文书}, - year ={[1936]} -} - - -@online{egbookpubdateg--, - title = {english book}, - date = {2012-05-03}, - urldate={2013-11-12}, -} - -@Book{曹凌2011-19-, - author = {曹凌}, - title = {中国佛教疑伪经综录}, - year = {2011}, - publisher = {上海古籍出版社}, - address = {上海}, - pages ={19} -} - -@Book{钱学森2001--, - author = {钱学森}, - title = {创建系统学}, - year = {2001}, - publisher = {山西科学技术出版社}, - address = {太原}, - pages ={序2-3} -} - -@Book{冯友兰2008--, - author = {冯友兰}, - title = {冯友兰自选集}, - year = {2008}, - publisher = {北京大学出版社}, - address = {北京}, - edition ={2}, - pages ={第1版自序} -} - -@inbook{李约瑟1991--, - author = {李约瑟}, - title = {题词}, - bookauthor = {苏克福 and 管成学 and 邓明鲁}, - booktitle = {苏颂与《本草图经》研究}, - year = {1991}, - publisher = {长春出版社}, - address = {长春}, - pages = {扉页} -} - -@ARTICLE{DUBAR2013--, - author = {DUBAR, K L. AND MITCHELL, D A.}, - title = {Revealing nature's synthetic potential through the study of ribosomal natural product biosynthesis}, - Journaltitle = {ACS chemical biology}, - DATE = {2013}, - VOLUME = {8}, - pages = {473-487}, - url = {http://pubs.acs.org/doi/pdfplus/10.1021/cb3005325}, - urldate = {2013-10-16} -} - -@Book{周鲁卫2011--, - author = {周鲁卫}, - title = {软物质物理导论}, - year = {2011}, - publisher = {复旦大学出版社}, - address = {上海}, - pages = {1} -} - -@ARTICLE{常森2013--, - author = {常森}, - title = {《五行》学说与《荀子》}, - Journaltitle = {北京大学学报(哲学社会科学版)}, - DATE = {2013}, - VOLUME = {50}, - number = {1}, - pages = {75}, -} - -@Book{RUDDOCK2009--, - author = {RUDDOCK, L.}, - title = {Economics for the modern built environment}, - year = {2009}, - publisher = {Taylor & Francis}, - address = {London}, - pages = {12}, - url = {http://lib.mylib.com}, - urldate = {2010-06-15}, -} - -@book{kereanrefa, - AUTHOR = {김세훈 and others}, - TITLE = { 도서판및특서진흥업 개정안 연구}, - DATE = {2003}, - address={서울}, - PAGES = {15}, - publisher = {한국운화관팡정책연구원}, -} -%%김세훈, 외. 도서판및특서진흥업 개정안 연구〔M〕, 서울; 한국운화관팡정책연구원,2003: 15. - - -@book{kereanrefb, - AUTHOR = {이냉목 }, - TITLE = { 도서관꺾규총람: 세 1 권}, - DATE = {2005}, - address={서울}, - PAGES = {67-68}, - publisher = {구미무역 출판부}, -} -%%이냉목 도서관꺾규총람: 세 1 권[M〕. 서울: 구미무역 출판부,2005: 67-68. -%% - -@Book{李炳穆2005--, - author = {李炳穆}, - title = {图书馆法柜总览:第1卷}, - year = {2005}, - publisher = {九美贸易出版部}, - address = {首尔}, - pages = {67-68} -} - - -@article{kereanrefc, - DATE = {2007}, - volume={48}, - number={7}, - PAGES = {11-12}, - journaltitle={ 圖書館文化}, - TITLE = {도서관 정보정책위원회 설립식 및 도서관 정보정책기획단신성}, -} -%%도서관 정보정책위원회 설립식 및 도서관 정보정책기획단신성. 圖書館文化,2007 ,48(7): 11-12. - -@ARTICLE{图书馆信息政策委员会2007--, - title = {图书馆信息政策委员会成立仪式与图书馆信息政策规划团}, - Journaltitle = {图书馆文化}, - DATE = {2007}, - VOLUME = {48}, - number = {7}, - pages = {11-12}, -} - -@book{japaneserefc, - AUTHOR = {図書館用語辞典編集委員会}, - TITLE = { 最新図書館用語大辞典}, - DATE = {2004}, - address={東京}, - PAGES = {154}, - publisher = {柏書房株式会社}, -} -%% -%%図書館用語辞典編集委員会.最新図書館用語大辞典[M].東京:柏書房株式会社,2004:154. -%% - -@article{russianrefc, - author={Кочекоs, А Я}, - TITLE = {Молибден-медно-эолотопорфиооое месторождение Рябиноосе}, - DATE = {1993}, - number={7}, - PAGES = {50-58}, - journaltitle={ Отечестsенная гелогия} -} -%%Кочекоs А Я. Молибден-медно-эолотопорфиооое месторождение Рябиноосе[J/ОL]. ,1993(7):50-58 - -@ARTICLE{熊平2005--, - author = {熊平 and 吴颉}, - title = {从交易费用的角度谈如何构建药品流通的良性机制}, - Journaltitle = {中国物价}, - DATE = {2005}, - number = {8}, - pages = {42-45}, -} - -@ARTICLE{xiong2005--, - author = {Xiong, Ping and Wu, Xie}, - title = {Discussion on how to construct benign medicine circulantion mechanism fromtranaction cosperspective}, - Journaltitle = {China price}, - DATE = {2005}, - number = {8}, - pages = {42-45}, -} - -@ARTICLE{上海市食品药品监督管理局课题组2008--, - author = {上海市食品药品监督管理局课题组}, - title = {互联网药品经营现状和监管机制的研究}, - Journaltitle = {上海食品药品监管情报研究}, - DATE = {2008}, - number = {1}, - pages = {8-11}, -} - -@ARTICLE{Rgsfda2008--, - author = {{Research Group of Shanghai Food and Drug Administration}}, - title = {A study on online pharmaceutical operating situation and supervision mechanism}, - Journaltitle = {Shanghai food and drug information research}, - DATE = {2008}, - number = {1}, - pages = {8-11}, -} - - -@PhdThesis{刘乃安2000-17-18, - author = {刘乃安}, - title = {生物质材料热解失重动力学及其分析方法研究}, - year = {2000}, - pages = {17--18}, - doi = {10.7666/d.y351065}, - url = {http://wenku.baidu.com/link?url=GJDJxb4lxBUXnIPmq1XoEGSIr1H8TMLbidW_LjlYu33tpt707u62rKliypU_FBGUmox7ovPNaVIVBALAMd5yfwuKUUOAGYuB7cuZ-BYEhXa}, - urldate = {2014-08-29}, - address = {安徽}, - school = {中国科学技术大学}, -} - -@book{Deverell2013-21-22, - author = {Deverell, William and Igler, David}, - title = {A Companion to {California} History}, - year = {2013}, - date = {2013-11-15}, - pages = {21--22}, - doi = {10.1002/9781444305036.ch2}, - url = {http://onlinelibrary.wiley.com/doi/10.1002/9781444305036.ch2/summary}, - urldate = {2014-06-24}, - address = {New York}, - school = {John Wiley \& Sons}, -} - -@inbook{姚中秋2009--, - author = {姚中秋}, - title = {作为一种制度变迁模式的“转型”}, - bookauthor = {罗卫东 and 姚中秋}, - booktitle = {中国转型的理论分析:奥地利学派的视角}, - year = {2009}, - publisher = {浙江大学出版社}, - address = {杭州}, - pages = {44} -} - -@inbook{姚中秋2008--, - author = {姚中秋}, - title = {一种制度变迁模式}, - bookauthor = {罗, 卫东 and 姚, 中秋}, - booktitle = {中国转型的理论分析}, - year = {2008}, - publisher = {浙江大学出版社}, - address = {杭州}, - pages = {44} -} - - -@ARTICLE{关立哲2014--, - author = {关立哲 and 韩纪富 and 张晨延}, - title = {科技期刊编辑审读中要注重比较思维的科学运用}, - Journaltitle = {编辑学报}, - DATE = {2014}, - VOLUME = {26}, - number = {2}, - pages = {144-146} -} - -@ARTICLE{TENOPIR1987--, - author = {TENOPIR, C.}, - title = {Online databases, quality control}, - Journaltitle = {Library journal}, - DATE = {1987}, - VOLUME = {113}, - number = {2}, - pages = {124-125} -} - -@ARTICLE{egdatevolnumpagea--, - title = {article of journal}, - DATE = {2001}, - VOLUME = {1}, - number = {1}, - pages = {5-6} -} - -@ARTICLE{egdatevolnumpageb--, - title = {article of journal}, - DATE = {2014}, - VOLUME = {510}, - pages = {356-363} -} - -@ARTICLE{egdatevolnumpagec--, - title = {article of journal}, - DATE = {2010}, - number = {6}, - pages = {23} -} - -@ARTICLE{egdatevolnumpaged--, - title = {article of journal}, - DATE = {2012}, - VOLUME = {22}, - number = {增刊2}, - pages = {81-86} -} - -@ARTICLE{egdatevolnumpagee--, - title = {article of journal}, - DATE = {2001}, - number = {9/10}, - pages = {36-39} -} - -@ARTICLE{egdatevolnumpagef--, - title = {article of journal}, - year = {2011, 33(2):20-25;2011, 33(3):26-30}, -} - -@newspaper{egdatevolnumpageg--, - title = {article of journal}, - date = {2013-03-16}, - number = {1} -} - - -@Book{尼葛洛庞帝1996--, - author = {尼葛洛庞帝}, - title = {数字化生存}, - year = {1996}, - translator = {胡泳 and 范海燕}, - publisher = {海南出版社}, - address = {海口}, -} - -@Book{汪冰1997-16-16, - author = {汪冰}, - title = {电子图书馆理论与实践研究}, - year = {1997}, - publisher = {北京图书馆出版社}, - pages = {16}, - address = {北京}, -} - -@Article{杨宗英1996-24-29, - author = {杨宗英}, - title = {电子图书馆的现实模型}, - journal = {中国图书馆学报}, - year = {1996}, - number = {2}, - pages = {24--29}, -} - -@Book{Baker1995--, - author = {Baker, S K and Jackson, M E}, - title = {The future of resource sharing}, - year = {1995}, - publisher = {The Haworth Press}, - address = {New York}, -} - -@Book{Chernik1982--, - author = {Chernik, B E}, - title = {Introduction to library services for library technicians}, - year = {1982}, - publisher = {Libraries Unlimited, Inc.}, - address = {Littleton, Colo.}, -} - - -@Article{Dowler1995-5-26, - author = {Dowler, L}, - title = {The research university’s dilemma: resource sharing and research in a transinstitutional environment}, - journal = {Journal of library administration}, - year = {1995}, - volume = {21}, - number = {1/2}, - pages = {5--26}, -} - - -@Inproceedings{ref-replace-char, - Title = {Cognitive Radio and Cooperative Strategies for Power Saving in Multi-Standard Wireless Devices}, - Address = {Florence, Italy}, - Author = {Rodriguez, J. and P. Marques and A. Radwan and K. Moessner and R. Tafazolli and others}, - Booktitle = {Future % Network \& Mobile # Summit 2010}, - Date = {June 2010} -} - -@Online{olnoauthorcn, - Title = {如何在LaTeX写作中管理参考文献?}, - Date = {2016-08-12}, - Url = {http://www.latexstudio.net/archives/7131} -} - -@Online{Allianceurlonly, - Url = {www.wimedia.org} -} - -@Online{olnoauthoren, - Title = {Dublin Core metadata element set: version 1.1}, - Url = {http://dublincore.org}, - Urldate = {2014-06-11}, - Year = {2012-06-14} -} - -@Article{王临慧2010-147, - author = {王临慧 and others}, - title = {天津方言的源流关系刍议}, - journal = {山西师范大学学报(社会科学版)}, - year = {2010}, - volume = {37}, - number = {4}, - pages = {147}, -} - - -@InProceedings{王临慧2010-138, - author = {王临慧}, - title = {从几组声母的演变看天津方言形成的自然条件和历史条件}, - bookauthor= {曹志耘}, - booktitle = {汉语方言的地理语言学研究:首届中国地理语言学国际学术研讨会论文集}, - year = {2010}, - publisher = {北京语言大学出版社}, - pages = {138}, - address = {北京}, -} - -@Book{王夫之1845--, - Title = {宋论}, - Author = {王夫之}, - Edition = {刻本}, - Publisher = {曾氏}, - Year = {1845(清同治四年)}, - Location = {金陵} -} - -@Book{汪昂1881--, - Title = {增订本草备要:四卷}, - Address = {京都}, - Author = {汪昂}, - Edition = {刻本}, - Publisher = {老二酉堂}, - Year = {1881(清光绪七年)}, - Location = {京都} -} - -@Periodical{AAAS1883--, - Title = {Science}, - Date = {1883}, - Editor = {{American Association for the Advancement of Science}}, - Number = {1}, - Volume = {1}, - Location = {Washington, D.C.}, - Publisher = {American Association for the Advancement of Science} -} - -@Book{汪昂1912--, - Title = {(增补)本草备要}, - Author = {汪昂}, - Edition = {石印本}, - Publisher = {同文书局}, - Year = {1912}, - Location = {上海} -} - -@Periodical{中国地质学会1936--, - Title = {地质评论}, - Date = {1936}, - Editor = {中国地质学会}, - Number = {1}, - Volume = {1}, - Location = {北京}, - Publisher = {地质出版社} -} - - -@Book{1962-50-50, - Title = {康熙字典:已集上:水部}, - Address = {北京}, - Edition = {同文书局影印本}, - Pages = {50}, - Publisher = {中华书局}, - Year = {1962} -} - -@Proceedings{ROSENTHALL1963--, - Title = {Proceedings of the Fifth Canadian Mathematical Congress, University of Montreal, 1961}, - Date = {1963}, - Publisher = {University of Toronto Press}, - Editor = {E M ROSENTHALL}, - Location = {Toronto} -} - -@Thesis{CALMS1965--, - Title = {Infrared spectroscopic studies on solid oxygen}, - Author = {R B CALMS}, - Date = {1965}, - Institution = {Univ. of California}, - Location = {Berkeley} -} - -@Report{WHO1970--, - Title = {Factors regulating the immune response}, - Author = {{World Health Organization}}, - Date = {1970}, - Institution = {WHO}, - Location = {Geneva}, - Titleaddon = {report of WHO Scientific Group} -} - -@Inproceedings{FOURNEY1971-17-38, - Title = {Advances in holographic photoelasticity}, - Author = {M E FOURNEY}, - Booktitle = {Symposium on Applications of Holography in Mechanics, August 23-25, 1971, University of Southern California, Los Angeles, California}, - year = {c1971}, - Pages = {17-38}, - Publisher = {ASME}, - Location = {New York} -} - -@Inproceedings{FOURNEY1971-17-38a, - Title = {Advances in holographic photoelasticity}, - Author = {M E FOURNEY}, - Bookauthor = {{American Society of Mechanical Engineers.Applied Mechanics Division}}, - Booktitle = {Symposium on Applications of Holography in Mechanics, August 23-25, 1971. University of Southern California, Los Angeles, California}, - Date = {1971}, - Pages = {17-38}, - Publisher = {ASME}, - Location = {New York} -} - -@TechReport{Humphrey1971--, - Title = {The sonic throat method and real gas one-dimensional flow: an application to air and nitrogen}, - Author = {Humphrey, Richard L. and Wagner, Jerry L.}, - Year = {1971}, - Number = {730029}, - Type = {AD} -} - -@Book{CRANE1972--, - Title = {Invisible college}, - Author = {D. Crane}, - Date = {1972}, - Publisher = {Univ. of Chicago Press}, - Location = {Chicago} -} - - - -@Article{KENNEDY1975-311-386, - Title = {Morphology and genesis of nodular chalks and hardgrounds in the Upper - Cretacesous of southern England}, - Author = {W. J. KENNEDY and R. E. GARRISON}, - Date = {1975}, - Journaltitle = {Sedimentology}, - Pages = {311-386}, - Volume = {22} -} - -@Article{KENNEDY1975-339-360, - Title = {Morphology and genesis of nodular phosphates in the cenomanian of South-east England}, - Author = {W. J. KENNEDY and R. E. GARRISON}, - Date = {1975}, - Journaltitle = {Lethaia}, - Pages = {339-360}, - Volume = {8} -} - -@Inbook{1977-49-49, - Title = {宋史卷三:本纪第三}, - Address = {北京}, - Booktitle = {宋史:第1册}, - Pages = {49}, - Publisher = {中华书局}, - Year = {1977} -} - -@Book{IFLAI1977--, - Title = {Names of persons: national usages for entry in catalogues}, - Author = {{International Federation of Library Association and Institutions}}, - Edition = {3}, - Publisher = {IFLA International Office for UBC}, - Year = {1977}, - Location = {London} -} - - -@InProceedings{张忠智1997-33-34, - author = {张忠智}, - title = {科技书刊的总编(主编)的角色要求}, - booktitle = {中国科学技术期刊编辑学会建会十周年学术研讨会论文汇编}, - year = {1997}, - editor = {中国科学技术期刊编辑学会}, - publisher = {中国科学技术期刊编辑学会学术委员会}, - pages = {33--34}, - address = {北京}, -} - -@Book{中国社会科学院语言研究所词典编辑室1996--, - author = {中国社会科学院语言研究所词典编辑室}, - title = {现代汉语词典}, - year = {1996}, - edition = {修订本}, - publisher = {商务印书馆}, - address = {北京}, -} - - -@Article{刘彻东1998-38-39, - Title = {中国的青年刊物}, - Author = {刘彻东}, - Date = {1998}, - Journaltitle = {中国出版}, - Number = {5}, - Pages = {38-39}, - Titleaddon = {个性特色为本} -} - -@InProceedings{裴丽生1981-2-10, - author = {裴丽生}, - title = {在中国科协学术期刊编辑工作经验交流会上的讲话}, - booktitle = {中国科协学术期刊编辑工作经验交流会资料选}, - year = {1981}, - editor = {中国科学技术协会}, - publisher = {中国科学技术协会学会工作部}, - pages = {2--10}, - address = {北京}, -} - - -@Article{亚洲地质图编目组1978-194-208, - Title = {亚洲地层与地质历史概述}, - Author = {亚洲地质图编目组}, - Date = {1978}, - Journaltitle = {地质学报}, - Pages = {194-208}, - Volume = {3} -} - -@Inbook{BUSECK1980-117-211, - Title = {Subsolidus phenomena in pyroxenes}, - Author = {P R BUSECK and NORD, Jr., G L and D R VEBLEN}, - Bookauthor = {CT PREWITT}, - Booktitle = {Pyroxense}, - year = {c1980}, - Pages = {117-211}, - Publisher = {Mineralogical Society of America}, - Location = {Washington, D.C.} -} - -@Inbook{陈晋镳1980-56-114, - Title = {蓟县震旦亚界研究}, - Author = {陈晋镳 and 张惠民 and 朱士兴 and others}, - Bookauthor = {中国地质科学院天津地质矿产研究所}, - Booktitle = {中国震旦亚界}, - Pages = {56-114}, - Publisher = {天津科学出版社}, - Location = {天津}, - Year = {1980} -} - -@Article{Sunstein1996-903-903, - author = {Sunstein, Cass R.}, - title = {Social Norms and Social Roles}, - journal = {Columbia law review}, - year = {1996}, - volume = {96}, - pages = {903}, - url = {http://www.heinonline.org/HOL/Page?handle=hein.journals/clr96&id=913&collection=journals&index=journals/clr}, - urldate = {2012-01-26}, -} - -@Book{罗杰斯2011-15-16, - author = {罗杰斯}, - title = {西方文明史: 问题与源头}, - year = {2011}, - translator = {潘惠霞 and 魏婧 and 杨艳 and others}, - publisher = {东北财经大学出版社}, - pages = {15--16}, - address = {大连}, -} - -@Book{陈登原2000-29-29, - author = {陈登原}, - title = {国史旧闻: 第1卷}, - year = {2000}, - publisher = {中华书局}, - pages = {29}, - address = {北京}, -} - -@Book{哈里森沃尔德伦2012-235-236, - author = {哈里森·沃尔德伦}, - title = {经济数学与金融数学}, - year = {2012}, - translator = {谢远涛}, - publisher = {中国人民大学出版社}, - pages = {235--236}, - address = {北京}, -} - -@Book{北京市政协民族和宗教委员会2012-112-112, - author = {北京市政协民族和宗教委员会 and 北京联合大学民族与宗教研究所}, - title = {历代王朝与民族宗教}, - year = {2012}, - publisher = {民族出版社}, - pages = {112}, - address = {北京}, -} - - -@Book{徐光宪2010--, - author = {徐光宪 and 王祥云}, - title = {物质结构}, - year = {2010}, - publisher = {科学出版社}, - address = {北京}, -} - -@Book{顾炎武1992--, - author = {顾炎武}, - title = {昌平山水记:京东考古录}, - year = {1992}, - publisher = {北京古籍出版社}, - address = {北京}, -} - -@Book{王夫之1865--, - author = {王夫之}, - title = {宋论}, - year = {1865(清同治四年)}, - edition = {刻本}, - publisher = {湘乡曾国荃}, - address = {金陵}, -} - -@Proceedings{牛志明2012--, - title = {综合湿地管理国际研讨会论文集}, - year = {2012}, - editor = {牛志明 and 斯温兰德 and 雷光春}, - publisher = {海洋出版社}, - address = {北京}, -} - -@Archive{中国第一历史档案馆2001--, - author = {中国第一历史档案馆 and 辽宁省档案馆}, - title = {中国明朝档案总汇}, - year = {2001}, - address = {桂林}, - publisher = {广西师范大学出版社}, -} - -@PhdThesis{杨保军2012--, - author = {杨保军}, - title = {新闻道德论}, - year = {2010}, - url = {http://apabi.lib.pku.edu.cn/usp/pku/pub.mvc?pid=book.detail&metaid=m.20101104-BPO-889-1023&cult=CN}, - urldate = {2012-11-01}, - address = {北京}, - publisher = {中国人民大学出版社}, -} - -@Book{赵学功2001--, - author = {赵学功}, - title = {当代美国外交}, - year = {2001}, - publisher = {社会科学文献出版社}, - url = {http://www.cadal.zju.edu.cn/book/trySinglePage/33023884/1}, - urldate = {2014-06-11}, - address = {北京}, -} - -@Book{同济大学土木工程防灾国家重点实验室2011-5-6, - author = {同济大学土木工程防灾国家重点实验室}, - title = {汶川地震灾害研究}, - year = {2011}, - publisher = {同济大学出版社}, - pages = {5--6}, - url = {http://apabi.lib.pku.edu.cn/usp/pku/pub.mvc?pid=book.detail&metaid=m.20120406-YPT-889-0010}, - urldate = {2013-05-09}, - address = {上海}, -} - -@Book{中国造纸学会2003--, - author = {中国造纸学会}, - title = {中国造纸年鉴: 2003}, - year = {2003}, - publisher = {中国轻工业出版社}, - url = {http://www.cadal.zju.edu.cn/book/view/25010080}, - urldate = {2014-04-25}, - address = {北京}, -} - - -@Proceedings{Yufin2000--, - title = {Geoecology and computers: proceedings of the {Third International Conference on Advances of Computer Methods in Geotechnical and Geoenvironmental Engineering, Moscow, Russia, February 1--4, 2000}}, - year = {2000}, - editor = {Yufin, Sergey A}, - publisher = {A. A. Balkema}, - address = {Rotterdam}, -} - -@Book{Baldock2011-105-105, - author = {Baldock, Peter}, - title = {Developing early childhood services: past, present and future}, - year = {2011}, - publisher = {Open University Press}, - pages = {105}, - url = {http://lib.myilibrary.com/Open.aspx?id=312377}, - urldate = {2012-11-27}, -} - -@Book{Fan2013-25-26, - author = {Fan, Xuetong and Sommers, Christopher H.}, - title = {Food irradiation research and technology}, - year = {2013}, - edition = {2}, - publisher = {Blackwell Publishing}, - pages = {25--26}, - url = {http://onlinelibrary.wiley.com/doi/10.1002/9781118422557.ch2/summary}, - urldate = {2014-06-26}, - address = {Ames, Iowa}, -} - - -@Inbook{王夫之2011-1109-1109, - title = {周易外传:卷 5}, - booktitle = {船山全书}, - year = {2011}, - editor = {王夫之}, - number = {6}, - publisher = {岳麓书社}, - pages = {1109}, - address = {长沙}, -} - -@Inbook{程根伟1999-32-36, - author = {程根伟}, - title = {1998 年长江洪水的成因与减灾对策}, - booktitle = {长江流域洪涝灾害与科技对策}, - year = {1999}, - editor = {许厚泽 and 赵其国}, - publisher = {科学出版社}, - pages = {32--36}, - address = {北京}, -} - -@Inbook{陈晋镳1980-56-114a, - author = {陈晋镳 and 张惠民 and 朱士兴 and 赵震 and 王振刚}, - title = {蓟县震旦亚界研究}, - booktitle = {中国震旦亚界}, - year = {1980}, - editor = {中国地质科学院天津地质矿产研究所}, - publisher = {天津科学技术出版社}, - pages = {56--114}, - address = {天津}, -} - -@Inbook{马克思2013-302-302, - author = {马克思}, - title = {政治经济学批判}, - booktitle = {马克思恩格斯全集}, - year = {2013}, - editor = {马克思 and 恩格斯}, - volume = {35}, - publisher = {人民出版社}, - pages = {302}, - address = {北京}, -} - - - - - -@InProceedings{贾东琴2011-45-52, - author = {贾东琴 and 柯平}, - title = {面向数字素养的高校图书馆数字服务体系研究}, - booktitle = {中国图书馆学会年会论文集: 2011年卷}, - year = {2011}, - editor = {中国图书馆学会}, - publisher = {国家图书馆出版社}, - pages = {45--52}, - address = {北京}, -} - -@Inbook{Weinstein1974-745-772, - author = {Weinstein, L and Swertz, M N}, - title = {Pathogenic properties of invading microorganism}, - booktitle = {Pathologic physiology: mechanisms of disease}, - year = {1974}, - editor = {Sodeman, Jr., William A and Sodeman, William A}, - publisher = {Saunders}, - pages = {745--772}, - address = {Philadelphia}, -} - -@InBOOK{Roberson2011-1-36, - author = {Roberson, J. Alan and Burneson, Eric G.}, - title = {Drinking water standards, regulations and goals}, - booktitle = {Water quality \& treatment: a handbook on drinking water}, - year = {2011}, - editor = {{American Water Works Association}}, - edition = {6}, - publisher = {McGraw-Hill}, - pages = {1.1--1.36}, - url = {http://lib.myilibrary.com/Open.aspx?id=291430}, - urldate = {2012-12-10}, - address = {New York}, -} - -@Periodical{中华医学会湖北分会1984----, - title = {临床内科杂志}, - year = {1984}, - volume = {1}, - number = {1}, - address = {武汉}, - author = {中华医学会湖北分会}, - publisher = {中华医学会湖北分会}, -} - -@Periodical{中国图书馆学会1957--1990--, - title = {图书馆学通讯}, - year = {1957/1990}, - number = {1-4}, - address = {北京}, - author = {中国图书馆学会}, - publisher = {北京图书馆}, -} - -@Periodical{中国图书馆学会1957--, - Title = {图书馆学通信}, - Address = {北京}, - Date = {1957/1990}, - Editor = {中国图书馆学会}, - Institution = {北京图书馆}, - Number = {1-4} -} - -@Periodical{中国图书馆学会1957a--, - Title = {图书馆学通信}, - Date = {1957/1990}, - Editor = {中国图书馆学会}, - Institution = {北京图书馆}, - Number = {1-4} -} - -@Periodical{中国图书馆学会1957b--, - Title = {图书馆学通信}, - Address = {北京}, - Date = {1957/1990}, - Editor = {中国图书馆学会}, - Number = {1-4} -} - -@Periodical{中国图书馆学会1957c--, - Title = {图书馆学通信}, - Date = {1957/1990}, - Editor = {中国图书馆学会}, - Number = {1-4} -} - -@Periodical{AAAS1883----, - title = {Science}, - year = {1883}, - volume = {1}, - number = {1}, - address = {Washington, D.C.}, - author = {{American Association for the Advancement of Science}}, - publisher = {American Association for the Advancement of Science}, -} - - -@Article{袁训来2012-3219-3219, - author = {袁训来 and 陈哲 and 肖书海 and others}, - title = {蓝田生物群: 一个认识多细胞生物起源和早期演化的新窗口}, - journal = {科学通报}, - year = {2012}, - volume = {55}, - number = {34}, - pages = {3219}, -} - -@Newspaper{余建斌2013--, - author = {余建斌}, - date = {2013-01-12}, - journal = {人民日报}, - number = {2}, - title = {我们的科技一直在追赶: 访中国工程院院长周济}, - url = {http://paper.people.com.cn/rmrb/html/2013-01/12/nw.D110000renmrb_20130112_5-02.htm}, - urldate = {2013-03-20}, - year = {2013}, -} - -@Article{李炳穆2008-6-12, - author = {李炳穆}, - title = {韩国图书馆法}, - journal = {图书情报工作}, - year = {2008}, - volume = {52}, - number = {6}, - pages = {6--12}, - url = {http://www.docin.com/p-400265742.html}, - urldate = {2013-10-25}, -} - -@Article{李幼平2010-225-228, - author = {李幼平 and 王莉}, - title = {循证医学研究方法: 附视频}, - journal = {中华移植杂志(电子版)}, - year = {2010}, - volume = {4}, - number = {3}, - pages = {225--228}, - url = {http://www.cqvip.com/Read/Read.aspx?id=36658332}, - urldate = {2014-06-09}, -} - -@Article{武丽丽2008-8-9, - author = {武丽丽 and 华一新 and 张亚军 and others}, - title = {“北斗一号”监控管理网设计与实现}, - journal = {测绘科学}, - year = {2008}, - volume = {33}, - number = {5}, - pages = {8--9}, - doi = {10.3771/j.issn.1009-2307.2008.05.002}, - url = {http://vip.calis.edu.cn/CSTJ/Sear.dll?OPAC_CreateDetail}, - urldate = {2009-10-25}, -} - -@Article{Kanamori1998-2063-2063, - author = {Kanamori, H}, - title = {Shaking without quaking}, - journal = {Science}, - year = {1998}, - volume = {279}, - number = {5359}, - pages = {2063}, -} - -@Article{Caplan1993-61-66, - author = {Caplan, P}, - title = {Cataloging internet resources}, - journal = {The public access computer systems review}, - year = {1993}, - volume = {4}, - number = {2}, - pages = {61--66}, -} - -@Article{Frese2013-378-398, - author = {Frese, Karen S. and Katus, Hugo A. and Meder, Benjamin}, - title = {Next-generation sequencing: from understanding biology to personalized medicine}, - journal = {Biology}, - year = {2013}, - volume = {2}, - number = {1}, - pages = {378--398}, - doi = {10.3390/biology2010378}, - url = {http://www.mdpi.com/2079-7737/2/1/378}, - urldate = {2013-03-19}, -} - -@Article{Myburg2014-356-362, - author = {Myburg, Alexander A. and Grattapaglia, Dario and Tuskan, Gerald A. and others}, - title = {The genome of Eucalyptus grandis}, - journal = {Nature}, - year = {2014}, - date = {2014-06-19}, - volume = {510}, - pages = {356--362}, - doi = {10.1038/nature13308}, - url = {http://www.nature.com/nature/journal/v510/n7505/pdf/nature13308.pdf}, - urldate = {2014-06-25}, -} - -@Patent{邓一刚2006--, - author = {邓一刚}, - title = {全智能节电器}, - number = {200610171314.3}, - year = {2006}, - date = {2006-12-13}, -} - -@Patent{西安电子科技大学2002--, - author = {西安电子科技大学}, - title = {光折变自适应光外差探测方法}, - number = {01128777.2}, - year = {2002}, - date = {2002-03-06}, - url = {http://211.152.9.47/sipoasp/zljs/hyjs-yx-new.asp?recid=01128777.2&leixin=0}, - urldate = {2002-05-28}, -} - -@Patent{Tachibana2005--, - author = {Tachibana, Ryuki and Shimizu, Shuhichi and Kobayshi, Seiji and Nakamura, Taiga}, - title = {Electronic watermarking method and system}, - number = {US6915001}, - year = {2005}, - date = {2005-07-05}, - url = {http://www.google.co.in/patents/US6915001}, - urldate = {2013-11-11}, -} - -@TechReport{中国互联网络信息中心2012--, - author = {中国互联网络信息中心}, - title = {第 29 次中国互联网络发展现状统计报告}, - year = {2012}, - date = {2012-01-16}, - url = {http://www.cnnic.net.cn/hlwfzyj/hlwxzbg/201201/P020120709345264469680}, - urldate = {2013-03-26}, -} - -@Archive{北京市人民政府办公厅2005--, - author = {北京市人民政府办公厅}, - title = {关于转发北京市企业投资项目核准暂行实施办法的通知: 京政办发[2005]37号}, - year = {2005}, - date = {2005-07-12}, - url = {http://china.findlaw.cn/fagui/p_1/39934.html}, - urldate = {2011-07-12}, -} - -@Online{Bawden2008--, - author = {Bawden, D}, - title = {Origins and Concepts of Digital Literacy}, - date = {2008-05-04}, - url = {http://www.soi.city.ac.uk/~dbawden/digital%20literacy%20chapter.pdf}, - urldate = {2013-03-08}, - year = {2008}, -} - -@Online{OCLC--, - author = {{Online Computer Library Center, Inc}}, - title = {About {OCLC}: History of Cooperation}, - url = {http://www.oclc.org/about/cooperation.en.html}, - urldate = {2012-03-27}, -} - -@Online{Hopkinson2009--, - author = {Hopkinson, A}, - title = {{UNIMARC} and Metadata: Dublin Core}, - date = {2009-04-22}, - url = {http://archive.ifla.org/IV/ifla64/138-161e.htm}, - urldate = {2013-03-27}, - year = {2009}, -} - -@PhdThesis{刘乃安2000-17-18a, - author = {刘乃安}, - title = {生物质材料热解失重动力学及其分析方法研究}, - year = {2000}, - pages = {17--18}, - doi = {10.7666/d.y351065}, - url = {http://wenku.baidu.com/link?url=GJDJxb4lxBUXnIPmq1XoEGSIr1H8TMLbidW_LjlYu33tpt707u62rKliypU_FBGUmox7ovPNaVIVBALAMd5yfwuKUUOAGYuB7cuZ-BYEhXa}, - urldate = {2014-08-29}, - address = {安徽}, - school = {中国科学技术大学}, -} - -@PhdThesis{Deverell2013-21-22a, - author = {Deverell, William and Igler, David}, - title = {A Companion to {California} History}, - year = {2013}, - date = {2013-11-15}, - pages = {21--22}, - doi = {10.1002/9781444305036.ch2}, - url = {http://onlinelibrary.wiley.com/doi/10.1002/9781444305036.ch2/summary}, - urldate = {2014-06-24}, - address = {New York}, - school = {John Wiley \& Sons}, -} - -@Book{Morri2010--, - author = {Morri, I}, - title = {Why the West Rules for Now: the Patterns of History, and What They Reveal about the Future}, - year = {2010}, - publisher = {{Farrar, Straus and Giroux}}, - address = {New York}, -} - - -@Article{STIEG1981-549-560, - Title = {The information needs of historians}, - Author = {M. F. STIEG}, - Date = {1981}, - Journaltitle = {College and Research Libraries}, - Number = {6}, - Pages = {549-560}, - Volume = {42} -} - - - -@Article{Milstein1982-436-446, - Title = {The effect of multiple-tone interfering signals on a direct sequence spread spectrum communication system}, - Author = {Milstein, L. B. and Davidovici,S. and Schilling,D. L.}, - Journal = {IEEE Trans. Commun.}, - Number = {3}, - Pages = {436-446}, - Volume = {30}, - Year = {1982} -} - -@Book{顾炎武1982--, - Title = {昌平山水记}, - Author = {顾炎武}, - Publisher = {北京古籍出版社}, - Year = {1982}, - Location = {北京}, - Titleaddon = {东京考古录} -} - -@Inbook{马克思1982-505-505, - Title = {关于《工资、价格和利润》的报告札记}, - Author = {马克思}, - Bookauthor = {马克思 and 恩格斯}, - Booktitle = {马克思恩格斯全集}, - Pages = {505}, - Publisher = {人民出版社}, - Booktitleaddon = {第44卷}, - Location = {北京}, - Year = {1982} -} - -@Article{HEWITT1984-205-218, - Title = {Technical services in 1983}, - Author = {J A HEWITT}, - Date = {1984}, - Journaltitle = {Library Resource Services}, - Number = {3}, - Pages = {205-218}, - Volume = {28} -} - -@Article{McEliece1984-44-53, - Title = {Channels with block interference}, - Author = {McEliece, R. J. and Stark, W. E.}, - Journal = {IEEE Trans. Inf. Theory}, - Number = {1}, - Pages = {44-53}, - Volume = {30}, - Year = {1984} -} - -@Article{陶仁骥1984-527-527, - Title = {密码学与数学}, - Author = {陶仁骥}, - Date = {1984}, - Journaltitle = {自然杂志}, - Number = {7}, - Pages = {527}, - Volume = {7} -} - -@Periodical{中华医学会湖北分会1984--, - Title = {临床内科杂志}, - Address = {武汉}, - Date = {1984}, - Editor = {中华医学会湖北分会}, - Institution = {中华医学会湖北分会}, - Number = {1}, - Volume = {1} -} - -@Incollection{韩吉人1985-90-99, - Title = {论职工教育的特点}, - Author = {韩吉人}, - Booktitle = {职工教育研究论文集}, - Date = {1985}, - Publisher = {人民教育出版社}, - Pages = {90-99}, - Bookauthor = {中国职工教育研究会}, - Location = {北京} -} - -@Collection{中国职工教育研究会1985--, - Title = {职工教育研究论文集}, - Author = {中国职工教育研究会}, - Location = {北京}, - Publisher = {人民教育出版社}, - Year = {1985} -} - -@Standard{全国文献工作标准化委员会第七分委员会1986--, - Title = {GB/T 5795--1986 中国标准书号}, - Author = {全国文献工作标准化委员会第七分委员会}, - Note = {standard}, - Year = {1986}, - Location = {北京}, - Publisher = {中国标准出版社} -} - -@Inbook{1988-590-590, - Title = {卷39 乞致任第一}, - Address = {北京}, - Booktitle = {苏魏公文集:下册}, - Pages = {590}, - Publisher = {中华书局}, - Year = {1988} -} - - - -@Standard{国家标准局信息分类编码研究所1988-59-92, - Title = {世界各国和地区名称代码 GB/T 2659-1986}, - Author = {国家标准局信息分类编码研究所}, - Date = {1988}, - Note = {standard}, - Bookauthor = {全国文献工作标准化技术委员会}, - Booktitle = {文献工作国家标准汇编}, - Booktitleaddon = {3}, - Location = {北京}, - Pages = {59-92}, - Publisher = {中国标准出版社} -} - -@Online{1989--, - Title = {PACS-L:the public-access computer systems forum}, - Date = {1989}, - Publisher = {Tex: University of Houston Libraries}, - Url = {http://info.lib.uh.edu/pacsl.html}, - Urldate = {1995-05-17}, - Location = {Houston} -} - -@Patent{姜锡洲1989--, - Title = {一种温热外敷药制备方案}, - Author = {姜锡洲}, - Date = {1989-07-26}, - Number = {88105607.3}, - Titleaddon = {中国} -} - -@Report{DTFHA1990--, - Title = {Guidelines for handling excavated acid-producing materials: PB 91-194001}, - Author = {{U.S. Department of Transportation Federal Highway Administration}}, - Institution = {U.S. Department of Commerce National Information Service}, - Location = {Springfield}, - Year = {1990} -} - -@Book{PIGGOT1990--, - Title = {The cataloguer's way through AACR2: from document receipt to document retrieval}, - Author = {T. M. PIGGOT}, - Publisher = {The Library Association}, - Year = {1990}, - Location = {London} -} - -@Article{DESMARAIS1992-605-609, - Title = {Carbon isotope evidence for the stepwise oxidation of the Proterozoic environment}, - Author = {DES MARAIS, D J and H STRAUSS and R E SUMMONS and others}, - Date = {1992}, - Journaltitle = {Nature}, - Pages = {605-609}, - Volume = {359} -} - -@Article{Holtzman1992-243-247, - Title = {On using perturbation analysis to do sensitivity analysis: derivatives versus differences}, - Author = {Holtzman, J. M.}, - Journal = {IEEE Trans. Autom. Control}, - Number = {2}, - Pages = {243-247}, - Volume = {37}, - Year = {1992} -} - -@Article{CAPLAN1993-61-66a, - Title = {Cataloging internet resources}, - Author = {P CAPLAN}, - Date = {1993}, - Journaltitle = {The public Access Computer Systems Review}, - Number = {2}, - Pages = {61-66}, - Volume = {4} -} - -@Book{广西壮族自治区林业厅1993--, - Title = {广西自然保护区}, - Author = {广西壮族自治区林业厅}, - Date = {1993}, - Publisher = {中国林业出版社}, - Location = {北京} -} - -@Patent{刘加林1993--, - Title = {多功能一次性压舌板}, - Author = {刘加林}, - Date = {1993-04-14}, - Number = {92214985.2}, - Location = {中国} -} - -@Book{OBRIEN1994--, - Title = {Introduction to information systems}, - Author = {J A O'BRIEN}, - Date = {1994}, - Edition = {7}, - Publisher = {Irwin}, - Location = {Burr Ridge, III} -} - -@Book{辛希孟1994--, - Title = {信息技术与信息服务国际研讨会论文集}, - Author = {辛希孟}, - Publisher = {中国社会科学出版社}, - Year = {1994}, - Location = {北京}, - Titleaddon = {A集} -} - -@Article{Andersen1995-42-49, - Title = {Propagation measurements and models for wireless communications channels}, - Author = {Andersen, J. B. and Rappaport, T. S. and Yoshida, S.}, - Journal = {IEEE Commun. Mag.}, - Number = {1}, - Pages = {42-49}, - Volume = {33}, - Year = {1995} -} - -@Book{CRAWFPRD1995--, - Title = {Future libraries: dreams, maddness, \& reality}, - Author = {W CRAWFPRD and M GORMAN}, - Date = {1995}, - Publisher = {American Library Association}, - Location = {Chicago} -} - -@Book{赵凯华1995--, - Title = {{新概念物理教程}}, - Address = {北京}, - Author = {赵凯华 and 罗蔚茵}, - Publisher = {高等教育出版社}, - Year = {1995} -} - -@Inbook{MARTIN1996-85-96, - Title = {Control of electronic resources in Australia}, - Author = {G MARTIN}, - Bookauthor = {L W PATTLE and B J COX}, - Booktitle = {Electronic resources}, - Date = {1996}, - Pages = {85-96}, - Publisher = {The Haworth Press}, - Booktitleaddon = {selection and bibliographic control}, - Location = {New York} -} - -@Book{国家环境保护局科技标准司1996-2-3, - Title = {土壤环境质量标准: GB 15616-1995}, - Address = {北京}, - Author = {国家环境保护局科技标准司}, - Note = {standard}, - Pages = {2-3}, - Publisher = {中国标准出版社}, - Url = {http://wenku.baidu.com}, - Urldate = {2013-10-14}, - Year = {1996} -} - - - -@Inbook{钟文发1996-468-471, - Title = {非线性规划在可燃毒物配置中的应用}, - Author = {钟文发}, - Bookauthor = {赵玮}, - Booktitle = {运筹学的理论和应用}, - Pages = {468-471}, - Publisher = {西安电子科技大学出版社}, - Booktitleon = {中国运筹学会第五届大会讨论文集}, - Location = {西安}, - Year = {1996} -} - -@Inproceedings{Nemec1997-209-214, - Title = {Force control of redundant robots}, - Author = {B Nemec}, - Booktitle = {Processings of Symposium on Robot Control}, - Pages = {209-214}, - Country = {Nantes France}, - Year = {1997} -} - - - -@Article{Andrisano1998-1383-1401, - Title = {Millimeter waves for short-range multimedia communication systems}, - Author = {Andrisano, O. and Tralli, V. and Verdone, R.}, - Journal = {Proc. IEEE}, - Number = {7}, - Pages = {1383-1401}, - Volume = {86}, - Year = {1998} -} - -@Article{Chiani1998-2998-3008, - Title = {Error probability for block codes over channels with block interference}, - Author = {Chiani, M.}, - Journal = {IEEE Trans. Inf. Theory}, - Number = {7}, - Pages = {2998-3008}, - Volume = {44}, - Year = {1998} -} - -@Article{CHRISTINE1998-331-332, - Title = {Plant physiology:plant biology in the Genome Era}, - Author = {M CHRISTINE}, - Date = {1998}, - Journaltitle = {Science}, - Pages = {331-332}, - Volume = {281}, - Url = {http://www.sciencemag.org/cgi/collection/anatmorp}, - Urldate = {1998-09-23} -} - -@Article{KANAMORI1998-2063-2064, - Title = {Shaking without quaking}, - Author = {H KANAMORI}, - Date = {1998}, - Journaltitle = {Science}, - Number = {5359}, - Pages = {2063-2064}, - Volume = {279} -} - -@Inbook{白书农1998-146-163, - Title = {植物开花研究}, - Author = {白书农}, - Bookauthor = {李承森}, - Booktitle = {植物科学进展}, - Pages = {146-163}, - Publisher = {高等教育出版社}, - Location = {北京}, - Year = {1998} -} - -@Book{蒋有绪1998--, - Title = {中国森林群落分类及其群落学特征 and \XeLaTeX{}}, - Address = {北京}, - Author = {蒋有绪 and 郭泉水 and 马娟 and others}, - Publisher = {科学出版社}, - Year = {1998} -} - - - -@Article{鲁明羽1998-290-295, - Title = {关于数据库系统数据词典的重要作用}, - Author = {鲁明羽 and 李纲民}, - Journal = {烟台大学学报自然科学与工程版}, - Number = {4}, - Pages = {290-295}, - Volume = {11}, - Year = {1998} -} - -@Mastersthesis{张志祥1998--, - Title = {间断动力系统的随机扰动及其在守恒律方程中的应用}, - Author = {张志祥}, - Date = {1998}, - Institution = {北京大学数学学院}, - Location = {北京} -} - -@Book{赵耀东1998--, - Title = {新时代的工业工程师}, - Author = {赵耀东}, - Publisher = {天下文化出版社}, - Url = {http://www.ie.nthu.edu.tw/info/ie.newie.htm(Big5)}, - Urldate = {1998-09-26}, - Year = {1998}, - Location = {台北} -} - -@Article{高光明1998-60-65, - Title = {信号情报接收机的发展现状及趋势}, - Author = {高光明}, - Journal = {电讯技术}, - Number = {2}, - Pages = {60-65}, - Volume = {38}, - Month = {4}, - Year = {1998} -} - -@Article{Dardari1999-1709-1721, - Title = {High-speed indoor wireless communications at 60 GHz with coded OFDM}, - Author = {Dardari, D. and Tralli,V.}, - Journal = {IEEE Trans. Commun.}, - Number = {11}, - Pages = {1709-1721}, - Volume = {47}, - Year = {1999} -} - -@InBook{程根伟1999-32-36a, - author = {程根伟}, - title = {1998年长江洪水的成因与减灾对策}, - booktitle = {长江流域洪涝灾害与科技对策}, - year = {1999}, - bookauthor = {许厚泽 and 赵其国}, - publisher = {科学出版社}, - location = {北京}, - pages = {32-36}, -} - -@Article{江向东1999-4-4, - Title = {互联网环境下的信息处理与图书管理系统解决方案}, - Author = {江向东}, - Date = {1999}, - Journaltitle = {情报学报}, - Number = {2}, - Pages = {4}, - Volume = {18}, - Url = {http://www.chinainfo.gov.cn/periodical/qbxb/qbxb99/qbxb990203}, - Urldate = {2000-01-18} -} - -@Article{李晓东1999-101-106, - Title = {气候学研究的若干理论问题}, - Author = {李晓东 and 张庆红 and 叶瑾琳}, - Date = {1999}, - Journaltitle = {北京大学学报}, - Number = {1}, - Pages = {101-106}, - Volume = {35}, - Journaltitleaddon = {自然科学版} -} - -@Article{梁振兴1999-24-32, - Title = {美军一体化{C\textsuperscript{4}ISR}系统的发展研究}, - Author = {梁振兴}, - Journal = {电子展望与决策}, - Pages = {24-32}, - Year = {1999} -} - -@Article{刘武1999-2481-2488, - Title = {元谋人牙齿测量数据的统计分析及其在分类研究上的意义}, - Author = {刘武 and 郑良 and 姜础}, - Date = {1999}, - Journaltitle = {科学通报}, - Number = {23}, - Pages = {2481-2488}, - Volume = {44} -} - -@Article{莫少强1999-1-6, - Title = {数字式中文全球文献格式的设计与研究}, - Author = {莫少强}, - Date = {1999}, - Journaltitle = {情报学报}, - Number = {4}, - Pages = {1-6}, - Volume = {18}, - Url = {http://periodical.wanfangdata.com.cn/periodical/qbxb/qbxb99/qbxb9904/990407.htm}, - Urldate = {2001-07-08} -} - -@Book{唐绪军1999-117-121, - Title = {报业经济与报业经营}, - Author = {唐绪军}, - Date = {1999}, - Pages = {117-121}, - Publisher = {新华出版社}, - Location = {北京} -} - -@Proceedings{中国力学学会1999--, - Title = {第3届全国实验流体力学学术会议论文集}, - Address = {天津}, - Year = {1999}, - Editor = {中国力学学会} -} - -@Article{杨友烈1999-60-65, - Title = {DII COE的基本概念和技术特征}, - Author = {杨友烈}, - Journal = {军事通信技术}, - Pages = {60-65}, - Volume = {72}, - Month = {12}, - Year = {1999} -} - -@Proceedings{GANZHA2000--, - Title = {Computer algebra in scientific computing:CASC 2000:proceedings of the Third -Workshop on Computer Algebra in Scientific Computing, Samarkand, October 5-9, 2000}, - Date = {2000}, - Publisher = {Springer}, - Editor = {V G GANZHA and E W MAYR and E V VOROZHTSOV}, - Location = {Berlin} -} - -@Book{Gradshteyn2000--, - Title = {Tables of Integrals, Series, and Products}, - Address = {San Diego}, - Author = {Gradshteyn, I. S. and Ryzhik,I. M.}, - Edition = {Sixth Edition}, - Publisher = {CA: Academic Press, Inc.}, - Year = {2000} -} - -@Book{Parsons2000--, - Title = {The Mobile Radio Propagation Channel}, - Address = {Hoboken}, - Author = {Parsons, J. D.}, - Edition = {2}, - Publisher = {John Wiley and Sons}, - Year = {2000} -} - -@Book{Parsons2000a--, - Title = {The Mobile Radio Propagation Channel}, - Address = {Hoboken}, - Author = {PARSONS}, - Edition = {2}, - Publisher = {John Wiley and Sons}, - Year = {2000} -} - -@Book{Parsons2000b--, - Title = {The Mobile Radio Propagation Channel}, - Address = {Hoboken}, - Author = {Parsons}, - Edition = {2}, - Publisher = {John Wiley and Sons}, - Year = {2000} -} - -@Book{Parsons2000noauthor--, - Title = {The Mobile Radio Propagation Channel}, - Address = {Hoboken}, - Edition = {2}, - Publisher = {John Wiley and Sons}, - Year = {2000} -} - -@Book{Parsons2000noloc--, - Title = {The Mobile Radio Propagation Channel}, - Author = {Parsons, J. D.}, - Edition = {2}, - Publisher = {John Wiley and Sons}, - Year = {2000} -} - -@Book{Parsons2000nopub--, - Title = {The Mobile Radio Propagation Channel}, - Address = {Hoboken}, - Author = {Parsons, J. D.}, - Edition = {2}, - Year = {2000} -} - -@Book{Parsons2000nopubpages--, - Title = {The Mobile Radio Propagation Channel}, - Address = {Hoboken}, - Author = {Parsons, J. D.}, - Edition = {2}, - Pages = {15-20}, - Year = {2000} -} - -@Book{YUFIN2000--a, - Title = {Geoecology and computers}, - Author = {S. A. YUFIN}, - Publisher = {A. A. Balkema}, - Year = {2000}, - Location = {Rotterdam}, - Titleaddon = {proceedings of the Third International Conference on Advances of - Computer Methods in Geotechnical and Geoenvironmental - Engineering, Moscow, Russia, February 1-4, 2000} -} - -@Article{李炳穆2000-5-8, - Title = {理想的图书管理员和信息专家的素养与形象}, - Author = {李炳穆}, - Date = {2000}, - Journaltitle = {图书情报工作}, - Number = {2}, - Pages = {5-8} -} - -@Book{孙玉文2000--, - Title = {汉语变调构词研究}, - Author = {孙玉文}, - Publisher = {北京大学出版社}, - Year = {2000}, - Location = {北京} -} - -@Article{傅刚2000--, - Title = {大风沙过后的思考}, - Author = {傅刚 and 赵承 and 李佳路}, - Date = {2000-04-12}, - Journaltitle = {北京青年报}, - Note = {news}, - Url = {http://www.bjyouth.com.cn/Bqb/20000412/GB/4216%5ED0412B1401.htm}, - Urldate = {2005-09-28} -}% Number = {14}, - -@Newspaper{张田勤2000--, - Title = {犯罪DNA库与生命伦理学计划}, - Author = {张田勤}, - Date = {2000-11-12}, - Journaltitle = {大众科技报}, - Note = {news}, - Number = {7} -} - -@Article{丁文祥2000--, - Title = {数字革命与竞争国际化}, - Author = {丁文祥}, - Date = {2000-11-20}, - Journaltitle = {中国青年报}, - Number = {15}, - Note = {news} -} - -@Book{booknoauthor, - Title = {出版集团研究}, - Date = {2001}, - Pages = {179-193}, - Publisher = {中国书籍出版社}, - Location = {北京} -} - -@Book{booknolocation, - Title = {出版集团研究}, - Author = {余敏}, - Date = {2001}, - Pages = {179-193}, - Publisher = {中国书籍出版社} -} - -@Book{booknopages, - Title = {出版集团研究}, - Author = {余敏}, - Date = {2001}, - Publisher = {中国书籍出版社}, - Url = {www.bla~bla.org}, - Location = {北京} -} - -@Book{booknopublisher, - Title = {出版集团研究}, - Author = {余敏}, - Date = {2001}, - Location = {北京} -} - -@Book{booknopublisherpage, - Title = {出版集团研究}, - Author = {余敏}, - Date = {2001}, - Pages = {20-30}, - Location = {北京} -} - -@Article{Moeneclaey2001-497-505, - Title = {Sensitivity of multiple-access techniques to narrowband interference}, - Author = {Moeneclaey, M. and Bladel,M. V. and Sari,H.}, - Journal = {IEEE Trans. Commun.}, - Number = {3}, - Pages = {497-505}, - Volume = {49}, - Year = {2001} -} - -@Book{PEEBLES2001--, - Title = {Probability, random variable and random signal principles}, - Author = {PEEBLES, Jr., P Z}, - Edition = {4}, - Publisher = {McGraw Hill}, - Year = {2001}, - Location = {New York} -} - -@Book{Peebles2001-100-100, - Title = {Probability, random variable, and random signal Principles and \LaTeX{}}, - Address = {New York}, - Author = {von Peebles, Jr., P. Z.}, - Edition = {4}, - Pages = {100}, - Publisher = {McGraw-Hill}, - Year = {2001} -} - -@Inproceedings{Piazzo2001--, - Title = {UWB EM compatibility and coexistence issues}, - Address = {Rome, Italy}, - Author = {Piazzo, L.}, - Booktitle = {Proc. 1st Int. Workshop on Networking with UWB}, - Year = {2001} -} - -@Book{ROOD2001--, - Title = {Logic and structured design for computer programmers}, - Author = {H J ROOD}, - Date = {2001}, - Edition = {3}, - Publisher = {Brooks/Cole-Thomson Learning} -} - -@Book{Simon2001--, - Title = {Spread Spectrum Communications Handbook}, - Address = {New York City}, - Author = {Simon, M. K. and Omura,J. K. and Scholtz,R. A. and Levitt,B. K.}, - Publisher = {McGraw-Hill, Inc.}, - Year = {2001} -} - -@Book{Stueber2001--, - Title = {Principles of Mobile Communication}, - Address = {Norwell}, - Author = {Stuber, G. L.}, - Edition = {Second Edition}, - Publisher = {MA: Kluwer Academic Publishers}, - Year = {2001} -} - -@Book{余敏2001-179-193, - Title = {出版集团研究}, - Author = {余敏}, - Date = {2001}, - Pages = {179-193}, - Publisher = {中国书籍出版社}, - Location = {北京} -} - -@Book{余敏2001-179-193a, - Title = {出版集团研究}, - Author = {余敏}, - Date = {2001}, - Edition = {3}, - Pages = {179-193}, - Publisher = {中国书籍出版社}, - Location = {北京} -} - -@Book{余敏2001-179-193b, - Title = {出版集团研究}, - Author = {余敏}, - Date = {2001}, - Edition = {2}, - Pages = {179-193}, - Publisher = {中国书籍出版社}, - Location = {北京} -} - -@Book{余敏2001-179-193c, - Title = {出版集团研究}, - Author = {余敏}, - Date = {2001}, - Pages = {179-193}, - Publisher = {中国书籍出版社}, - Url = {http://www.baidu.com}, - Urldate = {2001-08-04}, - Location = {北京} -} - -@Book{赵学功2001--a, - author = {赵学功}, - title = {当代美国外交}, - year = {2001}, - publisher = {社会科学文献出版社}, - url = {http://www.baidu.com}, - urldate = {2014-06-11}, -} - -@Manual{中国第一历史档案馆2001--a, - author = {中国第一历史档案馆 and 辽宁省档案馆}, - title = {中国明朝档案总汇}, - year = {2001}, - organization = {广西师范大学出版社}, - address = {桂林}, -} - -@Article{郜宪林2001-114-116, - Title = {DII COE研究与分析}, - Author = {郜宪林}, - Journal = {计算机工程与应用}, - Number = {19}, - Pages = {114-116}, - Year = {2001} -} - -@Patent{河北绿洲生态环境科技有限公司2001--, - Title = {一种荒漠化地区生态植被综合培育种植方法}, - Author = {河北绿洲生态环境科技有限公司}, - Date = {2001-10-24}, - Number = {01129210.5}, - Url = {http://211.152.9.47/sipoasp/zlijs/hyjs-yx-new.asp?recid=01129210.5&leixin}, - Urldate = {2002-05-28} -} - -@Article{陈金成2001-1861-1864, - Title = {一种开放式体系结构经济型数控装置的研制}, - Author = {陈金成 and 杨海威 and 钟廷修}, - Journal = {上海交通大学学报}, - Number = {12}, - Pages = {1861-1864}, - Volume = {35}, - Month = {12}, - Year = {2001} -} - -@Www{萧钰2001--, - Title = {出版业信息化迈入快车道}, - Author = {萧钰}, - Url = {http://www.creader.com/news/20011219/200112190019.html}, - Urldate = {2002-04-15}, - Date = {2001-12-19} -} - -@Inproceedings{Choi2002-1075-1080, - Title = {Performance analysis of ultra-wideband spread-spectrum communications in narrowband interference}, - Address = {Anaheim, CA}, - Author = {Choi, J. D. and Stark,W. E.}, - Booktitle = {Proc. IEEE Military Commun. Conf. (MILCOM)}, - Pages = {1075-1080}, - Volume = {2}, - Year = {2002} -} - -@Inproceedings{Dardari2002-201-206, - Title = {Simple and accurate models for error probability evaluation of IEEE802.11 DS-SS physical interface in the presence of Bluetooth interference}, - Address = {Taipei}, - Author = {Dardari, D. and Pasolini,G.}, - Booktitle = {Proc. IEEE Global Telecommun. Conf. (GLOBECOM)}, - Pages = {201-206}, - Volume = {1}, - Year = {2002} -} - -@Inproceedings{Foerster2002-1931-1935, - Title = {Interference modeling of pulse-based UWB waveforms on narrowband systems}, - Address = {Birmingham, AL}, - Author = {Foerster, J. R.}, - Booktitle = {Proc. IEEE Veh. Technol. Conf.}, - Pages = {1931-1935}, - Volume = {4}, - Year = {2002} -} - -@Inproceedings{Fontana2002-309-313, - Title = {An insight into UWB interference from a shot noise perspective}, - Address = {Baltimore, MD}, - Author = {Fontana, R. J.}, - Booktitle = {Proc. of IEEE Conference on Ultrawideband Systems and Technologies (UWBST)}, - Pages = {309-313}, - Year = {2002} -} - -@Article{Haemaelaeinen2002-1712-1721, - Title = {On the UWB system coexistence with GSM900, UMTS/WCDMA, and GPS}, - Author = {Hamalainen, M. M. and Hovinen,V. and Tesi,R. and Iinatti,J. H. J. and Latvaaho, M.}, - Journal = {IEEE J. Sel. Areas Commun.}, - Number = {9}, - Pages = {1712-1721}, - Volume = {20}, - Year = {2002} -} - -@Article{Zhao2002-1684-1691, - Title = {Performance of ultra-wideband communications in the presence of interference}, - Author = {Zhao, L. and Haimovich,A. M.}, - Journal = {IEEEJ. Sel. Areas Commun.}, - Number = {9}, - Pages = {1684-1691}, - Volume = {20}, - Year = {2002} -} - -@Inproceedings{汪学军2002-22-25, - Title = {中国农业转基因生物研发进展与安全管理}, - Address = {北京}, - Author = {汪学军}, - Bookauthor = {国家环境保护总局生物安全管理办公室}, - Booktitle = {中国国家生物安全框架实施国际合作项目研讨会论文集}, - Pages = {22-25}, - Publisher = {中国环境科学出版社}, - Year = {2002} -} - -@Book{张伯伟2002--, - Title = {全唐五代诗格会考}, - Address = {南京}, - Author = {张伯伟}, - Pages = {288}, - Publisher = {江苏古籍出版社}, - Year = {2002} -} - -@Patent{西安电子科技大学2002--a, - author = {西安电子科技大学}, - title = {光折变自适应光外差探测方法}, - number = {01128777.2}, - date = {2002-03-06}, - url = {http://211.152.9.47/sipoasp/zljs/hyjs-yx-new.asp?recid=01128777.2&leixin=0}, - urldate = {2002-05-28}, -} - -@Patent{TACHIBANA2002--, - Title = {Electronic watermarking method and system}, - Author = {R TACHIBANA and S SHIMIZU and S KOBAYSHI and others}, - Date = {2002-04-25}, - Number = {US6915001}, - Url = {http://patftuspto.gov/netacgi/nph-Parser?Seetl=PTO2&Sect2=HITOFF&=1&u=/netahhml/search-bool.html&r=1&f=G&1=50&col=AND&d=ptxt&sl=`Electronic+watermarking+method+system'.TTL.&OS=TTL/}, - Urldate = {2002-05-28} -} - -@Patent{KOSEKI2002--, - Title = {Compiler}, - Author = {A KOSEKI and H MOMOSE and M KAWAHITO and others}, - Date = {2002-05-25}, - Number = {US828402}, - Url = {http://FF&p=1&u=netahtml/PTO/search-bool.html&r=5&f=G&l=50&col=AND&d=PG01&sl=IBM.AS.&0S=AN/IBM&RS=AN/IBM}, - Urldate = {2002-05-28} -} - -@Article{Chiani2003-840-845, - Title = {New exponential bounds and approximations for the computation of error probability in fading channels}, - Author = {Chiani, M. and Dardari, D. and Simon, M. K.}, - Journal = {IEEE Trans. Wireless Commun.}, - Number = {4}, - Pages = {840-845}, - Volume = {2}, - Year = {2003} -} - -@Inproceedings{Firoozbakhsh2003-473-477, - Title = {Analysis of IEEE 802.11a interference on UWB systems}, - Address = {Oulu, Finland}, - Author = {Firoozbakhsh, B. and Pratt,T. G. and Jayant,N.}, - Booktitle = {Proc. of IEEE Conference on Ultrawideband Systems and Technologies (UWBST)}, - Pages = {473-477}, - Year = {2003} -} - -@Electronic{OMG2003--, - Title = {Unified Modeling Language: Superstructure}, - Author = {{omg Inc.}}, - Url = {http://www.omg.org}, - Year = {2003} -} - -@Thesis{吴云芳2003--, - Title = {面向中文信息处理的现代汉语并列结构研究}, - Address = {北京}, - Author = {吴云芳}, - Institution = {北京大学}, - Url = {http://thesis.lib.pku.edu.cn/dlib/List.asp?lang=gb&type=Reader&DocGroupID=4&DoclD=6328}, - Urldate = {2013-10-14}, - Year = {2003} -} - -@Thesis{吴云芳2003a--, - Title = {面向中文信息处理的现代汉语并列结构研究}, - Address = {北京}, - Author = {吴云芳}, - Url = {http://thesis.lib.pku.edu.cn}, - Urldate = {2013-10-14}, - Year = {2003} -} - -@Thesis{吴云芳2003b--, - Title = {面向中文信息处理的现代汉语并列结构研究}, - Author = {吴云芳}, - Institution = {北京大学}, - Url = {http://thesis.lib.pku.edu.cn}, - Urldate = {2013-10-14}, - Year = {2003} -} - -@Thesis{吴云芳2003c--, - Title = {面向中文信息处理的现代汉语并列结构研究}, - Author = {吴云芳}, - Url = {http://thesis.lib.pku.edu.cn}, - Urldate = {2013-10-14}, - Year = {2003} -} - -@Article{Chiani2004-1312-1318, - Title = {Further results on convolutional code search for blockfading channels}, - Author = {M. Chiani and A. Conti and V. Tralli}, - Journal = {IEEE Trans. Inf. Theory}, - Number = {6}, - Pages = {1312-1318}, - Volume = {50}, - Year = {2004} -} - -@Article{Chiani2004-1312-1318a, - Title = {Further results on convolutional code search for blockfading channels-a}, - Author = {M. Chiani and A. Conti and V. Tralli}, - Pages = {1312-1318}, - Year = {2004} -} - -@Article{Chiani2004-1312-1318b, - Title = {Further results on convolutional code search for blockfading channels-b}, - Author = {M. Chiani and A. Conti and V. Tralli}, - Pages = {1312-1318}, - Year = {2004} -} - -@Article{Coulson2004-2277-2287, - Title = {Narrowband interference in pilot symbol assisted OFDM systems}, - Author = {Coulson, A. J.}, - Journal = {IEEE Trans. Wireless Commun.}, - Number = {6}, - Pages = {2277-2287}, - Volume = {3}, - Year = {2004} -} - -@Article{Dardari2004-1557-1567, - Title = {Layered video transmission on adaptive OFDM wireless systems}, - Author = {Dardari, D. and Martini,M. G. and Mazzotti, M. and Chiani,M.}, - Journal = {EURASIP Journal on Wireless Communications and Networking}, - Number = {10}, - Pages = {1557-1567}, - Year = {2004} -} - -@Book{Kopka2004--, - Title = {A Guide to LATEX and Electronic Publishing}, - Address = {Harlow, England}, - Author = {Helmut Kopka and Patrick W. Daly}, - Date = {2004}, - Edition = {4}, - Publisher = {Addison-Wesley} -} - -@Conference{Li2004-21-24, - Title = {Practical approaches to channel estimation and interference suppression for OFDM based UWB communications}, - Author = {Li, Y. and Molisch,A. F. and Zhang,J.}, - Booktitle = {Proc. of the IEEE 6th Circ. and Syst., Symp. on Emerging Technologies: Frontiers of Mobile and Wireless Communication}, - Pages = {21-24}, - Volume = {1}, - Year = {2004} -} - -@Book{Lin2004--, - Title = {Error Control Coding}, - Address = {Englewood Cliffs}, - Author = {Lin, S. and Daniel Costello,J.}, - Edition = {Second Edition}, - Publisher = {NJ:Prentice Hall}, - Year = {2004} -} - -@Book{Mittelbach2004--, - Title = {The LaTeX Companion}, - Address = {Boston}, - Author = {Frank Mittelbach and Michel Goossens and Johannes Braams and David Carlisle and Chris Rowley}, - Edition = {Second Edition}, - Publisher = {Addison-Wesley}, - Year = {2004} -} - -@Book{Simon2004--, - Title = {Digital Communication over Fading Channels}, - Address = {Hoboken}, - Author = {Simon, M. K. and Alouini,M. S.}, - Publisher = {NJ: Wiley-IEEE Press}, - Year = {2004} -} - -@PhdThesis{张若凌2004--, - Title = {高超声速非平衡流动的计算和实验研究}, - Author = {张若凌}, - School = {中国空气动力研究与发展中心}, - Year = {2004}, - Location = {绵阳} -} - -@Book{Miroslav2004--, - Title = {信号处理滤波器设计-基于matlab和mathematica的设计方法}, - Address = {北京}, - Author = {Miroslav, D. L. and Dejan, V. T. and Brian, L. E.}, - Publisher = {电子工业出版社}, - Translator = {朱义胜 and 董辉}, - Year = {2004}, - Month = {1} -} - -@Book{Miroslav2003--, - Title = {信号处理滤波器设计方法}, - Address = {北京}, - Author = {Miroslav, D. L. and Dejan, V. T.}, - Publisher = {电子工业出版社}, - Translator = {朱义胜 and 董辉}, - Year = {2003}, - Month = {1} -} - -@Article{Giorgetti2005-1037-1042, - Title = {The impact of OFDM interference on TH-PPM/BPAM transmission systems}, - Author = {Giorgetti, A. and Dardari,D.}, - Journal = {Proc. IEEE Veh. Technol. Conf.}, - Pages = {1037-1042}, - Volume = {2}, - Year = {2005} -} - -@Article{Giorgetti2005-2139-2149, - Title = {The effect of narrowband interference on wideband wireless communication systems}, - Author = {Giorgetti, A. and Chiani, M. and Win, M. Z.}, - Journal = {IEEE Trans. Commun.}, - Number = {12}, - Pages = {2139-2149}, - Volume = {53}, - Year = {2005} -} - -@Article{Giorgetti2005-384-389, - Title = {Influence of fading on the Gaussian approximation for BPSK and QPSK with asynchronous cochannel interference}, - Author = {Giorgetti, A. and Chiani,M.}, - Journal = {IEEE Trans. Wireless Commun.}, - Number = {2}, - Pages = {384-389}, - Volume = {4}, - Year = {2005} -} - -@Inproceedings{Giorgetti2005-794-798, - Title = {Coexistence of UWB and narrowband systems in Nakagami/Rice channels}, - Address = {Aalborg, Denmark}, - Author = {Giorgetti, A.}, - Booktitle = {Proc. Int. Symp. on Wireless Personal Multimedia Commun. (WPMC)}, - Pages = {794-798}, - Year = {2005} -} - -@Book{Reed2005--, - Title = {An Introduction to Ultrawideband Communication Systems}, - Address = {Upper Saddle River}, - Author = {Reed, J. H.}, - Publisher = {NJ: Prentice Hall}, - Year = {2005} -} - -@Book{樊昌信2005--, - Title = {通信原理教程}, - Address = {北京}, - Author = {樊昌信}, - Publisher = {电子工业出版社}, - Year = {2005} -} - -@Article{Coulson2006-2484-2492, - Title = {Bit error rate performance of OFDM in narrowband interference with excision filtering}, - Author = {Coulson, A. J.}, - Journal = {IEEE Trans. Wireless Commun.}, - Number = {9}, - Pages = {2484-2492}, - Volume = {5}, - Year = {2006} -} - -@Inproceedings{Giorgetti2006--, - Title = {Coexistence issues in cognitive radios based on ultra-wide bandwidth systems}, - Address = {Mykonos, Greece}, - Author = {Giorgetti, A. and Chiani, M. and Dardari,D.}, - Booktitle = {Proc. IEEE Int. Conf. on Cognitive Radio Oriented Wireless Net. and Comm. (CROWNCOM)}, - Year = {2006} -} - -@Article{Hu2006-1720-1724, - Title = {Performance of an ultra-wideband communication system in the presence of narrowband BPSK-and QPSK-modulated OFDM interference}, - Author = {Hu, B. and Beaulieu,N. C.}, - Journal = {IEEE Trans. Commun.}, - Number = {10}, - Pages = {1720-1724}, - Volume = {54}, - Year = {2006} -} - -@Article{Molisch2006-3151-3166, - Title = {A comprehensive standardized model for ultrawideband propagation channels}, - Author = {Molisch, A. F. and Cassioli, D. and Chong, C. C. and Emami, S. and Fort, A.}, - Journal = {IEEE Trans. Antennas Propag.}, - Number = {11}, - Pages = {3151-3166}, - Volume = {54}, - Year = {2006} -} - -@Article{Saito2006-169-176, - Title = {jadeite-bearing metagabbro in serpentinite m\'elange of the ``kurosegawa belt" in Izumi Town,Yatsushiro city, kumamoto prefecture, central kyushu}, - Author = {Saito, M. and Miyazaki, k.}, - Journal = {bulletin of geological survey of japan}, - Number = {5/6}, - Pages = {169-176}, - Volume = {57}, - Year = {2006} -} - -@Book{郭文彬2006--, - Title = {通信原理--基于Matlab的计算机仿真}, - Address = {北京}, - Author = {郭文彬 and 桑林}, - Publisher = {北京邮电大学出版社}, - Year = {2006} -} - -@Book{蔡敏2006--, - Title = {UML基础和Rose建模教程}, - Address = {北京}, - Author = {蔡敏 and 徐慧慧 and 黄柄强}, - Publisher = {人民邮电出版社}, - Year = {2006}, - Month = {1} -} - -@Article{Nasri2007-4090-4100, - Title = {Analysis of narrowband communication systems impaired by MB-OFDM UWB interference}, - Author = {Nasri, A. and Schober, R. and Lampe, L.}, - Journal = {IEEE Trans. Wireless Commun.}, - Number = {11}, - Pages = {4090-4100}, - Volume = {6}, - Year = {2007} -} - -@Book{Proakis2007--, - Title = {Digital signal processing: Principles,algorithms, and applications}, - Address = {北京}, - Author = {Proakis, J. G. AND Manolakis, D. G.}, - Edition = {第4版}, - Publisher = {电子工业出版社}, - Year = {2007} -} - -@Article{Quek2007-2126-2139, - Title = {Unified analysis of UWB transmitted-reference schemes in the presence of narrowband interference}, - Author = {Quek, T. Q. S. and Win,M. Z. and Dardari,D.}, - Journal = {IEEE Trans. Wireless Commun.}, - Number = {6}, - Pages = {2126-2139}, - Volume = {6}, - Year = {2007} -} - -@Article{Shi2007-1118-1128, - Title = {Impact of narrowband interference on OFDM-UWB receivers: Analysis and mitigation}, - Author = {Shi, K. and Zhou,Y. and Kelleci,B. and Fischer, T. W. and Serpedin, E.E. and Ilker Karsilayan, A.}, - Journal = {IEEE Trans.Signal Process.}, - Number = {3}, - Pages = {1118-1128}, - Volume = {55}, - Year = {2007} -} - -@Article{Snow2007-1736-1746, - Title = {Error rate analysis for coded multicarrier systems over quasistatic fading channels}, - Author = {Snow, C. and Lampe, L. and Schober,R.}, - Journal = {IEEE Trans. Commun.}, - Number = {9}, - Pages = {1736-1746}, - Volume = {55}, - Year = {2007} -} - -@Book{全国广播电视标准化技术委员会2007-1-1, - Title = {广播电视音像资料编目规范:第2部分~ 广播资料:GY/T202.2-2007}, - Address = {北京}, - Author = {全国广播电视标准化技术委员会}, - Note = {standard}, - Pages = {1}, - Publisher = {国家广播电影电视局广播电视规划院}, - Year = {2007} -} - -@Article{张敏莉2007-500-503, - Title = {超声速短化喷管的设计和试验研究}, - Author = {张敏莉 and 易仕和 and 赵玉新}, - Journal = {空气动力学报}, - Number = {4}, - Pages = {500-503}, - Volume = {25}, - Year = {2007} -} - -@Book{庄钊文2007--, - Title = {军用目标雷达散射截面预估与测量}, - Address = {北京}, - Author = {庄钊文 and 袁乃昌 and 莫锦军 and 刘少斌}, - Publisher = {科学出版社}, - Year = {2007} -} - -@Article{刘晨2007-400-404, - Title = {体系对抗仿真模型形式规范研究}, - Author = {刘晨 and 王维平 and 朱一凡}, - Journal = {系统仿真学报}, - Number = {2}, - Pages = {400-404}, - Volume = {19}, - Month = {1}, - Year = {2007} -} - -@Manual{吴凌云2007--, - Title = {CTEX FAQ}, - Author = {吴凌云}, - Version = {version 0.4}, - Month = {1}, - Subtitle = {常见问题集}, - Year = {2007} -} - -@Article{articlemorenames, - Title = {Cooperation enforcement and learning for optimizing packet forwarding in autonomous wireless networks}, - Author = {Pandana, C. and Han, Z. and Liu, K.J.R. and others}, - Journal = {Wireless Communications, IEEE Transactions on}, - Number = {8}, - Pages = {3150--3163}, - Volume = {7}, - Publisher = {IEEE}, - Year = {2008} -} - -@Inproceedings{Nasri2008-3616-3621, - Title = {Performance Evaluation of BICM-OFDM Systems Impaired by UWB Interference}, - Address = {Beijing, China}, - Author = {Nasri, A. and Schober,R. and Lampe,L.}, - Booktitle = {Proc. IEEE Int. Conf. on Commun.}, - Pages = {3616-3621}, - Year = {2008} -} - -@Book{2009-155-155, - Title = {师伏堂日记:第4册}, - Address = {北京}, - Pages = {155}, - Publisher = {北京图书馆出版社}, - Year = {2009} -} - -@Article{Chiani2009-231-254, - Title = {Coexistence between UWB and narrow-band wireless communication systems}, - Author = {Chiani, M. and Giorgetti, A.}, - Journal = {Proc. IEEE, Special Issue on UWB Technology and Emerging Applications}, - Number = {2}, - Pages = {231-254}, - Volume = {97}, - Year = {2009} -} - -@Article{Pinto2009-1268-1282, - Title = {A stochastic geometry approach to coexistence in heterogeneous wireless networks}, - Author = {Pinto, P. and Giorgetti,A. and Win,M. Z. and Chiani,M.}, - Journal = {IEEE J. Sel. Areas Commun., Special Issue on Stochastic Geometry and Random Graphs for Wireless Networks}, - Number = {7}, - Pages = {1268-1282}, - Volume = {27}, - Year = {2009} -} - -@Book{罗斯基2009--, - Title = {战前中国经济的增长}, - Address = {杭州}, - Author = {罗斯基}, - Publisher = {浙江大学出版社}, - Translator = {唐巧天 and 毛立坤 and 姜修宪}, - Year = {2009} -} - -@Book{陈希孺2009--, - Title = {概率论与数理统计}, - Address = {合肥}, - Author = {陈希孺}, - Publisher = {中国科学技术大学出版社}, - Year = {2009}, - Month = {2} -} - -@Book{李云霞2009--, - Title = {光电对抗原理与应用}, - Address = {西安}, - Author = {李云霞 and 蒙文 and 马丽华 and 赵尚弘}, - Date = {2009-02}, - Publisher = {西安电子科技大学出版社} -} - -@Article{卢秋红2009-247-251, - Title = {基于开放式架构的反恐排爆机器人关键技术分析}, - Author = {卢秋红 and 蒋金鹏 and 付西光}, - Journal = {上海电机学院学报}, - Number = {3}, - Pages = {247-251}, - Volume = {12}, - Month = {9}, - Year = {2009} -} - -@Article{张庆杰2009-30-33, - Title = {支持无人机互操作的多数据链互连网关设计}, - Author = {张庆杰 and 王林 and 朱华勇 and 沈林成}, - Journal = {计算机工程}, - Number = {20}, - Pages = {30-33}, - Volume = {35}, - Month = {10}, - Year = {2009} -} - -@Article{Park2010-696-715, - Title = {metadata quality Control in Digital repositories and collections: criteria, semantics, and mechanisms}, - Author = {Park, J R and tosaka, Y.}, - Journal = {Cataloging \& classification quarterly}, - Number = {8}, - Pages = {696-715}, - Volume = {48}, - Url = {http://www.tandfonline.com}, - Urldate = {2013-09-05}, - Year = {2010} -} - -@Article{陈建军2010-93-93, - Title = {从数字地球到智慧地球}, - Author = {陈建军}, - Journal = {国图资源导刊}, - Number = {10}, - Pages = {93}, - Volume = {7}, - Doi = {10.3969/j.issn.1672-5603.2010.10.038}, - Url = {http://d.g.wanfangdata.com.cn}, - Urldate = {2013-03-20}, - Year = {2010} -} - -@Article{储大同2010-721-724, - Title = {恶性肿瘤个体化治疗靶向药物的临床表现}, - Author = {储大同}, - Journal = {中华肿瘤杂志}, - Number = {10}, - Pages = {721-724}, - Volume = {32}, - Url = {http://www.sohu.com}, - Urldate = {2014-06-25}, - Year = {2010} -} - -@book{weiner2010-38, - Title = {Microarchaeology: beyond the visible archaeological record}, - Author = {Weiner, S}, - Address = {Cambridge, Eng.}, - Date = {2010}, - Publisher = {Cambridge University Press Textbooks}, - Url = {http://lib.MYLIB.COM/OPEN.aspx?id=253897}, - Urldate = {2013-10-14}, - pages = {38} -} - -@Article{储大同2010-721-724m, - Title = {恶性肿瘤个体化治疗靶向药物的临床表现}, - Author = {储大同}, - Journal = {中华肿瘤杂志}, - Number = {9/10}, - Pages = {721-724}, - Volume = {32}, - Doi = {10.7666/d.y351065}, - Url = {http://www.sohu.com}, - Urldate = {2014-06-25}, - Year = {2010} -} - -@Book{候文顺2010-119-119, - Title = {高分子物理:高分子材料分析、选择与改性}, - Address = {北京}, - Author = {候文顺}, - Pages = {119}, - Publisher = {化学工业出版社}, - Url = {http://apabi.lib.pku.edu.cn}, - Urldate = {2012-11-27}, - Year = {2010} -} - -@Book{胡承正2010-112-112, - Title = {理论物理概论:上}, - Address = {武汉}, - Author = {胡承正 and 周详 and 缪灵}, - Pages = {112}, - Publisher = {武汉大学出版社}, - Year = {2010} -} - -@Book{美国妇产科医师学会2010-38-39, - Title = {新生儿脑病和脑性瘫痪发病机制与病理生理}, - Address = {北京}, - Author = {美国妇产科医师学会}, - Pages = {38-39}, - Publisher = {人民卫生出版社}, - Translator = {段涛 and 杨慧霞}, - Year = {2010} -} - -@Book{全国信息文献标准化技术委员会2010-3-3, - Title = {文献著录:第4部分~ 非书资料:GB/T3792.4-2009}, - Address = {北京}, - Author = {全国信息文献标准化技术委员会}, - Note = {standard}, - Pages = {3}, - Publisher = {中国标准出版社}, - Year = {2010} -} - -@Article{伍江华2010-70-74, - Title = {C4ISR互操作框架及信息关系模型研究}, - Author = {伍江华 and 潘小群}, - Journal = {舰船电子工程}, - Number = {1}, - Pages = {70-74}, - Volume = {30}, - Year = {2010} -} - -@Book{王雪松2010--, - Title = {现代雷达电子战系统建模与仿真}, - Address = {北京}, - Author = {王雪松 and 肖顺平 and 冯德军 and 赵锋}, - Date = {2010-03}, - Publisher = {电子工业出版社} -} - -@Book{Ross2010--, - Title = {概率论基础教程}, - Address = {北京}, - Author = {Ross, S. M.}, - Edition = {第8版}, - Publisher = {人民邮电出版社}, - Translator = {郑忠国 and 詹从赞}, - Year = {2010}, - Month = {4} -} - -@Book{陈志杰2006--, - Title = {LaTeX 入门与提高}, - Address = {北京}, - Author = {陈志杰 and 赵书钦 and 李树钧 and 万福永}, - Edition = {第二版}, - Publisher = {高等教育出版社}, - Year = {2010}, - Month = {5} -} - -@Manual{Umeki2010--, - Title = {The geometry package}, - Author = {Hideo Umeki}, - Version = {v5.6}, - Month = {09}, - Year = {2010} -} - -@Report{Calkin2011-8-9, - Title = {a comparative risk assessment framework for wildland fire management: the 2010 cohesive strategy Science report: RMRS-GTR-262}, - Author = {Calkin, D and Ager, a. and Thompson, m.}, - Pages = {8-9}, - Year = {2011} -} - -@Book{Praetzellis2011-13-13, - Title = {death by theory : a tale of mystery and archaeological theory}, - Author = {Praetzellis, A.}, - Edition = {Rev. ed.}, - Pages = {13}, - Publisher = {Rowman \& Littlefield Publishing Group, Inc.}, - Url = {http://lib.myilibrary.com}, - Urldate = {2012-07-26}, - Year = {2011} -} - -@Proceedings{陈志勇2011--, - Title = {中国财税文化价值研究:“中国财税文化国际学术研讨会”论文集}, - Address = {北京}, - Author = {陈志勇}, - Publisher = {经济科学出版社}, - Url = {http://apabi.lib.pku.edu.cn}, - Urldate = {2013-10-14}, - Year = {2011} -} - -@InProceedings{贾东琴2011-45-52a, - author = {贾东琴 and 柯平}, - title = {面向数字素养的高校图书馆数字服务体系研究}, - booktitle = {中国图书馆学会年会论文集:2011年卷}, - year = {2011}, - publisher = {国家图书馆出版社}, - pages = {45-52}, - address = {北京}, - bookauthor = {中国图书馆学会}, -} - -@Inbook{楼梦麟2011-11-12, - Title = {汶川地震基岩地震动特征分析}, - Address = {上海}, - Author = {楼梦麟 and 杨燕}, - Bookauthor = {同济大学土木工程防灾国家重点实验室}, - Booktitle = {汶川地震震害研究}, - Pages = {{011-012}}, - Publisher = {同济大学出版社}, - Url = {http://apabi.lib.pku.edu.cn}, - Urldate = {2013-05-09}, - Year = {2011} -} - -@Thesis{马欢2011-27-27, - Title = {人类活动影响下海河流域典型区水循环变化分析}, - Address = {北京}, - Author = {马欢}, - Institution = {清华大学}, - Pages = {27}, - Url = {http://www.cnki.net/kcms/detail/detail.aspx?dbcode=CDFD&QueryID=.O&CurRec=11&dbname=CDFDLAST2013&.filename=1012035905.nh&uid=WEEvRE­wSIJHSldTTGJhYIJRaEhGUXFQWVB6SGZXeisxdmVhV3Zy2kpoUnozeDElbOpaMONmMjZiQ3p4TUdmcw= }, - Urldate = {2013-10-14}, - Year = {2011} -} - -@InBook{2011-1109-1109, - title = {周易外传:卷5}, - booktitle = {船山全书:第6册}, - year = {2011}, - bookauthor = {王夫之}, - publisher = {岳麓书社}, - location = {长沙}, - pages = {1109}, -} - -@Book{胡伟2011--, - Title = {LaTeX2$\varepsilon$完全学习手册}, - Address = {北京}, - Author = {胡伟}, - Publisher = {清华大学出版社}, - Year = {2011}, - Month = {1} -} - -@Manual{Oetiker2011--, - Title = {The Not So Short Introduction to \LaTeXe{}}, - Author = {Tobias Oetiker and Hubert Partl and Irene Hyna and Elisabeth Schleg}, - Month = {4}, - Year = {2011} -} - -@Article{陈高峰2011-230-232, - Title = {基于开放式框架的交叉开发环境设计与实现}, - Author = {陈高峰}, - Journal = {煤炭技术}, - Number = {6}, - Pages = {230-232}, - Volume = {30}, - Month = {6}, - Year = {2011} -} - -@Manual{Robertson2011--, - Title = {The ccaption package}, - Author = {Will Robertson and Peter Wilson and Herries Press}, - Version = {v3.2c}, - Month = {8}, - Year = {2011} -} - -@Article{谭跃进2011-441-445, - Title = {体系工程的研究与发展}, - Author = {谭跃进 and 赵青松}, - Journal = {中国电子科学研究院学报}, - Number = {5}, - Pages = {441-445}, - Volume = {6}, - Month = {10}, - Year = {2011} -} - -@Manual{Sommerfeldt2011--, - Title = {Customizing captions of floating environments}, - Author = {Axel Sommerfeldt}, - Url = {http://sourceforge.net/projects/latex-caption/}, - Month = {11}, - Year = {2011} -} - -@Article{张晓琴2011--, - Title = {有重复组合公式的几种证明方法}, - Author = {张晓琴 and 王顺勇}, - Journal = {大学数学}, - Number = {6}, - Volume = {27}, - Month = {12}, - Year = {2011} -} - -@Book{Kinchy2012-50-50, - Title = {Seeds, Sciences, and struggle : the global politics of transgenic crops}, - Address = {Cambridge,Mass.}, - Author = {Kinchy, A.}, - Pages = {50}, - Publisher = {MIT Press}, - Url = {http://lib.myilibary.com}, - Urldate = {2013-07-14}, - Year = {2012} -} - -@Book{库恩2012--, - Title = {科学革命的结构:第4版}, - Address = {北京}, - Author = {库恩}, - Edition = {2}, - Publisher = {北京大学出版社}, - Translator = {金吾伦 and 胡新和}, - Year = {2012} -} - -@Proceedings{雷光春2012--, - Title = {综合湿地管理:综合湿地管理国际研讨会论文集}, - Address = {北京}, - Author = {雷光春}, - Publisher = {海洋出版社}, - Year = {2012} -} - -@Article{于潇2012-1518-1523, - Title = {互联网药品可信交易环境中主体资质审核备案模式}, - Author = {于潇 and 刘义 and 柴跃廷 and others}, - Journal = {清华大学学报(自然科学版)}, - Number = {11}, - Pages = {1518-1523}, - Volume = {52}, - Year = {2012} -} - -@Article{于潇2011-15-23, - Title = {互联网药品可信交易环境中主体资质审核备案模式}, - Author = {于, 潇 and 刘, 义 and 柴, 跃廷 and others}, - Journal = {清华大学学报}, - Number = {11}, - Pages = {15-23}, - Volume = {52}, - Year = {2011} -} - -@Proceedings{中国社会科学院台湾史研究中心2012--, - Title = {台湾光复六十五周年暨抗战史实学术研讨会论文集}, - Address = {北京}, - Publisher = {九州出版社}, - Year = {2012}, - Editor = {中国社会科学院台湾史研究中心} -} - -@Book{埃伯哈德$ullet$蔡德勒等2012--, - Title = {数学指南-实用数学手册}, - Address = {北京}, - Author = {埃伯哈德$\bullet$蔡德勒等}, - Publisher = {科学出版社}, - Translator = {李文林等}, - Year = {2012}, - Month = {1} -} - -@Book{廖平2012--, - Title = {导弹突防中的电子对抗技术}, - Address = {北京}, - Author = {廖平 and 姜勤波}, - Date = {2012-01}, - Publisher = {国防工业出版社} -} - -@Patent{张凯军2012-04-05--, - Title = {轨道火车及高速轨道火车紧急安全制动辅助装置}, - Author = {张凯军}, - Number = {201220158825.2}, - Year = {2012-04-05} -} - -@Online{李强2012-05-03--, - Title = {化解医患矛盾需釜底抽薪}, - Author = {李强}, - Url = {http://wenku.baidu.com}, - Urldate = {2013-03-25}, - Year = {2012-05-03} -} - -@Online{Dublin2012-06-14--, - Title = {Dublin core metadata element set: version 1.1}, - Url = {http://dublincore.org}, - Urldate = {2014-06-11}, - Year = {2012-06-14} -} - -@Book{胡广书2012--, - Title = {数字信号处理—理论、算法与实现}, - Address = {北京}, - Author = {胡广书}, - Edition = {第三版}, - Publisher = {清华大学出版社}, - Year = {2012}, - Month = {10} -} - -@Article{Franz2013-1053-1062, - Title = {Phenotypic screening with oleaginous microalgae reveals modulators of lipid productivity}, - Author = {Franz,A.K. AND DANIELEWICZ, M. A. AND WONG, D. M. AND OTHERS}, - Journal = {ACS chemical biology}, - Pages = {1053-1062}, - Volume = {8}, - Url = {http://pubs.acs.org}, - Urldate = {2014-06-26}, - Year = {2013} -} - -@Article{Walls2013-399-418, - Title = {drought, deluge and declines: the impact of precipition extremes on amphibians in a changing climate}, - Author = {Walls, S C and barichivich, W. J. and BROWN, m. e.}, - Journal = {Biology}, - Number = {1}, - Pages = {399-418}, - Volume = {2}, - Url = {http://www.mdpi.com}, - Urldate = {2013-11-04}, - Year = {2013}, - doi = {10.3390/biology2010399} -} - -@Article{Zhang2007-500-503, - Title = {The design and experimental investigations of supersonic length shorted nozzle}, - Author = {Zhang, Min-li and Yi, Shi-he and Zhao, Yu-xin}, - Journal = {ACTA AERODYNAMICA SINICA}, - Number = {4}, - Pages = {500-503}, - Volume = {25}, - Year = {2007} -} - -@Book{Yi2013--, - Title = {Supersonic and hypersonic nozzle design}, - Address = {Beijing}, - Author = {Yi, Shi he and Zhao, Yu xin and He, Lin and Zhang, Min li}, - Publisher = {National Defense Industry Press}, - Year = {2013} -} - -@Book{LIAO2012--, - Title = {Electronic countermeasure techniques for missile penetration}, - Address = {Beijing}, - Author = {LIAO, ping and JIANG, qin bo}, - Publisher = {National Defense Industry Press}, - Year = {2013} -} - -@Book{LIU2003--, - Title = {Introduction of Ballistic Misille Techniques}, - Address = {Beijing}, - Author = {LIU, shi Qiu}, - Publisher = {China Astronautic Publishing House}, - Year = {2003} -} - -@InBook{马克思2013-302-302a, - author = {马克思}, - title = {政治经济学批判}, - booktitle = {马克思恩格斯全集:第35卷}, - year = {2013}, - bookauthor = {马克思 and 恩格斯}, - publisher = {人民出版社}, - pages = {302}, - address = {北京}, -} - -@Article{杨洪升2013-56-75, - Title = {四库馆私家抄校书考略}, - Author = {杨洪升}, - Journal = {文献}, - Number = {1}, - Pages = {56-75}, - Year = {2013} -} - -@Book{易仕和2013--, - Title = {超声速和高超声速喷管设计}, - Address = {北京}, - Author = {易仕和 and 赵玉新 and 何霖 and 张敏莉}, - Publisher = {国防工业出版社}, - Year = {2013} -} - -@Article{詹广平2013-8-10, - Title = {美海军宙斯盾系统开放式体系结构研究}, - Author = {詹广平}, - Journal = {舰船电子工程}, - Number = {11}, - Pages = {8-10}, - Volume = {33}, - Year = {2013} -} - -@Book{中国企业投资协会2013--, - Title = {投资台湾:大陆企业赴台投资指南}, - Address = {北京}, - Author = {中国企业投资协会 and 台湾并购与私募股权协会 and 汇盈国际投资集团}, - Publisher = {九州出版社}, - Year = {2013} -} - -@Article{周学武2013-49-52, - Title = {数据链技术的发展及其在空面导弹中的应用}, - Author = {周学武 and 邹敏怀 and 张邦楚 and 黄剑斌 and 刘涛}, - Journal = {教练机}, - Number = {2}, - Pages = {49-52}, - Year = {2013} -} - -@Book{Poisel2013--, - Title = {通信电子战原理}, - Address = {北京}, - Author = {Poisel, Richard A.}, - Edition = {2版}, - Pages = {23--26}, - Publisher = {电子工业出版社}, - Translator = {聂皞 and 王振华 and 陈少昌 and 吴利民}, - Url = {http://www.baidu.com}, - Urldate = {2013-08-01}, - Year = {2013}, - Month = {1} -} - -@Article{王雪峥2013-249-254, - Title = {基于DoDAF的靶场体系结构设计}, - Author = {王雪峥 and 许雪梅}, - Journal = {系统工程理论与实践}, - Number = {1}, - Pages = {249-254}, - Volume = {33}, - Month = {1}, - Year = {2013} -} - -@Book{阎毅2013--, - Title = {软件无线电与认知无线电概论}, - Address = {北京}, - Author = {阎毅 and 贺鹏飞}, - Publisher = {电子工业出版社}, - Year = {2013}, - Month = {1} -} - -@Article{刘裕国2013-01-12--, - Title = {雾霾来袭,如何突围}, - Author = {刘裕国 and 杨柳 and 张洋 and OTHERS}, - Journal = {人民日报}, - Note = {news}, - Url = {http://paper.people.com.cn}, - Urldate = {2013-11-06}, - Year = {2013-01-12} -} - -@Report{中华人民共和国国务院新闻办公室2013-04-16--, - Title = {国防白皮书:中国武装力量的多样化运用}, - Author = {中华人民共和国国务院新闻办公室}, - Url = {http://www.mod.gov.cn}, - Urldate = {2014-06-11}, - Year = {2013}, - date = {2013-04-16} -} - -@Book{刘海洋2013--, - Title = {LaTeX 入门}, - Address = {北京}, - Author = {刘海洋}, - Publisher = {电子工业出版社}, - Year = {2013}, - Month = {6} -} - -@Unpublished{包太雷2013--, - Title = {LaTeX Notes}, - Author = {包太雷}, - Edition = {第二版}, - Month = {9}, - Subtitle = {雷太赫排版系统简介}, - Year = {2013} -} - -@Report{汤万金2013-09-30--, - Title = {人体安全重要技术标准研制最终报告: 7178999X}, - Author = {汤万金 and 杨跃翔 and 刘文 and others}, - Url = {http://www.nstrs.org.cn}, - Urldate = {2014-06-24}, - date = {2013-09-30}, - Year = {2013} -} - -@Manual{Lehman2013--, - Title = {The biblatex Package}, - Author = {Philipp Lehman and Philip Kime and Audrey Boruvka and Joseph Wright}, - Version = {version 2.8a}, - Month = {11}, - Subtitle = {Programmable Bibliographies and Citations}, - Year = {2013} -} - -@Proceedings{Babu2014--, - Title = {Proceedings of the second international conference on soft computing for problem solving, December 28-30, 2012}, - Address = {New Delhi}, - Publisher = {Springer}, - Year = {2014}, - Editor = {Babu, B. V. and NAGAR, A. K. AND DEEP, K. and others} -} - -@Book{同济大学数学系2014--, - Title = {高等数学}, - Address = {北京}, - Author = {同济大学数学系}, - Publisher = {高等教育出版社}, - Year = {2014}, - Month = {7} -} - -@Book{杨林2015--, - Title = {面向对象软件工程与UML实践教程}, - Address = {北京}, - Author = {杨林 and 叶亚琴 and 方芳}, - Publisher = {科学出版社}, - Year = {2015}, - Month = {1} -} - -@Manual{Braams2015--, - Title = {The \LaTeXe{} Sources}, - Author = {Johannes Braams and David Carlisle and Alan Jeffrey and Leslie Lamport and Frank Mittelbach and Chris Rowley and Rainer Sch¨opf}, - Date = {2015-01-01} -} - -@Manual{Lehman2015, - Title = {The Biblatex Package: Programmable Bibliographies and Citations}, - Author = {Philipp Lehman and Philip Kime and Audrey Boruvka and Joseph Wright}, - Date = {2015-04-20}, - Version = {3.0} -} - -@Book{中华人民共和国国家质量监督检验检疫总局2015, - Title = {中华人民共和国国家标准 GB/T 7714-2015 信息与文献 参考文献著录规则}, - Author = {中华人民共和国国家质量监督检验检疫总局 and 中国国家标准化管理委员会}, - Date = {2015-05-15}, - Note = {standard} -} - -@Article{高翔2015-26-31, - Title = {复杂航电架构的开放式系统标准研究}, - Author = {高翔 and 李辰}, - Journal = {航空电子技术}, - Number = {2}, - Pages = {26-31}, - Volume = {46}, - Month = {6}, - Year = {2015} -} - -@Manual{Mittelbach2015--, - Title = {An environment for multicolumn output}, - Author = {Frank Mittelbach}, - Month = {12}, - Year = {2015} -} - -@Manual{Berry2016--, - Title = {TEX Live 指南—2016}, - Author = {Karl Berry}, - Date = {2016-06} -} - -@Manual{胡振震2016, - Title = {符合 GB7714-2015 标准的 biblatex 参考文献样式文件}, - Author = {胡振震}, - Date = {2016-07-01}, - Url = {https://ctan.org/pkg/biblatex-gb7714-2015}, - Urldate = {2018-04-23} -} - -@Online{Alliance--, - Title = {WiMedia Alliance}, - Url = {www.wimedia.org} -} - -@Book{booknodate, - Title = {出版集团研究}, - Author = {余敏}, - Pages = {179-193}, - Publisher = {中国书籍出版社}, - Location = {北京} -} - -@Book{booknopublishernoyear, - Title = {出版集团研究}, - Author = {余敏}, - Location = {北京} -} - -@Online{Commonwealth--, - Title = {Pennsylvania library laws}, - Author = {{Commonwealth libraries bureau of library development.Pennsylvania department of education office}}, - Url = {http://www.racc.edu}, - Urldate = {2013-03-24} -} - -@Report{Eggrers--, - Title = {One-dimensional flows of an imperfect diatomic gas}, - Author = {Eggrers, A. J.}, - Number = {959}, - Type = {NACA report} -} - -@Online{HOPKINSON--, - Title = {UNIMARC and metadata: Dublin Core}, - Author = {A HOPKINSON}, - Url = {http://www.rfla.org/IV/rfla64/13801613.htm}, - Urldate = {1999-12-08} -} - -@Online{JabRef中文手册--, - Title = {JabRef中文手册}, - Url = {http://blog.csdn.net/zd0303/article/details/7676807} -} - -@Online{JabRefManual--, - Title = {JabRef Manual}, - Url = {http://blog.csdn.net/zd0303/article/details/7676807} -} - -@Online{OCLC--a, - author = {{Online Computer Library Center, Inc.}}, - title = {History of OCLC}, - url = {http://www.oclc.org/about/history/default.htm}, - urldate = {2000-01-08}, -} - -@Book{Parsons2000nodate--, - Title = {The Mobile Radio Propagation Channel}, - Address = {Hoboken}, - Author = {Parsons, J. D.}, - Edition = {2}, - Publisher = {John Wiley and Sons} -} - -@Book{Parsons2000nopubnoyear--, - Title = {The Mobile Radio Propagation Channel}, - Address = {Hoboken}, - Author = {Parsons, J. D.}, - Edition = {2} -} - -@Book{standardinfoiso158, - Title = {Information and documentation-the Dublin core metadata element set:ISO 15836:2009}, - Note = {standard}, - Url = {http://www.iso.org}, - Urldate = {2013-03-24} -} - -@Book{鸟哥--, - Title = {鸟哥的linux私房菜}, - Author = {鸟哥}, - Edition = {3}, - Publisher = {人民邮电出版社} -} - -@Online{olqa2016--, - Title = {求助beamerposter制作海报时参考文献样式的问题}, - Date = {2016}, - Url = {http://bbs.ctex.org/forum.php?mod=viewthread&tid=153061&page=1&extra=#pid544787} -} - -@Online{北京交通大学研究生公众号2016--, - Title = {新学期定个小目标—学会在LaTeX中管理参考文献}, - Author = {北京交通大学研究生公众号}, - Date = {2016-09-17}, - Url = {http://www.latexstudio.net/archives/7488} -} - -@Online{olref2016--, - Title = {如何在LaTeX写作中管理参考文献?}, - Date = {2016-08-12}, - Url = {http://www.latexstudio.net/archives/7131} -} - -@Online{文献助手2016--, - Title = {参考文献格式搜索神器上线了}, - Author = {文献助手}, - Date = {2016-09-21}, - Url = {http://www.latexstudio.net/archives/7560} -} - -@Book{IFLAI1977b--, - Title = {Names of persons: national usages for entry in catalogues}, - Author = {{International Federation of Library Association and Institutions} and {FCC} and {FBI} and {CIA}}, - Edition = {3}, - Publisher = {IFLA International Office for UBC}, - Year = {1977}, - Location = {London} -} - -@Inproceedings{r27-BenHadjAlaya-FekiA.2008-1-5, - Title = {Interference cartography for hierarchical dynamic spectrum access}, - Address = {Chicago, IL}, - Author = {{Ben Hadj Alaya-Feki A.} and B. Sayrac and S. Ben Jemaa and E. Moulines}, - Booktitle = {Proc. IEEE Symp. on New Frontiers in Dynamic Spectrum Access Networks (DySPAN)}, - Date = {2008-10}, - Pages = {1-5} -} - -@Book{中国企业投资协会2014--, - Title = {投资台湾:大陆企业赴台投资指南}, - Address = {北京}, - Author = {{中国企业投资协会} and 台湾并购与私募股权协会 and 汇盈国际投资集团 and 国际投资集团}, - Publisher = {九州出版社}, - Year = {2014} -} - -@Book{中国企业投资协会2015--, - Title = {投资台湾:大陆企业赴台投资指南}, - Address = {北京}, - Author = {中国企业投资协会 and 台湾并购与私募股权协会 and 汇盈国际投资集团 and 国际投资集团}, - Publisher = {九州出版社}, - Year = {2015} -} - -@Manual{Tantau2015--, - Title = {The beamer class -- User Guide for version 3.36}, - Author = {Till Tantau and Joseph Wright and Vedran Miletić}, - Date = {2015-03-08}, - Url = {http://bitbucket.org/rivanvx/beamer} -} - -@Manual{Oetiker--, - Title = {一份不太简短的LATEX2ε介绍}, - Author = {Tobias Oetiker and Hubert Partl and Irene Hyna and Elisabeth Schlegl}, - Date = {2017-03}, - Translator = {ChinaTEX论坛}, - Url = {https://ctan.org/pkg/lshort-zh-cn}, - Urldate = {2018-04-23}, - Version = {5.10} -} - -@Manual{Daly2010--, - Title = {Natural Sciences Citations and References (package natbib)}, - Author = {Patrick W. Daly}, - Date = {2010-09-13}, - Url = {https://ctan.org/pkg/natbib}, - Urldate = {2018-04-27}, - Version = {8.31b} -} - -@Manual{Arseneau2010--, - Title = {chapterbib multiple bibliographies in LATEX}, - Author = {Donald Arseneau}, - Date = {2010-09-05}, - Url = {https://ctan.org/pkg/chapterbib}, - Urldate = {2018-04-23} -} - -@Manual{Shell2013--, - Title = {Mciteplus: Enhanced Multicitations}, - Author = {Michael Shell}, - Date = {2013-09-13}, - Url = {https://ctan.org/pkg/mciteplus}, - Urldate = {2018-04-23}, - Version = {1.2} -} - -@Online{Hansen2008--, - Title = {The multibib Package}, - Author = {Thorsten Hansen}, - Date = {2008-12-10}, - Url = {https://www.ctan.org/pkg/multibib}, - Urldate = {2018-05-04}, - Version = {v1.4} -} - -@Online{Seindal1994--, - Title = {Inline bibliography style}, - Author = {René Seindal}, - Date = {1994-12-06}, - Url = {https://www.ctan.org/pkg/inlinebib}, - Urldate = {2018-05-04} -} - -@Book{booknopubitems, - Title = {出版集团研究}, - Author = {余敏}, - Date = {2001}, - Pages = {50-63} -} - -@Comment{jabref-meta: databaseType:biblatex;} - -@Comment{jabref-entrytype: Newspaper: req[] opt[]} +% Encoding: UTF-8 + + +@Other{易仕和,2013, + Entryset = {易仕和2013--,Yi2013--} +} + +@book{李时珍--, +author={李时珍} +} + +@book{乔纳斯--, +author={乔纳斯} +} + +@Book{昂温1988--, + Author = {昂温, S.}, +} + +@Book{GPS1988--, + Title = {外国出版史}, + Author = {{昂温, G} and {昂温, P S}}, + Publisher = {中国书籍出版社}, + Translator = {陈生诤}, + Year = {1988}, + Location = {北京} +} + +@Book{丸山敏秋--, + Author = {丸山敏秋}, +} + +@Book{凯西尔--, + Author = {凯西尔}, +} + +@book{Einstein--, + author = {Einstein, Albert} +} + +@book{Williams-ellis--, + author = {Williams-ellis, Amabel} +} + +@book{morgan--, + author = {De Morgan, Augustus} +} + +@book{lijianning--a, + author = {{LI Jiangning}} +} + +@book{lijianning--b, + author = {Li, Jiang Ning} +} + +@book{钱学森--, + author = {钱学森 and 刘再复} +} + +@book{李四光--, + author = {李四光 and 华罗庚 and 茅以升} +} + +@book{印森林--, + author = {印森林 and 吴胜和 and 李俊飞 and 冯文杰} +} + +@book{fordham--, + author = {Evenst W. Fordham and Amiad Ali and David A. Truner and John R. Charters} +} + +@Article{anon1981-628, + title = {Coffee drinking and cancer of the pancreas}, + journal = {Br Med J}, + year = {1981}, + volume = {283}, + number = {6292}, + pages = {628} +} + +@book{中国科学院物理研究所--, + author = {{中国科学院物理研究所}} +} + +@book{贵州省土穰普查办公室--, + author = {{贵州省土穰普查办公室}} +} + +@book{AmericanChemicalSociety--, + author = {{American Chemical Society}} +} + + +@book{StanfordUniversity--, + author = {{Stanford University. Department of Civil Eng ineering}} +} + + +@book{王夫之的诠释--, + title = {王夫之“乾坤并建”的诠释面向} +} + +@book{张子正蒙注--, + title = {张子正蒙注} +} + +@book{化学动力学和反应器原理--, + title = {化学动力学和反应器原理} +} + +@book{袖珍神学--, + title = {袖珍神学,或,简明基督教词典} +} + +@article{北京师范大学学报--, + Journaltitle = {北京师范大学学报(自然科学版)} +} + +@book{Gasesinsea--, + title = {Gases in sea ice 1975-1979} +} + +@article{jmath--, + Journaltitle = {J Math \& Phys} +} + +@book{为人民服务--, + title = {为人民服务;纪念白求恩;愚公移山} +} + +@book{编者1964--, + title = {为人民服务;纪念白求恩;愚公移山}, + address= {北京}, + publisher={人民出版社}, + date ={1964}, + pages= {1-3;7-11;31-35} +} + +@book{大趋势--, + title = {大趋势} +} + +@book{地壳运动--, + title = {地壳运动假说:从大陆漂移到板块构造} +} + +@book{三松堂--, + title = {三松堂全集:第4卷} +} + +@book{世界出版业--, + title = {世界出版业:美国卷} +} + +@book{ECL集成电路--, + title = {ECL集成电路:原理与设计} +} + +@book{中国科学技术史--, + title = {中国科学技术史:第2卷~~~~科学思想史} +} + +@article{商鞅战秋菊--, + title = {商鞅战秋菊:法治转型的一个思想实验} +} + +@article{中国科学--, + title = {中国科学:D辑~~~~地球科学} +} + +@Standard{信息与文献--, + title = {信息与文献---都柏林核心元数据元素集:GB/T 25100—2010} +} + +@Standard{全国信息与文献标准化技术委员会2010-2-3, + author = {全国信息与文献标准化技术委员会}, + title = {信息与文献\ \ \ \ 都柏林核心元数据元素集: GB/T 25100—2010}, + year = {2010}, + address = {北京}, + pages = {2--3}, + publisher = {中国标准出版社}, +} + +@report{中子反射--, + title = {中子反射数据分析技术:CNIC-01887} +} + +@article{AsianPacificjournal--, + Journaltitle = {Asian Pacific journal of eancer prevention: e-only} +} + + +@book{egbookeda--, + title = {中文书}, + edition={3} +} + +@book{egbookedb--, + title = {中文书}, + edition={新1版} +} + +@book{egbookedc--, + title = {中文书}, + edition={明刻本} +} + +@book{egbookedd--, + title = {english book}, + edition={5} +} + +@book{egbookede--, + title = {english book}, + edition={Rev. ed.} +} + +@book{egbookpuba--, + title = {中文书}, + date = {2013}, + address = {北京}, + publisher = {人民出版社}, +} + +@book{egbookpubb--, + title = {english book}, + date = {2012}, + address = {New York}, + publisher = {Academic Press}, +} + +@book{egbookpubaddressa--, + title = {english book}, + address = {Cambridge, Eng.}, + publisher = {Academic Press}, +} + +@book{egbookpubaddressb--, + title = {english book}, + address = {Cambridge, Mass.}, + publisher = {Academic Press}, +} + +@book{egbookpubaddressc--, + title = {中文书}, + date = {2013}, + address = {北京 and 上海}, + publisher = {科学出版社}, +} + +@book{egbookpubaddressd--, + title = {english book}, + date = {2000}, + address = {London and Boston and Durban and Syngapore and Sydney and Toronto and Wellington}, + publisher = {Butterworths}, +} + +@book{egbookpubaddresse--, + title = {中文书}, + date = {1990}, + publisher = {三户图书刊行社}, +} + +@book{egbookpubaddressf--, + title = {english book}, + date = {1975}, + publisher = {MacMillan}, +} + +@online{egbookpubaddressg--, + date = {2011}, + pages ={105}, + url={http://lib.myilibrary.com/Open.aspx?id=312377}, + urldate={2014-06-16}, + publisher = {Open University Press}, +} + + + +@book{egbookpubpublishera--, + title = {中文书}, + address = {北京}, + publisher = {中国标准出版社}, +} + +@book{egbookpubpublisherb--, + title = {english book}, + address = {Cambridge}, + publisher = {Elsevier Science Publishers}, +} + +@book{egbookpubpublisherc--, + title = {english book}, + address = {Cambridge}, + publisher = {IRRI}, +} + +@book{egbookpubpublisherd--, + title = {english book}, + address = {Chicago}, + publisher = {ALA and CLA}, + date ={1978} +} + +@book{egbookpubpublishere--, + title = {中文书}, + address = {哈尔滨}, + date ={2013} +} + +@book{egbookpubpublisherf--, + title = {english book}, + address = {Salt Lake City}, + date ={1964} +} + + +@book{egbookpubdatea--, + title = {中文书}, + year ={1947(民国三十六年)} +} + +@book{egbookpubdateb--, + title = {中文书}, + year ={1705(康熙四十四年)} +} + +@newspaper{egbookpubdatec--, + title = {中文书}, + date ={2013-01-08} +} + +@book{egbookpubdated--, + title = {中文书}, + year ={c1988} +} + +@book{egbookpubdatee--, + title = {中文书}, + year ={1985印刷} +} + +@book{egbookpubdatef--, + title = {中文书}, + year ={[1936]} +} + + +@online{egbookpubdateg--, + title = {english book}, + date = {2012-05-03}, + urldate={2013-11-12}, +} + +@Book{曹凌2011-19-, + author = {曹凌}, + title = {中国佛教疑伪经综录}, + year = {2011}, + publisher = {上海古籍出版社}, + address = {上海}, + pages ={19} +} + +@Book{钱学森2001--, + author = {钱学森}, + title = {创建系统学}, + year = {2001}, + publisher = {山西科学技术出版社}, + address = {太原}, + pages ={序2-3} +} + +@Book{冯友兰2008--, + author = {冯友兰}, + title = {冯友兰自选集}, + year = {2008}, + publisher = {北京大学出版社}, + address = {北京}, + edition ={2}, + pages ={第1版自序} +} + +@inbook{李约瑟1991--, + author = {李约瑟}, + title = {题词}, + bookauthor = {苏克福 and 管成学 and 邓明鲁}, + booktitle = {苏颂与《本草图经》研究}, + year = {1991}, + publisher = {长春出版社}, + address = {长春}, + pages = {扉页} +} + +@ARTICLE{DUBAR2013--, + author = {DUBAR, K L. AND MITCHELL, D A.}, + title = {Revealing nature's synthetic potential through the study of ribosomal natural product biosynthesis}, + Journaltitle = {ACS chemical biology}, + DATE = {2013}, + VOLUME = {8}, + pages = {473-487}, + url = {http://pubs.acs.org/doi/pdfplus/10.1021/cb3005325}, + urldate = {2013-10-16} +} + +@Book{周鲁卫2011--, + author = {周鲁卫}, + title = {软物质物理导论}, + year = {2011}, + publisher = {复旦大学出版社}, + address = {上海}, + pages = {1} +} + +@ARTICLE{常森2013--, + author = {常森}, + title = {《五行》学说与《荀子》}, + Journaltitle = {北京大学学报(哲学社会科学版)}, + DATE = {2013}, + VOLUME = {50}, + number = {1}, + pages = {75}, +} + +@Book{RUDDOCK2009--, + author = {RUDDOCK, L.}, + title = {Economics for the modern built environment}, + year = {2009}, + publisher = {Taylor & Francis}, + address = {London}, + pages = {12}, + url = {http://lib.mylib.com}, + urldate = {2010-06-15}, +} + +@book{kereanrefa, + AUTHOR = {김세훈 and others}, + TITLE = { 도서판및특서진흥업 개정안 연구}, + DATE = {2003}, + address={서울}, + PAGES = {15}, + publisher = {한국운화관팡정책연구원}, +} +%%김세훈, 외. 도서판및특서진흥업 개정안 연구〔M〕, 서울; 한국운화관팡정책연구원,2003: 15. + + +@book{kereanrefb, + AUTHOR = {이냉목 }, + TITLE = { 도서관꺾규총람: 세 1 권}, + DATE = {2005}, + address={서울}, + PAGES = {67-68}, + publisher = {구미무역 출판부}, +} +%%이냉목 도서관꺾규총람: 세 1 권[M〕. 서울: 구미무역 출판부,2005: 67-68. +%% + +@Book{李炳穆2005--, + author = {李炳穆}, + title = {图书馆法柜总览:第1卷}, + year = {2005}, + publisher = {九美贸易出版部}, + address = {首尔}, + pages = {67-68} +} + + +@article{kereanrefc, + DATE = {2007}, + volume={48}, + number={7}, + PAGES = {11-12}, + journaltitle={ 圖書館文化}, + TITLE = {도서관 정보정책위원회 설립식 및 도서관 정보정책기획단신성}, +} +%%도서관 정보정책위원회 설립식 및 도서관 정보정책기획단신성. 圖書館文化,2007 ,48(7): 11-12. + +@ARTICLE{图书馆信息政策委员会2007--, + title = {图书馆信息政策委员会成立仪式与图书馆信息政策规划团}, + Journaltitle = {图书馆文化}, + DATE = {2007}, + VOLUME = {48}, + number = {7}, + pages = {11-12}, +} + +@book{japaneserefc, + AUTHOR = {図書館用語辞典編集委員会}, + TITLE = { 最新図書館用語大辞典}, + DATE = {2004}, + address={東京}, + PAGES = {154}, + publisher = {柏書房株式会社}, +} +%% +%%図書館用語辞典編集委員会.最新図書館用語大辞典[M].東京:柏書房株式会社,2004:154. +%% + +@article{russianrefc, + author={Кочекоs, А Я}, + TITLE = {Молибден-медно-эолотопорфиооое месторождение Рябиноосе}, + DATE = {1993}, + number={7}, + PAGES = {50-58}, + journaltitle={Отечестsенная гелогия} +} +%%Кочекоs А Я. Молибден-медно-эолотопорфиооое месторождение Рябиноосе[J/ОL]. ,1993(7):50-58 + +@ARTICLE{熊平2005--, + author = {熊平 and 吴颉}, + title = {从交易费用的角度谈如何构建药品流通的良性机制}, + Journaltitle = {中国物价}, + DATE = {2005}, + number = {8}, + pages = {42-45}, +} + +@ARTICLE{xiong2005--, + author = {Xiong, Ping and Wu, Xie}, + title = {Discussion on how to construct benign medicine circulantion mechanism fromtranaction cosperspective}, + Journaltitle = {China price}, + DATE = {2005}, + number = {8}, + pages = {42-45}, +} + +@ARTICLE{上海市食品药品监督管理局课题组2008--, + author = {上海市食品药品监督管理局课题组}, + title = {互联网药品经营现状和监管机制的研究}, + Journaltitle = {上海食品药品监管情报研究}, + DATE = {2008}, + number = {1}, + pages = {8-11}, +} + +@ARTICLE{Rgsfda2008--, + author = {{Research Group of Shanghai Food and Drug Administration}}, + title = {A study on online pharmaceutical operating situation and supervision mechanism}, + Journaltitle = {Shanghai food and drug information research}, + DATE = {2008}, + number = {1}, + pages = {8-11}, +} + + +@PhdThesis{刘乃安2000-17-18, + author = {刘乃安}, + title = {生物质材料热解失重动力学及其分析方法研究}, + year = {2000}, + pages = {17--18}, + doi = {10.7666/d.y351065}, + url = {http://wenku.baidu.com/link?url=GJDJxb4lxBUXnIPmq1XoEGSIr1H8TMLbidW_LjlYu33tpt707u62rKliypU_FBGUmox7ovPNaVIVBALAMd5yfwuKUUOAGYuB7cuZ-BYEhXa}, + urldate = {2014-08-29}, + address = {安徽}, + school = {中国科学技术大学}, +} + +@book{Deverell2013-21-22, + author = {Deverell, William and Igler, David}, + title = {A Companion to {California} History}, + year = {2013}, + date = {2013-11-15}, + pages = {21--22}, + doi = {10.1002/9781444305036.ch2}, + url = {http://onlinelibrary.wiley.com/doi/10.1002/9781444305036.ch2/summary}, + urldate = {2014-06-24}, + address = {New York}, + school = {John Wiley \& Sons}, +} + +@inbook{姚中秋2009--, + author = {姚中秋}, + title = {作为一种制度变迁模式的“转型”}, + bookauthor = {罗卫东 and 姚中秋}, + booktitle = {中国转型的理论分析:奥地利学派的视角}, + year = {2009}, + publisher = {浙江大学出版社}, + address = {杭州}, + pages = {44} +} + +@inbook{姚中秋2008--, + author = {姚中秋}, + title = {一种制度变迁模式}, + bookauthor = {罗, 卫东 and 姚, 中秋}, + booktitle = {中国转型的理论分析}, + year = {2008}, + publisher = {浙江大学出版社}, + address = {杭州}, + pages = {44} +} + + +@ARTICLE{关立哲2014--, + author = {关立哲 and 韩纪富 and 张晨延}, + title = {科技期刊编辑审读中要注重比较思维的科学运用}, + Journaltitle = {编辑学报}, + DATE = {2014}, + VOLUME = {26}, + number = {2}, + pages = {144-146} +} + +@ARTICLE{TENOPIR1987--, + author = {TENOPIR, C.}, + title = {Online databases, quality control}, + Journaltitle = {Library journal}, + DATE = {1987}, + VOLUME = {113}, + number = {2}, + pages = {124-125} +} + +@ARTICLE{egdatevolnumpagea--, + title = {article of journal}, + DATE = {2001}, + VOLUME = {1}, + number = {1}, + pages = {5-6} +} + +@ARTICLE{egdatevolnumpageb--, + title = {article of journal}, + DATE = {2014}, + VOLUME = {510}, + pages = {356-363} +} + +@ARTICLE{egdatevolnumpagec--, + title = {article of journal}, + DATE = {2010}, + number = {6}, + pages = {23} +} + +@ARTICLE{egdatevolnumpaged--, + title = {article of journal}, + DATE = {2012}, + VOLUME = {22}, + number = {增刊2}, + pages = {81-86} +} + +@ARTICLE{egdatevolnumpagee--, + title = {article of journal}, + DATE = {2001}, + number = {9/10}, + pages = {36-39} +} + +@ARTICLE{egdatevolnumpagef--, + title = {article of journal}, + year = {2011, 33(2):20-25;2011, 33(3):26-30}, +} + +@newspaper{egdatevolnumpageg--, + title = {article of journal}, + date = {2013-03-16}, + number = {1} +} + + +@Book{尼葛洛庞帝1996--, + author = {尼葛洛庞帝}, + title = {数字化生存}, + year = {1996}, + translator = {胡泳 and 范海燕}, + publisher = {海南出版社}, + address = {海口}, +} + +@Book{汪冰1997-16-16, + author = {汪冰}, + title = {电子图书馆理论与实践研究}, + year = {1997}, + publisher = {北京图书馆出版社}, + pages = {16}, + address = {北京}, +} + +@Article{杨宗英1996-24-29, + author = {杨宗英}, + title = {电子图书馆的现实模型}, + journal = {中国图书馆学报}, + year = {1996}, + number = {2}, + pages = {24--29}, +} + +@Book{Baker1995--, + author = {Baker, S K and Jackson, M E}, + title = {The future of resource sharing}, + year = {1995}, + publisher = {The Haworth Press}, + address = {New York}, +} + +@Book{Chernik1982--, + author = {Chernik, B E}, + title = {Introduction to library services for library technicians}, + year = {1982}, + publisher = {Libraries Unlimited, Inc.}, + address = {Littleton, Colo.}, +} + + +@Article{Dowler1995-5-26, + author = {Dowler, L}, + title = {The research university’s dilemma: resource sharing and research in a transinstitutional environment}, + journal = {Journal of library administration}, + year = {1995}, + volume = {21}, + number = {1/2}, + pages = {5--26}, +} + + +@Inproceedings{ref-replace-char, + Title = {Cognitive Radio and Cooperative Strategies for Power Saving in Multi-Standard Wireless Devices}, + Address = {Florence, Italy}, + Author = {Rodriguez, J. and P. Marques and A. Radwan and K. Moessner and R. Tafazolli and others}, + Booktitle = {Future % Network \& Mobile # Summit 2010}, + Date = {June 2010} +} + +@Online{olnoauthorcn, + Title = {如何在LaTeX写作中管理参考文献?}, + Date = {2016-08-12}, + Url = {http://www.latexstudio.net/archives/7131} +} + +@Online{Allianceurlonly, + Url = {www.wimedia.org} +} + +@Online{olnoauthoren, + Title = {Dublin Core metadata element set: version 1.1}, + Url = {http://dublincore.org}, + Urldate = {2014-06-11}, + Year = {2012-06-14} +} + +@Article{王临慧2010-147, + author = {王临慧 and others}, + title = {天津方言的源流关系刍议}, + journal = {山西师范大学学报(社会科学版)}, + year = {2010}, + volume = {37}, + number = {4}, + pages = {147}, +} + + +@InProceedings{王临慧2010-138, + author = {王临慧}, + title = {从几组声母的演变看天津方言形成的自然条件和历史条件}, + bookauthor= {曹志耘}, + booktitle = {汉语方言的地理语言学研究:首届中国地理语言学国际学术研讨会论文集}, + year = {2010}, + publisher = {北京语言大学出版社}, + pages = {138}, + address = {北京}, +} + +@Book{王夫之1845--, + Title = {宋论}, + Author = {王夫之}, + Edition = {刻本}, + Publisher = {曾氏}, + Year = {1845(清同治四年)}, + Location = {金陵} +} + +@Book{汪昂1881--, + Title = {增订本草备要:四卷}, + Address = {京都}, + Author = {汪昂}, + Edition = {刻本}, + Publisher = {老二酉堂}, + Year = {1881(清光绪七年)}, + Location = {京都} +} + +@Periodical{AAAS1883--, + Title = {Science}, + Date = {1883}, + Editor = {{American Association for the Advancement of Science}}, + Number = {1}, + Volume = {1}, + Location = {Washington, D.C.}, + Publisher = {American Association for the Advancement of Science} +} + +@Book{汪昂1912--, + Title = {(增补)本草备要}, + Author = {汪昂}, + Edition = {石印本}, + Publisher = {同文书局}, + Year = {1912}, + Location = {上海} +} + +@Periodical{中国地质学会1936--, + Title = {地质评论}, + Date = {1936}, + Editor = {中国地质学会}, + Number = {1}, + Volume = {1}, + Location = {北京}, + Publisher = {地质出版社} +} + + +@Book{1962-50-50, + Title = {康熙字典:已集上:水部}, + Address = {北京}, + Edition = {同文书局影印本}, + Pages = {50}, + Publisher = {中华书局}, + Year = {1962} +} + +@Proceedings{ROSENTHALL1963--, + Title = {Proceedings of the Fifth Canadian Mathematical Congress, University of Montreal, 1961}, + Date = {1963}, + Publisher = {University of Toronto Press}, + Editor = {E M ROSENTHALL}, + Location = {Toronto} +} + +@Thesis{CALMS1965--, + Title = {Infrared spectroscopic studies on solid oxygen}, + Author = {R B CALMS}, + Date = {1965}, + Institution = {Univ. of California}, + Location = {Berkeley} +} + +@Report{WHO1970--, + Title = {Factors regulating the immune response}, + Author = {{World Health Organization}}, + Date = {1970}, + Institution = {WHO}, + Location = {Geneva}, + Titleaddon = {report of WHO Scientific Group} +} + +@Inproceedings{FOURNEY1971-17-38, + Title = {Advances in holographic photoelasticity}, + Author = {M E FOURNEY}, + Booktitle = {Symposium on Applications of Holography in Mechanics, August 23-25, 1971, University of Southern California, Los Angeles, California}, + year = {c1971}, + Pages = {17-38}, + Publisher = {ASME}, + Location = {New York} +} + +@Inproceedings{FOURNEY1971-17-38a, + Title = {Advances in holographic photoelasticity}, + Author = {M E FOURNEY}, + Bookauthor = {{American Society of Mechanical Engineers.Applied Mechanics Division}}, + Booktitle = {Symposium on Applications of Holography in Mechanics, August 23-25, 1971. University of Southern California, Los Angeles, California}, + Date = {1971}, + Pages = {17-38}, + Publisher = {ASME}, + Location = {New York} +} + +@TechReport{Humphrey1971--, + Title = {The sonic throat method and real gas one-dimensional flow: an application to air and nitrogen}, + Author = {Humphrey, Richard L. and Wagner, Jerry L.}, + Year = {1971}, + Number = {730029}, + Type = {AD} +} + +@Book{CRANE1972--, + Title = {Invisible college}, + Author = {D. Crane}, + Date = {1972}, + Publisher = {Univ. of Chicago Press}, + Location = {Chicago} +} + + + +@Article{KENNEDY1975-311-386, + Title = {Morphology and genesis of nodular chalks and hardgrounds in the Upper + Cretacesous of southern England}, + Author = {W. J. KENNEDY and R. E. GARRISON}, + Date = {1975}, + Journaltitle = {Sedimentology}, + Pages = {311-386}, + Volume = {22} +} + +@Article{KENNEDY1975-339-360, + Title = {Morphology and genesis of nodular phosphates in the cenomanian of South-east England}, + Author = {W. J. KENNEDY and R. E. GARRISON}, + Date = {1975}, + Journaltitle = {Lethaia}, + Pages = {339-360}, + Volume = {8} +} + +@Inbook{1977-49-49, + Title = {宋史卷三:本纪第三}, + Address = {北京}, + Booktitle = {宋史:第1册}, + Pages = {49}, + Publisher = {中华书局}, + Year = {1977} +} + +@Book{IFLAI1977--, + Title = {Names of persons: national usages for entry in catalogues}, + Author = {{International Federation of Library Association and Institutions}}, + Edition = {3}, + Publisher = {IFLA International Office for UBC}, + Year = {1977}, + Location = {London} +} + + +@InProceedings{张忠智1997-33-34, + author = {张忠智}, + title = {科技书刊的总编(主编)的角色要求}, + booktitle = {中国科学技术期刊编辑学会建会十周年学术研讨会论文汇编}, + year = {1997}, + editor = {中国科学技术期刊编辑学会}, + publisher = {中国科学技术期刊编辑学会学术委员会}, + pages = {33--34}, + address = {北京}, +} + +@Book{中国社会科学院语言研究所词典编辑室1996--, + author = {中国社会科学院语言研究所词典编辑室}, + title = {现代汉语词典}, + year = {1996}, + edition = {修订本}, + publisher = {商务印书馆}, + address = {北京}, +} + + +@Article{刘彻东1998-38-39, + Title = {中国的青年刊物}, + Author = {刘彻东}, + Date = {1998}, + Journaltitle = {中国出版}, + Number = {5}, + Pages = {38-39}, + Titleaddon = {个性特色为本} +} + +@InProceedings{裴丽生1981-2-10, + author = {裴丽生}, + title = {在中国科协学术期刊编辑工作经验交流会上的讲话}, + booktitle = {中国科协学术期刊编辑工作经验交流会资料选}, + year = {1981}, + editor = {中国科学技术协会}, + publisher = {中国科学技术协会学会工作部}, + pages = {2--10}, + address = {北京}, +} + + +@Article{亚洲地质图编目组1978-194-208, + Title = {亚洲地层与地质历史概述}, + Author = {亚洲地质图编目组}, + Date = {1978}, + Journaltitle = {地质学报}, + Pages = {194-208}, + Volume = {3} +} + +@Inbook{BUSECK1980-117-211, + Title = {Subsolidus phenomena in pyroxenes}, + Author = {P R BUSECK and NORD, Jr., G L and D R VEBLEN}, + Bookauthor = {CT PREWITT}, + Booktitle = {Pyroxense}, + year = {c1980}, + Pages = {117-211}, + Publisher = {Mineralogical Society of America}, + Location = {Washington, D.C.} +} + +@Inbook{陈晋镳1980-56-114, + Title = {蓟县震旦亚界研究}, + Author = {陈晋镳 and 张惠民 and 朱士兴 and others}, + Bookauthor = {中国地质科学院天津地质矿产研究所}, + Booktitle = {中国震旦亚界}, + Pages = {56-114}, + Publisher = {天津科学出版社}, + Location = {天津}, + Year = {1980} +} + +@Article{Sunstein1996-903-903, + author = {Sunstein, Cass R.}, + title = {Social Norms and Social Roles}, + journal = {Columbia law review}, + year = {1996}, + volume = {96}, + pages = {903}, + url = {http://www.heinonline.org/HOL/Page?handle=hein.journals/clr96&id=913&collection=journals&index=journals/clr}, + urldate = {2012-01-26}, +} + +@Book{罗杰斯2011-15-16, + author = {罗杰斯}, + title = {西方文明史: 问题与源头}, + year = {2011}, + translator = {潘惠霞 and 魏婧 and 杨艳 and others}, + publisher = {东北财经大学出版社}, + pages = {15--16}, + address = {大连}, +} + +@Book{陈登原2000-29-29, + author = {陈登原}, + title = {国史旧闻: 第1卷}, + year = {2000}, + publisher = {中华书局}, + pages = {29}, + address = {北京}, +} + +@Book{哈里森沃尔德伦2012-235-236, + author = {哈里森·沃尔德伦}, + title = {经济数学与金融数学}, + year = {2012}, + translator = {谢远涛}, + publisher = {中国人民大学出版社}, + pages = {235--236}, + address = {北京}, +} + +@Book{北京市政协民族和宗教委员会2012-112-112, + author = {北京市政协民族和宗教委员会 and 北京联合大学民族与宗教研究所}, + title = {历代王朝与民族宗教}, + year = {2012}, + publisher = {民族出版社}, + pages = {112}, + address = {北京}, +} + + +@Book{徐光宪2010--, + author = {徐光宪 and 王祥云}, + title = {物质结构}, + year = {2010}, + publisher = {科学出版社}, + address = {北京}, +} + +@Book{顾炎武1992--, + author = {顾炎武}, + title = {昌平山水记:京东考古录}, + year = {1992}, + publisher = {北京古籍出版社}, + address = {北京}, +} + +@Book{王夫之1865--, + author = {王夫之}, + title = {宋论}, + year = {1865(清同治四年)}, + edition = {刻本}, + publisher = {湘乡曾国荃}, + address = {金陵}, +} + +@Proceedings{牛志明2012--, + title = {综合湿地管理国际研讨会论文集}, + year = {2012}, + editor = {牛志明 and 斯温兰德 and 雷光春}, + publisher = {海洋出版社}, + address = {北京}, +} + +@Archive{中国第一历史档案馆2001--, + author = {中国第一历史档案馆 and 辽宁省档案馆}, + title = {中国明朝档案总汇}, + year = {2001}, + address = {桂林}, + publisher = {广西师范大学出版社}, +} + +@PhdThesis{杨保军2012--, + author = {杨保军}, + title = {新闻道德论}, + year = {2010}, + url = {http://apabi.lib.pku.edu.cn/usp/pku/pub.mvc?pid=book.detail&metaid=m.20101104-BPO-889-1023&cult=CN}, + urldate = {2012-11-01}, + address = {北京}, + publisher = {中国人民大学出版社}, +} + +@Book{赵学功2001--, + author = {赵学功}, + title = {当代美国外交}, + year = {2001}, + publisher = {社会科学文献出版社}, + url = {http://www.cadal.zju.edu.cn/book/trySinglePage/33023884/1}, + urldate = {2014-06-11}, + address = {北京}, +} + +@Book{同济大学土木工程防灾国家重点实验室2011-5-6, + author = {同济大学土木工程防灾国家重点实验室}, + title = {汶川地震灾害研究}, + year = {2011}, + publisher = {同济大学出版社}, + pages = {5--6}, + url = {http://apabi.lib.pku.edu.cn/usp/pku/pub.mvc?pid=book.detail&metaid=m.20120406-YPT-889-0010}, + urldate = {2013-05-09}, + address = {上海}, +} + +@Book{中国造纸学会2003--, + author = {中国造纸学会}, + title = {中国造纸年鉴: 2003}, + year = {2003}, + publisher = {中国轻工业出版社}, + url = {http://www.cadal.zju.edu.cn/book/view/25010080}, + urldate = {2014-04-25}, + address = {北京}, +} + + +@Proceedings{Yufin2000--, + title = {Geoecology and computers: proceedings of the {Third International Conference on Advances of Computer Methods in Geotechnical and Geoenvironmental Engineering, Moscow, Russia, February 1--4, 2000}}, + year = {2000}, + editor = {Yufin, Sergey A}, + publisher = {A. A. Balkema}, + address = {Rotterdam}, +} + +@Book{Baldock2011-105-105, + author = {Baldock, Peter}, + title = {Developing early childhood services: past, present and future}, + year = {2011}, + publisher = {Open University Press}, + pages = {105}, + url = {http://lib.myilibrary.com/Open.aspx?id=312377}, + urldate = {2012-11-27}, +} + +@Book{Fan2013-25-26, + author = {Fan, Xuetong and Sommers, Christopher H.}, + title = {Food irradiation research and technology}, + year = {2013}, + edition = {2}, + publisher = {Blackwell Publishing}, + pages = {25--26}, + url = {http://onlinelibrary.wiley.com/doi/10.1002/9781118422557.ch2/summary}, + urldate = {2014-06-26}, + address = {Ames, Iowa}, +} + + +@Inbook{王夫之2011-1109-1109, + title = {周易外传:卷 5}, + booktitle = {船山全书}, + year = {2011}, + editor = {王夫之}, + number = {6}, + publisher = {岳麓书社}, + pages = {1109}, + address = {长沙}, +} + +@Inbook{程根伟1999-32-36, + author = {程根伟}, + title = {1998 年长江洪水的成因与减灾对策}, + booktitle = {长江流域洪涝灾害与科技对策}, + year = {1999}, + editor = {许厚泽 and 赵其国}, + publisher = {科学出版社}, + pages = {32--36}, + address = {北京}, +} + +@Inbook{陈晋镳1980-56-114a, + author = {陈晋镳 and 张惠民 and 朱士兴 and 赵震 and 王振刚}, + title = {蓟县震旦亚界研究}, + booktitle = {中国震旦亚界}, + year = {1980}, + editor = {中国地质科学院天津地质矿产研究所}, + publisher = {天津科学技术出版社}, + pages = {56--114}, + address = {天津}, +} + +@Inbook{马克思2013-302-302, + author = {马克思}, + title = {政治经济学批判}, + booktitle = {马克思恩格斯全集}, + year = {2013}, + editor = {马克思 and 恩格斯}, + volume = {35}, + publisher = {人民出版社}, + pages = {302}, + address = {北京}, +} + + + + + +@InProceedings{贾东琴2011-45-52, + author = {贾东琴 and 柯平}, + title = {面向数字素养的高校图书馆数字服务体系研究}, + booktitle = {中国图书馆学会年会论文集: 2011年卷}, + year = {2011}, + editor = {中国图书馆学会}, + publisher = {国家图书馆出版社}, + pages = {45--52}, + address = {北京}, +} + +@Inbook{Weinstein1974-745-772, + author = {Weinstein, L and Swertz, M N}, + title = {Pathogenic properties of invading microorganism}, + booktitle = {Pathologic physiology: mechanisms of disease}, + year = {1974}, + editor = {Sodeman, Jr., William A and Sodeman, William A}, + publisher = {Saunders}, + pages = {745--772}, + address = {Philadelphia}, +} + +@InBOOK{Roberson2011-1-36, + author = {Roberson, J. Alan and Burneson, Eric G.}, + title = {Drinking water standards, regulations and goals}, + booktitle = {Water quality \& treatment: a handbook on drinking water}, + year = {2011}, + editor = {{American Water Works Association}}, + edition = {6}, + publisher = {McGraw-Hill}, + pages = {1.1--1.36}, + url = {http://lib.myilibrary.com/Open.aspx?id=291430}, + urldate = {2012-12-10}, + address = {New York}, +} + +@Periodical{中华医学会湖北分会1984----, + title = {临床内科杂志}, + year = {1984}, + volume = {1}, + number = {1}, + address = {武汉}, + author = {中华医学会湖北分会}, + publisher = {中华医学会湖北分会}, +} + +@Periodical{中国图书馆学会1957--1990--, + title = {图书馆学通讯}, + year = {1957/1990}, + number = {1-4}, + address = {北京}, + author = {中国图书馆学会}, + publisher = {北京图书馆}, +} + +@Periodical{中国图书馆学会1957--, + Title = {图书馆学通信}, + Address = {北京}, + Date = {1957/1990}, + Editor = {中国图书馆学会}, + Institution = {北京图书馆}, + Number = {1-4} +} + +@Periodical{中国图书馆学会1957a--, + Title = {图书馆学通信}, + Date = {1957/1990}, + Editor = {中国图书馆学会}, + Institution = {北京图书馆}, + Number = {1-4} +} + +@Periodical{中国图书馆学会1957b--, + Title = {图书馆学通信}, + Address = {北京}, + Date = {1957/1990}, + Editor = {中国图书馆学会}, + Number = {1-4} +} + +@Periodical{中国图书馆学会1957c--, + Title = {图书馆学通信}, + Date = {1957/1990}, + Editor = {中国图书馆学会}, + Number = {1-4} +} + +@Periodical{AAAS1883----, + title = {Science}, + year = {1883}, + volume = {1}, + number = {1}, + address = {Washington, D.C.}, + author = {{American Association for the Advancement of Science}}, + publisher = {American Association for the Advancement of Science}, +} + + +@Article{袁训来2012-3219-3219, + author = {袁训来 and 陈哲 and 肖书海 and others}, + title = {蓝田生物群: 一个认识多细胞生物起源和早期演化的新窗口}, + journal = {科学通报}, + year = {2012}, + volume = {55}, + number = {34}, + pages = {3219}, +} + +@Newspaper{余建斌2013--, + author = {余建斌}, + date = {2013-01-12}, + journal = {人民日报}, + number = {2}, + title = {我们的科技一直在追赶: 访中国工程院院长周济}, + url = {http://paper.people.com.cn/rmrb/html/2013-01/12/nw.D110000renmrb_20130112_5-02.htm}, + urldate = {2013-03-20}, + year = {2013}, +} + +@Article{李炳穆2008-6-12, + author = {李炳穆}, + title = {韩国图书馆法}, + journal = {图书情报工作}, + year = {2008}, + volume = {52}, + number = {6}, + pages = {6--12}, + url = {http://www.docin.com/p-400265742.html}, + urldate = {2013-10-25}, +} + +@Article{李幼平2010-225-228, + author = {李幼平 and 王莉}, + title = {循证医学研究方法: 附视频}, + journal = {中华移植杂志(电子版)}, + year = {2010}, + volume = {4}, + number = {3}, + pages = {225--228}, + url = {http://www.cqvip.com/Read/Read.aspx?id=36658332}, + urldate = {2014-06-09}, +} + +@Article{武丽丽2008-8-9, + author = {武丽丽 and 华一新 and 张亚军 and others}, + title = {“北斗一号”监控管理网设计与实现}, + journal = {测绘科学}, + year = {2008}, + volume = {33}, + number = {5}, + pages = {8--9}, + doi = {10.3771/j.issn.1009-2307.2008.05.002}, + url = {http://vip.calis.edu.cn/CSTJ/Sear.dll?OPAC_CreateDetail}, + urldate = {2009-10-25}, +} + +@Article{Kanamori1998-2063-2063, + author = {Kanamori, H}, + title = {Shaking without quaking}, + journal = {Science}, + year = {1998}, + volume = {279}, + number = {5359}, + pages = {2063}, +} + +@Article{Caplan1993-61-66, + author = {Caplan, P}, + title = {Cataloging internet resources}, + journal = {The public access computer systems review}, + year = {1993}, + volume = {4}, + number = {2}, + pages = {61--66}, +} + +@Article{Frese2013-378-398, + author = {Frese, Karen S. and Katus, Hugo A. and Meder, Benjamin}, + title = {Next-generation sequencing: from understanding biology to personalized medicine}, + journal = {Biology}, + year = {2013}, + volume = {2}, + number = {1}, + pages = {378--398}, + doi = {10.3390/biology2010378}, + url = {http://www.mdpi.com/2079-7737/2/1/378}, + urldate = {2013-03-19}, +} + +@Article{Myburg2014-356-362, + author = {Myburg, Alexander A. and Grattapaglia, Dario and Tuskan, Gerald A. and others}, + title = {The genome of Eucalyptus grandis}, + journal = {Nature}, + year = {2014}, + date = {2014-06-19}, + volume = {510}, + pages = {356--362}, + doi = {10.1038/nature13308}, + url = {http://www.nature.com/nature/journal/v510/n7505/pdf/nature13308.pdf}, + urldate = {2014-06-25}, +} + +@Patent{邓一刚2006--, + author = {邓一刚}, + title = {全智能节电器}, + number = {200610171314.3}, + year = {2006}, + date = {2006-12-13}, +} + +@Patent{西安电子科技大学2002--, + author = {西安电子科技大学}, + title = {光折变自适应光外差探测方法}, + number = {01128777.2}, + year = {2002}, + date = {2002-03-06}, + url = {http://211.152.9.47/sipoasp/zljs/hyjs-yx-new.asp?recid=01128777.2&leixin=0}, + urldate = {2002-05-28}, +} + +@Patent{Tachibana2005--, + author = {Tachibana, Ryuki and Shimizu, Shuhichi and Kobayshi, Seiji and Nakamura, Taiga}, + title = {Electronic watermarking method and system}, + number = {US6915001}, + year = {2005}, + date = {2005-07-05}, + url = {http://www.google.co.in/patents/US6915001}, + urldate = {2013-11-11}, +} + +@TechReport{中国互联网络信息中心2012--, + author = {中国互联网络信息中心}, + title = {第 29 次中国互联网络发展现状统计报告}, + year = {2012}, + date = {2012-01-16}, + url = {http://www.cnnic.net.cn/hlwfzyj/hlwxzbg/201201/P020120709345264469680}, + urldate = {2013-03-26}, +} + +@Archive{北京市人民政府办公厅2005--, + author = {北京市人民政府办公厅}, + title = {关于转发北京市企业投资项目核准暂行实施办法的通知: 京政办发[2005]37号}, + year = {2005}, + date = {2005-07-12}, + url = {http://china.findlaw.cn/fagui/p_1/39934.html}, + urldate = {2011-07-12}, +} + +@Online{Bawden2008--, + author = {Bawden, D}, + title = {Origins and Concepts of Digital Literacy}, + date = {2008-05-04}, + url = {http://www.soi.city.ac.uk/~dbawden/digital%20literacy%20chapter.pdf}, + urldate = {2013-03-08}, + year = {2008}, +} + +@Online{OCLC--, + author = {{Online Computer Library Center, Inc}}, + title = {About {OCLC}: History of Cooperation}, + url = {http://www.oclc.org/about/cooperation.en.html}, + urldate = {2012-03-27}, +} + +@Online{Hopkinson2009--, + author = {Hopkinson, A}, + title = {{UNIMARC} and Metadata: Dublin Core}, + date = {2009-04-22}, + url = {http://archive.ifla.org/IV/ifla64/138-161e.htm}, + urldate = {2013-03-27}, + year = {2009}, +} + +@PhdThesis{刘乃安2000-17-18a, + author = {刘乃安}, + title = {生物质材料热解失重动力学及其分析方法研究}, + year = {2000}, + pages = {17--18}, + doi = {10.7666/d.y351065}, + url = {http://wenku.baidu.com/link?url=GJDJxb4lxBUXnIPmq1XoEGSIr1H8TMLbidW_LjlYu33tpt707u62rKliypU_FBGUmox7ovPNaVIVBALAMd5yfwuKUUOAGYuB7cuZ-BYEhXa}, + urldate = {2014-08-29}, + address = {安徽}, + school = {中国科学技术大学}, +} + +@PhdThesis{Deverell2013-21-22a, + author = {Deverell, William and Igler, David}, + title = {A Companion to {California} History}, + year = {2013}, + date = {2013-11-15}, + pages = {21--22}, + doi = {10.1002/9781444305036.ch2}, + url = {http://onlinelibrary.wiley.com/doi/10.1002/9781444305036.ch2/summary}, + urldate = {2014-06-24}, + address = {New York}, + school = {John Wiley \& Sons}, +} + +@Book{Morri2010--, + author = {Morri, I}, + title = {Why the West Rules for Now: the Patterns of History, and What They Reveal about the Future}, + year = {2010}, + publisher = {{Farrar, Straus and Giroux}}, + address = {New York}, +} + + +@Article{STIEG1981-549-560, + Title = {The information needs of historians}, + Author = {M. F. STIEG}, + Date = {1981}, + Journaltitle = {College and Research Libraries}, + Number = {6}, + Pages = {549-560}, + Volume = {42} +} + + + +@Article{Milstein1982-436-446, + Title = {The effect of multiple-tone interfering signals on a direct sequence spread spectrum communication system}, + Author = {Milstein, L. B. and Davidovici,S. and Schilling,D. L.}, + Journal = {IEEE Trans. Commun.}, + Number = {3}, + Pages = {436-446}, + Volume = {30}, + Year = {1982} +} + +@Book{顾炎武1982--, + Title = {昌平山水记}, + Author = {顾炎武}, + Publisher = {北京古籍出版社}, + Year = {1982}, + Location = {北京}, + Titleaddon = {东京考古录} +} + +@Inbook{马克思1982-505-505, + Title = {关于《工资、价格和利润》的报告札记}, + Author = {马克思}, + Bookauthor = {马克思 and 恩格斯}, + Booktitle = {马克思恩格斯全集}, + Pages = {505}, + Publisher = {人民出版社}, + Booktitleaddon = {第44卷}, + Location = {北京}, + Year = {1982} +} + +@Article{HEWITT1984-205-218, + Title = {Technical services in 1983}, + Author = {J A HEWITT}, + Date = {1984}, + Journaltitle = {Library Resource Services}, + Number = {3}, + Pages = {205-218}, + Volume = {28} +} + +@Article{McEliece1984-44-53, + Title = {Channels with block interference}, + Author = {McEliece, R. J. and Stark, W. E.}, + Journal = {IEEE Trans. Inf. Theory}, + Number = {1}, + Pages = {44-53}, + Volume = {30}, + Year = {1984} +} + +@Article{陶仁骥1984-527-527, + Title = {密码学与数学}, + Author = {陶仁骥}, + Date = {1984}, + Journaltitle = {自然杂志}, + Number = {7}, + Pages = {527}, + Volume = {7} +} + +@Periodical{中华医学会湖北分会1984--, + Title = {临床内科杂志}, + Address = {武汉}, + Date = {1984}, + Editor = {中华医学会湖北分会}, + Institution = {中华医学会湖北分会}, + Number = {1}, + Volume = {1} +} + +@Incollection{韩吉人1985-90-99, + Title = {论职工教育的特点}, + Author = {韩吉人}, + Booktitle = {职工教育研究论文集}, + Date = {1985}, + Publisher = {人民教育出版社}, + Pages = {90-99}, + Bookauthor = {中国职工教育研究会}, + Location = {北京} +} + +@Collection{中国职工教育研究会1985--, + Title = {职工教育研究论文集}, + Author = {中国职工教育研究会}, + Location = {北京}, + Publisher = {人民教育出版社}, + Year = {1985} +} + +@Standard{全国文献工作标准化委员会第七分委员会1986--, + Title = {GB/T 5795--1986 中国标准书号}, + Author = {全国文献工作标准化委员会第七分委员会}, + Note = {standard}, + Year = {1986}, + Location = {北京}, + Publisher = {中国标准出版社} +} + +@Inbook{1988-590-590, + Title = {卷39 乞致任第一}, + Address = {北京}, + Booktitle = {苏魏公文集:下册}, + Pages = {590}, + Publisher = {中华书局}, + Year = {1988} +} + + + +@Standard{国家标准局信息分类编码研究所1988-59-92, + Title = {世界各国和地区名称代码 GB/T 2659-1986}, + Author = {国家标准局信息分类编码研究所}, + Date = {1988}, + Note = {standard}, + Bookauthor = {全国文献工作标准化技术委员会}, + Booktitle = {文献工作国家标准汇编}, + Booktitleaddon = {3}, + Location = {北京}, + Pages = {59-92}, + Publisher = {中国标准出版社} +} + +@Online{1989--, + Title = {PACS-L:the public-access computer systems forum}, + Date = {1989}, + Publisher = {Tex: University of Houston Libraries}, + Url = {http://info.lib.uh.edu/pacsl.html}, + Urldate = {1995-05-17}, + Location = {Houston} +} + +@Patent{姜锡洲1989--, + Title = {一种温热外敷药制备方案}, + Author = {姜锡洲}, + Date = {1989-07-26}, + Number = {88105607.3}, + Titleaddon = {中国} +} + +@Report{DTFHA1990--, + Title = {Guidelines for handling excavated acid-producing materials: PB 91-194001}, + Author = {{U.S. Department of Transportation Federal Highway Administration}}, + Institution = {U.S. Department of Commerce National Information Service}, + Location = {Springfield}, + Year = {1990} +} + +@Book{PIGGOT1990--, + Title = {The cataloguer's way through AACR2: from document receipt to document retrieval}, + Author = {T. M. PIGGOT}, + Publisher = {The Library Association}, + Year = {1990}, + Location = {London} +} + +@Article{DESMARAIS1992-605-609, + Title = {Carbon isotope evidence for the stepwise oxidation of the Proterozoic environment}, + Author = {DES MARAIS, D J and H STRAUSS and R E SUMMONS and others}, + Date = {1992}, + Journaltitle = {Nature}, + Pages = {605-609}, + Volume = {359} +} + +@Article{Holtzman1992-243-247, + Title = {On using perturbation analysis to do sensitivity analysis: derivatives versus differences}, + Author = {Holtzman, J. M.}, + Journal = {IEEE Trans. Autom. Control}, + Number = {2}, + Pages = {243-247}, + Volume = {37}, + Year = {1992} +} + +@Article{CAPLAN1993-61-66a, + Title = {Cataloging internet resources}, + Author = {P CAPLAN}, + Date = {1993}, + Journaltitle = {The public Access Computer Systems Review}, + Number = {2}, + Pages = {61-66}, + Volume = {4} +} + +@Book{广西壮族自治区林业厅1993--, + Title = {广西自然保护区}, + Author = {广西壮族自治区林业厅}, + Date = {1993}, + Publisher = {中国林业出版社}, + Location = {北京} +} + +@Patent{刘加林1993--, + Title = {多功能一次性压舌板}, + Author = {刘加林}, + Date = {1993-04-14}, + Number = {92214985.2}, + Location = {中国} +} + +@Book{OBRIEN1994--, + Title = {Introduction to information systems}, + Author = {J A O'BRIEN}, + Date = {1994}, + Edition = {7}, + Publisher = {Irwin}, + Location = {Burr Ridge, III} +} + +@Book{辛希孟1994--, + Title = {信息技术与信息服务国际研讨会论文集}, + Author = {辛希孟}, + Publisher = {中国社会科学出版社}, + Year = {1994}, + Location = {北京}, + Titleaddon = {A集} +} + +@Article{Andersen1995-42-49, + Title = {Propagation measurements and models for wireless communications channels}, + Author = {Andersen, J. B. and Rappaport, T. S. and Yoshida, S.}, + Journal = {IEEE Commun. Mag.}, + Number = {1}, + Pages = {42-49}, + Volume = {33}, + Year = {1995} +} + +@Book{CRAWFPRD1995--, + Title = {Future libraries: dreams, maddness, \& reality}, + Author = {W CRAWFPRD and M GORMAN}, + Date = {1995}, + Publisher = {American Library Association}, + Location = {Chicago} +} + +@Book{赵凯华1995--, + Title = {{新概念物理教程}}, + Address = {北京}, + Author = {赵凯华 and 罗蔚茵}, + Publisher = {高等教育出版社}, + Year = {1995} +} + +@Inbook{MARTIN1996-85-96, + Title = {Control of electronic resources in Australia}, + Author = {G MARTIN}, + Bookauthor = {L W PATTLE and B J COX}, + Booktitle = {Electronic resources}, + Date = {1996}, + Pages = {85-96}, + Publisher = {The Haworth Press}, + Booktitleaddon = {selection and bibliographic control}, + Location = {New York} +} + +@Book{国家环境保护局科技标准司1996-2-3, + Title = {土壤环境质量标准: GB 15616-1995}, + Address = {北京}, + Author = {国家环境保护局科技标准司}, + Note = {standard}, + Pages = {2-3}, + Publisher = {中国标准出版社}, + Url = {http://wenku.baidu.com}, + Urldate = {2013-10-14}, + Year = {1996} +} + + + +@Inbook{钟文发1996-468-471, + Title = {非线性规划在可燃毒物配置中的应用}, + Author = {钟文发}, + Bookauthor = {赵玮}, + Booktitle = {运筹学的理论和应用}, + Pages = {468-471}, + Publisher = {西安电子科技大学出版社}, + Booktitleon = {中国运筹学会第五届大会讨论文集}, + Location = {西安}, + Year = {1996} +} + +@Inproceedings{Nemec1997-209-214, + Title = {Force control of redundant robots}, + Author = {B Nemec}, + Booktitle = {Processings of Symposium on Robot Control}, + Pages = {209-214}, + Country = {Nantes France}, + Year = {1997} +} + + + +@Article{Andrisano1998-1383-1401, + Title = {Millimeter waves for short-range multimedia communication systems}, + Author = {Andrisano, O. and Tralli, V. and Verdone, R.}, + Journal = {Proc. IEEE}, + Number = {7}, + Pages = {1383-1401}, + Volume = {86}, + Year = {1998} +} + +@Article{Chiani1998-2998-3008, + Title = {Error probability for block codes over channels with block interference}, + Author = {Chiani, M.}, + Journal = {IEEE Trans. Inf. Theory}, + Number = {7}, + Pages = {2998-3008}, + Volume = {44}, + Year = {1998} +} + +@Article{CHRISTINE1998-331-332, + Title = {Plant physiology:plant biology in the Genome Era}, + Author = {M CHRISTINE}, + Date = {1998}, + Journaltitle = {Science}, + Pages = {331-332}, + Volume = {281}, + Url = {http://www.sciencemag.org/cgi/collection/anatmorp}, + Urldate = {1998-09-23} +} + +@Article{KANAMORI1998-2063-2064, + Title = {Shaking without quaking}, + Author = {H KANAMORI}, + Date = {1998}, + Journaltitle = {Science}, + Number = {5359}, + Pages = {2063-2064}, + Volume = {279} +} + +@Inbook{白书农1998-146-163, + Title = {植物开花研究}, + Author = {白书农}, + Bookauthor = {李承森}, + Booktitle = {植物科学进展}, + Pages = {146-163}, + Publisher = {高等教育出版社}, + Location = {北京}, + Year = {1998} +} + +@Book{蒋有绪1998--, + Title = {中国森林群落分类及其群落学特征 and \XeLaTeX{}}, + Address = {北京}, + Author = {蒋有绪 and 郭泉水 and 马娟 and others}, + Publisher = {科学出版社}, + Year = {1998} +} + + + +@Article{鲁明羽1998-290-295, + Title = {关于数据库系统数据词典的重要作用}, + Author = {鲁明羽 and 李纲民}, + Journal = {烟台大学学报自然科学与工程版}, + Number = {4}, + Pages = {290-295}, + Volume = {11}, + Year = {1998} +} + +@Mastersthesis{张志祥1998--, + Title = {间断动力系统的随机扰动及其在守恒律方程中的应用}, + Author = {张志祥}, + Date = {1998}, + Institution = {北京大学数学学院}, + Location = {北京} +} + +@Book{赵耀东1998--, + Title = {新时代的工业工程师}, + Author = {赵耀东}, + Publisher = {天下文化出版社}, + Url = {http://www.ie.nthu.edu.tw/info/ie.newie.htm(Big5)}, + Urldate = {1998-09-26}, + Year = {1998}, + Location = {台北} +} + +@Article{高光明1998-60-65, + Title = {信号情报接收机的发展现状及趋势}, + Author = {高光明}, + Journal = {电讯技术}, + Number = {2}, + Pages = {60-65}, + Volume = {38}, + Month = {4}, + Year = {1998} +} + +@Article{Dardari1999-1709-1721, + Title = {High-speed indoor wireless communications at 60 GHz with coded OFDM}, + Author = {Dardari, D. and Tralli,V.}, + Journal = {IEEE Trans. Commun.}, + Number = {11}, + Pages = {1709-1721}, + Volume = {47}, + Year = {1999} +} + +@InBook{程根伟1999-32-36a, + author = {程根伟}, + title = {1998年长江洪水的成因与减灾对策}, + booktitle = {长江流域洪涝灾害与科技对策}, + year = {1999}, + bookauthor = {许厚泽 and 赵其国}, + publisher = {科学出版社}, + location = {北京}, + pages = {32-36}, +} + +@Article{江向东1999-4-4, + Title = {互联网环境下的信息处理与图书管理系统解决方案}, + Author = {江向东}, + Date = {1999}, + Journaltitle = {情报学报}, + Number = {2}, + Pages = {4}, + Volume = {18}, + Url = {http://www.chinainfo.gov.cn/periodical/qbxb/qbxb99/qbxb990203}, + Urldate = {2000-01-18} +} + +@Article{李晓东1999-101-106, + Title = {气候学研究的若干理论问题}, + Author = {李晓东 and 张庆红 and 叶瑾琳}, + Date = {1999}, + Journaltitle = {北京大学学报}, + Number = {1}, + Pages = {101-106}, + Volume = {35}, + Journaltitleaddon = {自然科学版} +} + +@Article{梁振兴1999-24-32, + Title = {美军一体化{C\textsuperscript{4}ISR}系统的发展研究}, + Author = {梁振兴}, + Journal = {电子展望与决策}, + Pages = {24-32}, + Year = {1999} +} + +@Article{刘武1999-2481-2488, + Title = {元谋人牙齿测量数据的统计分析及其在分类研究上的意义}, + Author = {刘武 and 郑良 and 姜础}, + Date = {1999}, + Journaltitle = {科学通报}, + Number = {23}, + Pages = {2481-2488}, + Volume = {44} +} + +@Article{莫少强1999-1-6, + Title = {数字式中文全球文献格式的设计与研究}, + Author = {莫少强}, + Date = {1999}, + Journaltitle = {情报学报}, + Number = {4}, + Pages = {1-6}, + Volume = {18}, + Url = {http://periodical.wanfangdata.com.cn/periodical/qbxb/qbxb99/qbxb9904/990407.htm}, + Urldate = {2001-07-08} +} + +@Book{唐绪军1999-117-121, + Title = {报业经济与报业经营}, + Author = {唐绪军}, + Date = {1999}, + Pages = {117-121}, + Publisher = {新华出版社}, + Location = {北京} +} + +@Proceedings{中国力学学会1999--, + Title = {第3届全国实验流体力学学术会议论文集}, + Address = {天津}, + Year = {1999}, + Editor = {中国力学学会} +} + +@Article{杨友烈1999-60-65, + Title = {DII COE的基本概念和技术特征}, + Author = {杨友烈}, + Journal = {军事通信技术}, + Pages = {60-65}, + Volume = {72}, + Month = {12}, + Year = {1999} +} + +@Proceedings{GANZHA2000--, + Title = {Computer algebra in scientific computing:CASC 2000:proceedings of the Third +Workshop on Computer Algebra in Scientific Computing, Samarkand, October 5-9, 2000}, + Date = {2000}, + Publisher = {Springer}, + Editor = {V G GANZHA and E W MAYR and E V VOROZHTSOV}, + Location = {Berlin} +} + +@Book{Gradshteyn2000--, + Title = {Tables of Integrals, Series, and Products}, + Address = {San Diego}, + Author = {Gradshteyn, I. S. and Ryzhik,I. M.}, + Edition = {Sixth Edition}, + Publisher = {CA: Academic Press, Inc.}, + Year = {2000} +} + +@Book{Parsons2000--, + Title = {The Mobile Radio Propagation Channel}, + Address = {Hoboken}, + Author = {Parsons, J. D.}, + Edition = {2}, + Publisher = {John Wiley and Sons}, + Year = {2000} +} + +@Book{Parsons2000a--, + Title = {The Mobile Radio Propagation Channel}, + Address = {Hoboken}, + Author = {PARSONS}, + Edition = {2}, + Publisher = {John Wiley and Sons}, + Year = {2000} +} + +@Book{Parsons2000b--, + Title = {The Mobile Radio Propagation Channel}, + Address = {Hoboken}, + Author = {Parsons}, + Edition = {2}, + Publisher = {John Wiley and Sons}, + Year = {2000} +} + +@Book{Parsons2000noauthor--, + Title = {The Mobile Radio Propagation Channel}, + Address = {Hoboken}, + Edition = {2}, + Publisher = {John Wiley and Sons}, + Year = {2000} +} + +@Book{Parsons2000noloc--, + Title = {The Mobile Radio Propagation Channel}, + Author = {Parsons, J. D.}, + Edition = {2}, + Publisher = {John Wiley and Sons}, + Year = {2000} +} + +@Book{Parsons2000nopub--, + Title = {The Mobile Radio Propagation Channel}, + Address = {Hoboken}, + Author = {Parsons, J. D.}, + Edition = {2}, + Year = {2000} +} + +@Book{Parsons2000nopubpages--, + Title = {The Mobile Radio Propagation Channel}, + Address = {Hoboken}, + Author = {Parsons, J. D.}, + Edition = {2}, + Pages = {15-20}, + Year = {2000} +} + +@Book{YUFIN2000--a, + Title = {Geoecology and computers}, + Author = {S. A. YUFIN}, + Publisher = {A. A. Balkema}, + Year = {2000}, + Location = {Rotterdam}, + Titleaddon = {proceedings of the Third International Conference on Advances of + Computer Methods in Geotechnical and Geoenvironmental + Engineering, Moscow, Russia, February 1-4, 2000} +} + +@Article{李炳穆2000-5-8, + Title = {理想的图书管理员和信息专家的素养与形象}, + Author = {李炳穆}, + Date = {2000}, + Journaltitle = {图书情报工作}, + Number = {2}, + Pages = {5-8} +} + +@Book{孙玉文2000--, + Title = {汉语变调构词研究}, + Author = {孙玉文}, + Publisher = {北京大学出版社}, + Year = {2000}, + Location = {北京} +} + +@Article{傅刚2000--, + Title = {大风沙过后的思考}, + Author = {傅刚 and 赵承 and 李佳路}, + Date = {2000-04-12}, + Journaltitle = {北京青年报}, + Note = {news}, + Url = {http://www.bjyouth.com.cn/Bqb/20000412/GB/4216%5ED0412B1401.htm}, + Urldate = {2005-09-28} +}% Number = {14}, + +@Newspaper{张田勤2000--, + Title = {犯罪DNA库与生命伦理学计划}, + Author = {张田勤}, + Date = {2000-11-12}, + Journaltitle = {大众科技报}, + Note = {news}, + Number = {7} +} + +@Article{丁文祥2000--, + Title = {数字革命与竞争国际化}, + Author = {丁文祥}, + Date = {2000-11-20}, + Journaltitle = {中国青年报}, + Number = {15}, + Note = {news} +} + +@Book{booknoauthor, + Title = {出版集团研究}, + Date = {2001}, + Pages = {179-193}, + Publisher = {中国书籍出版社}, + Location = {北京} +} + +@Book{booknolocation, + Title = {出版集团研究}, + Author = {余敏}, + Date = {2001}, + Pages = {179-193}, + Publisher = {中国书籍出版社} +} + +@Book{booknopages, + Title = {出版集团研究}, + Author = {余敏}, + Date = {2001}, + Publisher = {中国书籍出版社}, + Url = {www.bla~bla.org}, + Location = {北京} +} + +@Book{booknopublisher, + Title = {出版集团研究}, + Author = {余敏}, + Date = {2001}, + Location = {北京} +} + +@Book{booknopublisherpage, + Title = {出版集团研究}, + Author = {余敏}, + Date = {2001}, + Pages = {20-30}, + Location = {北京} +} + +@Article{Moeneclaey2001-497-505, + Title = {Sensitivity of multiple-access techniques to narrowband interference}, + Author = {Moeneclaey, M. and Bladel,M. V. and Sari,H.}, + Journal = {IEEE Trans. Commun.}, + Number = {3}, + Pages = {497-505}, + Volume = {49}, + Year = {2001} +} + +@Book{PEEBLES2001--, + Title = {Probability, random variable and random signal principles}, + Author = {PEEBLES, Jr., P Z}, + Edition = {4}, + Publisher = {McGraw Hill}, + Year = {2001}, + Location = {New York} +} + +@Book{Peebles2001-100-100, + Title = {Probability, random variable, and random signal Principles and \LaTeX{}}, + Address = {New York}, + Author = {von Peebles, Jr., P. Z.}, + Edition = {4}, + Pages = {100}, + Publisher = {McGraw-Hill}, + Year = {2001} +} + +@Inproceedings{Piazzo2001--, + Title = {UWB EM compatibility and coexistence issues}, + Address = {Rome, Italy}, + Author = {Piazzo, L.}, + Booktitle = {Proc. 1st Int. Workshop on Networking with UWB}, + Year = {2001} +} + +@Book{ROOD2001--, + Title = {Logic and structured design for computer programmers}, + Author = {H J ROOD}, + Date = {2001}, + Edition = {3}, + Publisher = {Brooks/Cole-Thomson Learning} +} + +@Book{Simon2001--, + Title = {Spread Spectrum Communications Handbook}, + Address = {New York City}, + Author = {Simon, M. K. and Omura,J. K. and Scholtz,R. A. and Levitt,B. K.}, + Publisher = {McGraw-Hill, Inc.}, + Year = {2001} +} + +@Book{Stueber2001--, + Title = {Principles of Mobile Communication}, + Address = {Norwell}, + Author = {Stuber, G. L.}, + Edition = {Second Edition}, + Publisher = {MA: Kluwer Academic Publishers}, + Year = {2001} +} + +@Book{余敏2001-179-193, + Title = {出版集团研究}, + Author = {余敏}, + Date = {2001}, + Pages = {179-193}, + Publisher = {中国书籍出版社}, + Location = {北京} +} + +@Book{余敏2001-179-193a, + Title = {出版集团研究}, + Author = {余敏}, + Date = {2001}, + Edition = {3}, + Pages = {179-193}, + Publisher = {中国书籍出版社}, + Location = {北京} +} + +@Book{余敏2001-179-193b, + Title = {出版集团研究}, + Author = {余敏}, + Date = {2001}, + Edition = {2}, + Pages = {179-193}, + Publisher = {中国书籍出版社}, + Location = {北京} +} + +@Book{余敏2001-179-193c, + Title = {出版集团研究}, + Author = {余敏}, + Date = {2001}, + Pages = {179-193}, + Publisher = {中国书籍出版社}, + Url = {http://www.baidu.com}, + Urldate = {2001-08-04}, + Location = {北京} +} + +@Book{赵学功2001--a, + author = {赵学功}, + title = {当代美国外交}, + year = {2001}, + publisher = {社会科学文献出版社}, + url = {http://www.baidu.com}, + urldate = {2014-06-11}, +} + +@Manual{中国第一历史档案馆2001--a, + author = {中国第一历史档案馆 and 辽宁省档案馆}, + title = {中国明朝档案总汇}, + year = {2001}, + organization = {广西师范大学出版社}, + address = {桂林}, +} + +@Article{郜宪林2001-114-116, + Title = {DII COE研究与分析}, + Author = {郜宪林}, + Journal = {计算机工程与应用}, + Number = {19}, + Pages = {114-116}, + Year = {2001} +} + +@Patent{河北绿洲生态环境科技有限公司2001--, + Title = {一种荒漠化地区生态植被综合培育种植方法}, + Author = {河北绿洲生态环境科技有限公司}, + Date = {2001-10-24}, + Number = {01129210.5}, + Url = {http://211.152.9.47/sipoasp/zlijs/hyjs-yx-new.asp?recid=01129210.5&leixin}, + Urldate = {2002-05-28} +} + +@Article{陈金成2001-1861-1864, + Title = {一种开放式体系结构经济型数控装置的研制}, + Author = {陈金成 and 杨海威 and 钟廷修}, + Journal = {上海交通大学学报}, + Number = {12}, + Pages = {1861-1864}, + Volume = {35}, + Month = {12}, + Year = {2001} +} + +@Www{萧钰2001--, + Title = {出版业信息化迈入快车道}, + Author = {萧钰}, + Url = {http://www.creader.com/news/20011219/200112190019.html}, + Urldate = {2002-04-15}, + Date = {2001-12-19} +} + +@Inproceedings{Choi2002-1075-1080, + Title = {Performance analysis of ultra-wideband spread-spectrum communications in narrowband interference}, + Address = {Anaheim, CA}, + Author = {Choi, J. D. and Stark,W. E.}, + Booktitle = {Proc. IEEE Military Commun. Conf. (MILCOM)}, + Pages = {1075-1080}, + Volume = {2}, + Year = {2002} +} + +@Inproceedings{Dardari2002-201-206, + Title = {Simple and accurate models for error probability evaluation of IEEE802.11 DS-SS physical interface in the presence of Bluetooth interference}, + Address = {Taipei}, + Author = {Dardari, D. and Pasolini,G.}, + Booktitle = {Proc. IEEE Global Telecommun. Conf. (GLOBECOM)}, + Pages = {201-206}, + Volume = {1}, + Year = {2002} +} + +@Inproceedings{Foerster2002-1931-1935, + Title = {Interference modeling of pulse-based UWB waveforms on narrowband systems}, + Address = {Birmingham, AL}, + Author = {Foerster, J. R.}, + Booktitle = {Proc. IEEE Veh. Technol. Conf.}, + Pages = {1931-1935}, + Volume = {4}, + Year = {2002} +} + +@Inproceedings{Fontana2002-309-313, + Title = {An insight into UWB interference from a shot noise perspective}, + Address = {Baltimore, MD}, + Author = {Fontana, R. J.}, + Booktitle = {Proc. of IEEE Conference on Ultrawideband Systems and Technologies (UWBST)}, + Pages = {309-313}, + Year = {2002} +} + +@Article{Haemaelaeinen2002-1712-1721, + Title = {On the UWB system coexistence with GSM900, UMTS/WCDMA, and GPS}, + Author = {Hamalainen, M. M. and Hovinen,V. and Tesi,R. and Iinatti,J. H. J. and Latvaaho, M.}, + Journal = {IEEE J. Sel. Areas Commun.}, + Number = {9}, + Pages = {1712-1721}, + Volume = {20}, + Year = {2002} +} + +@Article{Zhao2002-1684-1691, + Title = {Performance of ultra-wideband communications in the presence of interference}, + Author = {Zhao, L. and Haimovich,A. M.}, + Journal = {IEEEJ. Sel. Areas Commun.}, + Number = {9}, + Pages = {1684-1691}, + Volume = {20}, + Year = {2002} +} + +@Inproceedings{汪学军2002-22-25, + Title = {中国农业转基因生物研发进展与安全管理}, + Address = {北京}, + Author = {汪学军}, + Bookauthor = {国家环境保护总局生物安全管理办公室}, + Booktitle = {中国国家生物安全框架实施国际合作项目研讨会论文集}, + Pages = {22-25}, + Publisher = {中国环境科学出版社}, + Year = {2002} +} + +@Book{张伯伟2002--, + Title = {全唐五代诗格会考}, + Address = {南京}, + Author = {张伯伟}, + Pages = {288}, + Publisher = {江苏古籍出版社}, + Year = {2002} +} + +@Patent{西安电子科技大学2002--a, + author = {西安电子科技大学}, + title = {光折变自适应光外差探测方法}, + number = {01128777.2}, + date = {2002-03-06}, + url = {http://211.152.9.47/sipoasp/zljs/hyjs-yx-new.asp?recid=01128777.2&leixin=0}, + urldate = {2002-05-28}, +} + +@Patent{TACHIBANA2002--, + Title = {Electronic watermarking method and system}, + Author = {R TACHIBANA and S SHIMIZU and S KOBAYSHI and others}, + Date = {2002-04-25}, + Number = {US6915001}, + Url = {http://patftuspto.gov/netacgi/nph-Parser?Seetl=PTO2&Sect2=HITOFF&=1&u=/netahhml/search-bool.html&r=1&f=G&1=50&col=AND&d=ptxt&sl=`Electronic+watermarking+method+system'.TTL.&OS=TTL/}, + Urldate = {2002-05-28} +} + +@Patent{KOSEKI2002--, + Title = {Compiler}, + Author = {A KOSEKI and H MOMOSE and M KAWAHITO and others}, + Date = {2002-05-25}, + Number = {US828402}, + Url = {http://FF&p=1&u=netahtml/PTO/search-bool.html&r=5&f=G&l=50&col=AND&d=PG01&sl=IBM.AS.&0S=AN/IBM&RS=AN/IBM}, + Urldate = {2002-05-28} +} + +@Article{Chiani2003-840-845, + Title = {New exponential bounds and approximations for the computation of error probability in fading channels}, + Author = {Chiani, M. and Dardari, D. and Simon, M. K.}, + Journal = {IEEE Trans. Wireless Commun.}, + Number = {4}, + Pages = {840-845}, + Volume = {2}, + Year = {2003} +} + +@Inproceedings{Firoozbakhsh2003-473-477, + Title = {Analysis of IEEE 802.11a interference on UWB systems}, + Address = {Oulu, Finland}, + Author = {Firoozbakhsh, B. and Pratt,T. G. and Jayant,N.}, + Booktitle = {Proc. of IEEE Conference on Ultrawideband Systems and Technologies (UWBST)}, + Pages = {473-477}, + Year = {2003} +} + +@Electronic{OMG2003--, + Title = {Unified Modeling Language: Superstructure}, + Author = {{omg Inc.}}, + Url = {http://www.omg.org}, + Year = {2003} +} + +@Thesis{吴云芳2003--, + Title = {面向中文信息处理的现代汉语并列结构研究}, + Address = {北京}, + Author = {吴云芳}, + Institution = {北京大学}, + Url = {http://thesis.lib.pku.edu.cn/dlib/List.asp?lang=gb&type=Reader&DocGroupID=4&DoclD=6328}, + Urldate = {2013-10-14}, + Year = {2003} +} + +@Thesis{吴云芳2003a--, + Title = {面向中文信息处理的现代汉语并列结构研究}, + Address = {北京}, + Author = {吴云芳}, + Url = {http://thesis.lib.pku.edu.cn}, + Urldate = {2013-10-14}, + Year = {2003} +} + +@Thesis{吴云芳2003b--, + Title = {面向中文信息处理的现代汉语并列结构研究}, + Author = {吴云芳}, + Institution = {北京大学}, + Url = {http://thesis.lib.pku.edu.cn}, + Urldate = {2013-10-14}, + Year = {2003} +} + +@Thesis{吴云芳2003c--, + Title = {面向中文信息处理的现代汉语并列结构研究}, + Author = {吴云芳}, + Url = {http://thesis.lib.pku.edu.cn}, + Urldate = {2013-10-14}, + Year = {2003} +} + +@Article{Chiani2004-1312-1318, + Title = {Further results on convolutional code search for blockfading channels}, + Author = {M. Chiani and A. Conti and V. Tralli}, + Journal = {IEEE Trans. Inf. Theory}, + Number = {6}, + Pages = {1312-1318}, + Volume = {50}, + Year = {2004} +} + +@Article{Chiani2004-1312-1318a, + Title = {Further results on convolutional code search for blockfading channels-a}, + Author = {M. Chiani and A. Conti and V. Tralli}, + Pages = {1312-1318}, + Year = {2004} +} + +@Article{Chiani2004-1312-1318b, + Title = {Further results on convolutional code search for blockfading channels-b}, + Author = {M. Chiani and A. Conti and V. Tralli}, + Pages = {1312-1318}, + Year = {2004} +} + +@Article{Coulson2004-2277-2287, + Title = {Narrowband interference in pilot symbol assisted OFDM systems}, + Author = {Coulson, A. J.}, + Journal = {IEEE Trans. Wireless Commun.}, + Number = {6}, + Pages = {2277-2287}, + Volume = {3}, + Year = {2004} +} + +@Article{Dardari2004-1557-1567, + Title = {Layered video transmission on adaptive OFDM wireless systems}, + Author = {Dardari, D. and Martini,M. G. and Mazzotti, M. and Chiani,M.}, + Journal = {EURASIP Journal on Wireless Communications and Networking}, + Number = {10}, + Pages = {1557-1567}, + Year = {2004} +} + +@Book{Kopka2004--, + Title = {A Guide to LATEX and Electronic Publishing}, + Address = {Harlow, England}, + Author = {Helmut Kopka and Patrick W. Daly}, + Date = {2004}, + Edition = {4}, + Publisher = {Addison-Wesley} +} + +@Conference{Li2004-21-24, + Title = {Practical approaches to channel estimation and interference suppression for OFDM based UWB communications}, + Author = {Li, Y. and Molisch,A. F. and Zhang,J.}, + Booktitle = {Proc. of the IEEE 6th Circ. and Syst., Symp. on Emerging Technologies: Frontiers of Mobile and Wireless Communication}, + Pages = {21-24}, + Volume = {1}, + Year = {2004} +} + +@Book{Lin2004--, + Title = {Error Control Coding}, + Address = {Englewood Cliffs}, + Author = {Lin, S. and Daniel Costello,J.}, + Edition = {Second Edition}, + Publisher = {NJ:Prentice Hall}, + Year = {2004} +} + +@Book{Mittelbach2004--, + Title = {The LaTeX Companion}, + Address = {Boston}, + Author = {Frank Mittelbach and Michel Goossens and Johannes Braams and David Carlisle and Chris Rowley}, + Edition = {Second Edition}, + Publisher = {Addison-Wesley}, + Year = {2004} +} + +@Book{Simon2004--, + Title = {Digital Communication over Fading Channels}, + Address = {Hoboken}, + Author = {Simon, M. K. and Alouini,M. S.}, + Publisher = {NJ: Wiley-IEEE Press}, + Year = {2004} +} + +@PhdThesis{张若凌2004--, + Title = {高超声速非平衡流动的计算和实验研究}, + Author = {张若凌}, + School = {中国空气动力研究与发展中心}, + Year = {2004}, + Location = {绵阳} +} + +@Book{Miroslav2004--, + Title = {信号处理滤波器设计-基于matlab和mathematica的设计方法}, + Address = {北京}, + Author = {Miroslav, D. L. and Dejan, V. T. and Brian, L. E.}, + Publisher = {电子工业出版社}, + Translator = {朱义胜 and 董辉}, + Year = {2004}, + Month = {1} +} + +@Book{Miroslav2003--, + Title = {信号处理滤波器设计方法}, + Address = {北京}, + Author = {Miroslav, D. L. and Dejan, V. T.}, + Publisher = {电子工业出版社}, + Translator = {朱义胜 and 董辉}, + Year = {2003}, + Month = {1} +} + +@Article{Giorgetti2005-1037-1042, + Title = {The impact of OFDM interference on TH-PPM/BPAM transmission systems}, + Author = {Giorgetti, A. and Dardari,D.}, + Journal = {Proc. IEEE Veh. Technol. Conf.}, + Pages = {1037-1042}, + Volume = {2}, + Year = {2005} +} + +@Article{Giorgetti2005-2139-2149, + Title = {The effect of narrowband interference on wideband wireless communication systems}, + Author = {Giorgetti, A. and Chiani, M. and Win, M. Z.}, + Journal = {IEEE Trans. Commun.}, + Number = {12}, + Pages = {2139-2149}, + Volume = {53}, + Year = {2005} +} + +@Article{Giorgetti2005-384-389, + Title = {Influence of fading on the Gaussian approximation for BPSK and QPSK with asynchronous cochannel interference}, + Author = {Giorgetti, A. and Chiani,M.}, + Journal = {IEEE Trans. Wireless Commun.}, + Number = {2}, + Pages = {384-389}, + Volume = {4}, + Year = {2005} +} + +@Inproceedings{Giorgetti2005-794-798, + Title = {Coexistence of UWB and narrowband systems in Nakagami/Rice channels}, + Address = {Aalborg, Denmark}, + Author = {Giorgetti, A.}, + Booktitle = {Proc. Int. Symp. on Wireless Personal Multimedia Commun. (WPMC)}, + Pages = {794-798}, + Year = {2005} +} + +@Book{Reed2005--, + Title = {An Introduction to Ultrawideband Communication Systems}, + Address = {Upper Saddle River}, + Author = {Reed, J. H.}, + Publisher = {NJ: Prentice Hall}, + Year = {2005} +} + +@Book{樊昌信2005--, + Title = {通信原理教程}, + Address = {北京}, + Author = {樊昌信}, + Publisher = {电子工业出版社}, + Year = {2005} +} + +@Article{Coulson2006-2484-2492, + Title = {Bit error rate performance of OFDM in narrowband interference with excision filtering}, + Author = {Coulson, A. J.}, + Journal = {IEEE Trans. Wireless Commun.}, + Number = {9}, + Pages = {2484-2492}, + Volume = {5}, + Year = {2006} +} + +@Inproceedings{Giorgetti2006--, + Title = {Coexistence issues in cognitive radios based on ultra-wide bandwidth systems}, + Address = {Mykonos, Greece}, + Author = {Giorgetti, A. and Chiani, M. and Dardari,D.}, + Booktitle = {Proc. IEEE Int. Conf. on Cognitive Radio Oriented Wireless Net. and Comm. (CROWNCOM)}, + Year = {2006} +} + +@Article{Hu2006-1720-1724, + Title = {Performance of an ultra-wideband communication system in the presence of narrowband BPSK-and QPSK-modulated OFDM interference}, + Author = {Hu, B. and Beaulieu,N. C.}, + Journal = {IEEE Trans. Commun.}, + Number = {10}, + Pages = {1720-1724}, + Volume = {54}, + Year = {2006} +} + +@Article{Molisch2006-3151-3166, + Title = {A comprehensive standardized model for ultrawideband propagation channels}, + Author = {Molisch, A. F. and Cassioli, D. and Chong, C. C. and Emami, S. and Fort, A.}, + Journal = {IEEE Trans. Antennas Propag.}, + Number = {11}, + Pages = {3151-3166}, + Volume = {54}, + Year = {2006} +} + +@Article{Saito2006-169-176, + Title = {jadeite-bearing metagabbro in serpentinite m\'elange of the ``kurosegawa belt" in Izumi Town,Yatsushiro city, kumamoto prefecture, central kyushu}, + Author = {Saito, M. and Miyazaki, k.}, + Journal = {bulletin of geological survey of japan}, + Number = {5/6}, + Pages = {169-176}, + Volume = {57}, + Year = {2006} +} + +@Book{郭文彬2006--, + Title = {通信原理--基于Matlab的计算机仿真}, + Address = {北京}, + Author = {郭文彬 and 桑林}, + Publisher = {北京邮电大学出版社}, + Year = {2006} +} + +@Book{蔡敏2006--, + Title = {UML基础和Rose建模教程}, + Address = {北京}, + Author = {蔡敏 and 徐慧慧 and 黄柄强}, + Publisher = {人民邮电出版社}, + Year = {2006}, + Month = {1} +} + +@Article{Nasri2007-4090-4100, + Title = {Analysis of narrowband communication systems impaired by MB-OFDM UWB interference}, + Author = {Nasri, A. and Schober, R. and Lampe, L.}, + Journal = {IEEE Trans. Wireless Commun.}, + Number = {11}, + Pages = {4090-4100}, + Volume = {6}, + Year = {2007} +} + +@Book{Proakis2007--, + Title = {Digital signal processing: Principles,algorithms, and applications}, + Address = {北京}, + Author = {Proakis, J. G. AND Manolakis, D. G.}, + Edition = {第4版}, + Publisher = {电子工业出版社}, + Year = {2007} +} + +@Article{Quek2007-2126-2139, + Title = {Unified analysis of UWB transmitted-reference schemes in the presence of narrowband interference}, + Author = {Quek, T. Q. S. and Win,M. Z. and Dardari,D.}, + Journal = {IEEE Trans. Wireless Commun.}, + Number = {6}, + Pages = {2126-2139}, + Volume = {6}, + Year = {2007} +} + +@Article{Shi2007-1118-1128, + Title = {Impact of narrowband interference on OFDM-UWB receivers: Analysis and mitigation}, + Author = {Shi, K. and Zhou,Y. and Kelleci,B. and Fischer, T. W. and Serpedin, E.E. and Ilker Karsilayan, A.}, + Journal = {IEEE Trans.Signal Process.}, + Number = {3}, + Pages = {1118-1128}, + Volume = {55}, + Year = {2007} +} + +@Article{Snow2007-1736-1746, + Title = {Error rate analysis for coded multicarrier systems over quasistatic fading channels}, + Author = {Snow, C. and Lampe, L. and Schober,R.}, + Journal = {IEEE Trans. Commun.}, + Number = {9}, + Pages = {1736-1746}, + Volume = {55}, + Year = {2007} +} + +@Book{全国广播电视标准化技术委员会2007-1-1, + Title = {广播电视音像资料编目规范:第2部分~ 广播资料:GY/T202.2-2007}, + Address = {北京}, + Author = {全国广播电视标准化技术委员会}, + Note = {standard}, + Pages = {1}, + Publisher = {国家广播电影电视局广播电视规划院}, + Year = {2007} +} + +@Article{张敏莉2007-500-503, + Title = {超声速短化喷管的设计和试验研究}, + Author = {张敏莉 and 易仕和 and 赵玉新}, + Journal = {空气动力学报}, + Number = {4}, + Pages = {500-503}, + Volume = {25}, + Year = {2007} +} + +@Book{庄钊文2007--, + Title = {军用目标雷达散射截面预估与测量}, + Address = {北京}, + Author = {庄钊文 and 袁乃昌 and 莫锦军 and 刘少斌}, + Publisher = {科学出版社}, + Year = {2007} +} + +@Article{刘晨2007-400-404, + Title = {体系对抗仿真模型形式规范研究}, + Author = {刘晨 and 王维平 and 朱一凡}, + Journal = {系统仿真学报}, + Number = {2}, + Pages = {400-404}, + Volume = {19}, + Month = {1}, + Year = {2007} +} + +@Manual{吴凌云2007--, + Title = {CTEX FAQ}, + Author = {吴凌云}, + Version = {version 0.4}, + Month = {1}, + Subtitle = {常见问题集}, + Year = {2007} +} + +@Article{articlemorenames, + Title = {Cooperation enforcement and learning for optimizing packet forwarding in autonomous wireless networks}, + Author = {Pandana, C. and Han, Z. and Liu, K.J.R. and others}, + Journal = {Wireless Communications, IEEE Transactions on}, + Number = {8}, + Pages = {3150--3163}, + Volume = {7}, + Publisher = {IEEE}, + Year = {2008} +} + +@Inproceedings{Nasri2008-3616-3621, + Title = {Performance Evaluation of BICM-OFDM Systems Impaired by UWB Interference}, + Address = {Beijing, China}, + Author = {Nasri, A. and Schober,R. and Lampe,L.}, + Booktitle = {Proc. IEEE Int. Conf. on Commun.}, + Pages = {3616-3621}, + Year = {2008} +} + +@Book{2009-155-155, + Title = {师伏堂日记:第4册}, + Address = {北京}, + Pages = {155}, + Publisher = {北京图书馆出版社}, + Year = {2009} +} + +@Article{Chiani2009-231-254, + Title = {Coexistence between UWB and narrow-band wireless communication systems}, + Author = {Chiani, M. and Giorgetti, A.}, + Journal = {Proc. IEEE, Special Issue on UWB Technology and Emerging Applications}, + Number = {2}, + Pages = {231-254}, + Volume = {97}, + Year = {2009} +} + +@Article{Pinto2009-1268-1282, + Title = {A stochastic geometry approach to coexistence in heterogeneous wireless networks}, + Author = {Pinto, P. and Giorgetti,A. and Win,M. Z. and Chiani,M.}, + Journal = {IEEE J. Sel. Areas Commun., Special Issue on Stochastic Geometry and Random Graphs for Wireless Networks}, + Number = {7}, + Pages = {1268-1282}, + Volume = {27}, + Year = {2009} +} + +@Book{罗斯基2009--, + Title = {战前中国经济的增长}, + Address = {杭州}, + Author = {罗斯基}, + Publisher = {浙江大学出版社}, + Translator = {唐巧天 and 毛立坤 and 姜修宪}, + Year = {2009} +} + +@Book{陈希孺2009--, + Title = {概率论与数理统计}, + Address = {合肥}, + Author = {陈希孺}, + Publisher = {中国科学技术大学出版社}, + Year = {2009}, + Month = {2} +} + +@Book{李云霞2009--, + Title = {光电对抗原理与应用}, + Address = {西安}, + Author = {李云霞 and 蒙文 and 马丽华 and 赵尚弘}, + Date = {2009-02}, + Publisher = {西安电子科技大学出版社} +} + +@Article{卢秋红2009-247-251, + Title = {基于开放式架构的反恐排爆机器人关键技术分析}, + Author = {卢秋红 and 蒋金鹏 and 付西光}, + Journal = {上海电机学院学报}, + Number = {3}, + Pages = {247-251}, + Volume = {12}, + Month = {9}, + Year = {2009} +} + +@Article{张庆杰2009-30-33, + Title = {支持无人机互操作的多数据链互连网关设计}, + Author = {张庆杰 and 王林 and 朱华勇 and 沈林成}, + Journal = {计算机工程}, + Number = {20}, + Pages = {30-33}, + Volume = {35}, + Month = {10}, + Year = {2009} +} + +@Article{Park2010-696-715, + Title = {metadata quality Control in Digital repositories and collections: criteria, semantics, and mechanisms}, + Author = {Park, J R and tosaka, Y.}, + Journal = {Cataloging \& classification quarterly}, + Number = {8}, + Pages = {696-715}, + Volume = {48}, + Url = {http://www.tandfonline.com}, + Urldate = {2013-09-05}, + Year = {2010} +} + +@Article{陈建军2010-93-93, + Title = {从数字地球到智慧地球}, + Author = {陈建军}, + Journal = {国图资源导刊}, + Number = {10}, + Pages = {93}, + Volume = {7}, + Doi = {10.3969/j.issn.1672-5603.2010.10.038}, + Url = {http://d.g.wanfangdata.com.cn}, + Urldate = {2013-03-20}, + Year = {2010} +} + +@Article{储大同2010-721-724, + Title = {恶性肿瘤个体化治疗靶向药物的临床表现}, + Author = {储大同}, + Journal = {中华肿瘤杂志}, + Number = {10}, + Pages = {721-724}, + Volume = {32}, + Url = {http://www.sohu.com}, + Urldate = {2014-06-25}, + Year = {2010} +} + +@book{weiner2010-38, + Title = {Microarchaeology: beyond the visible archaeological record}, + Author = {Weiner, S}, + Address = {Cambridge, Eng.}, + Date = {2010}, + Publisher = {Cambridge University Press Textbooks}, + Url = {http://lib.MYLIB.COM/OPEN.aspx?id=253897}, + Urldate = {2013-10-14}, + pages = {38} +} + +@Article{储大同2010-721-724m, + Title = {恶性肿瘤个体化治疗靶向药物的临床表现}, + Author = {储大同}, + Journal = {中华肿瘤杂志}, + Number = {9/10}, + Pages = {721-724}, + Volume = {32}, + Doi = {10.7666/d.y351065}, + Url = {http://www.sohu.com}, + Urldate = {2014-06-25}, + Year = {2010} +} + +@Book{候文顺2010-119-119, + Title = {高分子物理:高分子材料分析、选择与改性}, + Address = {北京}, + Author = {候文顺}, + Pages = {119}, + Publisher = {化学工业出版社}, + Url = {http://apabi.lib.pku.edu.cn}, + Urldate = {2012-11-27}, + Year = {2010} +} + +@Book{胡承正2010-112-112, + Title = {理论物理概论:上}, + Address = {武汉}, + Author = {胡承正 and 周详 and 缪灵}, + Pages = {112}, + Publisher = {武汉大学出版社}, + Year = {2010} +} + +@Book{美国妇产科医师学会2010-38-39, + Title = {新生儿脑病和脑性瘫痪发病机制与病理生理}, + Address = {北京}, + Author = {美国妇产科医师学会}, + Pages = {38-39}, + Publisher = {人民卫生出版社}, + Translator = {段涛 and 杨慧霞}, + Year = {2010} +} + +@Book{全国信息文献标准化技术委员会2010-3-3, + Title = {文献著录:第4部分~ 非书资料:GB/T3792.4-2009}, + Address = {北京}, + Author = {全国信息文献标准化技术委员会}, + Note = {standard}, + Pages = {3}, + Publisher = {中国标准出版社}, + Year = {2010} +} + +@Article{伍江华2010-70-74, + Title = {C4ISR互操作框架及信息关系模型研究}, + Author = {伍江华 and 潘小群}, + Journal = {舰船电子工程}, + Number = {1}, + Pages = {70-74}, + Volume = {30}, + Year = {2010} +} + +@Book{王雪松2010--, + Title = {现代雷达电子战系统建模与仿真}, + Address = {北京}, + Author = {王雪松 and 肖顺平 and 冯德军 and 赵锋}, + Date = {2010-03}, + Publisher = {电子工业出版社} +} + +@Book{Ross2010--, + Title = {概率论基础教程}, + Address = {北京}, + Author = {Ross, S. M.}, + Edition = {第8版}, + Publisher = {人民邮电出版社}, + Translator = {郑忠国 and 詹从赞}, + Year = {2010}, + Month = {4} +} + +@Book{陈志杰2006--, + Title = {LaTeX 入门与提高}, + Address = {北京}, + Author = {陈志杰 and 赵书钦 and 李树钧 and 万福永}, + Edition = {第二版}, + Publisher = {高等教育出版社}, + Year = {2010}, + Month = {5} +} + +@Manual{Umeki2010--, + Title = {The geometry package}, + Author = {Hideo Umeki}, + Version = {v5.6}, + Month = {09}, + Year = {2010} +} + +@Report{Calkin2011-8-9, + Title = {a comparative risk assessment framework for wildland fire management: the 2010 cohesive strategy Science report: RMRS-GTR-262}, + Author = {Calkin, D and Ager, a. and Thompson, m.}, + Pages = {8-9}, + Year = {2011} +} + +@Book{Praetzellis2011-13-13, + Title = {death by theory : a tale of mystery and archaeological theory}, + Author = {Praetzellis, A.}, + Edition = {Rev. ed.}, + Pages = {13}, + Publisher = {Rowman \& Littlefield Publishing Group, Inc.}, + Url = {http://lib.myilibrary.com}, + Urldate = {2012-07-26}, + Year = {2011} +} + +@Proceedings{陈志勇2011--, + Title = {中国财税文化价值研究:“中国财税文化国际学术研讨会”论文集}, + Address = {北京}, + Author = {陈志勇}, + Publisher = {经济科学出版社}, + Url = {http://apabi.lib.pku.edu.cn}, + Urldate = {2013-10-14}, + Year = {2011} +} + +@InProceedings{贾东琴2011-45-52a, + author = {贾东琴 and 柯平}, + title = {面向数字素养的高校图书馆数字服务体系研究}, + booktitle = {中国图书馆学会年会论文集:2011年卷}, + year = {2011}, + publisher = {国家图书馆出版社}, + pages = {45-52}, + address = {北京}, + bookauthor = {中国图书馆学会}, +} + +@Inbook{楼梦麟2011-11-12, + Title = {汶川地震基岩地震动特征分析}, + Address = {上海}, + Author = {楼梦麟 and 杨燕}, + Bookauthor = {同济大学土木工程防灾国家重点实验室}, + Booktitle = {汶川地震震害研究}, + Pages = {{011-012}}, + Publisher = {同济大学出版社}, + Url = {http://apabi.lib.pku.edu.cn}, + Urldate = {2013-05-09}, + Year = {2011} +} + +@Thesis{马欢2011-27-27, + Title = {人类活动影响下海河流域典型区水循环变化分析}, + Address = {北京}, + Author = {马欢}, + Institution = {清华大学}, + Pages = {27}, + Url = {http://www.cnki.net/kcms/detail/detail.aspx?dbcode=CDFD&QueryID=.O&CurRec=11&dbname=CDFDLAST2013&.filename=1012035905.nh&uid=WEEvRE­wSIJHSldTTGJhYIJRaEhGUXFQWVB6SGZXeisxdmVhV3Zy2kpoUnozeDElbOpaMONmMjZiQ3p4TUdmcw= }, + Urldate = {2013-10-14}, + Year = {2011} +} + +@InBook{2011-1109-1109, + title = {周易外传:卷5}, + booktitle = {船山全书:第6册}, + year = {2011}, + bookauthor = {王夫之}, + publisher = {岳麓书社}, + location = {长沙}, + pages = {1109}, +} + +@Book{胡伟2011--, + Title = {LaTeX2$\varepsilon$完全学习手册}, + Address = {北京}, + Author = {胡伟}, + Publisher = {清华大学出版社}, + Year = {2011}, + Month = {1} +} + +@Manual{Oetiker2011--, + Title = {The Not So Short Introduction to \LaTeXe{}}, + Author = {Tobias Oetiker and Hubert Partl and Irene Hyna and Elisabeth Schleg}, + Month = {4}, + Year = {2011} +} + +@Article{陈高峰2011-230-232, + Title = {基于开放式框架的交叉开发环境设计与实现}, + Author = {陈高峰}, + Journal = {煤炭技术}, + Number = {6}, + Pages = {230-232}, + Volume = {30}, + Month = {6}, + Year = {2011} +} + +@Manual{Robertson2011--, + Title = {The ccaption package}, + Author = {Will Robertson and Peter Wilson and Herries Press}, + Version = {v3.2c}, + Month = {8}, + Year = {2011} +} + +@Article{谭跃进2011-441-445, + Title = {体系工程的研究与发展}, + Author = {谭跃进 and 赵青松}, + Journal = {中国电子科学研究院学报}, + Number = {5}, + Pages = {441-445}, + Volume = {6}, + Month = {10}, + Year = {2011} +} + +@Manual{Sommerfeldt2011--, + Title = {Customizing captions of floating environments}, + Author = {Axel Sommerfeldt}, + Url = {http://sourceforge.net/projects/latex-caption/}, + Month = {11}, + Year = {2011} +} + +@Article{张晓琴2011--, + Title = {有重复组合公式的几种证明方法}, + Author = {张晓琴 and 王顺勇}, + Journal = {大学数学}, + Number = {6}, + Volume = {27}, + Month = {12}, + Year = {2011} +} + +@Book{Kinchy2012-50-50, + Title = {Seeds, Sciences, and struggle : the global politics of transgenic crops}, + Address = {Cambridge,Mass.}, + Author = {Kinchy, A.}, + Pages = {50}, + Publisher = {MIT Press}, + Url = {http://lib.myilibary.com}, + Urldate = {2013-07-14}, + Year = {2012} +} + +@Book{库恩2012--, + Title = {科学革命的结构:第4版}, + Address = {北京}, + Author = {库恩}, + Edition = {2}, + Publisher = {北京大学出版社}, + Translator = {金吾伦 and 胡新和}, + Year = {2012} +} + +@Proceedings{雷光春2012--, + Title = {综合湿地管理:综合湿地管理国际研讨会论文集}, + Address = {北京}, + Author = {雷光春}, + Publisher = {海洋出版社}, + Year = {2012} +} + +@Article{于潇2012-1518-1523, + Title = {互联网药品可信交易环境中主体资质审核备案模式}, + Author = {于潇 and 刘义 and 柴跃廷 and others}, + Journal = {清华大学学报(自然科学版)}, + Number = {11}, + Pages = {1518-1523}, + Volume = {52}, + Year = {2012} +} + +@Article{于潇2011-15-23, + Title = {互联网药品可信交易环境中主体资质审核备案模式}, + Author = {于, 潇 and 刘, 义 and 柴, 跃廷 and others}, + Journal = {清华大学学报}, + Number = {11}, + Pages = {15-23}, + Volume = {52}, + Year = {2011} +} + +@Proceedings{中国社会科学院台湾史研究中心2012--, + Title = {台湾光复六十五周年暨抗战史实学术研讨会论文集}, + Address = {北京}, + Publisher = {九州出版社}, + Year = {2012}, + Editor = {中国社会科学院台湾史研究中心} +} + +@Book{埃伯哈德$ullet$蔡德勒等2012--, + Title = {数学指南-实用数学手册}, + Address = {北京}, + Author = {埃伯哈德$\bullet$蔡德勒等}, + Publisher = {科学出版社}, + Translator = {李文林等}, + Year = {2012}, + Month = {1} +} + +@Book{廖平2012--, + Title = {导弹突防中的电子对抗技术}, + Address = {北京}, + Author = {廖平 and 姜勤波}, + Date = {2012-01}, + Publisher = {国防工业出版社} +} + +@Patent{张凯军2012-04-05--, + Title = {轨道火车及高速轨道火车紧急安全制动辅助装置}, + Author = {张凯军}, + Number = {201220158825.2}, + Year = {2012-04-05} +} + +@Online{李强2012-05-03--, + Title = {化解医患矛盾需釜底抽薪}, + Author = {李强}, + Url = {http://wenku.baidu.com}, + Urldate = {2013-03-25}, + Year = {2012-05-03} +} + +@Online{Dublin2012-06-14--, + Title = {Dublin core metadata element set: version 1.1}, + Url = {http://dublincore.org}, + Urldate = {2014-06-11}, + Year = {2012-06-14} +} + +@Book{胡广书2012--, + Title = {数字信号处理—理论、算法与实现}, + Address = {北京}, + Author = {胡广书}, + Edition = {第三版}, + Publisher = {清华大学出版社}, + Year = {2012}, + Month = {10} +} + +@Article{Franz2013-1053-1062, + Title = {Phenotypic screening with oleaginous microalgae reveals modulators of lipid productivity}, + Author = {Franz,A.K. AND DANIELEWICZ, M. A. AND WONG, D. M. AND OTHERS}, + Journal = {ACS chemical biology}, + Pages = {1053-1062}, + Volume = {8}, + Url = {http://pubs.acs.org}, + Urldate = {2014-06-26}, + Year = {2013} +} + +@Article{Walls2013-399-418, + Title = {drought, deluge and declines: the impact of precipition extremes on amphibians in a changing climate}, + Author = {Walls, S C and barichivich, W. J. and BROWN, m. e.}, + Journal = {Biology}, + Number = {1}, + Pages = {399-418}, + Volume = {2}, + Url = {http://www.mdpi.com}, + Urldate = {2013-11-04}, + Year = {2013}, + doi = {10.3390/biology2010399} +} + +@Article{Zhang2007-500-503, + Title = {The design and experimental investigations of supersonic length shorted nozzle}, + Author = {Zhang, Min-li and Yi, Shi-he and Zhao, Yu-xin}, + Journal = {ACTA AERODYNAMICA SINICA}, + Number = {4}, + Pages = {500-503}, + Volume = {25}, + Year = {2007} +} + +@Book{Yi2013--, + Title = {Supersonic and hypersonic nozzle design}, + Address = {Beijing}, + Author = {Yi, Shi he and Zhao, Yu xin and He, Lin and Zhang, Min li}, + Publisher = {National Defense Industry Press}, + Year = {2013} +} + +@Book{LIAO2012--, + Title = {Electronic countermeasure techniques for missile penetration}, + Address = {Beijing}, + Author = {LIAO, ping and JIANG, qin bo}, + Publisher = {National Defense Industry Press}, + Year = {2013} +} + +@Book{LIU2003--, + Title = {Introduction of Ballistic Misille Techniques}, + Address = {Beijing}, + Author = {LIU, shi Qiu}, + Publisher = {China Astronautic Publishing House}, + Year = {2003} +} + +@InBook{马克思2013-302-302a, + author = {马克思}, + title = {政治经济学批判}, + booktitle = {马克思恩格斯全集:第35卷}, + year = {2013}, + bookauthor = {马克思 and 恩格斯}, + publisher = {人民出版社}, + pages = {302}, + address = {北京}, +} + +@Article{杨洪升2013-56-75, + Title = {四库馆私家抄校书考略}, + Author = {杨洪升}, + Journal = {文献}, + Number = {1}, + Pages = {56-75}, + Year = {2013} +} + +@Book{易仕和2013--, + Title = {超声速和高超声速喷管设计}, + Address = {北京}, + Author = {易仕和 and 赵玉新 and 何霖 and 张敏莉}, + Publisher = {国防工业出版社}, + Year = {2013} +} + +@Article{詹广平2013-8-10, + Title = {美海军宙斯盾系统开放式体系结构研究}, + Author = {詹广平}, + Journal = {舰船电子工程}, + Number = {11}, + Pages = {8-10}, + Volume = {33}, + Year = {2013} +} + +@Book{中国企业投资协会2013--, + Title = {投资台湾:大陆企业赴台投资指南}, + Address = {北京}, + Author = {中国企业投资协会 and 台湾并购与私募股权协会 and 汇盈国际投资集团}, + Publisher = {九州出版社}, + Year = {2013} +} + +@Article{周学武2013-49-52, + Title = {数据链技术的发展及其在空面导弹中的应用}, + Author = {周学武 and 邹敏怀 and 张邦楚 and 黄剑斌 and 刘涛}, + Journal = {教练机}, + Number = {2}, + Pages = {49-52}, + Year = {2013} +} + +@Book{Poisel2013--, + Title = {通信电子战原理}, + Address = {北京}, + Author = {Poisel, Richard A.}, + Edition = {2版}, + Pages = {23--26}, + Publisher = {电子工业出版社}, + Translator = {聂皞 and 王振华 and 陈少昌 and 吴利民}, + Url = {http://www.baidu.com}, + Urldate = {2013-08-01}, + Year = {2013}, + Month = {1} +} + +@Article{王雪峥2013-249-254, + Title = {基于DoDAF的靶场体系结构设计}, + Author = {王雪峥 and 许雪梅}, + Journal = {系统工程理论与实践}, + Number = {1}, + Pages = {249-254}, + Volume = {33}, + Month = {1}, + Year = {2013} +} + +@Book{阎毅2013--, + Title = {软件无线电与认知无线电概论}, + Address = {北京}, + Author = {阎毅 and 贺鹏飞}, + Publisher = {电子工业出版社}, + Year = {2013}, + Month = {1} +} + +@Article{刘裕国2013-01-12--, + Title = {雾霾来袭,如何突围}, + Author = {刘裕国 and 杨柳 and 张洋 and OTHERS}, + Journal = {人民日报}, + Note = {news}, + Url = {http://paper.people.com.cn}, + Urldate = {2013-11-06}, + Year = {2013-01-12} +} + +@Report{中华人民共和国国务院新闻办公室2013-04-16--, + Title = {国防白皮书:中国武装力量的多样化运用}, + Author = {中华人民共和国国务院新闻办公室}, + Url = {http://www.mod.gov.cn}, + Urldate = {2014-06-11}, + Year = {2013}, + date = {2013-04-16} +} + +@Book{刘海洋2013--, + Title = {LaTeX 入门}, + Address = {北京}, + Author = {刘海洋}, + Publisher = {电子工业出版社}, + Year = {2013}, + Month = {6} +} + +@Unpublished{包太雷2013--, + Title = {LaTeX Notes}, + Author = {包太雷}, + Edition = {第二版}, + Month = {9}, + Subtitle = {雷太赫排版系统简介}, + Year = {2013} +} + +@Report{汤万金2013-09-30--, + Title = {人体安全重要技术标准研制最终报告: 7178999X}, + Author = {汤万金 and 杨跃翔 and 刘文 and others}, + Url = {http://www.nstrs.org.cn}, + Urldate = {2014-06-24}, + date = {2013-09-30}, + Year = {2013} +} + +@Manual{Lehman2013--, + Title = {The biblatex Package}, + Author = {Philipp Lehman and Philip Kime and Audrey Boruvka and Joseph Wright}, + Version = {version 2.8a}, + Month = {11}, + Subtitle = {Programmable Bibliographies and Citations}, + Year = {2013} +} + +@Proceedings{Babu2014--, + Title = {Proceedings of the second international conference on soft computing for problem solving, December 28-30, 2012}, + Address = {New Delhi}, + Publisher = {Springer}, + Year = {2014}, + Editor = {Babu, B. V. and NAGAR, A. K. AND DEEP, K. and others} +} + +@Book{同济大学数学系2014--, + Title = {高等数学}, + Address = {北京}, + Author = {同济大学数学系}, + Publisher = {高等教育出版社}, + Year = {2014}, + Month = {7} +} + +@Book{杨林2015--, + Title = {面向对象软件工程与UML实践教程}, + Address = {北京}, + Author = {杨林 and 叶亚琴 and 方芳}, + Publisher = {科学出版社}, + Year = {2015}, + Month = {1} +} + +@Manual{Braams2015--, + Title = {The \LaTeXe{} Sources}, + Author = {Johannes Braams and David Carlisle and Alan Jeffrey and Leslie Lamport and Frank Mittelbach and Chris Rowley and Rainer Sch¨opf}, + Date = {2015-01-01} +} + +@Manual{Lehman2015, + Title = {The Biblatex Package: Programmable Bibliographies and Citations}, + Author = {Philipp Lehman and Philip Kime and Audrey Boruvka and Joseph Wright}, + Date = {2015-04-20}, + Version = {3.0} +} + +@Book{中华人民共和国国家质量监督检验检疫总局2015, + Title = {中华人民共和国国家标准 GB/T 7714-2015 信息与文献 参考文献著录规则}, + Author = {中华人民共和国国家质量监督检验检疫总局 and 中国国家标准化管理委员会}, + Date = {2015-05-15}, + Note = {standard} +} + +@Article{高翔2015-26-31, + Title = {复杂航电架构的开放式系统标准研究}, + Author = {高翔 and 李辰}, + Journal = {航空电子技术}, + Number = {2}, + Pages = {26-31}, + Volume = {46}, + Month = {6}, + Year = {2015} +} + +@Manual{Mittelbach2015--, + Title = {An environment for multicolumn output}, + Author = {Frank Mittelbach}, + Month = {12}, + Year = {2015} +} + +@Manual{Berry2016--, + Title = {TEX Live 指南—2016}, + Author = {Karl Berry}, + Date = {2016-06} +} + +@Manual{胡振震2016, + Title = {符合 GB7714-2015 标准的 biblatex 参考文献样式文件}, + Author = {胡振震}, + Date = {2016-07-01}, + Url = {https://ctan.org/pkg/biblatex-gb7714-2015}, + Urldate = {2018-04-23} +} + +@Online{Alliance--, + Title = {WiMedia Alliance}, + Url = {www.wimedia.org} +} + +@Book{booknodate, + Title = {出版集团研究}, + Author = {余敏}, + Pages = {179-193}, + Publisher = {中国书籍出版社}, + Location = {北京} +} + +@Book{booknopublishernoyear, + Title = {出版集团研究}, + Author = {余敏}, + Location = {北京} +} + +@Online{Commonwealth--, + Title = {Pennsylvania library laws}, + Author = {{Commonwealth libraries bureau of library development.Pennsylvania department of education office}}, + Url = {http://www.racc.edu}, + Urldate = {2013-03-24} +} + +@Report{Eggrers--, + Title = {One-dimensional flows of an imperfect diatomic gas}, + Author = {Eggrers, A. J.}, + Number = {959}, + Type = {NACA report} +} + +@Online{HOPKINSON--, + Title = {UNIMARC and metadata: Dublin Core}, + Author = {A HOPKINSON}, + Url = {http://www.rfla.org/IV/rfla64/13801613.htm}, + Urldate = {1999-12-08} +} + +@Online{JabRef中文手册--, + Title = {JabRef中文手册}, + Url = {http://blog.csdn.net/zd0303/article/details/7676807} +} + +@Online{JabRefManual--, + Title = {JabRef Manual}, + Url = {http://blog.csdn.net/zd0303/article/details/7676807} +} + +@Online{OCLC--a, + author = {{Online Computer Library Center, Inc.}}, + title = {History of OCLC}, + url = {http://www.oclc.org/about/history/default.htm}, + urldate = {2000-01-08}, +} + +@Book{Parsons2000nodate--, + Title = {The Mobile Radio Propagation Channel}, + Address = {Hoboken}, + Author = {Parsons, J. D.}, + Edition = {2}, + Publisher = {John Wiley and Sons} +} + +@Book{Parsons2000nopubnoyear--, + Title = {The Mobile Radio Propagation Channel}, + Address = {Hoboken}, + Author = {Parsons, J. D.}, + Edition = {2} +} + +@Book{standardinfoiso158, + Title = {Information and documentation-the Dublin core metadata element set:ISO 15836:2009}, + Note = {standard}, + Url = {http://www.iso.org}, + Urldate = {2013-03-24} +} + +@Book{鸟哥--, + Title = {鸟哥的linux私房菜}, + Author = {鸟哥}, + Edition = {3}, + Publisher = {人民邮电出版社} +} + +@Online{olqa2016--, + Title = {求助beamerposter制作海报时参考文献样式的问题}, + Date = {2016}, + Url = {http://bbs.ctex.org/forum.php?mod=viewthread&tid=153061&page=1&extra=#pid544787} +} + +@Online{北京交通大学研究生公众号2016--, + Title = {新学期定个小目标—学会在LaTeX中管理参考文献}, + Author = {北京交通大学研究生公众号}, + Date = {2016-09-17}, + Url = {http://www.latexstudio.net/archives/7488} +} + +@Online{olref2016--, + Title = {如何在LaTeX写作中管理参考文献?}, + Date = {2016-08-12}, + Url = {http://www.latexstudio.net/archives/7131} +} + +@Online{文献助手2016--, + Title = {参考文献格式搜索神器上线了}, + Author = {文献助手}, + Date = {2016-09-21}, + Url = {http://www.latexstudio.net/archives/7560} +} + +@Book{IFLAI1977b--, + Title = {Names of persons: national usages for entry in catalogues}, + Author = {{International Federation of Library Association and Institutions} and {FCC} and {FBI} and {CIA}}, + Edition = {3}, + Publisher = {IFLA International Office for UBC}, + Year = {1977}, + Location = {London} +} + +@Inproceedings{r27-BenHadjAlaya-FekiA.2008-1-5, + Title = {Interference cartography for hierarchical dynamic spectrum access}, + Address = {Chicago, IL}, + Author = {{Ben Hadj Alaya-Feki A.} and B. Sayrac and S. Ben Jemaa and E. Moulines}, + Booktitle = {Proc. IEEE Symp. on New Frontiers in Dynamic Spectrum Access Networks (DySPAN)}, + Date = {2008-10}, + Pages = {1-5} +} + +@Book{中国企业投资协会2014--, + Title = {投资台湾:大陆企业赴台投资指南}, + Address = {北京}, + Author = {{中国企业投资协会} and 台湾并购与私募股权协会 and 汇盈国际投资集团 and 国际投资集团}, + Publisher = {九州出版社}, + Year = {2014} +} + +@Book{中国企业投资协会2015--, + Title = {投资台湾:大陆企业赴台投资指南}, + Address = {北京}, + Author = {中国企业投资协会 and 台湾并购与私募股权协会 and 汇盈国际投资集团 and 国际投资集团}, + Publisher = {九州出版社}, + Year = {2015} +} + +@Manual{Tantau2015--, + Title = {The beamer class -- User Guide for version 3.36}, + Author = {Till Tantau and Joseph Wright and Vedran Miletić}, + Date = {2015-03-08}, + Url = {http://bitbucket.org/rivanvx/beamer} +} + +@Manual{Oetiker--, + Title = {一份不太简短的LATEX2ε介绍}, + Author = {Tobias Oetiker and Hubert Partl and Irene Hyna and Elisabeth Schlegl}, + Date = {2017-03}, + Translator = {ChinaTEX论坛}, + Url = {https://ctan.org/pkg/lshort-zh-cn}, + Urldate = {2018-04-23}, + Version = {5.10} +} + +@Manual{Daly2010--, + Title = {Natural Sciences Citations and References (package natbib)}, + Author = {Patrick W. Daly}, + Date = {2010-09-13}, + Url = {https://ctan.org/pkg/natbib}, + Urldate = {2018-04-27}, + Version = {8.31b} +} + +@Manual{Arseneau2010--, + Title = {chapterbib multiple bibliographies in LATEX}, + Author = {Donald Arseneau}, + Date = {2010-09-05}, + Url = {https://ctan.org/pkg/chapterbib}, + Urldate = {2018-04-23} +} + +@Manual{Shell2013--, + Title = {Mciteplus: Enhanced Multicitations}, + Author = {Michael Shell}, + Date = {2013-09-13}, + Url = {https://ctan.org/pkg/mciteplus}, + Urldate = {2018-04-23}, + Version = {1.2} +} + +@Online{Hansen2008--, + Title = {The multibib Package}, + Author = {Thorsten Hansen}, + Date = {2008-12-10}, + Url = {https://www.ctan.org/pkg/multibib}, + Urldate = {2018-05-04}, + Version = {v1.4} +} + +@Online{Seindal1994--, + Title = {Inline bibliography style}, + Author = {René Seindal}, + Date = {1994-12-06}, + Url = {https://www.ctan.org/pkg/inlinebib}, + Urldate = {2018-05-04} +} + +@Book{booknopubitems, + Title = {出版集团研究}, + Author = {余敏}, + Date = {2001}, + Pages = {50-63} +} + +@Comment{jabref-meta: databaseType:biblatex;} + +@Comment{jabref-entrytype: Newspaper: req[] opt[]} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015-gbk.def b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015-gbk.def index b2dc830eb6..402e13df90 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015-gbk.def +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015-gbk.def @@ -1,28 +1,28 @@ -%% -%% --------------------------------------------------------------- -%% biblatex-gb7714-2015 --- A biblatex implementation of the -%% GBT7714-2015 bibliography style, GBK supported file -%% Maintained by huzhenzhen -%% E-mail: hzzmail@163.com -%% Released under the LaTeX Project Public License v1.3c or later -%% --------------------------------------------------------------- -%% - - \def\str@bibliography{ο} - \def\str@references{ο} - \def\str@bytranslator{} - \def\str@andotherscn{} - \def\str@andcn{} - \def\str@backrefpage{ҳ} - \def\str@backrefpages{ҳ} - \def\str@noaddress{ز} - \def\str@nopublisher{߲} - \def\str@edition{} - \def\str@volumecn{} - \def\str@numbercn{} - \def\str@serialcn{} - \def\str@sameentry{ͬ} - \def\str@incn{} - \def\str@mathesiscn{˶ʿѧλ} - \def\str@phdthesiscn{ʿѧλ} - \def\str@editorcn{} +%% +%% --------------------------------------------------------------- +%% biblatex-gb7714-2015 --- A biblatex implementation of the +%% GBT7714-2015 bibliography style, GBK supported file +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% + + \def\str@bibliography{ο} + \def\str@references{ο} + \def\str@bytranslator{} + \def\str@andotherscn{} + \def\str@andcn{} + \def\str@backrefpage{ҳ} + \def\str@backrefpages{ҳ} + \def\str@noaddress{ز} + \def\str@nopublisher{߲} + \def\str@edition{} + \def\str@volumecn{} + \def\str@numbercn{} + \def\str@serialcn{} + \def\str@sameentry{ͬ} + \def\str@incn{} + \def\str@mathesiscn{˶ʿѧλ} + \def\str@phdthesiscn{ʿѧλ} + \def\str@editorcn{} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.bbx index ea6357c25e..0da0841ee9 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.bbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.bbx @@ -1,3899 +1,3900 @@ -%% -%% --------------------------------------------------------------- -%% biblatex-gb7714-2015 --- A biblatex implementation of the -%% GBT7714-2015 bibliography style,numerical sequence -%% Maintained by huzhenzhen -%% E-mail: hzzmail@163.com -%% Released under the LaTeX Project Public License v1.3c or later -%% --------------------------------------------------------------- -%% - -% -% 版本和时间信息 -% -\def\versionofgbtstyle{2020/07/21 v1.0v} -\def\versionofbiblatex{\abx@version} -\ProvidesFile{gb7714-2015.bbx}[\versionofgbtstyle biblatex bibliography style] -%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求 - -%===================================================================== -% 加载标准样式 -%===================================================================== -\RequireBibliographyStyle{numeric-comp} -\RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题 - - -%===================================================================== -% 功能函数 -%===================================================================== - % - % biblatex版本判断 - % 20180405,v1.0k,为兼容biblatexv3.11增加toggle:iftlnine,HU zhenzhen - % 20181020,v1.0n,为不再使用xstring宏包做的修改,hzz - % - % 原理方法:当版本继续更新时,增加一个新的toggle用以处理新的旧版,最新版和未判断出来的版本永远用iftlatest - \providetoggle{iftlfive}\togglefalse{iftlfive} %处理biblatex3.2之前版本,时间2016-03-01前 - \providetoggle{iftlsix}\togglefalse{iftlsix} %处理biblatex3.3开始改变姓名机制后版本,时间2016-03-01及以后 - \providetoggle{iftlseven}\togglefalse{iftlseven}%处理biblatex3.7的兼容性,时间2016-12-01后 - \providetoggle{iftleight}\togglefalse{iftleight}%处理biblatex3.8到3.9的兼容性,时间2017-11-01后到2017-12-01前 - \providetoggle{iftlnine}\togglefalse{iftlnine} %处理biblatex10的兼容性,时间2017-12-01后 - \providetoggle{iftlatest}\toggletrue{iftlatest} %假设是最新版biblatex - - \@ifpackagelater{biblatex}{2014/04/01}{ - \@ifpackagelater{biblatex}{2016/03/01}{ - \@ifpackagelater{biblatex}{2016/12/01}{ - \@ifpackagelater{biblatex}{2017/11/01}{ - \@ifpackagelater{biblatex}{2017/12/01}{ - \@ifpackagelater{biblatex}{2018/02/19}{} - {\toggletrue{iftlnine}\togglefalse{iftlatest}}} - {\toggletrue{iftleight}\togglefalse{iftlatest}}} - {\toggletrue{iftlseven}\togglefalse{iftlatest}}} - {\toggletrue{iftlsix}\togglefalse{iftlatest}}} - {\toggletrue{iftlfive}\togglefalse{iftlatest}}} - {\PackageError{biblatex}{Outdated 'biblatex' package} - {Please update biblatex, This is a fatal error.}} - - \newcommand\defversion[2]{\csdef{codeversion#1#2}}%定义不同版本的命令 - \newcommand\switchversion[2]{\csuse{codeversion#1#2}}%使用不同版本的命令 - - % - % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成 - % v1.0k,20180509,hzz - % - % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏 - % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8 - % 编码用xelatex编译的问题。 - % - % 原理是:利用perl正则将中文标识记录到域中, - % 然后利用\iffieldundef和\iffieldequalstr进行判断 - \providetoggle{ifCJKforgbt} - \def\testCJKfirst#1{% - \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{% - \iffieldequalstr{#1}{chinese}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}} - - % - % 2个卷的解析函数,用于连续出版物 - % - % 原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号 - \newcommand{\multivolparser}[1]{% - \IfSubStr{#1}{-}% - {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}% - {\def\multivolfirst{#1}\def\multivolsecond{}}% - } - - - % - % 2个期的解析函数,用于连续出版物 - % - \newcommand{\multinumberparser}[1]{% - \IfSubStr{#1}{-}% - {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}% - {\def\multinumberfirst{#1}\def\multinumbersecond{}}% - } - - % 对没有分隔符环境命令的低版本biblatex做增补,避免报错 - % - \iftoggle{iftlfive}{ - - \def\blx@inf@delimdeclare#1#2{% - \blx@info{Delimiter '#1' in context '#2' already defined, overwriting}} - - \def\blx@warn@delimuse#1#2{% - \blx@warning{Delimiter '#1' in context '#2' undefined}} - % Delimiter interface - - % []{}{} - \newrobustcmd*{\DeclareDelimFormat}{% - \@ifstar - {\blx@declaredelimclear} - {\blx@declaredelim}} - - \newrobustcmd*{\blx@declaredelimclear}[3][]{% - \ifcsvoid{blx@declaredelimcontexts@#2} - {} - {\def\do##1{\csundef{blx@printdelim@##1@#2}}% - \dolistcsloop{blx@declaredelimcontexts@#2}}% - \cslet{blx@declaredelimcontexts@#2}\@empty - \ifblank{#1} - {\blx@declaredelim{#2}{#3}} - {\blx@declaredelim[#1]{#2}{#3}}} - - \newrobustcmd*{\blx@declaredelim}[3][]{% - \ifblank{#1} - {\blx@declaredelim@i{}{}{#2}{#3}} - {\def\do##1{% - \listcsadd{blx@declaredelimcontexts@#2}{##1}% - \blx@declaredelim@i{blx@printdelim@##1@}{##1}{#2}{#3}}% - \docsvlist{#1}}}% - - \def\blx@declaredelim@i#1#2#3#4{% - \def\do@i##1{% - \ifcsdef{#1##1} - {\blx@inf@delimdeclare{##1}{#2}} - {}% - \csdef{#1##1}{#4}}% - \forcsvlist{\do@i}{#3}} - - % *[]{}{} - \newrobustcmd*{\DeclareDelimAlias}{% - \@ifstar - {\blx@declaredelimalias} - {\blx@declaredelimaliasauto}} - - \newrobustcmd*{\blx@declaredelimalias}[3][]{% - \ifblank{#1} - {\blx@declaredelimalias@i{}{#2}{#3}} - {\def\do##1{% - \blx@declaredelimalias@i{blx@printdelim@##1@}{#2}{#3}}% - \docsvlist{#1}}} - - \newrobustcmd*{\blx@declaredelimaliasauto}[2]{% - \blx@declaredelimalias@i{}{#1}{#2}% - \ifcsvoid{blx@declaredelimcontexts@#2} - {} - {\def\do##1{% - \blx@declaredelimalias@i{blx@printdelim@##1@}{#1}{#2}}% - \dolistcsloop{blx@declaredelimcontexts@#2}}} - - \def\blx@declaredelimalias@i#1#2#3{% - \ifcsdef{#1#2} - {\blx@inf@delimdeclare{#2}{#1}} - {}% - \csdef{#1#2}{\csuse{#1#3}}} - - \def\blx@delimcontext{none} - \newcommand*{\printdelim}[2][]{% - \ifblank{#1} - {\ifcsdef{blx@printdelim@\blx@delimcontext @#2} - {\csuse{blx@printdelim@\blx@delimcontext @#2}} - {\ifcsdef{#2}% fall back on legacy macros - {\csuse{#2}} - {\blx@warn@delimuse{#2}{*}}}} - {\ifcsdef{blx@printdelim@#1@#2} - {\csuse{blx@printdelim@#1@#2}} - {\blx@warn@delimuse{#2}{#1}}}} - - \newcommand*{\delimcontext}[1]{% - \edef\blx@delimcontext{\blx@delimcontextalias{#1}}} - - \def\blx@delimcontextalias#1{% - \ifcsdef{blx@delimcontextalias@#1} - {\csuse{blx@delimcontextalias@#1}} - {#1}} - - \newcommand*{\DeclareDelimcontextAlias}[2]{% - \csgdef{blx@delimcontextalias@#1}{#2}} - }{} - - -%===================================================================== -% 数据模型定义 -%===================================================================== - %定义类型和载体标识,从gb内容看载体基本属于介质。 - %为与lee zeping的bst的样式统一,使用mark和medium这两域名 - %为单个条目的姓名格式控制增加nameformat和namefmtid两个域 - %为缩略信息文献表增加了shortbooktitle域 - %为多语言排序增加了lansortorder域 - \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat} - \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid} - \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle} - \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder} - - %因为biblatex更新3.14版本以后,biber对于为声明数据模型的条目类型 - %不再默认读取,而是以空字符串作为条目类型名,自然在条目定义alias时 - %就会出现问题,因此显式的声明一下newspaper,然后保留后面采用alias的方式 - %而standard类型则是采用另一种方式直接在sourcemap中转换为其它类型。 - \@ifpackagelater{biblatex}{2019/11/30}{%2019/12/01 v3.14 - \DeclareDatamodelEntrytypes{newspaper}% - }{} - - - -%===================================================================== -% 设置宏包选项 -%===================================================================== - % - % 增加一个控制是否输出文献载体的选项 - % 20191125,v1,0s,hzz - \newtoggle{bbx:gbmedium} - \DeclareBibliographyOption{gbmedium}[true]{%biblatex低版本 - \settoggle{bbx:gbmedium}{#1}} - \ExecuteBibliographyOptions{gbmedium} - - % - % 增加一个控制是否输出annotation域的选项,该域可以用于在文献条目后面输出一些注释信息 - % 20190509,v1,0s,hzz - \newtoggle{bbx:gbannote} - \DeclareBibliographyOption{gbannote}[false]{%biblatex低版本 - \settoggle{bbx:gbannote}{#1}} - \ExecuteBibliographyOptions{gbannote} - % - %用于在文献条目后面输出注释信息的宏 - %FieldFormat{annotation}用于设置注释信息的格式 - \DeclareFieldFormat{annotation}{% - \printtext{\addspace(#1)}% - } - \renewbibmacro*{annotation}{% - \iftoggle{bbx:gbannote}% - {\iffieldundef{annotation}% - {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}% - {\printfield{annotation}}}% - {}% - } - - % - % 增加一个控制是否输出type域的选项 - % 20190212,v1,0q,hzz - \newtoggle{bbx:gbfieldtype} - \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本 - \settoggle{bbx:gbfieldtype}{#1}} - \ExecuteBibliographyOptions{gbfieldtype} - - % - % 增加一个控制是否根据页码重设脚注数字标号的选项 - % 20190422,v1,0r,hzz - \newtoggle{bbx:gbfnperpage} - \DeclareBibliographyOption{gbfnperpage}[false]{% - \settoggle{bbx:gbfnperpage}{#1}} - \ExecuteBibliographyOptions{gbfnperpage} - - - % - % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表 - % 20190203,v1.0p,hzz - % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签 - % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式 - % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题 - \DeclareBibliographyOption{gbfootbib}[false]{% - \ifstrequal{#1}{false}{}{\execgbfootbib}} - \ExecuteBibliographyOptions{gbfootbib} - - %% - \newlength{\footbibmargin} - \newlength{\footbiblabelsep} - \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离 - \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距 - \def\execgbfootbib% - {% - %开启引用跟踪计数器,为使用\ifciteseen等测试命令 - \ExecuteBibliographyOptions{citetracker=true} - % - %利用footmisc宏包来实现脚注文献的悬挂对齐 - \AtEndPreamble{ - \@ifclassloaded{beamer}{}{ - %beamer类因为其特殊性,为避免冲突不调footmisc。 - %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接 - %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。 - %\PassOptionsToPackage{perpage,hang}{footmisc}% - %\RequirePackage{footmisc}% - - %重新实现脚注的根据单页重设脚注号码 - %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改 - %v1.0q 20190317 hzz - %v1.0r 20190422 hzz 根据gbfnperpage选项设置 - \iftoggle{bbx:gbfnperpage}% - {\@addtoreset{footnote}{page}}{}%重设计数器 - -\@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义 - \long\def\H@@footnotetext##1{\insert\footins{% - \reset@font\footnotesize - \interlinepenalty\interfootnotelinepenalty - \splittopskip\footnotesep - \splitmaxdepth \dp\strutbox \floatingpenalty \@MM - \hsize\columnwidth \@parboxrestore - \protected@edef\@currentlabel{% - \csname p@footnote\endcsname\@thefnmark - }% - \color@begingroup - \leftskip \footbibmargin%增加的左侧缩进 - \@makefntext{% - \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% - }% - \color@endgroup}}% - - \long\def\H@@mpfootnotetext##1{% - \global\setbox\@mpfootins\vbox{% - \unvbox\@mpfootins - \reset@font\footnotesize - \hsize\columnwidth - \@parboxrestore - \protected@edef\@currentlabel - {\csname p@mpfootnote\endcsname\@thefnmark}% - \leftskip \footbibmargin%增加的左侧缩进 - \color@begingroup - \@makefntext{% - \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% - \color@endgroup}} - }{%否则对latex核心代码中的\@footnotetext做重定义 - \long\def\@footnotetext##1{\insert\footins{% - \reset@font\footnotesize - \interlinepenalty\interfootnotelinepenalty - \splittopskip\footnotesep - \splitmaxdepth \dp\strutbox \floatingpenalty \@MM - \hsize\columnwidth \@parboxrestore - \protected@edef\@currentlabel{% - \csname p@footnote\endcsname\@thefnmark - }% - \color@begingroup - \leftskip \footbibmargin%增加的左侧缩进 - \@makefntext{% - \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% - }% - \color@endgroup}}% - - \long\def\@mpfootnotetext##1{% - \global\setbox\@mpfootins\vbox{% - \unvbox\@mpfootins - \reset@font\footnotesize - \hsize\columnwidth - \@parboxrestore - \protected@edef\@currentlabel - {\csname p@mpfootnote\endcsname\@thefnmark}% - \leftskip \footbibmargin%增加的左侧缩进 - \color@begingroup - \@makefntext{% - \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% - \color@endgroup}} - } - - \long\def\@makefntext##1{%增加了脚注标记与正文的间隔 - \parindent 1em\noindent \hb@xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1} - - } - - % - %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式 - \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}} - %做patch使得脚注内容中的脚注数字标签不上标 - \pretocmd{\@makefntext}{% - \def\@makefnmark{% - \hbox{\textcircled{\tiny\@thefnmark}}% - }% - }{}{} - } - - % - %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容) - %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。 - %v1.0q 20190309 区分使脚注标注适应minipage中的情况 - \newbibmacro*{citesavefn}{% - \ifciteseen%当被引用过为true - {\ifcsdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%当已经定义过脚注序号信息 - {\csgdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% - \str@sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}% - \@makefnmark% - }}% - {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% - \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% - }}% - }% - {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% - \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% - %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断 - }}% - } - - % - %重定义\footfullcite使完成gb7714-2015的脚注文献要求 - \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% - {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 - \defcounter{minnames}{\blx@minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。 - \usebibmacro{prenote}% - \renewbibmacro*{postnote}{% - \iffieldundef{postnote}% - {}{\setunit{\addcolon\addspace}\printfield{postnote}}}%与ay样式不同,由于已修改postnote域格式,直接用printfield - }% - {\usebibmacro{citesavefn}% - \ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}% - {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%\nopunct - {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}% - }% - {\multicitedelim}% - {\usebibmacro{postnote}} - - } - - % - % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式 - % 20180814,v1.0m,hzz - % 原理方法: - % 只为兼容性考虑不做任何处理 - \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本 - } - - % - % 增加一个控制是否输出文献类型和载体标识的选项 - % - % 原理方法: - % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的 - % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本 - \newtoggle{bbx:gbtype} - %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本 - \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本 - \settoggle{bbx:gbtype}{#1}} - \ExecuteBibliographyOptions{gbtype} - - % - % 增加一个源文件编码选择选项,当true时可以使用GBK编码。 - % v1.0k, 2018.05.08, by hzz - % - % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档 - % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def - % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用 - % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。 - % 另外注意: - % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码 - % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常 - % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。 - \newtoggle{bbx:codegbk} - \DeclareBibliographyOption{gbcodegbk}[false]{% - \settoggle{bbx:codegbk}{#1}} - \ExecuteBibliographyOptions{gbcodegbk} - - \def\str@bibliography{参考文献} - \def\str@references{参考文献} - \def\str@bytranslator{译} - \def\str@andotherscn{等} - \def\str@andcn{和} - \def\str@backrefpage{引用页} - \def\str@backrefpages{引用页} - \def\str@noaddress{出版地不详} - \def\str@nopublisher{出版者不详} - \def\str@edition{版} - \def\str@volumecn{卷} - \def\str@numbercn{册} - \def\str@serialcn{第} - \def\str@sameentry{同} - \def\str@incn{见} - \def\str@mathesiscn{硕士学位论文} - \def\str@phdthesiscn{博士学位论文} - \def\str@editorcn{主编} - - \AtEndOfPackage{% - \iftoggle{bbx:codegbk}{% - \ExecuteBibliographyOptions{texencoding = GBK} - \input{gb7714-2015-gbk.def} - }{}} - - % - % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项 - % v1.0k, 2018.05.08, by hzz - % - % 原理方法: - % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息 - % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式 - % 可能需要用于中英文判断的language域的信息。 - \newtoggle{bbx:gbstrict} - \DeclareBibliographyOption{gbstrict}[true]{% - \settoggle{bbx:gbstrict}{#1}} - \ExecuteBibliographyOptions{gbstrict} - - % - % 增加一个控制标题域超链接设置的选项 - % v1.0k, 2018.05.24, by hzz - % - % 原理方法: - % 利用标题域格式来实现,默认设置该选项为false,不做超链接。 - % 设置为true,则标题设置超链接 - \newtoggle{bbx:titlelink} - \DeclareBibliographyOption{gbtitlelink}[false]{% - \settoggle{bbx:titlelink}{#1}} - \ExecuteBibliographyOptions{gbtitlelink} - - % - % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项 - % v1.0l, 2018.07.02, by hzz - % - % 原理方法: - % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置 - \newtoggle{bbx:ctexset} - \DeclareBibliographyOption{gbctexset}[true]{% - \settoggle{bbx:ctexset}{#1}} - \ExecuteBibliographyOptions{gbctexset} - - \AtEndOfPackage{% - \iftoggle{bbx:ctexset}{% - \def\blx@defbibstrings#1#2{% - \def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}% - \abx@dostrings - \csuse{abx@strings@#1}% - \setkeys{blx@lbx}{#2}% - \let\do\blx@defbibstrings@i - \csxdef{abx@strings@#1}{\abx@dostrings}% - } - }{}} - - % - % 增加一个处理佚名或noauthor的控制选项 - % - % 原理方法:在顺序编码制中不需要使用,为与作者年制的兼容性考虑,这里也增加避免报错 - \DeclareBibliographyOption{gbnoauthor}[true]{}% - - - % - % 增加一个恢复域格式为标准样式的控制选项 - % v1.0k, 2018.05.15, by hzz - % - % 原理方法: - % 默认设置该选项为false,采用国标要求的域格式输出相关域 - % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域 - \newtoggle{bbx:gbfieldstd} - \DeclareBibliographyOption{gbfieldstd}[false]{% - \settoggle{bbx:gbfieldstd}{#1}% - \ifstrequal{#1}{false}{}{\execgbfdfmtstd}% - } - \ExecuteBibliographyOptions{gbfieldstd} - - % - % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。 - % - \newtoggle{bbx:gbpub} - \DeclareBibliographyOption{gbpub}[true]{% - %\settoggle{bbx:gbpub}{#1} %或采用下面这一句 - \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}} - \ExecuteBibliographyOptions{gbpub} - - % - % 增加控制析出文献来源前的标点符号//输出的选项 - % v1.0k, 2018.04.20,added in by hzz - \newtoggle{bbx:gbpunctin} - \DeclareBibliographyOption{gbpunctin}[true]{% - \settoggle{bbx:gbpunctin}{#1}} - \ExecuteBibliographyOptions{gbpunctin} - - - - - - % - % 选项设置 - % - \ExecuteBibliographyOptions{ - sorting=none, - useprefix=true, %名字的信息包括前缀 - date = year, %日期仅写到年 - maxbibnames = 3,%设置名字最大数量 - minbibnames = 3, %设置缩减后的名字最小数量 - maxitems = 1,%设置列表最大数量 - minitems = 1, %设置缩减后的列表最小数量 - isbn=false, - } - - % - %为日期相关选项增加选项值gb7714-2015 - % - \csdef{mkdaterangegb7714-2015}#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year} - {} - {\printtext[#1date]{% - \blx@gbdate{#1}{}}}% - \endgroup} - - \newrobustcmd*{\blx@gbdate}[3][]{% - \dateeraprintpre{#2#3year}% - \blx@imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}% - \iffieldundef{#2#3month}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3month}}}% - \iffieldundef{#2#3day}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3day}}}} - - - %为姓名格式选择增加的计数器 - \newcounter{gbnamefmtcase} - \def\thegbnamefmtcase{\the\c@gbnamefmtcase} - %为数字标签格式选择增加的计数器/命令 - \newcommand{\mkgbnumlabel}[1]{\mkbibbrackets{#1}} - \def\gbbiblabelopt@bracket{\renewcommand{\mkgbnumlabel}[1]{\mkbibbrackets{##1}}} - \def\gbbiblabelopt@parens{\renewcommand{\mkgbnumlabel}[1]{\mkbibparens{##1}}} - \def\gbbiblabelopt@dot{\renewcommand{\mkgbnumlabel}[1]{##1\adddot}} - \def\gbbiblabelopt@plain{\renewcommand{\mkgbnumlabel}[1]{##1}} - \def\gbbiblabelopt@box{\renewcommand{\mkgbnumlabel}[1]{\framebox{##1}}} - \def\gbbiblabelopt@circle{\renewcommand{\mkgbnumlabel}[1]{\textcircled{##1}}} - %为文献表中数字标签对齐方式选择增加的计数器/命令 - \newcounter{gbalignlabel} - \def\thegbalignlabel{\the\c@gbalignlabel} - %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令 - \newcounter{gbcitelocalcase} - \newcounter{gbbiblocalcase} - \def\thegbcitelocalcase{\the\c@gbcitelocalcase} - \def\thegbbiblocalcase{\the\c@gbbiblocalcase} - -\@ifpackagelater{biblatex}{2016/03/27} - { % 针对biblatex>=3.3版本的选项设置 - % 增加不同语言排序的切换选项 - % numeric样式,不使用该选项,这里给出仅为兼容性考虑 - % v1.0q,20190307,hzz - % - % 增加不同语言排序的切换选项 - % gblanorder=chineseahead的顺序为cn,jp,kr,en,fr,ru - % gblanorder=englishahead的顺序为en,fr,ru,cn,jp,kr - % gblanorder=cn;en;ru;fr;jp;kr的顺序为指定的cn;en;ru;fr;jp;kr,自定义内容可以随意写以分号分隔 - % v1.0q,20190307,hzz - % - \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{% - \ifstrequal{#1}{chineseahead}%%中文在前的顺序 - {\gdef\lancnorder{1}\gdef\lanjporder{2}\gdef\lankrorder{3}% - \gdef\lanenorder{4}\gdef\lanfrorder{5}\gdef\lanruorder{6}}% - {% - \ifstrequal{#1}{englishahead}% - {\execlanodeah\dealsortlan}% - {\execlanodudf{#1}\dealsortlan}% - }% - } - \ExecuteBibliographyOptions{gblanorder} - - \def\execlanodeah{%中文在后的顺序 - \gdef\lancnorder{4} - \gdef\lanjporder{5} - \gdef\lankrorder{6} - \gdef\lanenorder{1} - \gdef\lanfrorder{2} - \gdef\lanruorder{3}} - - \newcounter{lanordernum} - \newcommand{\execlanodudf}[1]{%like:cn;en;ru;fr;jp;kr - \setcounter{lanordernum}{0} - \DeclareListParser{\parsinglanorder}{;} - \renewcommand*{\do}[1]{\stepcounter{lanordernum}\csxdef{lan##1order}{\thelanordernum}} - \parsinglanorder{#1} - } - - % - % 增加本地化字符串的中英文切换选项 - % gbcitelocal指标注中的本地化字符串 - % gbbiblocal 指文献表中的本地化字符串 - % gblocal 指设置文献表和标注中的本地化字符串 - % v1.0o,20190103,hzz - % - \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{% - \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}% - \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}% - \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}% - } - \ExecuteBibliographyOptions{gbcitelocal} - - \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{% - \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}% - \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}% - \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}% - } - \ExecuteBibliographyOptions{gbbiblocal} - - \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{% - \ExecuteBibliographyOptions{gbbiblocal=#1}% - \ExecuteBibliographyOptions{gbcitelocal=#1}% - } - %\ExecuteBibliographyOptions{gblocal} %默认值已经通过两个相关选项设置 - - % - % 增加序号标签格式处理选项 - % v1.0l,20180623,hzz - % - \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{% - \csuse{gbbiblabelopt@#1} - } - \ExecuteBibliographyOptions{gbbiblabel} - - % - % 增加姓名大小写格式处理选项 - % - \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{% - \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}% - \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}% - \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family - \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{} - \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given - \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family - } - \ExecuteBibliographyOptions{gbnamefmt} - - % - % 增加标签对齐选项 - % - % right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式 - \DeclareBibliographyOption[string]{gbalign}[right]{% - \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{} - \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{} - \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{} - \ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{} - } - } - {% 针对biblatex<3.3版本的选项设置 - % 增加不同语言排序的切换选项 - % numeric样式, biblatex 3.4及以下版本不能使用多个stylesourcemap,所以不使用该选项 - % v1.0q,20190307,hzz - % - \DeclareBibliographyOption{gblanorder}[chineseahead]{} - - % - % 增加序号标签格式处理选项 - % v1.0l,20180623,hzz - % - \DeclareBibliographyOption{gbbiblabel}[bracket]{% - \csuse{gbbiblabelopt@#1} - } - \ExecuteBibliographyOptions{gbbiblabel} - - % - % 增加姓名大小写格式处理选项 - % - \DeclareBibliographyOption{gbnamefmt}[uppercase]{% - \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}% - \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}% - \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family - \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{} - \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given - \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family - } - \ExecuteBibliographyOptions{gbnamefmt} - - % - % 增加标签对齐选项 - % - % 原理方法:right是默认的右对齐,left是左对齐,gb7714-2015无效,仍然为右对齐模式, - % 因为在这种biblatex低版本中,舍弃了list类环境后,会出错。 - % 注意:texlive2015中的3.0版中的DeclareBibliographyOption选项没有类型说明 - \DeclareBibliographyOption{gbalign}[right]{% - \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{} - \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{} - \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{} - \ifstrequal{#1}{gb7714-2015}{}{} - } - } - - -% -% 针对biblatex<3.3版本的选项设置,比如texlive2015中的3.0版 -% -\defversion{3.0}{opt}{ - \ExecuteBibliographyOptions{ - firstinits=true, %名字有缩写,参考3.1.2.3 Internal - } -} -% -% 针对3.3<=biblatex<3.5版本的选项设置,比如texlive2016中的3.4版 -% -\defversion{3.4}{opt}{ - \ExecuteBibliographyOptions{ - giveninits=true, %名字有缩写,参考3.1.2.3 Internal - } -} -% -% 针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版 -% -\defversion{3.7}{opt}{ - \ExecuteBibliographyOptions{ - giveninits=true, - urldate =edtf, %iso8601 - eventdate =edtf, - } -} -% -% 针对3.10<=biblatex版本的选项设置,比如texlive2018中的3.11版 -% -\defversion{3.10}{opt}{ - \ExecuteBibliographyOptions{ - giveninits=true, - urldate =gb7714-2015, %iso,iso8601,edtf - eventdate =gb7714-2015, - } -} - -% -% 根据biblatex版本信息,选择选项设置 -% -% 原理方法:如下这种选择机制能自动兼容更新的版本,但对于老版本 -% 必须要把情况列全。 -\iftoggle{iftlfive}{\switchversion{3.0}{opt}}{}%biblatex<=3.2 -\iftoggle{iftlsix}{\switchversion{3.4}{opt}}{}%3.3<=biblatex<=3.6 -\iftoggle{iftlseven}{\switchversion{3.7}{opt}}{}%biblatex=3.7 -\iftoggle{iftleight}{\switchversion{3.7}{opt}}{}%3.8<=biblatex<=3.9 -\iftoggle{iftlnine}{\switchversion{3.10}{opt}}{}%biblatex=3.10 -\iftoggle{iftlatest}{\switchversion{3.10}{opt}}{}%biblatex最新3.11 - - -%===================================================================== -% 设置本地化字符串 -%===================================================================== - % - % 新建当地化字符串,用来记录“等”字符、“和”字符 - % - \NewBibliographyString{andotherscn} - \NewBibliographyString{andothersincitecn} - \NewBibliographyString{andothersincite} - \NewBibliographyString{andcn} - \NewBibliographyString{andothersjp} - \NewBibliographyString{andotherskr} - \NewBibliographyString{andjp} - \NewBibliographyString{andkr} - \NewBibliographyString{andincitecn} - \NewBibliographyString{andincite} - \NewBibliographyString{volumecn} - \NewBibliographyString{numbercn} - \NewBibliographyString{serialcn} - \NewBibliographyString{incn} - \NewBibliographyString{mathesiscn} - \NewBibliographyString{phdthesiscn} - \NewBibliographyString{editorcn} - \NewBibliographyString{editorscn} - - - - % - % 修改一些当地化字符串 - % - % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件 - % 当然也可以增加比如上面定义的andotherscn - % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别 - - \DefineBibliographyStrings{english}{ - bibliography = {\str@bibliography}, - references = {\str@references}, - bytranslator= {\str@bytranslator},%\addperiod,%将trans. by 改成 译\addcomma\ - and = {\addcomma},%将第2和3人名间的and符号改成逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 - andcn = {\addcomma},%and本地化字符串的中文对应词 - andincitecn = {\str@andcn},%将标注中的分开,便于与文献表中的区分 - andincite = {\addcomma}, - %andothers = {et al.},%将超过3个人名的省略,et al.改成为 等 - andotherscn = {\str@andotherscn},%将超过3个人名的省略,et al.改成为 等 - andothersincitecn={\str@andotherscn},%将标注中的分开,便于与文献表中的区分 - andothersincite={et al\adddot}, - backrefpage = {\str@backrefpage:}, - backrefpages = {\str@backrefpages:}, - in={in\intitlepunct}, - volumecn={\str@volumecn}, - numbercn={\str@numbercn}, - serialcn={\str@serialcn}, - andothersjp={他}, - andotherskr={외}, - andjp={和}, - andkr={和}, - incn={\str@incn\addcolon\addspace}, - mathesiscn={\str@mathesiscn}, - phdthesiscn={\str@phdthesiscn}, - editorscn={\str@editorcn}, - editorcn={\str@editorcn}, -} - - % - % 增加两个命令用于临时的局部的修改本地化字符串 - % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串 - % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内 - % v1.0t,hzz,20190525 - \newcommand{\setlocalbibstring}[2]{% - \csdef{abx@sstr@#1}{#2}} - \newcommand{\setlocalbiblstring}[2]{% - \csdef{abx@lstr@#1}{#2}} - -%===================================================================== -% 动态数据修改 -%===================================================================== -% -% 各层次的数据映射和动态修改 -% -% 原理方法: -% 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中 -% 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性 -% 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个 -% 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次 -% 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。 -% 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符, -% 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息 -% -% 不同的文献类型使用相同的驱动输出可以有5种方法: -% 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型 -% 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型 -% 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型 -% 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名 -% 驱动别名定义本质上是做了驱动层映射 -% 5. 直接定义不同的类型的驱动,但驱动内容相同。 -% -% 关于数据映射和驱动使用的考虑如下: -% 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换 -% 2. 为减少代码量,尽量少做内容相同的不同类型驱动 -% 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名 -% 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type -% 可以在样式层映射做某些需要避免这种默认处置的转换 -% 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射 -% -% 文献类型和驱动考虑如下: -% 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article -% newpaper映射为article,并以note域做区分特殊处理 -% 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook -% standard映射为book或inbook,并以note域做区分特殊处理 -% collection和proceedings基本与book类似,因此做book驱动别名处理 -% incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理 -% 3. 专利类型有其特殊性,考虑patent类型 -% 4. 电子资源类型有其特殊性,考虑online类型 -% 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更新日期 -% 因此考虑用一种类型来输出,使用report类型 -% 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略, -% 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型 -% 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时, -% 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。 -% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述 -% 更多的信息,因此不存在网址时,独立做一个备选格式 -% 9. 出版项主要以如下方式处理: -% (a) location+institution+date 仅用于连续出版物 -% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report -% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型 -% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。 -% (e) 不输出,主要用于连续出版物析出的文献 -% 10. 日期以如下方式处理: -% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year -% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate -% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date -% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate - - -\DeclareSourcemap{ -\maps[datatype=bibtex]{% - \map{%当没有作者时将editor转成author - \pernottype{inbook}%因为in系列中editor可能用来表示bookauthor,所以排除 - \pernottype{inproceedings} - \pernottype{incollection} - \pernottype{periodical}%因为peridical直接使用editor,所以排除 - %注意notfield在低版本biblatex中没有 - %\step[notfield=author,final]%当author不存在,将editor复制给author - \step[fieldsource=editor,fieldtarget=author]%并删除editor - } - \map{%当没有作者时将translator转成author - \pernottype{inbook} - \pernottype{inproceedings} - \pernottype{incollection} - %\step[notfield=author,final]%当author不存在,将translator复制给author - \step[fieldsource=translator,fieldtarget=author]%并删除translator - } - \map{%让address和location同步,biblatex中address是location的别名 - %因此输出的时候只有location信息,但处理过程中是可以存在address的。 - %\step[notfield=address,final] - \step[fieldsource=location,final] - \step[fieldset=address,origfieldval] - } - \map{%让address和location同步 - %\step[notfield=location,final] - \step[fieldsource=address,final] - \step[fieldset=location,origfieldval] - } - \map{%处理在bib文件用mark标记文献类型标识符的情况 - \step[fieldsource=mark,final] - \step[fieldset=usera, origfieldval] - } - \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况 - \step[fieldsource=nameformat,match=lowercase,final] - \step[fieldset=namefmtid,fieldvalue={1}] - } - \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况 - \step[fieldsource=nameformat,match=givenahead,final] - \step[fieldset=namefmtid,fieldvalue={2}] - } - \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况 - \step[fieldsource=nameformat,match=familyahead,final] - \step[fieldset=namefmtid,fieldvalue={3}] - } - \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况 - \step[fieldsource=nameformat,match=pinyin,final] - \step[fieldset=namefmtid,fieldvalue={4}] - } - \map{%根据article确定文献类型标识符 - \pertype{article} - \step[fieldset=usera, fieldvalue={J}] - } - \map{%根据periodical确定文献类型标识符 - \pertype{periodical} - \step[fieldset=usera, fieldvalue={J}] - \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor - \step[fieldset=editor, origfieldval] - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符 - \pertype{newspaper} - \step[fieldset=usera, fieldvalue={N}] - \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断 - } - \map{%对应增加的一个数据库类型database确定文献类型标识符 - \pertype{database} - \step[fieldset=usera, fieldvalue={DB}] - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%对应增加的一个数据集类型dataset确定文献类型标识符 - \pertype{dataset} - \step[fieldset=usera, fieldvalue={DS}]% - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%对应增加的一个软件类型software确定文献类型标识符 - \pertype{software} - \step[fieldset=usera, fieldvalue={CP}] - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%对应增加的一个舆图类型map确定文献类型标识符 - \pertype{map} - \step[fieldset=usera, fieldvalue={CM}]% - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%对应增加的一个档案类型archive确定文献类型标识符 - \pertype{archive} - \step[fieldset=usera, fieldvalue={A}] - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以 - %当misc类型带有网址时,直接将其转换为online类型 - \pertype{misc} - \step[fieldsource=url,final] - \step[typesource=misc,typetarget=online] - } - \map{%对应增加的一个备选类型misc确定文献类型标识符 - \pertype{misc} - \step[fieldset=usera, fieldvalue={Z}]% - } - \map{ - \pertype{book} - \pertype{inbook} - \step[fieldset=usera, fieldvalue={M}] - \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition - \step[fieldset=edition, origfieldval] - } - \map{%兼容老的standard类型,确定文献类型标识符 - \pertype{standard} - \step[fieldset=usera, fieldvalue={S}] - \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断 - } - \map{ - \pertype{patent} - \step[fieldset=usera, fieldvalue={P}] - } - \map{ - \pertype{inproceedings} - \pertype{conference}%兼容老的conference类型 - \step[fieldset=usera, fieldvalue={C}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{proceedings} - \step[fieldset=usera, fieldvalue={C}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{incollection} - \step[fieldset=usera, fieldvalue={G}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{collection} - \step[fieldset=usera, fieldvalue={G}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{report} - \pertype{techreport}%兼容老的techreport类型 - \step[fieldset=usera, fieldvalue={R}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{thesis} - \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型 - \pertype{phdthesis} - \step[fieldset=usera, fieldvalue={D}] - \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{ - \pertype{online} - \pertype{electronic}%兼容老的electronic类型 - \pertype{www}%兼容老的www类型 - \step[fieldset=usera, fieldvalue={EB}] - \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册 - \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 - \step[fieldset=institution, origfieldval] - } - \map{ - \pertype{manual} - \step[fieldset=usera, fieldvalue={A}] - \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version - \step[fieldset=version, origfieldval] - \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 - \step[fieldset=institution, origfieldval] - } - \map{ - \pertype{unpublished} - \step[fieldset=usera, fieldvalue={Z}] - } - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - }% - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={editor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - }% - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={translator}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - }% - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={bookauthor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - }% - \map{%处理一些用year表示date的情况 - %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。 - %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息 - \step[fieldsource=year] - \step[fieldset=date, origfieldval] - } - \map{%将entrykey放入keywords中用于后期使用 - \step[fieldsource=entrykey] - \step[fieldset=keywords, origfieldval] - } - \map{\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=userd,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=userd,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=userd,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=userd,fieldvalue={korean}]%韩语 - } - \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题 - \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]% - \step[fieldset=userd, fieldvalue={chinese}] - } - \map{%将没有设置userd,且存在title域的默认设置为英文 - \step[fieldsource=title,final] - \step[fieldset=userd,fieldvalue={english}] - } - \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=userf,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=author,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=userf,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=author,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=userf,fieldvalue={korean}]%韩语 - } - \map{%作者的中文判断 - \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=userf, fieldvalue={chinese}] - } - \map{%将没有设置userf,且存在author域的默认设置为英文 - \step[fieldsource=author,final] - \step[fieldset=userf,fieldvalue={english}] - } - \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=usere,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=translator,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=usere,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=translator,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=usere,fieldvalue={korean}]%韩语 - } - \map{%译者的中文判断 - \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=usere, fieldvalue={chinese}] - } - \map{%将没有设置usere,且存在translator域的默认设置为英文 - \step[fieldsource=translator,final] - \step[fieldset=usere,fieldvalue={english}] - } - \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=userc,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=userc,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=userc,fieldvalue={korean}]%韩语 - } - \map{%编者的中文判断 - \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 - \step[fieldset=userc, fieldvalue={chinese}] - } - \map{%将没有设置userc,且存在editor域的默认设置为英文 - \step[fieldsource=editor,final] - \step[fieldset=userc,fieldvalue={english}] - } - \map{\step[fieldsource=bookauthor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=userb,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=bookauthor,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=userb,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=bookauthor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=userb,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=bookauthor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=userb,fieldvalue={korean}]%韩语 - } - \map{%编者的中文判断 - \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 - \step[fieldset=userb, fieldvalue={chinese}] - } - \map{%将没有设置userc,且存在editor域的默认设置为英文 - \step[fieldsource=bookauthor,final] - \step[fieldset=userb,fieldvalue={english}] - } - \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language - \step[fieldset=language,origfieldval]%本身language存在则不设定 - } - \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language - \step[fieldset=language,origfieldval] - }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。 - \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。 - \step[fieldset=language,fieldvalue={english}] - } - \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断, - %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况, - %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd - \step[fieldsource=language] - \step[fieldset=userd,origfieldval] - } - \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言 - %biblatex 3.11及以下版本仅有match是区分大小写的,而3.12版开始用matchi来区分大小,而match不区分 - %这里为兼容3.11及以下版本,所以用一个复杂一点的正则表达式 - \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final] - \step[fieldset=langid,fieldvalue={english}] - \step[fieldset=lansortorder,fieldvalue=\lanenorder] - } - \map{ - \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final] - \step[fieldset=langid,fieldvalue={russian}] - \step[fieldset=lansortorder,fieldvalue=\lanruorder] - } - \map{% - \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final] - \step[fieldset=langid,fieldvalue={french}] - \step[fieldset=lansortorder,fieldvalue=\lanfrorder] - } - \map{% - \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, - \step[fieldset=langid,fieldvalue={english}] - \step[fieldset=lansortorder,fieldvalue=\lancnorder] - } - \map{% - \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, - \step[fieldset=langid,fieldvalue={english}] - \step[fieldset=lansortorder,fieldvalue=\lanjporder] - } - \map{% - \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english, - \step[fieldset=langid,fieldvalue={english}] - \step[fieldset=lansortorder,fieldvalue=\lankrorder] - } -} -} - - -% -% 修改输入的参考文献数据,样式层的操作 -% -% 原理方法:因为biblatex3.0版的map不使用foreach选项,所以需要一个一个写,以处理特殊字符 -\defversion{3.0}{map}{ - \DeclareStyleSourcemap{ - \maps[datatype=bibtex]{ - \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook, - %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 - %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断 - \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook - \step[typesource=standard, typetarget=inbook, final] - } - \map{%剩下的全部映射为book - \step[typesource=standard, typetarget=book, final] - } -% \map{%先于标准样式的driver层映射,以取消type设置 -% \step[typesource=mastersthesis, typetarget=thesis, final] -% %\step[fieldset=type, fieldvalue=mathesis] -% } -% \map{%先于标准样式的driver层映射,以取消type设置 -% \step[typesource=phdthesis, typetarget=thesis, final] -% %\step[fieldset=type, fieldvalue=phdthesis] -% } - \map{%先于标准样式的driver层映射,以取消type设置 - \step[typesource=techreport, typetarget=report, final] - %\step[fieldset=type, fieldvalue=techreport] - } - \map{% - \pertype{report} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=report,typetarget=online] - \step[fieldset=note,fieldvalue={report}] - } - \map{% - \pertype{thesis} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=thesis,typetarget=online] - } - \map{% - \pertype{manual} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=manual,typetarget=online] - } - \map{% - \pertype{unpublished} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=unpublished,typetarget=online] - } - \map{% - \pertype{database} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=databasetypetarget=online] - } - \map{% - \pertype{dataset} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=dataset,typetarget=online] - } - \map{% - \pertype{software} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=software,typetarget=online] - } - \map{% - \pertype{map} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=map,typetarget=online] - } - \map{% - \pertype{archive} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=archive,typetarget=online] - } - \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确) - \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 - \step[fieldset=keywords, fieldvalue={,}, append] - \step[fieldset=keywords, origfieldval, append] - } - \map[overwrite]{%title,booktitle,journaltitle,journal,publisher,address,location,institution,organization - \step[fieldsource={title}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={booktitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={journaltitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={journal}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={publisher}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={address}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={location}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={institution}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={booktitle}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] - } - \map[overwrite]{ - \step[fieldsource={booktitle}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] - } - } - } -} - -% -% 修改输入的参考文献数据,样式层的操作 -% -% 原理方法:biblatex3.4以上版本 -\defversion{3.4}{map}{ - \DeclareStyleSourcemap{ - \maps[datatype=bibtex]{ - \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook, - %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 - %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断 - \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook - \step[typesource=standard, typetarget=inbook, final] - } - \map{%剩下的全部映射为book - \step[typesource=standard, typetarget=book, final] - } -% \map{%先于标准样式的driver层映射,以取消type设置 -% \step[typesource=mastersthesis, typetarget=thesis, final] -% %\step[fieldset=type, fieldvalue=mathesis] -% } -% \map{%先于标准样式的driver层映射,以取消type设置 -% \step[typesource=phdthesis, typetarget=thesis, final] -% %\step[fieldset=type, fieldvalue=phdthesis] -% } - \map{%先于标准样式的driver层映射,以取消type设置 - \step[typesource=techreport, typetarget=report, final] - %\step[fieldset=type, fieldvalue=techreport] - } - \map{% - \pertype{report} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=report,typetarget=online] - \step[fieldset=note,fieldvalue={report}] - } - \map{% - \pertype{thesis} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=thesis,typetarget=online] - } - \map{% - \pertype{manual} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=manual,typetarget=online] - } - \map{% - \pertype{unpublished} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=unpublished,typetarget=online] - } - \map{% - \pertype{database} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=databasetypetarget=online] - } - \map{% - \pertype{dataset} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=dataset,typetarget=online] - } - \map{% - \pertype{software} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=software,typetarget=online] - } - \map{% - \pertype{map} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=map,typetarget=online] - } - \map{% - \pertype{archive} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=archive,typetarget=online] - } - \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确) - \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 - \step[fieldset=keywords, fieldvalue={,}, append] - \step[fieldset=keywords, origfieldval, append] - } - \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ - \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] - } - \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ - \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] - } - \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,% - address,location,institution,organization}]{ - \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - } - } -} - -\iftoggle{iftlfive}% - {\switchversion{3.0}{map}}%%当采用biblatex<=3.2版本时 - {\switchversion{3.4}{map}}%%当采用3.3<=biblatex版本时 - - -% -% 不同语言分集调整的实现方式 -% -% 原理方法:利用样式层的动态数据修改lansortorder域来实现排序 -\def\dealsortlan{ - \DeclareStyleSourcemap{ - \maps[datatype=bibtex]{ - \map[overwrite]{%当文献给出language域时,设置文献要使用的本地化字符串的语言 - \step[fieldsource=language,match=english,final] - \step[fieldset=lansortorder,fieldvalue=\lanenorder] - } - \map[overwrite]{ - \step[fieldsource=language,match=russian,final] - \step[fieldset=lansortorder,fieldvalue=\lanruorder] - } - \map[overwrite]{% - \step[fieldsource=language,match=french,final] - \step[fieldset=lansortorder,fieldvalue=\lanfrorder] - } - \map[overwrite]{% - \step[fieldsource=language,match=chinese,final]%中日韩语目前都用english, - \step[fieldset=lansortorder,fieldvalue=\lancnorder] - } - \map[overwrite]{% - \step[fieldsource=language,match=japanese,final]%中日韩语目前都用english, - \step[fieldset=lansortorder,fieldvalue=\lanjporder] - } - \map[overwrite]{% - \step[fieldsource=language,match=korean,final]%中日韩语目前都用english, - \step[fieldset=lansortorder,fieldvalue=\lankrorder] - } - } - } -} - -% -%驱动别名等价于驱动层映射 -% -\DeclareBibliographyAlias{newspaper}{article}% -\DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动 -\DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动 -\DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动 -\DeclareBibliographyAlias{collection}{book}%%文集类型驱动 -\DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动 -\DeclareBibliographyAlias{thesis}{manual}%学位论文驱动 -\DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动 -\DeclareBibliographyAlias{database}{manual} -\DeclareBibliographyAlias{dataset}{manual} -\DeclareBibliographyAlias{software}{manual} -\DeclareBibliographyAlias{map}{manual} -\DeclareBibliographyAlias{archive}{manual} - -%===================================================================== -% 设置排序格式 -%===================================================================== -% -% 排序格式,用降序,及userb域,针对biblatex3.7及以下版本 -% -\defversion{3.7}{sort}{%这是3.4版的,3.7版略有差异,但不大,后面有注释 - \DeclareSortingScheme{gb7714-2015}{ - \sort{ - \field{presort} - } - %\sort[final]{ - %\field{sortkey} - %} - \sort{ - \field{lansortorder}%language - } - \sort{ - \field{sortkey} - } - \sort{%[direction=descending] - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sortyear} - \field{year} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} - \literal{0000}%3.7版是\literal{0} - } - } - - %降序的nyt - \DeclareSortingScheme{gbnytd}{ - \sort{ - \field{presort} - } - %\sort[final]{ - %\field{sortkey} - %} - \sort{ - \field{lansortorder}%language - } - \sort[direction=descending]{ - \field{sortkey} - } - \sort[direction=descending]{ - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sortyear} - \field{year} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} - \literal{0000}%3.7版是\literal{0} - } - } - - %降序的ynt - \DeclareSortingScheme{gbyntd}{ - \sort{ - \field{presort} - } - %\sort[final]{ - %\field{sortkey} - %} - \sort{ - \field{lansortorder}%language - } - \sort[direction=descending]{ - \field{sortyear} - \field{year} - } - \sort{ - \field{sortkey} - } - \sort{ - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} - \literal{0000}%3.7版是\literal{0} - } - } - - %升序的ynt - \DeclareSortingScheme{gbynta}{ - \sort{ - \field{presort} - } - %\sort[final]{ - %\field{sortkey} - %} - \sort{ - \field{lansortorder}%language - } - \sort{ - \field{sortyear} - \field{year} - } - \sort{ - \field{sortkey} - } - \sort{ - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} - \literal{0000}%3.7版是\literal{0} - } - } -} - - -% -% 排序格式,用降序,及userb域,针对biblatex3.8及以上版本 -% -\defversion{3.8}{sort}{ - \DeclareSortingTemplate{gb7714-2015}{ - \sort{ - \field{presort} - } - %\sort[final]{ - %\field{sortkey} - %} - \sort{ - \field{lansortorder}%language - } - \sort{ - \field{sortkey} - } - \sort{%[direction=descending] - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sortyear} - \field{year} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field{volume} - \literal{0} - } - } - - %降序的nyt - \DeclareSortingTemplate{gbnytd}{ - \sort{ - \field{presort} - } -% \sort[final]{ -% \field{sortkey} -% } - \sort{ - \field{lansortorder}%language - } - \sort[direction=descending]{ - \field{sortkey} - } - \sort[direction=descending]{% - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sortyear} - \field{year} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field{volume} - \literal{0} - } - } - - %降序的ynt - \DeclareSortingTemplate{gbyntd}{ - \sort{ - \field{presort} - } -% \sort[final]{ -% \field{sortkey} -% } - \sort{ - \field{lansortorder}%language - } - \sort[direction=descending]{ - \field{sortyear} - \field{year} - } - \sort{ - \field{sortkey} - } - \sort{% - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field{volume} - \literal{0} - } - } - - %升序的ynt - \DeclareSortingTemplate{gbynta}{ - \sort{ - \field{presort} - } -% \sort[final]{ -% \field{sortkey} -% } - \sort{ - \field{lansortorder}%language - } - \sort{%[direction=ascending] - \field{sortyear} - \field{year} - } - \sort{ - \field{sortkey} - } - \sort{% - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field{volume} - \literal{0} - } - } -} - - -\ifboolexpr{ -test {\iftoggle{iftlfive}} -or -test {\iftoggle{iftlsix}} -or -test {\iftoggle{iftlseven}}%biblatex<=3.7 -}{\switchversion{3.7}{sort}}{\switchversion{3.8}{sort}}%3.8<=biblatex - -%===================================================================== -% 参考文献表环境 -%===================================================================== -% -% 列表格式 -% -% 增加一个\bibitemindent尺寸用于控制list环境的itemindent -% v1.0l,20180615,hzz -% v1.0t,20200319,hzz,增加尺寸\biblabelextend使某些字体下标签宽度不足时可增加标签宽度 -\setlength{\bibhang}{\biblabelsep}% -\newlength{\bibitemindent} -\setlength{\bibitemindent}{0pt} -\newlength{\biblabelextend} -\setlength{\biblabelextend}{0pt} - - -\defbibenvironment{bibliography} - {\list - {\printtext[labelnumberwidth]{% - \printfield{labelprefix}% - \printfield{labelnumber}}} - {\addtolength{\labelnumberwidth}{\biblabelextend}% - \setlength{\labelwidth}{\labelnumberwidth}% - \setlength{\labelsep}{\biblabelsep}% - \setlength{\leftmargin}{\bibhang}% - \addtolength{\leftmargin}{\labelnumberwidth}% - \setlength{\itemindent}{\bibitemindent}% - \setlength{\itemsep}{\bibitemsep}% - \setlength{\parsep}{\bibparsep}}% - \renewcommand*{\makelabel}[1]{\hss##1}} - {\endlist} - {\item} - -% -% 顺序编码制-标签对齐方式处理 -% -% 原理方法:利用选项提供的计数器数值做选择 -% 左对齐,右对齐为list环境下的处理,此时list环境的\labelwidth只能设置一个,是最宽标签的宽度 -% 项对齐则是在段落环境下做的处理。 -% 左对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距可变 -% 右对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距相等,标签与页边距离可变 -% 项对齐时,序号标签贴在页边,序号标签与参考文献项内容的间距相等 -% 修改序号标签格式为: -% \DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} %源来自numeric.BBX -% \DeclareFieldFormat{labelnumberwidth}{\ttfamily\mkbibbrackets{#1}\hfill} -\DeclareFieldFormat{labelnumberwidth}{% -\ifcase\value{gbalignlabel}%右对齐,整个标签为右对齐 - \mkgbnumlabel{#1}% -\or%左对齐,整个标签为左对齐 - \mkgbnumlabel{#1}\hfill% -\or%中间对齐,比如:序号数字居于[]中间 - \hfil\mkgbnumlabel{\hfill#1\hfill}\hfil% -\fi} - -% -% 修改序号标签格式为以各条参文献为基础进行对齐的方式,即序号与条目内容间隔相等的方式。 -\def\setaligngbstyle{% -\def\blx@bibitem##1{% - \blx@ifdata{##1} - {\begingroup - \blx@getdata{##1}% - \blx@bibcheck - \iftoggle{blx@skipentry}{}{% - \blx@setdefaultrefcontext{##1}% - \global\let\blx@noitem\@empty - \blx@setoptions@type\abx@field@entrytype - \blx@setoptions@entry - \blx@thelabelnumber - \addtocounter{instcount}\@ne - \blx@initsep - \blx@namesep - \csuse{blx@item@\blx@theenv}\relax -% \blx@initsep %移动到上面去,恢复bibnamesep等的作用机制 -% \blx@namesep - \csuse{blx@hook@bibitem}% - \blx@execute - \blx@initunit - \blx@anchor - \blx@beglangbib - \bibsentence - \blx@pagetracker - \blx@driver\abx@field@entrytype - \blx@postpunct - \blx@endlangbib}% - \par\endgroup}%这里增加了一个\par - {}} -\newlength{\lengthid} -\newlength{\lengthlw} -\newcommand{\itemcmd}{% -\settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}} -\addtolength{\lengthid}{\biblabelsep} -\setlength{\lengthlw}{\textwidth} -\addtolength{\lengthlw}{-\lengthid} -\addvspace{\bibitemsep}%恢复\bibitemsep的作用 -%\parshape 2 0em \textwidth \lengthid \lengthlw -\hangindent\lengthid -\mkgbnumlabel{\printfield{labelnumber}}% -\hspace{\biblabelsep}} -% -% 简单的段落环境 -\defbibenvironment{bibliography} -{\begingroup\setlength{\parindent}{0em}} -{\endgroup} -{\itemcmd}} - - -%===================================================================== -% 设置单元或块等的标点 -%===================================================================== -\renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin -\renewcommand*{\subtitlepunct}{\addcolon\addspace} %修改标题和其它标题信息间的标点,来源biblatex.def, -% -% 利用set实现的多语言文献不同语言间的分隔符 -% 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进 -% -% 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets -% 这里调整一下两种语言参考文献的间隔,源来自biblatex.def -\renewcommand*{\entrysetpunct}{\adddot\newline\nobreak} -\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号 -%\renewcommand{\relateddelim}{}%\par - -%===================================================================== -% 修改域的格式,重定义域的输出宏 -%===================================================================== -% -% 新增文献类型标识符的格式 -% []前的nobreak,从GB4.1节的例子看不应该加,所以去掉 -% 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上 -% 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉 -% -\DeclareFieldFormat{gbtypeflag}{% -\iftoggle{bbx:gbmedium}% -{\iftoggle{bbx:url}% - {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% - }% - {\ifentrytype{online}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% - }}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% -} - -% -% 新增用于报纸的文献类型标识符的格式 -% -\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper -\iftoggle{bbx:gbmedium}% -{\iftoggle{bbx:url}% - {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% - {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% - }% - {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% -}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}% -} - -% -% 新增用于标准的文献类型标识符的格式 -% -\DeclareFieldFormat{gbtypeflags}{%用于标准standard -\iftoggle{bbx:gbmedium}% -{\iftoggle{bbx:url}% - {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% - {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% - }% - {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% -}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}% -} - -% -% 重设title等参考文献信息的输出格式 -% -% 原理方法:修改来自biblatex.def文件的原格式 -\newcommand{\bibtitlefont}{} -\newcommand{\bibauthorfont}{} -\newcommand{\bibpubfont}{} - -\DeclareFieldFormat{title}{#1\adddot\addthinspace} -\DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪 -\DeclareFieldFormat{issuetitle}{#1} -\DeclareFieldFormat{maintitle}{#1} -\DeclareFieldFormat{booktitle}{#1} -\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 - [article,patent,thesis,unpublished] - {title}{#1\adddot\addthinspace}%\mkbibquote{#1\isdot} -\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 - [inbook,incollection,inproceedings] - {title}{#1}%\nopunct\unspace -\DeclareFieldFormat{url}{\url{#1}} %%url相关输出,url域修改如本行,源来自biblatex.def -\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily -%\urlstyle{rm} %使用这句也一样 -\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行 -\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行 -\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行 -\DeclareFieldFormat{doi}{% - \rmfamily{DOI}\addcolon\space - \ifhyperref - {\href{https://doi.org/#1}{\nolinkurl{#1}}} - {\nolinkurl{#1}}} -% -% 标题的字母大小写格式修改 -% -% 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase -% 因为titlecase is applied to the contents of the field directly,title is not -%\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写 -\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{% -\iffieldundef{url}{\MakeCapital#1}{% -\href{\thefield{url}}{#1}}}{\MakeCapital#1}}%重设标题格式,将其修改为首字母大写 -\DeclareFieldFormat{pages}{#1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{#1} -\DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线 - -\def\execgbfdfmtstd{%恢复到标准样式的设置 -\DeclareFieldFormat{title}{\mkbibemph{##1}} -\DeclareFieldFormat - [article,inbook,incollection,inproceedings,patent,thesis,unpublished] - {title}{\mkbibquote{##1\isdot}} -\DeclareFieldFormat - [suppbook,suppcollection,suppperiodical] - {title}{##1} -\DeclareFieldFormat{journaltitle}{\mkbibemph{##1}} -\DeclareFieldFormat{issuetitle}{\mkbibemph{##1}} -\DeclareFieldFormat{maintitle}{\mkbibemph{##1}} -\DeclareFieldFormat{booktitle}{\mkbibemph{##1}} -\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{##1}} -\DeclareFieldFormat{titlecase}{##1} -\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{##1}} -} - -% -% 文献标题后的标点问题 -% v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen -% -% 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况: -% texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于 -% 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响 -% 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct -\ifboolexpr{% - test{\iftoggle{iftlfive}} - or - test{\iftoggle{iftlsix}} - }{}% - {%texlive 2017对应iftlseven以上版本 - \@ifclassloaded{beamer}{ - \DeclareFieldFormat{title}{#1}% - \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1} - \AtBeginDocument{% - \patchcmd{\abx@macro@title}{\newunitpunct}{}{}{}}}{} - } - - -% -% 修改译者位置格式 -% -% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式 -\renewbibmacro*{bytranslator+others}{\bibauthorfont% - \ifnameundef{translator} - {} - {%\usebibmacro{bytranslator+othersstrg} - %\setunit{\addspace}% - \printnames[bytranslator]{translator}% - \clearname{translator}% - %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理 - %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串 - \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。 - %\setunit{\addspace}% - \newunit}% - \usebibmacro{withothers}} - - -% -% 修改作者数量超过限定值,做省略时的处理格式 -% v1.0,20160701,hzz -% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim -% -% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。 -\renewbibmacro*{name:andothers}{\bibauthorfont% - \ifboolexpr{ - test {\ifnumequal{\value{listcount}}{\value{liststop}}} - and - test \ifmorenames - }{\ifnumgreater{\value{liststop}}{1}% - {\finalandcomma}% - {}% -\printdelim{andothersdelim}\printdelim{strandothersdelim}% -}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如: -%袁训来, 陈哲, 肖书海, 等. -%胡泳, 范海燕, 译. -%潘惠霞, 魏婧, 杨艳, 等译. -\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理 -}} - - -% 修改省略作者后的本地化字符串,比如et al. -% v1.0o,20190103,hzz -% -% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。 -% 非默认情况,根据选项信息,选择选择强制中文或英文 -% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 -% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 -\DeclareDelimFormat{strandothersdelim}{% - \edef\userfieldabcde{userd}%这里使用\iffieldequalstr{labelnamesource}替代ifcurrentname因为标注中使用ifcurrentname无效 - \iffieldequalstr{labelnamesource}{translator}{\edef\userfieldabcde{usere}}{}% - \iffieldequalstr{labelnamesource}{editor}{\edef\userfieldabcde{userc}}{}% - \iffieldequalstr{labelnamesource}{author}{\edef\userfieldabcde{userf}}{}% - \iffieldequalstr{labelnamesource}{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbcitelocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\ifbibstring{andothersincitecn}{\bibstring{andothersincitecn}}{\bibstring{andothers}}}{}%中文已经通过english本地化字符串定义 - \iffieldequalstr{\userfieldabcde}{korean}{\ifbibstring{andotherskr}{\bibstring{andotherskr}}{\bibstring{andothers}}}{}%韩语未定义,所以与bib中一致 - \iffieldequalstr{\userfieldabcde}{japanese}{\ifbibstring{andothersjp}{\bibstring{andothersjp}}{\bibstring{andothers}}}{}%日与同韩语 - \iffieldequalstr{\userfieldabcde}{english}{\ifbibstring{andothersincite}{\bibstring{andothersincite}}{\bibstring{andothers}}}{}%英语已定义 - \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%法语未定义,若要定义需要针对french本地化字符串定义 - \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%俄语未定义,若要定义需要针对russian本地化字符串定义 - \or% - \bibstring{andothersincitecn}% - \or% - \bibstring{andothersincite}% - \fi} - - -\DeclareDelimFormat[bib,biblist]{strandothersdelim}{% - \edef\userfieldabcde{userd}% - \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbbiblocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}% - \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}% - \or% - \bibstring{andotherscn}% - \or% - \bibstring{andothers}% - \fi} - -% -% 修改最后一个作者前的字符串,比如 and -% v1.0o,20190103,hzz -% -% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。 -% 非默认情况,根据选项信息,选择选择强制中文或英文 -% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 -% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 -\DeclareDelimFormat{finalnamedelim}{% - \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% -% \addspace% - \edef\userfieldabcde{userd}% - \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbcitelocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\space\bibstring{andincite}\space}{}% - \iffieldequalstr{\userfieldabcde}{french}{\space\bibstring{and}\space}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\space\bibstring{and}\space}{}% -%\space% - \or% - \bibstring{andincitecn}%\space% - \or% -\space\bibstring{andincite}\space% - \fi} - -\DeclareDelimFormat[bib,biblist]{finalnamedelim}{% - \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% - \addspace% - \edef\userfieldabcde{userd}% - \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbbiblocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}% - \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% -\space% - \or% - \bibstring{andcn}\space% - \or% - \bibstring{and}\space% - \fi} - - -% -% 重设title的输出 -% -% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen -% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件 -% 利用toggle做标识符是否输出的判断 -\renewbibmacro*{title}{% - \ifboolexpr{% - test{\iffieldundef{title}}% - and - test{\iffieldundef{subtitle}}% - }% - {}% - {\printtext[title]{\bibtitlefont%增加字体控制命令 - \printfield[titlecase]{title}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct}% - \printfield[titlecase]{subtitle}}% - \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 - {\setunit{\subtitlepunct}\printfield{titleaddon}}% - \iftoggle{bbx:gbtype}{% - \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 - {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 - {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 - {\printfield[gbtypeflag]{usera}}}%其它 - }}{}% - %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 - %\newunit -}% -}} - -% -% 作者信息的输出格式 -% -% 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen -% 20180603,v1.0l,增加使用nameformat域来选择姓名格式 -\DeclareNameFormat{namefmtselected}{% -\iffieldundef{namefmtid}{}% -{\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}% -\ifcase\value{gbnamefmtcase}% - \ifgiveninits - {\usebibmacro{name:gbuppercase} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:gbuppercase} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% -\or - \ifgiveninits - {\usebibmacro{name:gblowercase} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:gblowercase} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% -\or - \ifgiveninits - {\usebibmacro{name:given-family} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:given-family} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% -\or - \ifgiveninits - {\usebibmacro{name:family-given} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:family-given} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% -\or -\usebibmacro{name:gbpinyin} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}% -\or - \ifnumequal{\value{listcount}}{1} - {\ifgiveninits - {\usebibmacro{name:family-given} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:family-given} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% - \ifboolexpe{% - test {\ifdefvoid\namepartgiven} - and - test {\ifdefvoid\namepartprefix}} - {} - {\usebibmacro{name:revsdelim}}} - {\ifgiveninits - {\usebibmacro{name:given-family} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:given-family} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}}% -\fi - \usebibmacro{name:andothers}} - -\DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式 -\DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family -\DeclareNameAlias{citename}{default}% Default used by \citename - -\DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace} -%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% - -%GB/T 7714-2015 风格,全部大写 -\newbibmacro*{name:gbuppercase}[4]{\bibauthorfont% -\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 -\renewcommand*{\revsdnamepunct}{}% - \ifuseprefix% - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifdefvoid{#3}{}{% - \ifcapital% - {\mkbibnameprefix{\MakeCapital{#3}}\isdot}% - {\mkbibnameprefix{#3}\isdot}% - \ifprefchar{}{\bibnamedelimc}}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% - \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital - \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号 - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% - \ifboolexpe{% - test {\ifdefvoid{#2}} - and - test {\ifdefvoid{#3}}} - {}{\revsdnamepunct}% - \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital - \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% - \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号 -} - -%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 -\newbibmacro*{name:gblowercase}[4]{\bibauthorfont% - \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 - \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifdefvoid{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifprefchar{}{\bibnamedelimc}}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% - \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital - \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号 - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% - \ifboolexpe{% - test {\ifdefvoid{#2}} - and - test {\ifdefvoid{#3}}} - {}{\revsdnamepunct}% - \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital - \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} - \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号 -} - -%中文常见风格,汉语拼音全拼模式 -\newbibmacro*{name:gbpinyin}[4]{\bibauthorfont% -\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY -\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def -\renewrobustcmd*{\bibnamedelima}{\mbox{-}}% - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifdefvoid{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifprefchar{}{\bibnamedelimc}}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% - \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamegiven{#2}}\isdot}%\MakeCapital - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}} - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% - \ifboolexpe{% - test {\ifdefvoid{#2}} - and - test {\ifdefvoid{#3}}} - {} - {\revsdnamepunct}% - \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital - \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% -} - - -\@ifpackagelater{biblatex}{2016/03/27}%biblatex<3.2版的情况 - {}{ - %GB/T 7714-2015 风格,全部大写 - \renewbibmacro*{name:gbuppercase}[4]{\bibauthorfont% - \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 - \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifblank{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifpunctmark{'}{}{\bibnamedelimc}}% - %\mkbibnamelast{#1}\isdot - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase - %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开 - %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{} - %\mkbibnamelast{\MakeUppercase{#1}}\isdot - %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 - \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}%后缀前加逗号 - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}} - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase - %\mkbibnamelast{\MakeUppercase{#1}}\isdot - %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 - \ifblank{#2#3}{}{\revsdnamepunct}% - \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% - \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% - \addcomma\addspace% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%%后缀前加逗号 - }% - } - - %GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 - \renewbibmacro*{name:gblowercase}[4]{\bibauthorfont% - \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 - \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifblank{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifpunctmark{'}{}{\bibnamedelimc}}% - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase - \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}%后缀前加逗号 - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase - \ifblank{#2#3}{}{\revsdnamepunct}% - \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}% - \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% - \addcomma\addspace% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%%后缀前加逗号 - }% - } - - %中文常见风格,汉语拼音全拼模式 - \renewbibmacro*{name:gbpinyin}[4]{\bibauthorfont% - \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 - \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def - \renewrobustcmd*{\bibnamedelima}{\mbox{-}}% - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifblank{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifpunctmark{'}{}{\bibnamedelimc}}% - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase - \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamefirst{#2}}\isdot}% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}} - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase - \ifblank{#2#3}{}{\revsdnamepunct}% - \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% - \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% - \addcomma\addspace% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}% - }% - } - - %%biblatex<3.2版的情况,姓名的处理格式带参数 - \DeclareNameFormat{namefmtselected}{% - \iffieldundef{namefmtid}{}% - {\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}% - \ifcase\value{gbnamefmtcase}% - \iffirstinits - {\usebibmacro{name:gbuppercase}{#1}{#4}{#5}{#7}} - {\usebibmacro{name:gbuppercase}{#1}{#3}{#5}{#7}}% - \or - \iffirstinits - {\usebibmacro{name:gblowercase}{#1}{#4}{#5}{#7}} - {\usebibmacro{name:gblowercase}{#1}{#3}{#5}{#7}}% - \or - \iffirstinits - {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}} - {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}% - \ifblank{#3#5} - {} - {\usebibmacro{name:revsdelim}}% - \or - \iffirstinits - {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}} - {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}% - \or - \usebibmacro{name:gbpinyin}{#1}{#3}{#5}{#7}% - \or - \ifnumequal{\value{listcount}}{1} - {\iffirstinits - {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}} - {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}% - \ifblank{#3#5} - {} - {\usebibmacro{name:revsdelim}}} - {\iffirstinits - {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}} - {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}}% - \fi - \usebibmacro{name:andothers}} -} - -% -% url和url日期格式 -% -\renewbibmacro*{url+urldate}{% - %\usebibmacro{url}%%更换url的位置,放到下面 - \iffieldundef{urlyear}% - {}{%\setunit*{\addspace}% - \usebibmacro{urldate}}% - \setunit{\addperiod\addspace}% - \usebibmacro{url}} -\renewbibmacro*{url}{\printfield{url}} - - - - -% -% 日期信息的输出格式,针对biblatex<3.7版本 -% -\defversion{3.4}{date}{ - \renewbibmacro*{urldate}{% - \addthinspace\printtext{[}\printfield{urlyear}% - \iffieldundef{urlmonth}{}{\bibrangedash\printfield{urlmonth}}% - \iffieldundef{urlday}{}{\bibrangedash\printfield{urlday}}\printtext{]}} - - \newbibmacro*{newsdate}{%%新增加一个公告日期,公开日期或新闻日期 - \iffieldundef{year}{}{\printfield{year}% - \iffieldundef{month}{}{\bibrangedash\printtext{\thefield{month}}% - \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}% - } - - \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 - \ifboolexpr{% - test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% - }% - {}%更新或修改日期通常有day信息 - {\iffieldequalstr{year}{}{%替换\iffieldundef{year},因为year总是存在,但为空 - \iffieldundef{endyear}{% - \iffieldundef{eventyear}{}{\printtext{\mkbibparens{\printtext{\printfield{eventyear}}% - \iffieldundef{eventmonth}{}{\bibrangedash\thefield{eventmonth}}% - \iffieldundef{eventday}{}{\bibrangedash\printfield{eventday}}}}% - }% - }{% - \iffieldundef{endyear}{}{\printtext{\mkbibparens{\printtext{\printfield{endyear}}% - \iffieldundef{endmonth}{}{\bibrangedash\thefield{endmonth}}% - \iffieldundef{endday}{}{\bibrangedash\printfield{endday}}}}% - }% - }% - }% - {% - \iffieldundef{year}{}{\printtext{\mkbibparens{\printtext{\printfield{year}}% - \iffieldundef{month}{}{\bibrangedash\thefield{month}}% - \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}% - }% - }% - }}% -} - -% -% 日期信息的输出格式,针对3.9>=biblatex>=3.7版本 -% -\defversion{3.7}{date}{ - \DeclareFieldFormat{urldate}{##1} - \renewbibmacro*{urldate}{% - \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 - - % - % 专利的公告日期、或报纸的日期的输出宏 - % 20160701,v1.0,新增加 - % 20180405,v1.0k,为biblatexv3.7-3.9版本,出现多出点bug做处理,Hu Zhenzhen - % - % 原理方法:加上printtext避免破坏异步标点机制 - % - \newbibmacro*{newsdate}{% - \printtext{\blx@edtfdate{}{}}% - } - - \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 - \ifboolexpr{% - test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% - }% - {}%更新或修改日期通常有day信息 - {\iffieldundef{year}{% - \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% - {\printtext{(}\printenddate\printtext{)}}% - }{\iffieldequalstr{year}{}{%因为year存在,但为空 - }{\printtext{(}\blx@edtfdate{}{}\printtext{)}}% - }% - }}% -} - -% -% 日期信息的输出格式,针对biblatex>=3.10版本 -% -\defversion{3.10}{date}{ - \DeclareFieldFormat{urldate}{##1} - \renewbibmacro*{urldate}{% - \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 - - % - % 专利的公告日期、或报纸的日期的输出宏 - % 20160701,v1.0,新增加 - % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen - % - % 原理方法:加上printtext避免破坏异步标点机制 - % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份 - % 所以无法再用选项设置的方法,印象需要用底层的命令 - % 这里可以用\blx@isodate,但用\blx@gbdate试图避免版本判断 - \newbibmacro*{newsdate}{%% - \printtext{\blx@gbdate{}{}}%%\blx@isodate{}{}% - } - - % - \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 - \ifboolexpr{% - test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% - }% - {}%更新或修改日期通常有day信息 - {\iffieldundef{year}{% - \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% - {\printtext{(}\printenddate\printtext{)}}% - }{\iffieldequalstr{year}{}{%因为year存在,但为空 - }{\printtext{(}\blx@gbdate{}{}\printtext{)}}% - }% - }}% -} - -% -% biblatex>v3.8版利用related实现双语文献的处理 -% -\defversion{3.8}{dblang}{ - %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了, - %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息 - %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中 - \newcommand{\defdoublelangentry}[2]{% - \edef\entrykeya{##1} - \edef\entrykeyb{##2} - \DeclareStyleSourcemap{ - \maps[datatype=bibtex]{ - \map{ - \step[fieldsource=entrykey, match=\entrykeya, final] - \step[fieldset=related, fieldvalue=\entrykeyb] - } - } - } - } -} - -% -% 关联文献间的分隔符 -% -\renewcommand{\relateddelim}{\adddot\newline\nobreak}%\par,而作者年样式不需要修改,因为没有项对齐的标签问题 - -% -% 关联文献的输出格式,针对3.9>=biblatex>=3.7版本 -% -% 原理方法:因为related宏中带有##了,所以无法封装到defversion中了。所以直接做判断 -% 下面这一段主要针对v3.8-3.10,因为我提问后,biblatex作者为3.11版增加了一个钩子控制relatedblock前的分隔符。 -\ifboolexpr{ -test{\iftoggle{iftleight}} -or -test{\iftoggle{iftlnine}} -}{\renewbibmacro*{related}{%standard.bbx - \ifboolexpr{ test {\iffieldundef{related}} or test {\ifrelatedloop} } - {} - {\usebibmacro{begrelated}% - \def\bbx@tempa{}% - \setcounter{bbx:relatedtotal}{0}% - \def\do##1{% - \entrydata{##1}{% - \ifrelatedloop - {} - {\stepcounter{bbx:relatedtotal}% - \gappto{\bbx@tempa}{##1,}}}}% - \docsvfield{related}% - \restorefield{related}{\bbx@tempa}% - \ifnumgreater{\value{bbx:relatedtotal}}{0} - {\listcsxadd{bbx:relatedloop}{\strfield{entrykey}}% - \iffieldundef{clonesourcekey} - {} - {\listcsxadd{bbx:relatedloop}{\strfield{clonesourcekey}}}% - \setcounter{bbx:relatedcount}{0}% - \def\do{% - \stepcounter{bbx:relatedcount}% - \ifnumgreater{\value{bbx:relatedcount}}{0}%这里从1改为0 - {\ifcsundef{relateddelim\strfield{relatedtype}} - {\printtext{\relateddelim}} - {\printtext{\csuse{relateddelim\strfield{relatedtype}}}}} - {}}% - \ifbibmacroundef{related:\strfield{relatedtype}} - {\appto{\do}{\usebibmacro{related:default}}} - {\appto{\do}{\usebibmacro*{related:\strfield{relatedtype}}}}% - \iffieldformatundef{related:\strfield{relatedtype}} - {\def\bbx@tempa{related}} - {\def\bbx@tempa{related:\strfield{relatedtype}}}% - \iffieldformatundef{relatedstring:\strfield{relatedtype}} - {\def\bbx@tempb{relatedstring:default}} - {\def\bbx@tempb{relatedstring:\strfield{relatedtype}}}% - \printtext[\bbx@tempa]{% - \usebibmacro{begrelatedloop}% - \iffieldundef{relatedstring} - {\ifboolexpr{ - test {\ifnumgreater{\value{bbx:relatedtotal}}{1}} - and - test {\ifbibxstring{\thefield{relatedtype}s}} - } - {\printtext[\bbx@tempb]{% - \bibstring[\mkrelatedstring]{\thefield{relatedtype}s}}} - {\iffieldbibstring{relatedtype} - {\printtext[\bbx@tempb]{% - \bibstring[\mkrelatedstring]{\thefield{relatedtype}}}} - {}}} - {\iffieldbibstring{relatedstring} - {\printtext[\bbx@tempb]{% - \bibstring[\mkrelatedstring]{\thefield{relatedstring}}}} - {\printfield[\bbx@tempb]{relatedstring}}}% - \docsvfield{related}% - \usebibmacro{endrelatedloop}}}% - {}% - \usebibmacro{endrelated}}} -}{} - -% -% 关联文献块前的分隔符,针对biblatex>3.11 -% -% 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏 -\defversion{3.11}{related}{ -\renewcommand{\begrelateddelim}{\adddot\newline\nobreak} -} - -\iftoggle{iftlfive}{\switchversion{3.4}{date}}{}%biblatex<=3.2 -\iftoggle{iftlsix}{\switchversion{3.4}{date}}{}%3.3<=biblatex<=3.6 -\iftoggle{iftlseven}{\switchversion{3.7}{date}}{}%biblatex=3.7 -\iftoggle{iftleight}{\switchversion{3.7}{date}\switchversion{3.8}{dblang}}{}%3.8<=biblatex<=3.9 -\iftoggle{iftlnine}{\switchversion{3.10}{date}\switchversion{3.8}{dblang}}{}%biblatex=3.10 -\iftoggle{iftlatest}{\switchversion{3.10}{date}\switchversion{3.8}{dblang}\switchversion{3.11}{related}}{}%biblatex最新3.11 - -% -% 调整doi+eprint+url格式 -% 2016.07.01 byhzz -% 2019.05.01 byhzz 在eprint前增加一个空格 -% 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。 -\renewbibmacro*{doi+eprint+url}{% -% \iftoggle{bbx:doi}%把doi的位置放到url后面 -% {\printfield{doi}} -% {}% - %\newunit\newblock - \iftoggle{bbx:eprint} - {\iffieldundef{eprint}{}{\newunit\usebibmacro{eprint}}} - {}% - %\newunit\newblock - \iftoggle{bbx:url} - {\usebibmacro{url+urldate}} - {} - \newunit\newblock - \iftoggle{bbx:doi} - {\printfield{doi}} - {}} - -% -% 调整页码的格式,即chapter+pages格式 -% -\renewbibmacro*{chapter+pages}{% -\iftoggle{bbx:gbstrict}{}{% - \printfield{chapter}}% - \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出 - \setunit{\bibpagespunct}% - \printfield{pages}}% - %\newunit %这里的标点去掉 -} - -% -% 当location等出版项超过maxitem缩减后不再输出etal -% -\DeclareListFormat{location}{% - \usebibmacro{list:delim}{#1}% - #1\isdot} -\DeclareListAlias{institution}{location} -\DeclareListAlias{publisher}{location} - -% 新增一个样式用于输出连续出版物的地址,单位,时间, -% 用于periodical连续出版物的出版社和地址的处理 -% -% v1.0k,20180425,为出版信息增加字体控制命令,hzz -% %类似\newbibmacro*{publisher+location+date} -\newbibmacro*{location+institution+date}{\bibpubfont% -\iftoggle{bbx:gbpub}% -{\testCJKfirst{userd}% -\ifboolexpr{% -test {\iflistundef{location}} and test {\iflistundef{institution}}% -}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}% -{\printtext{[S.l.\space :\space s.n.\adddot]}}% -}{% -\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}% - {\printlist{location}}% -\addcolon\addspace% -\iflistundef{institution}{% -\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}% -{\printlist{institution}}}% -\setunit{\addcomma\addspace}% - %\usebibmacro{date}% - \printfield{year}% - \bibrangedash% - \iffieldundef{endyear}{}{\printfield{endyear}}% - \newunit}% -{\printlist{location}% - \iflistundef{institution}% - {\setunit*{\addcomma\space}} - {\setunit*{\addcolon\space}}% - \printlist{institution}% - \setunit*{\addcomma\space}% - \usebibmacro{date}% - \newunit}% -} -% -% 通用的出版社和地址的处理 -% -% 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。 -% 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。 -% 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理 -\renewbibmacro*{publisher+location+date}{\bibpubfont% -\iftoggle{bbx:gbpub}% -{\testCJKfirst{userd}% - \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }% - {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}% - {\iflistundef{location}{%\adddot - \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 - {\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress} - {\printlist{location}\addcolon\addspace}%%\addcolon\addspace% - \iflistundef{publisher}{% - \iffieldequalstr{note}{standard}{}% - {\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}% - {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}% - {\printlist{publisher}}}% -\setunit*{\addcomma\addspace}%\addcomma\addspace% -\usebibmacro{date}%%\newunit %去掉这个标点 -}% -{\printlist{location}% - \iflistundef{publisher} - {\setunit*{\addcomma\space}} - {\setunit*{\addcolon\space}}% - \printlist{publisher}% - \setunit*{\addcomma\space}% - \usebibmacro{date}%%\newunit - }% -} - -% -% 修改了一个institution+location+date用于manual、report、thesis等类型 -% -% 20180425,v1.0k,增加了字体控制命令,hzz -% 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉 -\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。 -{\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉 - \iflistundef{institution} - {\setunit*{\addcomma\space}} - {\setunit*{\addcolon\space}}% - \printlist{institution}% - \setunit*{\addcomma\space}% - \usebibmacro{date}% - %\newunit - }} - -% -% 对volume卷信息格式做出修改 -% v1.0o,20190105,hzz -% -\DeclareFieldFormat{volume}{% -\testCJKfirst{userd}% -\iftoggle{ifCJKforgbt}% -{\bibstring{serialcn}#1\bibstring{volumecn}}% -{\bibstring{volume}~#1}% -}% volume of a book -\DeclareFieldFormat[article,periodical]{volume}{#1}% volume of a journal - -% -% 对number册信息格式做出修改 -% v1.0o,20190105,hzz -% -\DeclareFieldFormat{number}{#1}% -\DeclareFieldFormat[book,collection,inbook,% -incollection,proceedings,inproceedings]{number}{% -\testCJKfirst{userd}% -\iftoggle{ifCJKforgbt}% -{\bibstring{serialcn}#1\bibstring{numbercn}}% -{#1}% -}% - -% -% 对edition版本信息格式做出修改 -% -\DeclareFieldFormat{edition}{\bibtitlefont%源来自biblatex.DEF -\testCJKfirst{userd}% -\iftoggle{ifCJKforgbt}% -{\ifinteger{#1}% -{\printtext{#1\str@edition}}% -{#1\isdot}}% -{\ifinteger{#1}% -{\mkbibordedition{#1}~\bibstring{edition}}% -{#1\isdot}}} - -% -% 对version的版本信息做出修改 -% -\DeclareFieldFormat{version}{\bibtitlefont%源来自biblatex.DEF -\testCJKfirst{userd}% -\ifinteger{#1}% -{\iftoggle{ifCJKforgbt}{\printtext{#1\str@edition}}% -{\mkbibordedition{#1}~\bibstring{version}}}% -{#1\isdot}} - -% -% 修改析出文献的文集的标题与附加标题间的符号 -% -\renewbibmacro*{booktitle}{% - \ifboolexpr{ - test {\iffieldundef{booktitle}} - and - test {\iffieldundef{booksubtitle}} - } - {} - {\printtext[booktitle]{\bibtitlefont% - \printfield[titlecase]{booktitle}% - \setunit{\subtitlepunct}% - \printfield[titlecase]{booksubtitle}}% - \newunit%标点换成下一句 - \setunit{\subtitlepunct}}% - \printfield{booktitleaddon}} - - -% -% 调整期刊名的格式 -% -% v1.0k,20180425,增加了字体控制命令,hzz -\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx - \usebibmacro{journal}% - %\setunit*{\addspace}% - \setunit*{\addcomma\addspace}%修改为增加一个逗号 - \iffieldundef{series} - {} - {\newunit - \printfield{series}% - \setunit{\addspace}}% - %\usebibmacro{volume+number+eid}% - %\setunit{\addspace}% - \usebibmacro{issue+date}% - %\setunit{\addcolon\space}% - \iffieldundef{volume}{}{\setunit{\addcomma\space}}% - %换成逗号和空格 - \usebibmacro{issue}% - \usebibmacro{volume+number+eid}%把卷期放到年份后面 - %\newunit - } - - - -% -% 调整期刊卷和期的格式 -% -\renewbibmacro*{volume+number+eid}{%源来自standard.bbx -\iftoggle{bbx:gbfieldstd}{% - \printfield{volume}% - \setunit*{\adddot}% - \printfield{number}% - \setunit{\addcomma\space}% - \printfield{eid}}{% - \printfield{volume}% - %\setunit*{\adddot}%去掉点号 - %\printfield{number}% - \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号 - \iffieldundef{eid}{}{% - \setunit{\addcomma\space}% - \printfield{eid}}}} - -% -% 调整期刊年份的格式 -% -\renewbibmacro*{issue+date}{%去掉括号 - \printtext{%去掉了[parens] - \iffieldundef{issue} - {%\usebibmacro{date} - \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 - {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 - {\usebibmacro{date}}% - }}% - {\iftoggle{bbx:gbstrict}{}{\printfield{issue}% - \setunit*{\addspace}}% - %\usebibmacro{date} - \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 - {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 - {\usebibmacro{date}}% - }}}% - %\newunit - } - -% -% 调整页码前的标点和去掉期刊文章等页码后面的标点 -% -\renewbibmacro*{note+pages}{%源来自standard.bbx - %\printfield{note}%不要note,note用来判断是否是报纸newspaper - \iffieldundef{pages}{}{ - \setunit{\bibpagespunct}% - \printfield{pages}}% - %\newunit - } - - -% -% 编者的符号修改一下 -% v1.0 2016-07-01 -% v1.0q 2019-03-01 hzz 修改editortype前的标点 -% -\renewbibmacro*{editor}{%源来自biblatex.DEF - \ifboolexpr{ - test \ifuseeditor - and - not test {\ifnameundef{editor}} - } - {\printnames{editor}% - \iffieldundef{editortype}%增加一个类型判断,用于存在editortype的情况 - {\setunit\addspace}%当没有editortype时,直接用句点 - {%\setunit{\addcomma\space}% - \usebibmacro{editorstrg}}% - %\clearname{editor} - }% - {}} - -% -% 编者类型做一修改 -% v1.0 2016-07-01 -% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串 -% -\renewbibmacro*{editorstrg}{%源来自biblatex.DEF - \printtext[editortype]{% - \iffieldundef{editortype} - {% -% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理 -% test {\ifnumgreater{\value{editor}}{1}} -% or -% test {\ifandothers{editor}} -% } -% {\bibstring{editors}} -% {\bibstring{editor}} - } - {\ifbibxstring{\thefield{editortype}} %定义编者类型情况下处理,以后根据需要修改 - {\ifboolexpr{ - test {\ifnumgreater{\value{editor}}{1}} - or - test {\ifandothers{editor}} - } - {\printdelim{streditortypes}} - {\printdelim{streditortype}}} - {\thefield{editortype}}}% - }} - -% -% 编者类型的本地化字符串输出 -% v1.0q 2019-03-01 hzz -% 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符 -% 能对不同文境作设置的包括排序,标签等 -% 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串 -% -\DeclareDelimFormat{streditortypes}{% - \edef\userfieldabcde{userd}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbbiblocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% - \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% - \or% - \bibstring{\thefield{editortype}scn}% - \or% - \addcomma\addthinspace\bibstring{\thefield{editortype}s}% - \fi} -% -\DeclareDelimFormat{streditortype}{% - \edef\userfieldabcde{userd}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbbiblocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% - \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% - \or% - \bibstring{\thefield{editortype}cn}% - \or% - \addcomma\addthinspace\bibstring{\thefield{editortype}}% - \fi} - - -% -% bookauthor域的输出, -% v1.0q 2019-03-01 hzz -% 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替, -% 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype -\renewbibmacro*{bybookauthor}{% - \ifnameundef{bookauthor}% - {\ifnameundef{editor}% - {}% - {\ifnamesequal{author}{editor}% - {}{\usebibmacro{editor}}}% - }% - {\ifnamesequal{author}{bookauthor}% - {}{\printnames{bookauthor}}% - }% -} - -% -% 修改期刊的标题 -% -\renewbibmacro*{periodical}{%源来自biblatex.DEF - \iffieldundef{title} - {} - {\printtext[title]{\bibtitlefont% - \printfield[titlecase]{title}% - %\setunit{\subtitlepunct}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct} - \printfield[titlecase]{subtitle}}% - %}%把编组结束移到后面去 - \iftoggle{bbx:gbtype}{% - \iffieldundef{usera}{}{%在标题后直接给出文献标识字母 - \printfield[gbtypeflag]{usera}}}{} - }} - } - -% -% 期刊的标题做修改 -% -\renewbibmacro*{title+issuetitle}{%源来自standard.BBX - \usebibmacro{periodical}% - %\setunit*{\addspace}% - \setunit*{\adddot\addspace}%标点修改为句点 - \iffieldundef{series} - {} - {\newunit - \printfield{series}% - \setunit{\addspace}}% - \usebibmacro{periodical+issue}%将issue调整到上面来,并修改 -\iffieldundef{number}{}{%%进一步处理有范围的数字 - \multinumberparser{\thefield{number}}}% - \iffieldundef{volume}% - {\printfield{year}% - \printtext{\mkbibparens{\multinumberfirst}}% - \bibrangedash% - \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}% - }% - {\multivolparser{\thefield{volume}}% - \printfield{year}% - \setunit{\addcomma\space}%将冒号修改为逗号 - \printtext{\multivolfirst}% - \printtext{\mkbibparens{\multinumberfirst}}% - \bibrangedash% - \iffieldundef{endyear}{}{% - \printfield{endyear}% - \setunit{\addcomma\space}%将冒号修改为逗号 - \printtext{\multivolsecond}% - \printtext{\mkbibparens{\multinumbersecond}}}% - }% - \setunit{\addcomma\space}% - \printfield{eid}% - \setunit{\addspace}% - %\usebibmacro{issue+date}% - %\setunit{\addcolon\space}% - \usebibmacro{issue}% - \newunit} - -% -% 新增一个样式用于调整期刊年份的格式,只打印年份 -% -\newbibmacro*{periodical+issue}{% - \printtext{%去掉了[parens] - \iffieldundef{issue} - {%\usebibmacro{date}%修改为下一句 - }% - {\printfield{issue}% - \setunit*{\addspace}% - %\usebibmacro{date}%修改为下一句 - }% - }% - %\newunit -} - -% -% 重设专利title的输出,将文献类型标识符输出出去 -% -\newbibmacro*{patenttitle}{%原输出来自biblatex.def文件 - \ifboolexpr{% - test{\iffieldundef{title}}% - and% - test{\iffieldundef{subtitle}}% - }% - {}% - {\printtext[title]{\bibtitlefont% - \printfield[titlecase]{title}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct}% - \printfield[titlecase]{subtitle}}% - \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 - {\setunit{\subtitlepunct}\printfield{titleaddon}}% - \setunit{\subtitlepunct}\printfield{number}%写专利号 - \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}% - %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 - %\newunit - }% -}% -} - - - -% -% 修改in:用于inbook、incollection、inproceedings等类型 -% 2018.04.20,v1.0k,renewed marco,by hzz -% 20190212,v1.0q,增加中英文区分,by hzz -% -% 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。 -\renewbibmacro*{in:}{% - \iftoggle{bbx:gbpunctin}{\printtext{\texttt{//}\allowbreak}}%\addthinspace - {\setunit{\adddot\addspace}% - \iffieldequalstr{userd}{chinese}% - {\printtext{\bibstring{incn}}}% - {\printtext{\bibstring{in}}}% - }}%\newunit\newblock\intitlepunct - -% -% 修改type域的输出格式 -% 2019.02.12,v1.0q,byhzz -% 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文 -\DeclareFieldFormat{type}% -{\iffieldequalstr{userd}{chinese}% - {\ifbibxstring{#1cn}{\bibxstring{#1cn}}{#1}}% - {\ifbibstring{#1}{\bibstring{#1}}{#1}}% -} - -% -% 修改series域的输出格式 -% 2019.05.01,v1.0r,byhzz -\renewbibmacro*{series+number}{% - \printfield{series}% - %\setunit*{\addspace}% - %\printfield{number}% - %\newunit - } - -%===================================================================== -%设置驱动格式 -%===================================================================== -% -% book条目类的驱动 -% - \DeclareBibliographyDriver{book}{%源来自standard.bbx文件 - \usebibmacro{bibindex}% - \usebibmacro{begentry}% -\usebibmacro{author/editor+others/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 -\usebibmacro{maintitle+title}% -\iftoggle{bbx:gbstrict}{}{% -\newunit -\printlist{language}% -\newunit\newblock% -\usebibmacro{byauthor}% -\newunit\newblock}% -\usebibmacro{byeditor+others}% -\newunit -\printfield{edition}% -\newunit\newblock%% -\iftoggle{bbx:gbstrict}{}{% -\iffieldundef{maintitle}% -{\printfield{volume}% -\printfield{part}}% -{}% -\newunit% -\printfield{volumes}% -\newunit\newblock% -\usebibmacro{series+number}}% -\newunit\newblock% -%\printfield{note}% -%\newunit\newblock% -\usebibmacro{publisher+location+date}% -%\newunit\newblock %这里标点去掉 -\usebibmacro{chapter+pages}% - \iffieldundef{url}{}{%当没有网址时也不输出 - \usebibmacro{modifydate}}%带括号的修改或更新日期, -\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 - \newunit\newblock% - \printfield{pagetotal}% - \newunit\newblock% - \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% - \newunit\newblock - %\usebibmacro{doi+eprint+url}% - %\newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - - -% -% 期刊文章,连续出版物中的析出文献的格式 -% - \DeclareBibliographyDriver{article}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}% - \newunit\newblock - \usebibmacro{bytranslator+others}% - \newunit\newblock - \printfield{version}}% - \newunit\newblock - %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物 - \usebibmacro{journal+issuetitle}% - %\newunit -% \usebibmacro{byeditor+others}% -% \newunit - \usebibmacro{note+pages}% - \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期 - \iffieldundef{url}{}{%当没有网址时也不输出 - \iftoggle{bbx:url}{%当url选项为false时,也不输出 - \usebibmacro{modifydate}}{}}}%带括号的修改或更新日期, - \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置 - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{issn}} - {}% - \newunit\newblock - %\usebibmacro{doi+eprint+url}% - %\newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - - - -% -% 连续出版物的驱动 -% - \DeclareBibliographyDriver{periodical}{%源来自standard.BBX - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{editor}% - %\setunit{\labelnamepunct}\newblock - \newunit\newblock %删除上面一行,添加这一行 - \usebibmacro{title+issuetitle}% - \newunit\newblock% - \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间 - \newunit\newblock%添加这一行 - \iftoggle{bbx:gbstrict}{}{% - \printlist{language}% - \newunit\newblock - \usebibmacro{byeditor}% - \newunit\newblock - \printfield{note}% - \newunit\newblock} - \iftoggle{bbx:isbn} - {\printfield{issn}} - {}% - \newunit\newblock - \usebibmacro{doi+eprint+url}% - \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - -% -% 专利文献驱动 -% - \DeclareBibliographyDriver{patent}{%源来自standard.BBX - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - %\usebibmacro{title}% - \usebibmacro{patenttitle}%给出专利专用的标题输出 - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}}% - \newunit\newblock - \printfield{type}% - \setunit*{\addspace}% - %\printfield{number}%已放到patenttitle中处理 - \iflistundef{location} - {} - {\setunit*{\addspace}% - \printtext{%[parens] - \printlist[][-\value{listtotal}]{location}}}% - \newunit\newblock - \usebibmacro{byholder}% - \newunit\newblock - \printfield{note}% - \newunit\newblock - \usebibmacro{newsdate}% - %\newunit\newblock - \usebibmacro{doi+eprint+url}% - \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - - -% -% 在线文献驱动 -% -\DeclareBibliographyDriver{online}{%源来自standard.BBX - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/editor+others/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}% - \newunit\newblock - \usebibmacro{byeditor+others}% - \newunit\newblock - \printfield{note}}% - \newunit - \printfield{version}% - \newunit\newblock - %\printlist{organization}% - \printlist{institution}% - \newunit\newblock -\ifboolexpr{% -test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% -}{\usebibmacro{date}}% -{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间 - \usebibmacro{url+urldate}%从下面移上来 - \newunit\newblock - \iftoggle{bbx:eprint} - {\usebibmacro{eprint}} - {}% - \newunit\newblock - %\usebibmacro{url+urldate}% - %\newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - - -% -% 报告类型驱动 -% 当有网址无出版项时,用online输出 -% -\DeclareBibliographyDriver{report}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}}% - \newunit\newblock - \usebibmacro{byeditor+others}%增加的译者信息 - \newunit\newblock - \printfield{type}% - \setunit*{\addspace}% - \printfield{number}% - \newunit\newblock - \printfield{version}% - \newunit - \printfield{note}% - \newunit\newblock - \usebibmacro{publisher+location+date}% - %\newunit\newblock - \usebibmacro{chapter+pages}% - \usebibmacro{doi+eprint+url}% - \newunit - \printfield{pagetotal}% - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{isrn}} - {}% - \newunit\newblock -% \usebibmacro{doi+eprint+url}% -% \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - -% -% 论文、手册类型驱动 -% 2016-11-11,增加了译者信息 -% -\DeclareBibliographyDriver{manual}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}}% - \newunit\newblock - \usebibmacro{byeditor+others}%增加的译者信息 - \newunit\newblock - \iftoggle{bbx:gbfieldtype}{% - \printfield{type}% - \setunit*{\addspace}}{}% - \printfield{number}% - \newunit\newblock - \printfield{version}% - \newunit - \printfield{note}% - \newunit\newblock - \usebibmacro{institution+location+date}% - %\newunit\newblock - \usebibmacro{chapter+pages}% - \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期 - \usebibmacro{modifydate}}%修改或更新日期为带括号的时间 - \usebibmacro{doi+eprint+url}% - \newunit - \printfield{pagetotal}% - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{isrn}} - {}% - \newunit\newblock -% \usebibmacro{doi+eprint+url}% -% \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - -% -% 备选类型驱动 -% -% 利用biblatex的misc驱动 -\DeclareBibliographyDriver{misc}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/editor+others/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% -\iftoggle{bbx:gbstrict}{}{% - \newunit - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}% - \newunit\newblock - \usebibmacro{byeditor+others}}% - \newunit\newblock - \printfield{howpublished}% - \newunit\newblock - \printfield{type}% - \newunit - \printfield{version}% - \newunit - \printfield{note}% - \newunit\newblock - \usebibmacro{institution+location+date}% - %\usebibmacro{organization+location+date}% - %\newunit\newblock - \usebibmacro{doi+eprint+url}% - \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - - -% -% 专著中的析出文献的格式修改 -% -\DeclareBibliographyDriver{inbook}{%源来自standard.bbx - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 -\usebibmacro{title}% -\usebibmacro{in:}% -%\printtext{\texttt{//}\addthinspace}% - \usebibmacro{bybookauthor}% - \ifnameundef{bookauthor}{% - \ifnameundef{editor}{}{\newunit}% - }{\newunit}%替换下一句 - %\newunit\newblock -\iffieldundef{series}{}{\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加 - \usebibmacro{maintitle+booktitle}% -\iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}% -\iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息 - \newunit\newblock% -% \usebibmacro{byeditor+others}% -% \newunit\newblock - \printfield{edition}% - \newunit - \iftoggle{bbx:gbstrict}{}{% -% \iffieldundef{maintitle} -% {\printfield{volume}% -% \printfield{part}} -% {}% -% \newunit -% \printfield{volumes}% -% \newunit\newblock -% \usebibmacro{series+number} - }% - \newunit\newblock - %\printfield{note}% - %\newunit\newblock - \usebibmacro{publisher+location+date}% - %\newunit\newblock - \usebibmacro{chapter+pages}% - %\newunit\newblock - \usebibmacro{doi+eprint+url}%移到上面来 - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% - \newunit\newblock -% \usebibmacro{doi+eprint+url}% -% \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} +%% +%% --------------------------------------------------------------- +%% biblatex-gb7714-2015 --- A biblatex implementation of the +%% GBT7714-2015 bibliography style,numerical sequence +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% + +% +% 版本和时间信息 +% +\def\versionofgbtstyle{2021/01/19 v1.0w} +\def\versionofbiblatex{\abx@version} +\ProvidesFile{gb7714-2015.bbx}[\versionofgbtstyle biblatex bibliography style] +%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求 + +%===================================================================== +% 加载标准样式 +%===================================================================== +\RequireBibliographyStyle{numeric-comp} +\RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题 + + +%===================================================================== +% 功能函数 +%===================================================================== + % + % biblatex版本判断 + % 20180405,v1.0k,为兼容biblatexv3.11增加toggle:iftlnine,HU zhenzhen + % 20181020,v1.0n,为不再使用xstring宏包做的修改,hzz + % + % 原理方法:当版本继续更新时,增加一个新的toggle用以处理新的旧版,最新版和未判断出来的版本永远用iftlatest + \providetoggle{iftlfive}\togglefalse{iftlfive} %处理biblatex3.2之前版本,时间2016-03-01前 + \providetoggle{iftlsix}\togglefalse{iftlsix} %处理biblatex3.3开始改变姓名机制后版本,时间2016-03-01及以后 + \providetoggle{iftlseven}\togglefalse{iftlseven}%处理biblatex3.7的兼容性,时间2016-12-01后 + \providetoggle{iftleight}\togglefalse{iftleight}%处理biblatex3.8到3.9的兼容性,时间2017-11-01后到2017-12-01前 + \providetoggle{iftlnine}\togglefalse{iftlnine} %处理biblatex10的兼容性,时间2017-12-01后 + \providetoggle{iftlatest}\toggletrue{iftlatest} %假设是最新版biblatex + + \@ifpackagelater{biblatex}{2014/04/01}{ + \@ifpackagelater{biblatex}{2016/03/01}{ + \@ifpackagelater{biblatex}{2016/12/01}{ + \@ifpackagelater{biblatex}{2017/11/01}{ + \@ifpackagelater{biblatex}{2017/12/01}{ + \@ifpackagelater{biblatex}{2018/02/19}{} + {\toggletrue{iftlnine}\togglefalse{iftlatest}}} + {\toggletrue{iftleight}\togglefalse{iftlatest}}} + {\toggletrue{iftlseven}\togglefalse{iftlatest}}} + {\toggletrue{iftlsix}\togglefalse{iftlatest}}} + {\toggletrue{iftlfive}\togglefalse{iftlatest}}} + {\PackageError{biblatex}{Outdated 'biblatex' package} + {Please update biblatex, This is a fatal error.}} + + \newcommand\defversion[2]{\csdef{codeversion#1#2}}%定义不同版本的命令 + \newcommand\switchversion[2]{\csuse{codeversion#1#2}}%使用不同版本的命令 + + % + % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成 + % v1.0k,20180509,hzz + % + % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏 + % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8 + % 编码用xelatex编译的问题。 + % + % 原理是:利用perl正则将中文标识记录到域中, + % 然后利用\iffieldundef和\iffieldequalstr进行判断 + \providetoggle{ifCJKforgbt} + \def\testCJKfirst#1{% + \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{% + \iffieldequalstr{#1}{chinese}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}} + + % + % 2个卷的解析函数,用于连续出版物 + % + % 原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号 + \newcommand{\multivolparser}[1]{% + \IfSubStr{#1}{-}% + {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}% + {\def\multivolfirst{#1}\def\multivolsecond{}}% + } + + + % + % 2个期的解析函数,用于连续出版物 + % + \newcommand{\multinumberparser}[1]{% + \IfSubStr{#1}{-}% + {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}% + {\def\multinumberfirst{#1}\def\multinumbersecond{}}% + } + + % 对没有分隔符环境命令的低版本biblatex做增补,避免报错 + % + \iftoggle{iftlfive}{ + + \def\blx@inf@delimdeclare#1#2{% + \blx@info{Delimiter '#1' in context '#2' already defined, overwriting}} + + \def\blx@warn@delimuse#1#2{% + \blx@warning{Delimiter '#1' in context '#2' undefined}} + % Delimiter interface + + % []{}{} + \newrobustcmd*{\DeclareDelimFormat}{% + \@ifstar + {\blx@declaredelimclear} + {\blx@declaredelim}} + + \newrobustcmd*{\blx@declaredelimclear}[3][]{% + \ifcsvoid{blx@declaredelimcontexts@#2} + {} + {\def\do##1{\csundef{blx@printdelim@##1@#2}}% + \dolistcsloop{blx@declaredelimcontexts@#2}}% + \cslet{blx@declaredelimcontexts@#2}\@empty + \ifblank{#1} + {\blx@declaredelim{#2}{#3}} + {\blx@declaredelim[#1]{#2}{#3}}} + + \newrobustcmd*{\blx@declaredelim}[3][]{% + \ifblank{#1} + {\blx@declaredelim@i{}{}{#2}{#3}} + {\def\do##1{% + \listcsadd{blx@declaredelimcontexts@#2}{##1}% + \blx@declaredelim@i{blx@printdelim@##1@}{##1}{#2}{#3}}% + \docsvlist{#1}}}% + + \def\blx@declaredelim@i#1#2#3#4{% + \def\do@i##1{% + \ifcsdef{#1##1} + {\blx@inf@delimdeclare{##1}{#2}} + {}% + \csdef{#1##1}{#4}}% + \forcsvlist{\do@i}{#3}} + + % *[]{}{} + \newrobustcmd*{\DeclareDelimAlias}{% + \@ifstar + {\blx@declaredelimalias} + {\blx@declaredelimaliasauto}} + + \newrobustcmd*{\blx@declaredelimalias}[3][]{% + \ifblank{#1} + {\blx@declaredelimalias@i{}{#2}{#3}} + {\def\do##1{% + \blx@declaredelimalias@i{blx@printdelim@##1@}{#2}{#3}}% + \docsvlist{#1}}} + + \newrobustcmd*{\blx@declaredelimaliasauto}[2]{% + \blx@declaredelimalias@i{}{#1}{#2}% + \ifcsvoid{blx@declaredelimcontexts@#2} + {} + {\def\do##1{% + \blx@declaredelimalias@i{blx@printdelim@##1@}{#1}{#2}}% + \dolistcsloop{blx@declaredelimcontexts@#2}}} + + \def\blx@declaredelimalias@i#1#2#3{% + \ifcsdef{#1#2} + {\blx@inf@delimdeclare{#2}{#1}} + {}% + \csdef{#1#2}{\csuse{#1#3}}} + + \def\blx@delimcontext{none} + \newcommand*{\printdelim}[2][]{% + \ifblank{#1} + {\ifcsdef{blx@printdelim@\blx@delimcontext @#2} + {\csuse{blx@printdelim@\blx@delimcontext @#2}} + {\ifcsdef{#2}% fall back on legacy macros + {\csuse{#2}} + {\blx@warn@delimuse{#2}{*}}}} + {\ifcsdef{blx@printdelim@#1@#2} + {\csuse{blx@printdelim@#1@#2}} + {\blx@warn@delimuse{#2}{#1}}}} + + \newcommand*{\delimcontext}[1]{% + \edef\blx@delimcontext{\blx@delimcontextalias{#1}}} + + \def\blx@delimcontextalias#1{% + \ifcsdef{blx@delimcontextalias@#1} + {\csuse{blx@delimcontextalias@#1}} + {#1}} + + \newcommand*{\DeclareDelimcontextAlias}[2]{% + \csgdef{blx@delimcontextalias@#1}{#2}} + }{} + + +%===================================================================== +% 数据模型定义 +%===================================================================== + %定义类型和载体标识,从gb内容看载体基本属于介质。 + %为与lee zeping的bst的样式统一,使用mark和medium这两域名 + %为单个条目的姓名格式控制增加nameformat和namefmtid两个域 + %为缩略信息文献表增加了shortbooktitle域 + %为多语言排序增加了lansortorder域 + \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat} + \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid} + \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle} + \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder} + + %因为biblatex更新3.14版本以后,biber对于为声明数据模型的条目类型 + %不再默认读取,而是以空字符串作为条目类型名,自然在条目定义alias时 + %就会出现问题,因此显式的声明一下newspaper,然后保留后面采用alias的方式 + %而standard类型则是采用另一种方式直接在sourcemap中转换为其它类型。 + \@ifpackagelater{biblatex}{2019/11/30}{%2019/12/01 v3.14 + \DeclareDatamodelEntrytypes{newspaper}% + }{} + + + +%===================================================================== +% 设置宏包选项 +%===================================================================== + % + % 增加一个控制是否输出文献载体的选项 + % 20191125,v1,0s,hzz + \newtoggle{bbx:gbmedium} + \DeclareBibliographyOption{gbmedium}[true]{%biblatex低版本 + \settoggle{bbx:gbmedium}{#1}} + \ExecuteBibliographyOptions{gbmedium} + + % + % 增加一个控制是否输出annotation域的选项,该域可以用于在文献条目后面输出一些注释信息 + % 20190509,v1,0s,hzz + \newtoggle{bbx:gbannote} + \DeclareBibliographyOption{gbannote}[false]{%biblatex低版本 + \settoggle{bbx:gbannote}{#1}} + \ExecuteBibliographyOptions{gbannote} + % + %用于在文献条目后面输出注释信息的宏 + %FieldFormat{annotation}用于设置注释信息的格式 + \DeclareFieldFormat{annotation}{% + \printtext{\addspace(#1)}% + } + \renewbibmacro*{annotation}{% + \iftoggle{bbx:gbannote}% + {\iffieldundef{annotation}% + {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}% + {\printfield{annotation}}}% + {}% + } + + % + % 增加一个控制是否输出type域的选项 + % 20190212,v1,0q,hzz + \newtoggle{bbx:gbfieldtype} + \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本 + \settoggle{bbx:gbfieldtype}{#1}} + \ExecuteBibliographyOptions{gbfieldtype} + + % + % 增加一个控制是否根据页码重设脚注数字标号的选项 + % 20190422,v1,0r,hzz + \newtoggle{bbx:gbfnperpage} + \DeclareBibliographyOption{gbfnperpage}[false]{% + \settoggle{bbx:gbfnperpage}{#1}} + \ExecuteBibliographyOptions{gbfnperpage} + + + % + % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表 + % 20190203,v1.0p,hzz + % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签 + % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式 + % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题 + \DeclareBibliographyOption{gbfootbib}[false]{% + \ifstrequal{#1}{false}{}{\execgbfootbib}} + \ExecuteBibliographyOptions{gbfootbib} + + %% + \newlength{\footbibmargin} + \newlength{\footbiblabelsep} + \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离 + \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距 + \def\execgbfootbib% + {% + %开启引用跟踪计数器,为使用\ifciteseen等测试命令 + \ExecuteBibliographyOptions{citetracker=true} + % + %利用footmisc宏包来实现脚注文献的悬挂对齐 + \AtEndPreamble{ + \@ifclassloaded{beamer}{}{ + %beamer类因为其特殊性,为避免冲突不调footmisc。 + %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接 + %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。 + %\PassOptionsToPackage{perpage,hang}{footmisc}% + %\RequirePackage{footmisc}% + + %重新实现脚注的根据单页重设脚注号码 + %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改 + %v1.0q 20190317 hzz + %v1.0r 20190422 hzz 根据gbfnperpage选项设置 + \iftoggle{bbx:gbfnperpage}% + {\@addtoreset{footnote}{page}}{}%重设计数器 + +\@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义 + \long\def\H@@footnotetext##1{\insert\footins{% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \leftskip \footbibmargin%增加的左侧缩进 + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% + }% + \color@endgroup}}% + + \long\def\H@@mpfootnotetext##1{% + \global\setbox\@mpfootins\vbox{% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \leftskip \footbibmargin%增加的左侧缩进 + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \color@endgroup}} + }{%否则对latex核心代码中的\@footnotetext做重定义 + \long\def\@footnotetext##1{\insert\footins{% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \leftskip \footbibmargin%增加的左侧缩进 + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% + }% + \color@endgroup}}% + + \long\def\@mpfootnotetext##1{% + \global\setbox\@mpfootins\vbox{% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \leftskip \footbibmargin%增加的左侧缩进 + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \color@endgroup}} + } + + \long\def\@makefntext##1{%增加了脚注标记与正文的间隔 + \parindent 1em\noindent \hb@xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1} + + } + + % + %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式 + \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}} + %做patch使得脚注内容中的脚注数字标签不上标 + \pretocmd{\@makefntext}{% + \def\@makefnmark{% + \hbox{\textcircled{\tiny\@thefnmark}}% + }% + }{}{} + } + + % + %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容) + %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。 + %v1.0q 20190309 区分使脚注标注适应minipage中的情况 + \newbibmacro*{citesavefn}{% + \ifciteseen%当被引用过为true + {\ifcsdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%当已经定义过脚注序号信息 + {\csgdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% + \str@sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}% + \@makefnmark% + }}% + {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% + \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% + }}% + }% + {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% + \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% + %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断 + }}% + } + + % + %重定义\footfullcite使完成gb7714-2015的脚注文献要求 + \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% + {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 + \defcounter{minnames}{\blx@minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。 + \usebibmacro{prenote}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {}{\setunit{\addcolon\addspace}\printfield{postnote}}}%与ay样式不同,由于已修改postnote域格式,直接用printfield + }% + {\usebibmacro{citesavefn}% + \ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}% + {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%\nopunct + {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}% + }% + {\multicitedelim}% + {\usebibmacro{postnote}} + + } + + % + % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式 + % 20180814,v1.0m,hzz + % 原理方法: + % 只为兼容性考虑不做任何处理 + \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本 + } + + % + % 增加一个控制是否输出文献类型和载体标识的选项 + % + % 原理方法: + % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的 + % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本 + \newtoggle{bbx:gbtype} + %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本 + \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本 + \settoggle{bbx:gbtype}{#1}} + \ExecuteBibliographyOptions{gbtype} + + % + % 增加一个源文件编码选择选项,当true时可以使用GBK编码。 + % v1.0k, 2018.05.08, by hzz + % + % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档 + % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def + % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用 + % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。 + % 另外注意: + % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码 + % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常 + % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。 + \newtoggle{bbx:codegbk} + \DeclareBibliographyOption{gbcodegbk}[false]{% + \settoggle{bbx:codegbk}{#1}} + \ExecuteBibliographyOptions{gbcodegbk} + + \def\str@bibliography{参考文献} + \def\str@references{参考文献} + \def\str@bytranslator{译} + \def\str@andotherscn{等} + \def\str@andcn{和} + \def\str@backrefpage{引用页} + \def\str@backrefpages{引用页} + \def\str@noaddress{出版地不详} + \def\str@nopublisher{出版者不详} + \def\str@edition{版} + \def\str@volumecn{卷} + \def\str@numbercn{册} + \def\str@serialcn{第} + \def\str@sameentry{同} + \def\str@incn{见} + \def\str@mathesiscn{硕士学位论文} + \def\str@phdthesiscn{博士学位论文} + \def\str@editorcn{主编} + + \AtEndOfPackage{% + \iftoggle{bbx:codegbk}{% + \ExecuteBibliographyOptions{texencoding = GBK} + \input{gb7714-2015-gbk.def} + }{}} + + % + % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项 + % v1.0k, 2018.05.08, by hzz + % + % 原理方法: + % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息 + % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式 + % 可能需要用于中英文判断的language域的信息。 + \newtoggle{bbx:gbstrict} + \DeclareBibliographyOption{gbstrict}[true]{% + \settoggle{bbx:gbstrict}{#1}} + \ExecuteBibliographyOptions{gbstrict} + + % + % 增加一个控制标题域超链接设置的选项 + % v1.0k, 2018.05.24, by hzz + % + % 原理方法: + % 利用标题域格式来实现,默认设置该选项为false,不做超链接。 + % 设置为true,则标题设置超链接 + \newtoggle{bbx:titlelink} + \DeclareBibliographyOption{gbtitlelink}[false]{% + \settoggle{bbx:titlelink}{#1}} + \ExecuteBibliographyOptions{gbtitlelink} + + % + % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项 + % v1.0l, 2018.07.02, by hzz + % + % 原理方法: + % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置 + \newtoggle{bbx:ctexset} + \DeclareBibliographyOption{gbctexset}[true]{% + \settoggle{bbx:ctexset}{#1}} + \ExecuteBibliographyOptions{gbctexset} + + \AtEndOfPackage{% + \iftoggle{bbx:ctexset}{% + \def\blx@defbibstrings#1#2{% + \def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}% + \abx@dostrings + \csuse{abx@strings@#1}% + \setkeys{blx@lbx}{#2}% + \let\do\blx@defbibstrings@i + \csxdef{abx@strings@#1}{\abx@dostrings}% + } + }{}} + + % + % 增加一个处理佚名或noauthor的控制选项 + % + % 原理方法:在顺序编码制中不需要使用,为与作者年制的兼容性考虑,这里也增加避免报错 + \DeclareBibliographyOption{gbnoauthor}[true]{}% + + + % + % 增加一个恢复域格式为标准样式的控制选项 + % v1.0k, 2018.05.15, by hzz + % + % 原理方法: + % 默认设置该选项为false,采用国标要求的域格式输出相关域 + % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域 + \newtoggle{bbx:gbfieldstd} + \DeclareBibliographyOption{gbfieldstd}[false]{% + \settoggle{bbx:gbfieldstd}{#1}% + \ifstrequal{#1}{false}{}{\execgbfdfmtstd}% + } + \ExecuteBibliographyOptions{gbfieldstd} + + % + % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。 + % + \newtoggle{bbx:gbpub} + \DeclareBibliographyOption{gbpub}[true]{% + %\settoggle{bbx:gbpub}{#1} %或采用下面这一句 + \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}} + \ExecuteBibliographyOptions{gbpub} + + % + % 增加控制析出文献来源前的标点符号//输出的选项 + % v1.0k, 2018.04.20,added in by hzz + \newtoggle{bbx:gbpunctin} + \DeclareBibliographyOption{gbpunctin}[true]{% + \settoggle{bbx:gbpunctin}{#1}} + \ExecuteBibliographyOptions{gbpunctin} + + + + + + % + % 选项设置 + % + \ExecuteBibliographyOptions{ + sorting=none, + useprefix=true, %名字的信息包括前缀 + date = year, %日期仅写到年 + maxbibnames = 3,%设置名字最大数量 + minbibnames = 3, %设置缩减后的名字最小数量 + maxitems = 1,%设置列表最大数量 + minitems = 1, %设置缩减后的列表最小数量 + isbn=false, + } + + % + %为日期相关选项增加选项值gb7714-2015 + % + \csdef{mkdaterangegb7714-2015}#1{% + \begingroup + \blx@metadateinfo{#1}% + \iffieldundef{#1year} + {} + {\printtext[#1date]{% + \blx@gbdate{#1}{}}}% + \endgroup} + + \newrobustcmd*{\blx@gbdate}[3][]{% + \dateeraprintpre{#2#3year}% + \blx@imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}% + \iffieldundef{#2#3month}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3month}}}% + \iffieldundef{#2#3day}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3day}}}} + + + %为姓名格式选择增加的计数器 + \newcounter{gbnamefmtcase} + \def\thegbnamefmtcase{\the\c@gbnamefmtcase} + %为数字标签格式选择增加的计数器/命令 + \newcommand{\mkgbnumlabel}[1]{\mkbibbrackets{#1}} + \def\gbbiblabelopt@bracket{\renewcommand{\mkgbnumlabel}[1]{\mkbibbrackets{##1}}} + \def\gbbiblabelopt@parens{\renewcommand{\mkgbnumlabel}[1]{\mkbibparens{##1}}} + \def\gbbiblabelopt@dot{\renewcommand{\mkgbnumlabel}[1]{##1\adddot}} + \def\gbbiblabelopt@plain{\renewcommand{\mkgbnumlabel}[1]{##1}} + \def\gbbiblabelopt@box{\renewcommand{\mkgbnumlabel}[1]{\framebox{##1}}} + \def\gbbiblabelopt@circle{\renewcommand{\mkgbnumlabel}[1]{\textcircled{##1}}} + %为文献表中数字标签对齐方式选择增加的计数器/命令 + \newcounter{gbalignlabel} + \def\thegbalignlabel{\the\c@gbalignlabel} + %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令 + \newcounter{gbcitelocalcase} + \newcounter{gbbiblocalcase} + \def\thegbcitelocalcase{\the\c@gbcitelocalcase} + \def\thegbbiblocalcase{\the\c@gbbiblocalcase} + +\@ifpackagelater{biblatex}{2016/03/27} + { % 针对biblatex>=3.3版本的选项设置 + % 增加不同语言排序的切换选项 + % numeric样式,不使用该选项,这里给出仅为兼容性考虑 + % v1.0q,20190307,hzz + % + % 增加不同语言排序的切换选项 + % gblanorder=chineseahead的顺序为cn,jp,kr,en,fr,ru + % gblanorder=englishahead的顺序为en,fr,ru,cn,jp,kr + % gblanorder=cn;en;ru;fr;jp;kr的顺序为指定的cn;en;ru;fr;jp;kr,自定义内容可以随意写以分号分隔 + % v1.0q,20190307,hzz + % + \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{% + \ifstrequal{#1}{chineseahead}%%中文在前的顺序 + {\gdef\lancnorder{1}\gdef\lanjporder{2}\gdef\lankrorder{3}% + \gdef\lanenorder{4}\gdef\lanfrorder{5}\gdef\lanruorder{6}}% + {% + \ifstrequal{#1}{englishahead}% + {\execlanodeah\dealsortlan}% + {\execlanodudf{#1}\dealsortlan}% + }% + } + \ExecuteBibliographyOptions{gblanorder} + + \def\execlanodeah{%中文在后的顺序 + \gdef\lancnorder{4} + \gdef\lanjporder{5} + \gdef\lankrorder{6} + \gdef\lanenorder{1} + \gdef\lanfrorder{2} + \gdef\lanruorder{3}} + + \newcounter{lanordernum} + \newcommand{\execlanodudf}[1]{%like:cn;en;ru;fr;jp;kr + \setcounter{lanordernum}{0} + \DeclareListParser{\parsinglanorder}{;} + \renewcommand*{\do}[1]{\stepcounter{lanordernum}\csxdef{lan##1order}{\thelanordernum}} + \parsinglanorder{#1} + } + + % + % 增加本地化字符串的中英文切换选项 + % gbcitelocal指标注中的本地化字符串 + % gbbiblocal 指文献表中的本地化字符串 + % gblocal 指设置文献表和标注中的本地化字符串 + % v1.0o,20190103,hzz + % + \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{% + \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}% + \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}% + \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}% + } + \ExecuteBibliographyOptions{gbcitelocal} + + \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{% + \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}% + \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}% + \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}% + } + \ExecuteBibliographyOptions{gbbiblocal} + + \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{% + \ExecuteBibliographyOptions{gbbiblocal=#1}% + \ExecuteBibliographyOptions{gbcitelocal=#1}% + } + %\ExecuteBibliographyOptions{gblocal} %默认值已经通过两个相关选项设置 + + % + % 增加序号标签格式处理选项 + % v1.0l,20180623,hzz + % + \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{% + \csuse{gbbiblabelopt@#1} + } + \ExecuteBibliographyOptions{gbbiblabel} + + % + % 增加姓名大小写格式处理选项 + % + \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{% + \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}% + \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}% + \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family + \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{} + \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given + \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family + } + \ExecuteBibliographyOptions{gbnamefmt} + + % + % 增加标签对齐选项 + % + % right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式 + \DeclareBibliographyOption[string]{gbalign}[right]{% + \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{} + \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{} + \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{} + \ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{} + } + } + {% 针对biblatex<3.3版本的选项设置 + % 增加不同语言排序的切换选项 + % numeric样式, biblatex 3.4及以下版本不能使用多个stylesourcemap,所以不使用该选项 + % v1.0q,20190307,hzz + % + \DeclareBibliographyOption{gblanorder}[chineseahead]{} + + % + % 增加序号标签格式处理选项 + % v1.0l,20180623,hzz + % + \DeclareBibliographyOption{gbbiblabel}[bracket]{% + \csuse{gbbiblabelopt@#1} + } + \ExecuteBibliographyOptions{gbbiblabel} + + % + % 增加姓名大小写格式处理选项 + % + \DeclareBibliographyOption{gbnamefmt}[uppercase]{% + \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}% + \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}% + \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family + \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{} + \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given + \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family + } + \ExecuteBibliographyOptions{gbnamefmt} + + % + % 增加标签对齐选项 + % + % 原理方法:right是默认的右对齐,left是左对齐,gb7714-2015无效,仍然为右对齐模式, + % 因为在这种biblatex低版本中,舍弃了list类环境后,会出错。 + % 注意:texlive2015中的3.0版中的DeclareBibliographyOption选项没有类型说明 + \DeclareBibliographyOption{gbalign}[right]{% + \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{} + \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{} + \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{} + \ifstrequal{#1}{gb7714-2015}{}{} + } + } + + +% +% 针对biblatex<3.3版本的选项设置,比如texlive2015中的3.0版 +% +\defversion{3.0}{opt}{ + \ExecuteBibliographyOptions{ + firstinits=true, %名字有缩写,参考3.1.2.3 Internal + } +} +% +% 针对3.3<=biblatex<3.5版本的选项设置,比如texlive2016中的3.4版 +% +\defversion{3.4}{opt}{ + \ExecuteBibliographyOptions{ + giveninits=true, %名字有缩写,参考3.1.2.3 Internal + } +} +% +% 针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版 +% +\defversion{3.7}{opt}{ + \ExecuteBibliographyOptions{ + giveninits=true, + urldate =edtf, %iso8601 + eventdate =edtf, + } +} +% +% 针对3.10<=biblatex版本的选项设置,比如texlive2018中的3.11版 +% +\defversion{3.10}{opt}{ + \ExecuteBibliographyOptions{ + giveninits=true, + urldate =gb7714-2015, %iso,iso8601,edtf + eventdate =gb7714-2015, + } +} + +% +% 根据biblatex版本信息,选择选项设置 +% +% 原理方法:如下这种选择机制能自动兼容更新的版本,但对于老版本 +% 必须要把情况列全。 +\iftoggle{iftlfive}{\switchversion{3.0}{opt}}{}%biblatex<=3.2 +\iftoggle{iftlsix}{\switchversion{3.4}{opt}}{}%3.3<=biblatex<=3.6 +\iftoggle{iftlseven}{\switchversion{3.7}{opt}}{}%biblatex=3.7 +\iftoggle{iftleight}{\switchversion{3.7}{opt}}{}%3.8<=biblatex<=3.9 +\iftoggle{iftlnine}{\switchversion{3.10}{opt}}{}%biblatex=3.10 +\iftoggle{iftlatest}{\switchversion{3.10}{opt}}{}%biblatex最新3.11 + + +%===================================================================== +% 设置本地化字符串 +%===================================================================== + % + % 新建当地化字符串,用来记录“等”字符、“和”字符 + % + \NewBibliographyString{andotherscn} + \NewBibliographyString{andothersincitecn} + \NewBibliographyString{andothersincite} + \NewBibliographyString{andcn} + \NewBibliographyString{andothersjp} + \NewBibliographyString{andotherskr} + \NewBibliographyString{andjp} + \NewBibliographyString{andkr} + \NewBibliographyString{andincitecn} + \NewBibliographyString{andincite} + \NewBibliographyString{volumecn} + \NewBibliographyString{numbercn} + \NewBibliographyString{serialcn} + \NewBibliographyString{incn} + \NewBibliographyString{mathesiscn} + \NewBibliographyString{phdthesiscn} + \NewBibliographyString{editorcn} + \NewBibliographyString{editorscn} + + + + % + % 修改一些当地化字符串 + % + % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件 + % 当然也可以增加比如上面定义的andotherscn + % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别 + + \DefineBibliographyStrings{english}{ + bibliography = {\str@bibliography}, + references = {\str@references}, + bytranslator= {\str@bytranslator},%\addperiod,%将trans. by 改成 译\addcomma\ + and = {\addcomma},%将第2和3人名间的and符号改成逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 + andcn = {\addcomma},%and本地化字符串的中文对应词 + andincitecn = {\str@andcn},%将标注中的分开,便于与文献表中的区分 + andincite = {\addcomma}, + %andothers = {et al.},%将超过3个人名的省略,et al.改成为 等 + andotherscn = {\str@andotherscn},%将超过3个人名的省略,et al.改成为 等 + andothersincitecn={\str@andotherscn},%将标注中的分开,便于与文献表中的区分 + andothersincite={et al\adddot}, + backrefpage = {\str@backrefpage:}, + backrefpages = {\str@backrefpages:}, + in={in\intitlepunct}, + volumecn={\str@volumecn}, + numbercn={\str@numbercn}, + serialcn={\str@serialcn}, + andothersjp={他}, + andotherskr={외}, + andjp={和}, + andkr={和}, + incn={\str@incn\addcolon\addspace}, + mathesiscn={\str@mathesiscn}, + phdthesiscn={\str@phdthesiscn}, + editorscn={\str@editorcn}, + editorcn={\str@editorcn}, +} + + % + % 增加两个命令用于临时的局部的修改本地化字符串 + % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串 + % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内 + % v1.0t,hzz,20190525 + \newcommand{\setlocalbibstring}[2]{% + \csdef{abx@sstr@#1}{#2}} + \newcommand{\setlocalbiblstring}[2]{% + \csdef{abx@lstr@#1}{#2}} + +%===================================================================== +% 动态数据修改 +%===================================================================== +% +% 各层次的数据映射和动态修改 +% +% 原理方法: +% 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中 +% 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性 +% 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个 +% 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次 +% 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。 +% 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符, +% 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息 +% +% 不同的文献类型使用相同的驱动输出可以有5种方法: +% 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型 +% 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型 +% 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型 +% 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名 +% 驱动别名定义本质上是做了驱动层映射 +% 5. 直接定义不同的类型的驱动,但驱动内容相同。 +% +% 关于数据映射和驱动使用的考虑如下: +% 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换 +% 2. 为减少代码量,尽量少做内容相同的不同类型驱动 +% 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名 +% 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type +% 可以在样式层映射做某些需要避免这种默认处置的转换 +% 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射 +% +% 文献类型和驱动考虑如下: +% 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article +% newpaper映射为article,并以note域做区分特殊处理 +% 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook +% standard映射为book或inbook,并以note域做区分特殊处理 +% collection和proceedings基本与book类似,因此做book驱动别名处理 +% incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理 +% 3. 专利类型有其特殊性,考虑patent类型 +% 4. 电子资源类型有其特殊性,考虑online类型 +% 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更新日期 +% 因此考虑用一种类型来输出,使用report类型 +% 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略, +% 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型 +% 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时, +% 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。 +% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述 +% 更多的信息,因此不存在网址时,独立做一个备选格式 +% 9. 出版项主要以如下方式处理: +% (a) location+institution+date 仅用于连续出版物 +% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report +% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型 +% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。 +% (e) 不输出,主要用于连续出版物析出的文献 +% 10. 日期以如下方式处理: +% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year +% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate +% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date +% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate + + +\DeclareSourcemap{ +\maps[datatype=bibtex]{% + \map{%当没有作者时将editor转成author + \pernottype{inbook}%因为in系列中editor可能用来表示bookauthor,所以排除 + \pernottype{inproceedings} + \pernottype{incollection} + \pernottype{periodical}%因为peridical直接使用editor,所以排除 + %注意notfield在低版本biblatex中没有 + %\step[notfield=author,final]%当author不存在,将editor复制给author + \step[fieldsource=editor,fieldtarget=author]%并删除editor + } + \map{%当没有作者时将translator转成author + \pernottype{inbook} + \pernottype{inproceedings} + \pernottype{incollection} + %\step[notfield=author,final]%当author不存在,将translator复制给author + \step[fieldsource=translator,fieldtarget=author]%并删除translator + } + \map{%让address和location同步,biblatex中address是location的别名 + %因此输出的时候只有location信息,但处理过程中是可以存在address的。 + %\step[notfield=address,final] + \step[fieldsource=location,final] + \step[fieldset=address,origfieldval] + } + \map{%让address和location同步 + %\step[notfield=location,final] + \step[fieldsource=address,final] + \step[fieldset=location,origfieldval] + } + \map{%处理在bib文件用mark标记文献类型标识符的情况 + \step[fieldsource=mark,final] + \step[fieldset=usera, origfieldval] + } + \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况 + \step[fieldsource=nameformat,match=lowercase,final] + \step[fieldset=namefmtid,fieldvalue={1}] + } + \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况 + \step[fieldsource=nameformat,match=givenahead,final] + \step[fieldset=namefmtid,fieldvalue={2}] + } + \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况 + \step[fieldsource=nameformat,match=familyahead,final] + \step[fieldset=namefmtid,fieldvalue={3}] + } + \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况 + \step[fieldsource=nameformat,match=pinyin,final] + \step[fieldset=namefmtid,fieldvalue={4}] + } + \map{%根据article确定文献类型标识符 + \pertype{article} + \step[fieldset=usera, fieldvalue={J}] + } + \map{%根据periodical确定文献类型标识符 + \pertype{periodical} + \step[fieldset=usera, fieldvalue={J}] + \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor + \step[fieldset=editor, origfieldval] + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符 + \pertype{newspaper} + \step[fieldset=usera, fieldvalue={N}] + \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断 + } + \map{%对应增加的一个数据库类型database确定文献类型标识符 + \pertype{database} + \step[fieldset=usera, fieldvalue={DB}] + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%对应增加的一个数据集类型dataset确定文献类型标识符 + \pertype{dataset} + \step[fieldset=usera, fieldvalue={DS}]% + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%对应增加的一个软件类型software确定文献类型标识符 + \pertype{software} + \step[fieldset=usera, fieldvalue={CP}] + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%对应增加的一个舆图类型map确定文献类型标识符 + \pertype{map} + \step[fieldset=usera, fieldvalue={CM}]% + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%对应增加的一个档案类型archive确定文献类型标识符 + \pertype{archive} + \step[fieldset=usera, fieldvalue={A}] + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以 + %当misc类型带有网址时,直接将其转换为online类型 + \pertype{misc} + \step[fieldsource=url,final] + \step[typesource=misc,typetarget=online] + } + \map{%对应增加的一个备选类型misc确定文献类型标识符 + \pertype{misc} + \step[fieldset=usera, fieldvalue={Z}]% + } + \map{ + \pertype{book} + \pertype{inbook} + \step[fieldset=usera, fieldvalue={M}] + \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition + \step[fieldset=edition, origfieldval] + } + \map{%兼容老的standard类型,确定文献类型标识符 + \pertype{standard} + \step[fieldset=usera, fieldvalue={S}] + \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断 + } + \map{ + \pertype{patent} + \step[fieldset=usera, fieldvalue={P}] + } + \map{ + \pertype{inproceedings} + \pertype{conference}%兼容老的conference类型 + \step[fieldset=usera, fieldvalue={C}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{proceedings} + \step[fieldset=usera, fieldvalue={C}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{incollection} + \step[fieldset=usera, fieldvalue={G}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{collection} + \step[fieldset=usera, fieldvalue={G}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{report} + \pertype{techreport}%兼容老的techreport类型 + \step[fieldset=usera, fieldvalue={R}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{thesis} + \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型 + \pertype{phdthesis} + \step[fieldset=usera, fieldvalue={D}] + \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{ + \pertype{online} + \pertype{electronic}%兼容老的electronic类型 + \pertype{www}%兼容老的www类型 + \step[fieldset=usera, fieldvalue={EB}] + \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册 + \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 + \step[fieldset=institution, origfieldval] + } + \map{ + \pertype{manual} + \step[fieldset=usera, fieldvalue={A}] + \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version + \step[fieldset=version, origfieldval] + \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 + \step[fieldset=institution, origfieldval] + } + \map{ + \pertype{unpublished} + \step[fieldset=usera, fieldvalue={Z}] + } + \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 + \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] + }% + \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 + \step[fieldsource={editor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] + }% + \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 + \step[fieldsource={translator}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] + }% + \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 + \step[fieldsource={bookauthor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] + }% + \map{%处理一些用year表示date的情况 + %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。 + %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息 + \step[fieldsource=year] + \step[fieldset=date, origfieldval] + } + \map{%将entrykey放入keywords中用于后期使用 + \step[fieldsource=entrykey] + \step[fieldset=keywords, origfieldval] + } + \map{\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userd,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userd,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userd,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userd,fieldvalue={korean}]%韩语 + } + \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题 + \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]% + \step[fieldset=userd, fieldvalue={chinese}] + } + \map{%将没有设置userd,且存在title域的默认设置为英文 + \step[fieldsource=title,final] + \step[fieldset=userd,fieldvalue={english}] + } + \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userf,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=author,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userf,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=author,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userf,fieldvalue={korean}]%韩语 + } + \map{%作者的中文判断 + \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] + \step[fieldset=userf, fieldvalue={chinese}] + } + \map{%将没有设置userf,且存在author域的默认设置为英文 + \step[fieldsource=author,final] + \step[fieldset=userf,fieldvalue={english}] + } + \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=usere,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=translator,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=usere,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=translator,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=usere,fieldvalue={korean}]%韩语 + } + \map{%译者的中文判断 + \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] + \step[fieldset=usere, fieldvalue={chinese}] + } + \map{%将没有设置usere,且存在translator域的默认设置为英文 + \step[fieldsource=translator,final] + \step[fieldset=usere,fieldvalue={english}] + } + \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userc,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userc,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userc,fieldvalue={korean}]%韩语 + } + \map{%编者的中文判断 + \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 + \step[fieldset=userc, fieldvalue={chinese}] + } + \map{%将没有设置userc,且存在editor域的默认设置为英文 + \step[fieldsource=editor,final] + \step[fieldset=userc,fieldvalue={english}] + } + \map{\step[fieldsource=bookauthor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userb,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=bookauthor,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userb,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=bookauthor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userb,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=bookauthor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userb,fieldvalue={korean}]%韩语 + } + \map{%编者的中文判断 + \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 + \step[fieldset=userb, fieldvalue={chinese}] + } + \map{%将没有设置userc,且存在editor域的默认设置为英文 + \step[fieldsource=bookauthor,final] + \step[fieldset=userb,fieldvalue={english}] + } + \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language + \step[fieldset=language,origfieldval]%本身language存在则不设定 + } + \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language + \step[fieldset=language,origfieldval] + }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。 + \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。 + \step[fieldset=language,fieldvalue={english}] + } + \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断, + %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况, + %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd + \step[fieldsource=language] + \step[fieldset=userd,origfieldval] + } + \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言 + %biblatex 3.11及以下版本仅有match是区分大小写的,而3.12版开始用matchi来区分大小,而match不区分 + %这里为兼容3.11及以下版本,所以用一个复杂一点的正则表达式 + \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final] + \step[fieldset=langid,fieldvalue={english}] + \step[fieldset=lansortorder,fieldvalue=\lanenorder] + } + \map{ + \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final] + \step[fieldset=langid,fieldvalue={russian}] + \step[fieldset=lansortorder,fieldvalue=\lanruorder] + } + \map{% + \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final] + \step[fieldset=langid,fieldvalue={french}] + \step[fieldset=lansortorder,fieldvalue=\lanfrorder] + } + \map{% + \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + \step[fieldset=lansortorder,fieldvalue=\lancnorder] + } + \map{% + \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + \step[fieldset=lansortorder,fieldvalue=\lanjporder] + } + \map{% + \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + \step[fieldset=lansortorder,fieldvalue=\lankrorder] + } +} +} + + +% +% 修改输入的参考文献数据,样式层的操作 +% +% 原理方法:因为biblatex3.0版的map不使用foreach选项,所以需要一个一个写,以处理特殊字符 +\defversion{3.0}{map}{ + \DeclareStyleSourcemap{ + \maps[datatype=bibtex]{ + \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook, + %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 + %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断 + \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook + \step[typesource=standard, typetarget=inbook, final] + } + \map{%剩下的全部映射为book + \step[typesource=standard, typetarget=book, final] + } +% \map{%先于标准样式的driver层映射,以取消type设置 +% \step[typesource=mastersthesis, typetarget=thesis, final] +% %\step[fieldset=type, fieldvalue=mathesis] +% } +% \map{%先于标准样式的driver层映射,以取消type设置 +% \step[typesource=phdthesis, typetarget=thesis, final] +% %\step[fieldset=type, fieldvalue=phdthesis] +% } + \map{%先于标准样式的driver层映射,以取消type设置 + \step[typesource=techreport, typetarget=report, final] + %\step[fieldset=type, fieldvalue=techreport] + } + \map{% + \pertype{report} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=report,typetarget=online] + \step[fieldset=note,fieldvalue={report}] + } + \map{% + \pertype{thesis} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=thesis,typetarget=online] + } + \map{% + \pertype{manual} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=manual,typetarget=online] + } + \map{% + \pertype{unpublished} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=unpublished,typetarget=online] + } + \map{% + \pertype{database} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=databasetypetarget=online] + } + \map{% + \pertype{dataset} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=dataset,typetarget=online] + } + \map{% + \pertype{software} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=software,typetarget=online] + } + \map{% + \pertype{map} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=map,typetarget=online] + } + \map{% + \pertype{archive} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=archive,typetarget=online] + } + \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确) + \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 + \step[fieldset=keywords, fieldvalue={,}, append] + \step[fieldset=keywords, origfieldval, append] + } + \map[overwrite]{%title,booktitle,journaltitle,journal,publisher,address,location,institution,organization + \step[fieldsource={title}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={booktitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={journaltitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={journal}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={publisher}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={address}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={location}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={institution}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={booktitle}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] + } + \map[overwrite]{ + \step[fieldsource={booktitle}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] + } + } + } +} + +% +% 修改输入的参考文献数据,样式层的操作 +% +% 原理方法:biblatex3.4以上版本 +\defversion{3.4}{map}{ + \DeclareStyleSourcemap{ + \maps[datatype=bibtex]{ + \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook, + %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 + %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断 + \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook + \step[typesource=standard, typetarget=inbook, final] + } + \map{%剩下的全部映射为book + \step[typesource=standard, typetarget=book, final] + } +% \map{%先于标准样式的driver层映射,以取消type设置 +% \step[typesource=mastersthesis, typetarget=thesis, final] +% %\step[fieldset=type, fieldvalue=mathesis] +% } +% \map{%先于标准样式的driver层映射,以取消type设置 +% \step[typesource=phdthesis, typetarget=thesis, final] +% %\step[fieldset=type, fieldvalue=phdthesis] +% } + \map{%先于标准样式的driver层映射,以取消type设置 + \step[typesource=techreport, typetarget=report, final] + %\step[fieldset=type, fieldvalue=techreport] + } + \map{% + \pertype{report} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=report,typetarget=online] + \step[fieldset=note,fieldvalue={report}] + } + \map{% + \pertype{thesis} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=thesis,typetarget=online] + } + \map{% + \pertype{manual} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=manual,typetarget=online] + } + \map{% + \pertype{unpublished} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=unpublished,typetarget=online] + } + \map{% + \pertype{database} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=databasetypetarget=online] + } + \map{% + \pertype{dataset} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=dataset,typetarget=online] + } + \map{% + \pertype{software} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=software,typetarget=online] + } + \map{% + \pertype{map} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=map,typetarget=online] + } + \map{% + \pertype{archive} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=archive,typetarget=online] + } + \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确) + \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 + \step[fieldset=keywords, fieldvalue={,}, append] + \step[fieldset=keywords, origfieldval, append] + } + \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ + \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] + } + \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ + \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] + } + \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,% + address,location,institution,organization}]{ + \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + } + } +} + +\iftoggle{iftlfive}% + {\switchversion{3.0}{map}}%%当采用biblatex<=3.2版本时 + {\switchversion{3.4}{map}}%%当采用3.3<=biblatex版本时 + + +% +% 不同语言分集调整的实现方式 +% +% 原理方法:利用样式层的动态数据修改lansortorder域来实现排序 +\def\dealsortlan{ + \DeclareStyleSourcemap{ + \maps[datatype=bibtex]{ + \map[overwrite]{%当文献给出language域时,设置文献要使用的本地化字符串的语言 + \step[fieldsource=language,match=english,final] + \step[fieldset=lansortorder,fieldvalue=\lanenorder] + } + \map[overwrite]{ + \step[fieldsource=language,match=russian,final] + \step[fieldset=lansortorder,fieldvalue=\lanruorder] + } + \map[overwrite]{% + \step[fieldsource=language,match=french,final] + \step[fieldset=lansortorder,fieldvalue=\lanfrorder] + } + \map[overwrite]{% + \step[fieldsource=language,match=chinese,final]%中日韩语目前都用english, + \step[fieldset=lansortorder,fieldvalue=\lancnorder] + } + \map[overwrite]{% + \step[fieldsource=language,match=japanese,final]%中日韩语目前都用english, + \step[fieldset=lansortorder,fieldvalue=\lanjporder] + } + \map[overwrite]{% + \step[fieldsource=language,match=korean,final]%中日韩语目前都用english, + \step[fieldset=lansortorder,fieldvalue=\lankrorder] + } + } + } +} + +% +%驱动别名等价于驱动层映射 +% +\DeclareBibliographyAlias{newspaper}{article}% +\DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动 +\DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动 +\DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动 +\DeclareBibliographyAlias{collection}{book}%%文集类型驱动 +\DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动 +\DeclareBibliographyAlias{thesis}{manual}%学位论文驱动 +\DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动 +\DeclareBibliographyAlias{database}{manual} +\DeclareBibliographyAlias{dataset}{manual} +\DeclareBibliographyAlias{software}{manual} +\DeclareBibliographyAlias{map}{manual} +\DeclareBibliographyAlias{archive}{manual} + +%===================================================================== +% 设置排序格式 +%===================================================================== +% +% 排序格式,用降序,及userb域,针对biblatex3.7及以下版本 +% +\defversion{3.7}{sort}{%这是3.4版的,3.7版略有差异,但不大,后面有注释 + \DeclareSortingScheme{gb7714-2015}{ + \sort{ + \field{presort} + } + %\sort[final]{ + %\field{sortkey} + %} + \sort{ + \field{lansortorder}%language + } + \sort{ + \field{sortkey} + } + \sort{%[direction=descending] + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sortyear} + \field{year} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} + \literal{0000}%3.7版是\literal{0} + } + } + + %降序的nyt + \DeclareSortingScheme{gbnytd}{ + \sort{ + \field{presort} + } + %\sort[final]{ + %\field{sortkey} + %} + \sort{ + \field{lansortorder}%language + } + \sort[direction=descending]{ + \field{sortkey} + } + \sort[direction=descending]{ + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sortyear} + \field{year} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} + \literal{0000}%3.7版是\literal{0} + } + } + + %降序的ynt + \DeclareSortingScheme{gbyntd}{ + \sort{ + \field{presort} + } + %\sort[final]{ + %\field{sortkey} + %} + \sort{ + \field{lansortorder}%language + } + \sort[direction=descending]{ + \field{sortyear} + \field{year} + } + \sort{ + \field{sortkey} + } + \sort{ + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} + \literal{0000}%3.7版是\literal{0} + } + } + + %升序的ynt + \DeclareSortingScheme{gbynta}{ + \sort{ + \field{presort} + } + %\sort[final]{ + %\field{sortkey} + %} + \sort{ + \field{lansortorder}%language + } + \sort{ + \field{sortyear} + \field{year} + } + \sort{ + \field{sortkey} + } + \sort{ + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} + \literal{0000}%3.7版是\literal{0} + } + } +} + + +% +% 排序格式,用降序,及userb域,针对biblatex3.8及以上版本 +% +\defversion{3.8}{sort}{ + \DeclareSortingTemplate{gb7714-2015}{ + \sort{ + \field{presort} + } + %\sort[final]{ + %\field{sortkey} + %} + \sort{ + \field{lansortorder}%language + } + \sort{ + \field{sortkey} + } + \sort{%[direction=descending] + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sortyear} + \field{year} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field{volume} + \literal{0} + } + } + + %降序的nyt + \DeclareSortingTemplate{gbnytd}{ + \sort{ + \field{presort} + } +% \sort[final]{ +% \field{sortkey} +% } + \sort{ + \field{lansortorder}%language + } + \sort[direction=descending]{ + \field{sortkey} + } + \sort[direction=descending]{% + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sortyear} + \field{year} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field{volume} + \literal{0} + } + } + + %降序的ynt + \DeclareSortingTemplate{gbyntd}{ + \sort{ + \field{presort} + } +% \sort[final]{ +% \field{sortkey} +% } + \sort{ + \field{lansortorder}%language + } + \sort[direction=descending]{ + \field{sortyear} + \field{year} + } + \sort{ + \field{sortkey} + } + \sort{% + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field{volume} + \literal{0} + } + } + + %升序的ynt + \DeclareSortingTemplate{gbynta}{ + \sort{ + \field{presort} + } +% \sort[final]{ +% \field{sortkey} +% } + \sort{ + \field{lansortorder}%language + } + \sort{%[direction=ascending] + \field{sortyear} + \field{year} + } + \sort{ + \field{sortkey} + } + \sort{% + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field{volume} + \literal{0} + } + } +} + + +\ifboolexpr{ +test {\iftoggle{iftlfive}} +or +test {\iftoggle{iftlsix}} +or +test {\iftoggle{iftlseven}}%biblatex<=3.7 +}{\switchversion{3.7}{sort}}{\switchversion{3.8}{sort}}%3.8<=biblatex + +%===================================================================== +% 参考文献表环境 +%===================================================================== +% +% 列表格式 +% +% 增加一个\bibitemindent尺寸用于控制list环境的itemindent +% v1.0l,20180615,hzz +% v1.0t,20200319,hzz,增加尺寸\biblabelextend使某些字体下标签宽度不足时可增加标签宽度 +\setlength{\bibhang}{\biblabelsep}% +\newlength{\bibitemindent} +\setlength{\bibitemindent}{0pt} +\newlength{\biblabelextend} +\setlength{\biblabelextend}{0pt} + + +\defbibenvironment{bibliography} + {\list + {\printtext[labelnumberwidth]{% + \printfield{labelprefix}% + \printfield{labelnumber}}} + {\addtolength{\labelnumberwidth}{\biblabelextend}% + \setlength{\labelwidth}{\labelnumberwidth}% + \setlength{\labelsep}{\biblabelsep}% + \setlength{\leftmargin}{\bibhang}% + \addtolength{\leftmargin}{\labelnumberwidth}% + \setlength{\itemindent}{\bibitemindent}% + \setlength{\itemsep}{\bibitemsep}% + \setlength{\parsep}{\bibparsep}}% + \renewcommand*{\makelabel}[1]{\hss##1}} + {\endlist} + {\item} + +% +% 顺序编码制-标签对齐方式处理 +% +% 原理方法:利用选项提供的计数器数值做选择 +% 左对齐,右对齐为list环境下的处理,此时list环境的\labelwidth只能设置一个,是最宽标签的宽度 +% 项对齐则是在段落环境下做的处理。 +% 左对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距可变 +% 右对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距相等,标签与页边距离可变 +% 项对齐时,序号标签贴在页边,序号标签与参考文献项内容的间距相等 +% 修改序号标签格式为: +% \DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} %源来自numeric.BBX +% \DeclareFieldFormat{labelnumberwidth}{\ttfamily\mkbibbrackets{#1}\hfill} +\DeclareFieldFormat{labelnumberwidth}{% +\ifcase\value{gbalignlabel}%右对齐,整个标签为右对齐 + \mkgbnumlabel{#1}% +\or%左对齐,整个标签为左对齐 + \mkgbnumlabel{#1}\hfill% +\or%中间对齐,比如:序号数字居于[]中间 + \hfil\mkgbnumlabel{\hfill#1\hfill}\hfil% +\fi} + +% +% 修改序号标签格式为以各条参文献为基础进行对齐的方式,即序号与条目内容间隔相等的方式。 +\def\setaligngbstyle{% +\def\blx@bibitem##1{% + \blx@ifdata{##1} + {\begingroup + \blx@getdata{##1}% + \blx@bibcheck + \iftoggle{blx@skipentry}{}{% + \blx@setdefaultrefcontext{##1}% + \global\let\blx@noitem\@empty + \blx@setoptions@type\abx@field@entrytype + \blx@setoptions@entry + \blx@thelabelnumber + \addtocounter{instcount}\@ne + \blx@initsep + \blx@namesep + \csuse{blx@item@\blx@theenv}\relax +% \blx@initsep %移动到上面去,恢复bibnamesep等的作用机制 +% \blx@namesep + \csuse{blx@hook@bibitem}% + \blx@execute + \blx@initunit + \blx@anchor + \blx@beglangbib + \bibsentence + \blx@pagetracker + \blx@driver\abx@field@entrytype + \blx@postpunct + \blx@endlangbib}% + \par\endgroup}%这里增加了一个\par + {}} +\newlength{\lengthid} +\newlength{\lengthlw} +\newcommand{\itemcmd}{% +\settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}} +\addtolength{\lengthid}{\biblabelsep} +\setlength{\lengthlw}{\textwidth} +\addtolength{\lengthlw}{-\lengthid} +\addvspace{\bibitemsep}%恢复\bibitemsep的作用 +%\parshape 2 0em \textwidth \lengthid \lengthlw +\hangindent\lengthid +\mkgbnumlabel{\printfield{labelnumber}}% +\hspace{\biblabelsep}} +% +% 简单的段落环境 +\defbibenvironment{bibliography} +{\begingroup\setlength{\parindent}{0em}} +{\endgroup} +{\itemcmd}} + + +%===================================================================== +% 设置单元或块等的标点 +%===================================================================== +\renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin +\renewcommand*{\subtitlepunct}{\addcolon\addspace} %修改标题和其它标题信息间的标点,来源biblatex.def, +% +% 利用set实现的多语言文献不同语言间的分隔符 +% 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进 +% +% 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets +% 这里调整一下两种语言参考文献的间隔,源来自biblatex.def +\renewcommand*{\entrysetpunct}{\adddot\newline\nobreak} +\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号 +%\renewcommand{\relateddelim}{}%\par + +%===================================================================== +% 修改域的格式,重定义域的输出宏 +%===================================================================== +% +% 新增文献类型标识符的格式 +% []前的nobreak,从GB4.1节的例子看不应该加,所以去掉 +% 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上 +% 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉 +% +\DeclareFieldFormat{gbtypeflag}{% +\iftoggle{bbx:gbmedium}% +{\iftoggle{bbx:url}% + {\iffieldundef{url}%当存在url时,增加一个OL标识符 + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% + }% + {\ifentrytype{online}% + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% + }}% + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% +} + +% +% 新增用于报纸的文献类型标识符的格式 +% +\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper +\iftoggle{bbx:gbmedium}% +{\iftoggle{bbx:url}% + {\iffieldundef{url}%当存在url时,增加一个OL标识符 + {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% + {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% + }% + {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% +}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}% +} + +% +% 新增用于标准的文献类型标识符的格式 +% +\DeclareFieldFormat{gbtypeflags}{%用于标准standard +\iftoggle{bbx:gbmedium}% +{\iftoggle{bbx:url}% + {\iffieldundef{url}%当存在url时,增加一个OL标识符 + {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% + {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% + }% + {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% +}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}% +} + +% +% 重设title等参考文献信息的输出格式 +% +% 原理方法:修改来自biblatex.def文件的原格式 +\newcommand{\bibtitlefont}{} +\newcommand{\bibauthorfont}{} +\newcommand{\bibpubfont}{} + +\DeclareFieldFormat{title}{#1\adddot\addthinspace} +\DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪 +\DeclareFieldFormat{issuetitle}{#1} +\DeclareFieldFormat{maintitle}{#1} +\DeclareFieldFormat{booktitle}{#1} +\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 + [article,patent,thesis,unpublished] + {title}{#1\adddot\addthinspace}%\mkbibquote{#1\isdot} +\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 + [inbook,incollection,inproceedings] + {title}{#1}%\nopunct\unspace +\DeclareFieldFormat{url}{\url{#1}} %%url相关输出,url域修改如本行,源来自biblatex.def +\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily +%\urlstyle{rm} %使用这句也一样 +\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行 +\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行 +\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行 +\DeclareFieldFormat{doi}{% + \rmfamily{DOI}\addcolon\space + \ifhyperref + {\href{https://doi.org/#1}{\nolinkurl{#1}}} + {\nolinkurl{#1}}} +% +% 标题的字母大小写格式修改 +% +% 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase +% 因为titlecase is applied to the contents of the field directly,title is not +%\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写 +\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{% +\iffieldundef{url}{\MakeCapital#1}{% +\href{\thefield{url}}{#1}}}{\MakeCapital#1}}%重设标题格式,将其修改为首字母大写 +\DeclareFieldFormat{pages}{#1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{#1} +\DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线 +\DefineBibliographyExtras{russian}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线 + +\def\execgbfdfmtstd{%恢复到标准样式的设置 +\DeclareFieldFormat{title}{\mkbibemph{##1}} +\DeclareFieldFormat + [article,inbook,incollection,inproceedings,patent,thesis,unpublished] + {title}{\mkbibquote{##1\isdot}} +\DeclareFieldFormat + [suppbook,suppcollection,suppperiodical] + {title}{##1} +\DeclareFieldFormat{journaltitle}{\mkbibemph{##1}} +\DeclareFieldFormat{issuetitle}{\mkbibemph{##1}} +\DeclareFieldFormat{maintitle}{\mkbibemph{##1}} +\DeclareFieldFormat{booktitle}{\mkbibemph{##1}} +\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{##1}} +\DeclareFieldFormat{titlecase}{##1} +\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{##1}} +} + +% +% 文献标题后的标点问题 +% v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen +% +% 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况: +% texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于 +% 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响 +% 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct +\ifboolexpr{% + test{\iftoggle{iftlfive}} + or + test{\iftoggle{iftlsix}} + }{}% + {%texlive 2017对应iftlseven以上版本 + \@ifclassloaded{beamer}{ + \DeclareFieldFormat{title}{#1}% + \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1} + \AtBeginDocument{% + \patchcmd{\abx@macro@title}{\newunitpunct}{}{}{}}}{} + } + + +% +% 修改译者位置格式 +% +% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式 +\renewbibmacro*{bytranslator+others}{\bibauthorfont% + \ifnameundef{translator} + {} + {%\usebibmacro{bytranslator+othersstrg} + %\setunit{\addspace}% + \printnames[bytranslator]{translator}% + \clearname{translator}% + %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理 + %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串 + \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。 + %\setunit{\addspace}% + \newunit}% + \usebibmacro{withothers}} + + +% +% 修改作者数量超过限定值,做省略时的处理格式 +% v1.0,20160701,hzz +% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim +% +% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。 +\renewbibmacro*{name:andothers}{\bibauthorfont% + \ifboolexpr{ + test {\ifnumequal{\value{listcount}}{\value{liststop}}} + and + test \ifmorenames + }{\ifnumgreater{\value{liststop}}{1}% + {\finalandcomma}% + {}% +\printdelim{andothersdelim}\printdelim{strandothersdelim}% +}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如: +%袁训来, 陈哲, 肖书海, 等. +%胡泳, 范海燕, 译. +%潘惠霞, 魏婧, 杨艳, 等译. +\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理 +}} + + +% 修改省略作者后的本地化字符串,比如et al. +% v1.0o,20190103,hzz +% +% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。 +% 非默认情况,根据选项信息,选择选择强制中文或英文 +% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 +% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 +\DeclareDelimFormat{strandothersdelim}{% + \edef\userfieldabcde{userd}%这里使用\iffieldequalstr{labelnamesource}替代ifcurrentname因为标注中使用ifcurrentname无效 + \iffieldequalstr{labelnamesource}{translator}{\edef\userfieldabcde{usere}}{}% + \iffieldequalstr{labelnamesource}{editor}{\edef\userfieldabcde{userc}}{}% + \iffieldequalstr{labelnamesource}{author}{\edef\userfieldabcde{userf}}{}% + \iffieldequalstr{labelnamesource}{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbcitelocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\ifbibstring{andothersincitecn}{\bibstring{andothersincitecn}}{\bibstring{andothers}}}{}%中文已经通过english本地化字符串定义 + \iffieldequalstr{\userfieldabcde}{korean}{\ifbibstring{andotherskr}{\bibstring{andotherskr}}{\bibstring{andothers}}}{}%韩语未定义,所以与bib中一致 + \iffieldequalstr{\userfieldabcde}{japanese}{\ifbibstring{andothersjp}{\bibstring{andothersjp}}{\bibstring{andothers}}}{}%日与同韩语 + \iffieldequalstr{\userfieldabcde}{english}{\ifbibstring{andothersincite}{\bibstring{andothersincite}}{\bibstring{andothers}}}{}%英语已定义 + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%法语未定义,若要定义需要针对french本地化字符串定义 + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%俄语未定义,若要定义需要针对russian本地化字符串定义 + \or% + \bibstring{andothersincitecn}% + \or% + \bibstring{andothersincite}% + \fi} + + +\DeclareDelimFormat[bib,biblist]{strandothersdelim}{% + \edef\userfieldabcde{userd}% + \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}% + \or% + \bibstring{andotherscn}% + \or% + \bibstring{andothers}% + \fi} + +% +% 修改最后一个作者前的字符串,比如 and +% v1.0o,20190103,hzz +% +% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。 +% 非默认情况,根据选项信息,选择选择强制中文或英文 +% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 +% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 +\DeclareDelimFormat{finalnamedelim}{% + \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% +% \addspace% + \edef\userfieldabcde{userd}% + \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbcitelocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\space\bibstring{andincite}\space}{}% + \iffieldequalstr{\userfieldabcde}{french}{\space\bibstring{and}\space}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\space\bibstring{and}\space}{}% +%\space% + \or% + \bibstring{andincitecn}%\space% + \or% +\space\bibstring{andincite}\space% + \fi} + +\DeclareDelimFormat[bib,biblist]{finalnamedelim}{% + \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% + \addspace% + \edef\userfieldabcde{userd}% + \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% +\space% + \or% + \bibstring{andcn}\space% + \or% + \bibstring{and}\space% + \fi} + + +% +% 重设title的输出 +% +% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen +% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件 +% 利用toggle做标识符是否输出的判断 +\renewbibmacro*{title}{% + \ifboolexpr{% + test{\iffieldundef{title}}% + and + test{\iffieldundef{subtitle}}% + }% + {}% + {\printtext[title]{\bibtitlefont%增加字体控制命令 + \printfield[titlecase]{title}% + \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 + {}{\setunit{\subtitlepunct}% + \printfield[titlecase]{subtitle}}% + \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 + {\setunit{\subtitlepunct}\printfield{titleaddon}}% + \iftoggle{bbx:gbtype}{% + \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 + {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 + {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 + {\printfield[gbtypeflag]{usera}}}%其它 + }}{}% + %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 + %\newunit +}% +}} + +% +% 作者信息的输出格式 +% +% 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen +% 20180603,v1.0l,增加使用nameformat域来选择姓名格式 +\DeclareNameFormat{namefmtselected}{% +\iffieldundef{namefmtid}{}% +{\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}% +\ifcase\value{gbnamefmtcase}% + \ifgiveninits + {\usebibmacro{name:gbuppercase} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:gbuppercase} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% +\or + \ifgiveninits + {\usebibmacro{name:gblowercase} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:gblowercase} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% +\or + \ifgiveninits + {\usebibmacro{name:given-family} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:given-family} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% +\or + \ifgiveninits + {\usebibmacro{name:family-given} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:family-given} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% +\or +\usebibmacro{name:gbpinyin} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}% +\or + \ifnumequal{\value{listcount}}{1} + {\ifgiveninits + {\usebibmacro{name:family-given} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:family-given} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% + \ifboolexpe{% + test {\ifdefvoid\namepartgiven} + and + test {\ifdefvoid\namepartprefix}} + {} + {\usebibmacro{name:revsdelim}}} + {\ifgiveninits + {\usebibmacro{name:given-family} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:given-family} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}}% +\fi + \usebibmacro{name:andothers}} + +\DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式 +\DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family +\DeclareNameAlias{citename}{default}% Default used by \citename + +\DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace} +%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% + +%GB/T 7714-2015 风格,全部大写 +\newbibmacro*{name:gbuppercase}[4]{\bibauthorfont% +\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 +\renewcommand*{\revsdnamepunct}{}% + \ifuseprefix% + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifdefvoid{#3}{}{% + \ifcapital% + {\mkbibnameprefix{\MakeCapital{#3}}\isdot}% + {\mkbibnameprefix{#3}\isdot}% + \ifprefchar{}{\bibnamedelimc}}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% + \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital + \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号 + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% + \ifboolexpe{% + test {\ifdefvoid{#2}} + and + test {\ifdefvoid{#3}}} + {}{\revsdnamepunct}% + \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital + \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% + \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号 +} + +%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 +\newbibmacro*{name:gblowercase}[4]{\bibauthorfont% + \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 + \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def + \ifuseprefix + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifdefvoid{#3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{#3}}\isdot} + {\mkbibnameprefix{#3}\isdot}% + \ifprefchar{}{\bibnamedelimc}}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% + \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital + \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号 + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% + \ifboolexpe{% + test {\ifdefvoid{#2}} + and + test {\ifdefvoid{#3}}} + {}{\revsdnamepunct}% + \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital + \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} + \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号 +} + +%中文常见风格,汉语拼音全拼模式 +\newbibmacro*{name:gbpinyin}[4]{\bibauthorfont% +\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY +\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def +\renewrobustcmd*{\bibnamedelima}{\mbox{-}}% + \ifuseprefix + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifdefvoid{#3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{#3}}\isdot} + {\mkbibnameprefix{#3}\isdot}% + \ifprefchar{}{\bibnamedelimc}}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% + \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamegiven{#2}}\isdot}%\MakeCapital + \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}} + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% + \ifboolexpe{% + test {\ifdefvoid{#2}} + and + test {\ifdefvoid{#3}}} + {} + {\revsdnamepunct}% + \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital + \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} + \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% +} + + +\@ifpackagelater{biblatex}{2016/03/27}%biblatex<3.2版的情况 + {}{ + %GB/T 7714-2015 风格,全部大写 + \renewbibmacro*{name:gbuppercase}[4]{\bibauthorfont% + \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 + \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def + \ifuseprefix + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifblank{#3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{#3}}\isdot} + {\mkbibnameprefix{#3}\isdot}% + \ifpunctmark{'}{}{\bibnamedelimc}}% + %\mkbibnamelast{#1}\isdot + \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase + %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开 + %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{} + %\mkbibnamelast{\MakeUppercase{#1}}\isdot + %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 + \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% + \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}%后缀前加逗号 + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}} + \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase + %\mkbibnamelast{\MakeUppercase{#1}}\isdot + %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 + \ifblank{#2#3}{}{\revsdnamepunct}% + \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% + \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% + \addcomma\addspace% + \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%%后缀前加逗号 + }% + } + + %GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 + \renewbibmacro*{name:gblowercase}[4]{\bibauthorfont% + \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 + \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def + \ifuseprefix + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifblank{#3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{#3}}\isdot} + {\mkbibnameprefix{#3}\isdot}% + \ifpunctmark{'}{}{\bibnamedelimc}}% + \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase + \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}% + \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}%后缀前加逗号 + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase + \ifblank{#2#3}{}{\revsdnamepunct}% + \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}% + \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% + \addcomma\addspace% + \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%%后缀前加逗号 + }% + } + + %中文常见风格,汉语拼音全拼模式 + \renewbibmacro*{name:gbpinyin}[4]{\bibauthorfont% + \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 + \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def + \renewrobustcmd*{\bibnamedelima}{\mbox{-}}% + \ifuseprefix + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifblank{#3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{#3}}\isdot} + {\mkbibnameprefix{#3}\isdot}% + \ifpunctmark{'}{}{\bibnamedelimc}}% + \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase + \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamefirst{#2}}\isdot}% + \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}} + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase + \ifblank{#2#3}{}{\revsdnamepunct}% + \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% + \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% + \addcomma\addspace% + \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}% + }% + } + + %%biblatex<3.2版的情况,姓名的处理格式带参数 + \DeclareNameFormat{namefmtselected}{% + \iffieldundef{namefmtid}{}% + {\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}% + \ifcase\value{gbnamefmtcase}% + \iffirstinits + {\usebibmacro{name:gbuppercase}{#1}{#4}{#5}{#7}} + {\usebibmacro{name:gbuppercase}{#1}{#3}{#5}{#7}}% + \or + \iffirstinits + {\usebibmacro{name:gblowercase}{#1}{#4}{#5}{#7}} + {\usebibmacro{name:gblowercase}{#1}{#3}{#5}{#7}}% + \or + \iffirstinits + {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}} + {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}% + \ifblank{#3#5} + {} + {\usebibmacro{name:revsdelim}}% + \or + \iffirstinits + {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}} + {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}% + \or + \usebibmacro{name:gbpinyin}{#1}{#3}{#5}{#7}% + \or + \ifnumequal{\value{listcount}}{1} + {\iffirstinits + {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}} + {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}% + \ifblank{#3#5} + {} + {\usebibmacro{name:revsdelim}}} + {\iffirstinits + {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}} + {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}}% + \fi + \usebibmacro{name:andothers}} +} + +% +% url和url日期格式 +% +\renewbibmacro*{url+urldate}{% + %\usebibmacro{url}%%更换url的位置,放到下面 + \iffieldundef{urlyear}% + {}{%\setunit*{\addspace}% + \usebibmacro{urldate}}% + \setunit{\addperiod\addspace}% + \usebibmacro{url}} +\renewbibmacro*{url}{\printfield{url}} + + + + +% +% 日期信息的输出格式,针对biblatex<3.7版本 +% +\defversion{3.4}{date}{ + \renewbibmacro*{urldate}{% + \addthinspace\printtext{[}\printfield{urlyear}% + \iffieldundef{urlmonth}{}{\bibrangedash\printfield{urlmonth}}% + \iffieldundef{urlday}{}{\bibrangedash\printfield{urlday}}\printtext{]}} + + \newbibmacro*{newsdate}{%%新增加一个公告日期,公开日期或新闻日期 + \iffieldundef{year}{}{\printfield{year}% + \iffieldundef{month}{}{\bibrangedash\printtext{\thefield{month}}% + \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}% + } + + \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 + \ifboolexpr{% + test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% + }% + {}%更新或修改日期通常有day信息 + {\iffieldequalstr{year}{}{%替换\iffieldundef{year},因为year总是存在,但为空 + \iffieldundef{endyear}{% + \iffieldundef{eventyear}{}{\printtext{\mkbibparens{\printtext{\printfield{eventyear}}% + \iffieldundef{eventmonth}{}{\bibrangedash\thefield{eventmonth}}% + \iffieldundef{eventday}{}{\bibrangedash\printfield{eventday}}}}% + }% + }{% + \iffieldundef{endyear}{}{\printtext{\mkbibparens{\printtext{\printfield{endyear}}% + \iffieldundef{endmonth}{}{\bibrangedash\thefield{endmonth}}% + \iffieldundef{endday}{}{\bibrangedash\printfield{endday}}}}% + }% + }% + }% + {% + \iffieldundef{year}{}{\printtext{\mkbibparens{\printtext{\printfield{year}}% + \iffieldundef{month}{}{\bibrangedash\thefield{month}}% + \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}% + }% + }% + }}% +} + +% +% 日期信息的输出格式,针对3.9>=biblatex>=3.7版本 +% +\defversion{3.7}{date}{ + \DeclareFieldFormat{urldate}{##1} + \renewbibmacro*{urldate}{% + \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 + + % + % 专利的公告日期、或报纸的日期的输出宏 + % 20160701,v1.0,新增加 + % 20180405,v1.0k,为biblatexv3.7-3.9版本,出现多出点bug做处理,Hu Zhenzhen + % + % 原理方法:加上printtext避免破坏异步标点机制 + % + \newbibmacro*{newsdate}{% + \printtext{\blx@edtfdate{}{}}% + } + + \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 + \ifboolexpr{% + test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% + }% + {}%更新或修改日期通常有day信息 + {\iffieldundef{year}{% + \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% + {\printtext{(}\printenddate\printtext{)}}% + }{\iffieldequalstr{year}{}{%因为year存在,但为空 + }{\printtext{(}\blx@edtfdate{}{}\printtext{)}}% + }% + }}% +} + +% +% 日期信息的输出格式,针对biblatex>=3.10版本 +% +\defversion{3.10}{date}{ + \DeclareFieldFormat{urldate}{##1} + \renewbibmacro*{urldate}{% + \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 + + % + % 专利的公告日期、或报纸的日期的输出宏 + % 20160701,v1.0,新增加 + % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen + % + % 原理方法:加上printtext避免破坏异步标点机制 + % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份 + % 所以无法再用选项设置的方法,印象需要用底层的命令 + % 这里可以用\blx@isodate,但用\blx@gbdate试图避免版本判断 + \newbibmacro*{newsdate}{%% + \printtext{\blx@gbdate{}{}}%%\blx@isodate{}{}% + } + + % + \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 + \ifboolexpr{% + test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% + }% + {}%更新或修改日期通常有day信息 + {\iffieldundef{year}{% + \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% + {\printtext{(}\printenddate\printtext{)}}% + }{\iffieldequalstr{year}{}{%因为year存在,但为空 + }{\printtext{(}\blx@gbdate{}{}\printtext{)}}% + }% + }}% +} + +% +% biblatex>v3.8版利用related实现双语文献的处理 +% +\defversion{3.8}{dblang}{ + %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了, + %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息 + %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中 + \newcommand{\defdoublelangentry}[2]{% + \edef\entrykeya{##1} + \edef\entrykeyb{##2} + \DeclareStyleSourcemap{ + \maps[datatype=bibtex]{ + \map{ + \step[fieldsource=entrykey, match=\entrykeya, final] + \step[fieldset=related, fieldvalue=\entrykeyb] + } + } + } + } +} + +% +% 关联文献间的分隔符 +% +\renewcommand{\relateddelim}{\adddot\newline\nobreak}%\par,而作者年样式不需要修改,因为没有项对齐的标签问题 + +% +% 关联文献的输出格式,针对3.9>=biblatex>=3.7版本 +% +% 原理方法:因为related宏中带有##了,所以无法封装到defversion中了。所以直接做判断 +% 下面这一段主要针对v3.8-3.10,因为我提问后,biblatex作者为3.11版增加了一个钩子控制relatedblock前的分隔符。 +\ifboolexpr{ +test{\iftoggle{iftleight}} +or +test{\iftoggle{iftlnine}} +}{\renewbibmacro*{related}{%standard.bbx + \ifboolexpr{ test {\iffieldundef{related}} or test {\ifrelatedloop} } + {} + {\usebibmacro{begrelated}% + \def\bbx@tempa{}% + \setcounter{bbx:relatedtotal}{0}% + \def\do##1{% + \entrydata{##1}{% + \ifrelatedloop + {} + {\stepcounter{bbx:relatedtotal}% + \gappto{\bbx@tempa}{##1,}}}}% + \docsvfield{related}% + \restorefield{related}{\bbx@tempa}% + \ifnumgreater{\value{bbx:relatedtotal}}{0} + {\listcsxadd{bbx:relatedloop}{\strfield{entrykey}}% + \iffieldundef{clonesourcekey} + {} + {\listcsxadd{bbx:relatedloop}{\strfield{clonesourcekey}}}% + \setcounter{bbx:relatedcount}{0}% + \def\do{% + \stepcounter{bbx:relatedcount}% + \ifnumgreater{\value{bbx:relatedcount}}{0}%这里从1改为0 + {\ifcsundef{relateddelim\strfield{relatedtype}} + {\printtext{\relateddelim}} + {\printtext{\csuse{relateddelim\strfield{relatedtype}}}}} + {}}% + \ifbibmacroundef{related:\strfield{relatedtype}} + {\appto{\do}{\usebibmacro{related:default}}} + {\appto{\do}{\usebibmacro*{related:\strfield{relatedtype}}}}% + \iffieldformatundef{related:\strfield{relatedtype}} + {\def\bbx@tempa{related}} + {\def\bbx@tempa{related:\strfield{relatedtype}}}% + \iffieldformatundef{relatedstring:\strfield{relatedtype}} + {\def\bbx@tempb{relatedstring:default}} + {\def\bbx@tempb{relatedstring:\strfield{relatedtype}}}% + \printtext[\bbx@tempa]{% + \usebibmacro{begrelatedloop}% + \iffieldundef{relatedstring} + {\ifboolexpr{ + test {\ifnumgreater{\value{bbx:relatedtotal}}{1}} + and + test {\ifbibxstring{\thefield{relatedtype}s}} + } + {\printtext[\bbx@tempb]{% + \bibstring[\mkrelatedstring]{\thefield{relatedtype}s}}} + {\iffieldbibstring{relatedtype} + {\printtext[\bbx@tempb]{% + \bibstring[\mkrelatedstring]{\thefield{relatedtype}}}} + {}}} + {\iffieldbibstring{relatedstring} + {\printtext[\bbx@tempb]{% + \bibstring[\mkrelatedstring]{\thefield{relatedstring}}}} + {\printfield[\bbx@tempb]{relatedstring}}}% + \docsvfield{related}% + \usebibmacro{endrelatedloop}}}% + {}% + \usebibmacro{endrelated}}} +}{} + +% +% 关联文献块前的分隔符,针对biblatex>3.11 +% +% 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏 +\defversion{3.11}{related}{ +\renewcommand{\begrelateddelim}{\adddot\newline\nobreak} +} + +\iftoggle{iftlfive}{\switchversion{3.4}{date}}{}%biblatex<=3.2 +\iftoggle{iftlsix}{\switchversion{3.4}{date}}{}%3.3<=biblatex<=3.6 +\iftoggle{iftlseven}{\switchversion{3.7}{date}}{}%biblatex=3.7 +\iftoggle{iftleight}{\switchversion{3.7}{date}\switchversion{3.8}{dblang}}{}%3.8<=biblatex<=3.9 +\iftoggle{iftlnine}{\switchversion{3.10}{date}\switchversion{3.8}{dblang}}{}%biblatex=3.10 +\iftoggle{iftlatest}{\switchversion{3.10}{date}\switchversion{3.8}{dblang}\switchversion{3.11}{related}}{}%biblatex最新3.11 + +% +% 调整doi+eprint+url格式 +% 2016.07.01 byhzz +% 2019.05.01 byhzz 在eprint前增加一个空格 +% 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。 +\renewbibmacro*{doi+eprint+url}{% +% \iftoggle{bbx:doi}%把doi的位置放到url后面 +% {\printfield{doi}} +% {}% + %\newunit\newblock + \iftoggle{bbx:eprint} + {\iffieldundef{eprint}{}{\newunit\usebibmacro{eprint}}} + {}% + %\newunit\newblock + \iftoggle{bbx:url} + {\usebibmacro{url+urldate}} + {} + \newunit\newblock + \iftoggle{bbx:doi} + {\printfield{doi}} + {}} + +% +% 调整页码的格式,即chapter+pages格式 +% +\renewbibmacro*{chapter+pages}{% +\iftoggle{bbx:gbstrict}{}{% + \printfield{chapter}}% + \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出 + \setunit{\bibpagespunct}% + \printfield{pages}}% + %\newunit %这里的标点去掉 +} + +% +% 当location等出版项超过maxitem缩减后不再输出etal +% +\DeclareListFormat{location}{% + \usebibmacro{list:delim}{#1}% + #1\isdot} +\DeclareListAlias{institution}{location} +\DeclareListAlias{publisher}{location} + +% 新增一个样式用于输出连续出版物的地址,单位,时间, +% 用于periodical连续出版物的出版社和地址的处理 +% +% v1.0k,20180425,为出版信息增加字体控制命令,hzz +% %类似\newbibmacro*{publisher+location+date} +\newbibmacro*{location+institution+date}{\bibpubfont% +\iftoggle{bbx:gbpub}% +{\testCJKfirst{userd}% +\ifboolexpr{% +test {\iflistundef{location}} and test {\iflistundef{institution}}% +}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}% +{\printtext{[S.l.\space :\space s.n.\adddot]}}% +}{% +\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}% + {\printlist{location}}% +\addcolon\addspace% +\iflistundef{institution}{% +\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}% +{\printlist{institution}}}% +\setunit{\addcomma\addspace}% + %\usebibmacro{date}% + \printfield{year}% + \bibrangedash% + \iffieldundef{endyear}{}{\printfield{endyear}}% + \newunit}% +{\printlist{location}% + \iflistundef{institution}% + {\setunit*{\addcomma\space}} + {\setunit*{\addcolon\space}}% + \printlist{institution}% + \setunit*{\addcomma\space}% + \usebibmacro{date}% + \newunit}% +} +% +% 通用的出版社和地址的处理 +% +% 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。 +% 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。 +% 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理 +\renewbibmacro*{publisher+location+date}{\bibpubfont% +\iftoggle{bbx:gbpub}% +{\testCJKfirst{userd}% + \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }% + {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}% + {\iflistundef{location}{%\adddot + \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 + {\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress} + {\printlist{location}\addcolon\addspace}%%\addcolon\addspace% + \iflistundef{publisher}{% + \iffieldequalstr{note}{standard}{}% + {\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}% + {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}% + {\printlist{publisher}}}% +\setunit*{\addcomma\addspace}%\addcomma\addspace% +\usebibmacro{date}%%\newunit %去掉这个标点 +}% +{\printlist{location}% + \iflistundef{publisher} + {\setunit*{\addcomma\space}} + {\setunit*{\addcolon\space}}% + \printlist{publisher}% + \setunit*{\addcomma\space}% + \usebibmacro{date}%%\newunit + }% +} + +% +% 修改了一个institution+location+date用于manual、report、thesis等类型 +% +% 20180425,v1.0k,增加了字体控制命令,hzz +% 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉 +\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。 +{\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉 + \iflistundef{institution} + {\setunit*{\addcomma\space}} + {\setunit*{\addcolon\space}}% + \printlist{institution}% + \setunit*{\addcomma\space}% + \usebibmacro{date}% + %\newunit + }} + +% +% 对volume卷信息格式做出修改 +% v1.0o,20190105,hzz +% +\DeclareFieldFormat{volume}{% +\testCJKfirst{userd}% +\iftoggle{ifCJKforgbt}% +{\bibstring{serialcn}#1\bibstring{volumecn}}% +{\bibstring{volume}~#1}% +}% volume of a book +\DeclareFieldFormat[article,periodical]{volume}{#1}% volume of a journal + +% +% 对number册信息格式做出修改 +% v1.0o,20190105,hzz +% +\DeclareFieldFormat{number}{#1}% +\DeclareFieldFormat[book,collection,inbook,% +incollection,proceedings,inproceedings]{number}{% +\testCJKfirst{userd}% +\iftoggle{ifCJKforgbt}% +{\bibstring{serialcn}#1\bibstring{numbercn}}% +{#1}% +}% + +% +% 对edition版本信息格式做出修改 +% +\DeclareFieldFormat{edition}{\bibtitlefont%源来自biblatex.DEF +\testCJKfirst{userd}% +\iftoggle{ifCJKforgbt}% +{\ifinteger{#1}% +{\printtext{#1\str@edition}}% +{#1\isdot}}% +{\ifinteger{#1}% +{\mkbibordedition{#1}~\bibstring{edition}}% +{#1\isdot}}} + +% +% 对version的版本信息做出修改 +% +\DeclareFieldFormat{version}{\bibtitlefont%源来自biblatex.DEF +\testCJKfirst{userd}% +\ifinteger{#1}% +{\iftoggle{ifCJKforgbt}{\printtext{#1\str@edition}}% +{\mkbibordedition{#1}~\bibstring{version}}}% +{#1\isdot}} + +% +% 修改析出文献的文集的标题与附加标题间的符号 +% +\renewbibmacro*{booktitle}{% + \ifboolexpr{ + test {\iffieldundef{booktitle}} + and + test {\iffieldundef{booksubtitle}} + } + {} + {\printtext[booktitle]{\bibtitlefont% + \printfield[titlecase]{booktitle}% + \setunit{\subtitlepunct}% + \printfield[titlecase]{booksubtitle}}% + \newunit%标点换成下一句 + \setunit{\subtitlepunct}}% + \printfield{booktitleaddon}} + + +% +% 调整期刊名的格式 +% +% v1.0k,20180425,增加了字体控制命令,hzz +\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx + \usebibmacro{journal}% + %\setunit*{\addspace}% + \setunit*{\addcomma\addspace}%修改为增加一个逗号 + \iffieldundef{series} + {} + {\newunit + \printfield{series}% + \setunit{\addspace}}% + %\usebibmacro{volume+number+eid}% + %\setunit{\addspace}% + \usebibmacro{issue+date}% + %\setunit{\addcolon\space}% + \iffieldundef{volume}{}{\setunit{\addcomma\space}}% + %换成逗号和空格 + \usebibmacro{issue}% + \usebibmacro{volume+number+eid}%把卷期放到年份后面 + %\newunit + } + + + +% +% 调整期刊卷和期的格式 +% +\renewbibmacro*{volume+number+eid}{%源来自standard.bbx +\iftoggle{bbx:gbfieldstd}{% + \printfield{volume}% + \setunit*{\adddot}% + \printfield{number}% + \setunit{\addcomma\space}% + \printfield{eid}}{% + \printfield{volume}% + %\setunit*{\adddot}%去掉点号 + %\printfield{number}% + \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号 + \iffieldundef{eid}{}{% + \setunit{\addcomma\space}% + \printfield{eid}}}} + +% +% 调整期刊年份的格式 +% +\renewbibmacro*{issue+date}{%去掉括号 + \printtext{%去掉了[parens] + \iffieldundef{issue} + {%\usebibmacro{date} + \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 + {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 + {\usebibmacro{date}}% + }}% + {\iftoggle{bbx:gbstrict}{}{\printfield{issue}% + \setunit*{\addspace}}% + %\usebibmacro{date} + \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 + {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 + {\usebibmacro{date}}% + }}}% + %\newunit + } + +% +% 调整页码前的标点和去掉期刊文章等页码后面的标点 +% +\renewbibmacro*{note+pages}{%源来自standard.bbx + %\printfield{note}%不要note,note用来判断是否是报纸newspaper + \iffieldundef{pages}{}{ + \setunit{\bibpagespunct}% + \printfield{pages}}% + %\newunit + } + + +% +% 编者的符号修改一下 +% v1.0 2016-07-01 +% v1.0q 2019-03-01 hzz 修改editortype前的标点 +% +\renewbibmacro*{editor}{%源来自biblatex.DEF + \ifboolexpr{ + test \ifuseeditor + and + not test {\ifnameundef{editor}} + } + {\printnames{editor}% + \iffieldundef{editortype}%增加一个类型判断,用于存在editortype的情况 + {\setunit\addspace}%当没有editortype时,直接用句点 + {%\setunit{\addcomma\space}% + \usebibmacro{editorstrg}}% + %\clearname{editor} + }% + {}} + +% +% 编者类型做一修改 +% v1.0 2016-07-01 +% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串 +% +\renewbibmacro*{editorstrg}{%源来自biblatex.DEF + \printtext[editortype]{% + \iffieldundef{editortype} + {% +% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理 +% test {\ifnumgreater{\value{editor}}{1}} +% or +% test {\ifandothers{editor}} +% } +% {\bibstring{editors}} +% {\bibstring{editor}} + } + {\ifbibxstring{\thefield{editortype}} %定义编者类型情况下处理,以后根据需要修改 + {\ifboolexpr{ + test {\ifnumgreater{\value{editor}}{1}} + or + test {\ifandothers{editor}} + } + {\printdelim{streditortypes}} + {\printdelim{streditortype}}} + {\thefield{editortype}}}% + }} + +% +% 编者类型的本地化字符串输出 +% v1.0q 2019-03-01 hzz +% 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符 +% 能对不同文境作设置的包括排序,标签等 +% 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串 +% +\DeclareDelimFormat{streditortypes}{% + \edef\userfieldabcde{userd}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% + \or% + \bibstring{\thefield{editortype}scn}% + \or% + \addcomma\addthinspace\bibstring{\thefield{editortype}s}% + \fi} +% +\DeclareDelimFormat{streditortype}{% + \edef\userfieldabcde{userd}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% + \or% + \bibstring{\thefield{editortype}cn}% + \or% + \addcomma\addthinspace\bibstring{\thefield{editortype}}% + \fi} + + +% +% bookauthor域的输出, +% v1.0q 2019-03-01 hzz +% 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替, +% 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype +\renewbibmacro*{bybookauthor}{% + \ifnameundef{bookauthor}% + {\ifnameundef{editor}% + {}% + {\ifnamesequal{author}{editor}% + {}{\usebibmacro{editor}}}% + }% + {\ifnamesequal{author}{bookauthor}% + {}{\printnames{bookauthor}}% + }% +} + +% +% 修改期刊的标题 +% +\renewbibmacro*{periodical}{%源来自biblatex.DEF + \iffieldundef{title} + {} + {\printtext[title]{\bibtitlefont% + \printfield[titlecase]{title}% + %\setunit{\subtitlepunct}% + \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 + {}{\setunit{\subtitlepunct} + \printfield[titlecase]{subtitle}}% + %}%把编组结束移到后面去 + \iftoggle{bbx:gbtype}{% + \iffieldundef{usera}{}{%在标题后直接给出文献标识字母 + \printfield[gbtypeflag]{usera}}}{} + }} + } + +% +% 期刊的标题做修改 +% +\renewbibmacro*{title+issuetitle}{%源来自standard.BBX + \usebibmacro{periodical}% + %\setunit*{\addspace}% + \setunit*{\adddot\addspace}%标点修改为句点 + \iffieldundef{series} + {} + {\newunit + \printfield{series}% + \setunit{\addspace}}% + \usebibmacro{periodical+issue}%将issue调整到上面来,并修改 +\iffieldundef{number}{}{%%进一步处理有范围的数字 + \multinumberparser{\thefield{number}}}% + \iffieldundef{volume}% + {\printfield{year}% + \printtext{\mkbibparens{\multinumberfirst}}% + \bibrangedash% + \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}% + }% + {\multivolparser{\thefield{volume}}% + \printfield{year}% + \setunit{\addcomma\space}%将冒号修改为逗号 + \printtext{\multivolfirst}% + \printtext{\mkbibparens{\multinumberfirst}}% + \bibrangedash% + \iffieldundef{endyear}{}{% + \printfield{endyear}% + \setunit{\addcomma\space}%将冒号修改为逗号 + \printtext{\multivolsecond}% + \printtext{\mkbibparens{\multinumbersecond}}}% + }% + \setunit{\addcomma\space}% + \printfield{eid}% + \setunit{\addspace}% + %\usebibmacro{issue+date}% + %\setunit{\addcolon\space}% + \usebibmacro{issue}% + \newunit} + +% +% 新增一个样式用于调整期刊年份的格式,只打印年份 +% +\newbibmacro*{periodical+issue}{% + \printtext{%去掉了[parens] + \iffieldundef{issue} + {%\usebibmacro{date}%修改为下一句 + }% + {\printfield{issue}% + \setunit*{\addspace}% + %\usebibmacro{date}%修改为下一句 + }% + }% + %\newunit +} + +% +% 重设专利title的输出,将文献类型标识符输出出去 +% +\newbibmacro*{patenttitle}{%原输出来自biblatex.def文件 + \ifboolexpr{% + test{\iffieldundef{title}}% + and% + test{\iffieldundef{subtitle}}% + }% + {}% + {\printtext[title]{\bibtitlefont% + \printfield[titlecase]{title}% + \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 + {}{\setunit{\subtitlepunct}% + \printfield[titlecase]{subtitle}}% + \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 + {\setunit{\subtitlepunct}\printfield{titleaddon}}% + \setunit{\subtitlepunct}\printfield{number}%写专利号 + \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}% + %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 + %\newunit + }% +}% +} + + + +% +% 修改in:用于inbook、incollection、inproceedings等类型 +% 2018.04.20,v1.0k,renewed marco,by hzz +% 20190212,v1.0q,增加中英文区分,by hzz +% +% 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。 +\renewbibmacro*{in:}{% + \iftoggle{bbx:gbpunctin}{\printtext{\allowbreak\texttt{//}\allowbreak}}%\addthinspace + {\setunit{\adddot\addspace}% + \iffieldequalstr{userd}{chinese}% + {\printtext{\bibstring{incn}}}% + {\printtext{\bibstring{in}}}% + }}%\newunit\newblock\intitlepunct + +% +% 修改type域的输出格式 +% 2019.02.12,v1.0q,byhzz +% 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文 +\DeclareFieldFormat{type}% +{\iffieldequalstr{userd}{chinese}% + {\ifbibxstring{#1cn}{\bibxstring{#1cn}}{#1}}% + {\ifbibstring{#1}{\bibstring{#1}}{#1}}% +} + +% +% 修改series域的输出格式 +% 2019.05.01,v1.0r,byhzz +\renewbibmacro*{series+number}{% + \printfield{series}% + %\setunit*{\addspace}% + %\printfield{number}% + %\newunit + } + +%===================================================================== +%设置驱动格式 +%===================================================================== +% +% book条目类的驱动 +% + \DeclareBibliographyDriver{book}{%源来自standard.bbx文件 + \usebibmacro{bibindex}% + \usebibmacro{begentry}% +\usebibmacro{author/editor+others/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 +\usebibmacro{maintitle+title}% +\iftoggle{bbx:gbstrict}{}{% +\newunit +\printlist{language}% +\newunit\newblock% +\usebibmacro{byauthor}% +\newunit\newblock}% +\usebibmacro{byeditor+others}% +\newunit +\printfield{edition}% +\newunit\newblock%% +\iftoggle{bbx:gbstrict}{}{% +\iffieldundef{maintitle}% +{\printfield{volume}% +\printfield{part}}% +{}% +\newunit% +\printfield{volumes}% +\newunit\newblock% +\usebibmacro{series+number}}% +\newunit\newblock% +%\printfield{note}% +%\newunit\newblock% +\usebibmacro{publisher+location+date}% +%\newunit\newblock %这里标点去掉 +\usebibmacro{chapter+pages}% + \iffieldundef{url}{}{%当没有网址时也不输出 + \usebibmacro{modifydate}}%带括号的修改或更新日期, +\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 + \newunit\newblock% + \printfield{pagetotal}% + \newunit\newblock% + \iftoggle{bbx:isbn} + {\printfield{isbn}} + {}% + \newunit\newblock + %\usebibmacro{doi+eprint+url}% + %\newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + + +% +% 期刊文章,连续出版物中的析出文献的格式 +% + \DeclareBibliographyDriver{article}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}% + \newunit\newblock + \usebibmacro{bytranslator+others}% + \newunit\newblock + \printfield{version}}% + \newunit\newblock + %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物 + \usebibmacro{journal+issuetitle}% + %\newunit +% \usebibmacro{byeditor+others}% +% \newunit + \usebibmacro{note+pages}% + \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期 + \iffieldundef{url}{}{%当没有网址时也不输出 + \iftoggle{bbx:url}{%当url选项为false时,也不输出 + \usebibmacro{modifydate}}{}}}%带括号的修改或更新日期, + \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置 + \newunit\newblock + \iftoggle{bbx:isbn} + {\printfield{issn}} + {}% + \newunit\newblock + %\usebibmacro{doi+eprint+url}% + %\newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + + + +% +% 连续出版物的驱动 +% + \DeclareBibliographyDriver{periodical}{%源来自standard.BBX + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{editor}% + %\setunit{\labelnamepunct}\newblock + \newunit\newblock %删除上面一行,添加这一行 + \usebibmacro{title+issuetitle}% + \newunit\newblock% + \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间 + \newunit\newblock%添加这一行 + \iftoggle{bbx:gbstrict}{}{% + \printlist{language}% + \newunit\newblock + \usebibmacro{byeditor}% + \newunit\newblock + \printfield{note}% + \newunit\newblock} + \iftoggle{bbx:isbn} + {\printfield{issn}} + {}% + \newunit\newblock + \usebibmacro{doi+eprint+url}% + \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + +% +% 专利文献驱动 +% + \DeclareBibliographyDriver{patent}{%源来自standard.BBX + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + %\usebibmacro{title}% + \usebibmacro{patenttitle}%给出专利专用的标题输出 + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}}% + \newunit\newblock + \printfield{type}% + \setunit*{\addspace}% + %\printfield{number}%已放到patenttitle中处理 + \iflistundef{location} + {} + {\setunit*{\addspace}% + \printtext{%[parens] + \printlist[][-\value{listtotal}]{location}}}% + \newunit\newblock + \usebibmacro{byholder}% + \newunit\newblock + \printfield{note}% + \newunit\newblock + \usebibmacro{newsdate}% + %\newunit\newblock + \usebibmacro{doi+eprint+url}% + \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + + +% +% 在线文献驱动 +% +\DeclareBibliographyDriver{online}{%源来自standard.BBX + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/editor+others/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}% + \newunit\newblock + \usebibmacro{byeditor+others}% + \newunit\newblock + \printfield{note}}% + \newunit + \printfield{version}% + \newunit\newblock + %\printlist{organization}% + \printlist{institution}% + \newunit\newblock +\ifboolexpr{% +test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% +}{\usebibmacro{date}}% +{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间 + \usebibmacro{url+urldate}%从下面移上来 + \newunit\newblock + \iftoggle{bbx:eprint} + {\usebibmacro{eprint}} + {}% + \newunit\newblock + %\usebibmacro{url+urldate}% + %\newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + + +% +% 报告类型驱动 +% 当有网址无出版项时,用online输出 +% +\DeclareBibliographyDriver{report}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}}% + \newunit\newblock + \usebibmacro{byeditor+others}%增加的译者信息 + \newunit\newblock + \printfield{type}% + \setunit*{\addspace}% + \printfield{number}% + \newunit\newblock + \printfield{version}% + \newunit + \printfield{note}% + \newunit\newblock + \usebibmacro{publisher+location+date}% + %\newunit\newblock + \usebibmacro{chapter+pages}% + \usebibmacro{doi+eprint+url}% + \newunit + \printfield{pagetotal}% + \newunit\newblock + \iftoggle{bbx:isbn} + {\printfield{isrn}} + {}% + \newunit\newblock +% \usebibmacro{doi+eprint+url}% +% \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + +% +% 论文、手册类型驱动 +% 2016-11-11,增加了译者信息 +% +\DeclareBibliographyDriver{manual}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}}% + \newunit\newblock + \usebibmacro{byeditor+others}%增加的译者信息 + \newunit\newblock + \iftoggle{bbx:gbfieldtype}{% + \printfield{type}% + \setunit*{\addspace}}{}% + \printfield{number}% + \newunit\newblock + \printfield{version}% + \newunit + \printfield{note}% + \newunit\newblock + \usebibmacro{institution+location+date}% + %\newunit\newblock + \usebibmacro{chapter+pages}% + \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期 + \usebibmacro{modifydate}}%修改或更新日期为带括号的时间 + \usebibmacro{doi+eprint+url}% + \newunit + \printfield{pagetotal}% + \newunit\newblock + \iftoggle{bbx:isbn} + {\printfield{isrn}} + {}% + \newunit\newblock +% \usebibmacro{doi+eprint+url}% +% \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + +% +% 备选类型驱动 +% +% 利用biblatex的misc驱动 +\DeclareBibliographyDriver{misc}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/editor+others/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% +\iftoggle{bbx:gbstrict}{}{% + \newunit + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}% + \newunit\newblock + \usebibmacro{byeditor+others}}% + \newunit\newblock + \printfield{howpublished}% + \newunit\newblock + \printfield{type}% + \newunit + \printfield{version}% + \newunit + \printfield{note}% + \newunit\newblock + \usebibmacro{institution+location+date}% + %\usebibmacro{organization+location+date}% + %\newunit\newblock + \usebibmacro{doi+eprint+url}% + \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + + +% +% 专著中的析出文献的格式修改 +% +\DeclareBibliographyDriver{inbook}{%源来自standard.bbx + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 +\usebibmacro{title}% +\usebibmacro{in:}% +%\printtext{\texttt{//}\addthinspace}% + \usebibmacro{bybookauthor}% + \ifnameundef{bookauthor}{% + \ifnameundef{editor}{}{\newunit}% + }{\newunit}%替换下一句 + %\newunit\newblock +\iffieldundef{series}{}{\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加 + \usebibmacro{maintitle+booktitle}% +\iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}% +\iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息 + \newunit\newblock% +% \usebibmacro{byeditor+others}% +% \newunit\newblock + \printfield{edition}% + \newunit + \iftoggle{bbx:gbstrict}{}{% +% \iffieldundef{maintitle} +% {\printfield{volume}% +% \printfield{part}} +% {}% +% \newunit +% \printfield{volumes}% +% \newunit\newblock +% \usebibmacro{series+number} + }% + \newunit\newblock + %\printfield{note}% + %\newunit\newblock + \usebibmacro{publisher+location+date}% + %\newunit\newblock + \usebibmacro{chapter+pages}% + %\newunit\newblock + \usebibmacro{doi+eprint+url}%移到上面来 + \newunit\newblock + \iftoggle{bbx:isbn} + {\printfield{isbn}} + {}% + \newunit\newblock +% \usebibmacro{doi+eprint+url}% +% \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.cbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.cbx index 43705f28cc..9a44c7462e 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.cbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.cbx @@ -1,376 +1,376 @@ -%% -%% --------------------------------------------------------------- -%% biblatex-gb7714-2015 --- A biblatex implementation of the -%% GBT7714-2015 citation style,numerical sequence -%% Maintained by huzhenzhen -%% E-mail: hzzmail@163.com -%% Released under the LaTeX Project Public License v1.3c or later -%% --------------------------------------------------------------- -%% -\def\versionofgbtstyle{2020/07/21 v1.0v} -\ProvidesFile{gb7714-2015.cbx}[\versionofgbtstyle biblatex citation style] - -% -% 加载标准样式 -% -\RequireCitationStyle{numeric-comp} %numeric - - -% -% 选项设置 -% -\ExecuteBibliographyOptions{ - autocite = superscript , - autopunct = true , - %sorting = none , - maxcitenames=1, - mincitenames=1, -} - -%textcite标注命令中的标点设置 -%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% - -% -%将连续3篇文献压缩改为连续2篇文献压缩 -% -%该宏的目的是抛弃压缩内部的编号,而仅输出最后一个编号,主要通过cbx@tempcnta来控制 -%一般情况下cbx@tempcnta为0,所以该宏不输出任何内容。当cbx@tempcnta在cite:comp:comp宏中更改变大后 -%说明开始进入需要压缩的范围,当到压缩终点时,cbx@tempcnta必然大于1,则输出内容。 -%修改第二行的数字1为0即可将默认的3个开始压缩变为2个开始压缩。 -\renewbibmacro*{cite:dump}{% - \ifnumgreater{\value{cbx@tempcnta}}{0}% - {\ifnumgreater{\value{cbx@tempcnta}}{0}%1改为0,可以将压缩起始3个编号改为2个编号 - {\bibrangedash}% - {\multicitedelim}% - \bibhyperref[\cbx@lastkey]{% - \ifdef\cbx@lastprefix% - {\printtext[labelprefix]{\cbx@lastprefix}}% - {}% - \printtext[labelnumber]{\cbx@lastnumber}}}% - {}% - \setcounter{cbx@tempcnta}{0}% - \global\undef\cbx@lastprefix} - -% -% 定义一个上标方括号wrapper -% -\newcommand*\mkbibsuperbracket[1]{% - \mkbibsuperscript{\mkbibbrackets{#1}}% -} - -% 修改postnote的输出格式 -\DeclareFieldFormat{postnote}{#1} - -% -% 重定义cite命令 -% -% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode} -% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式 -\DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 - {[\usebibmacro{cite:init}% - \usebibmacro{prenote}} - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {\usebibmacro{cite:dump}]% - \printfield{postnote}} -% v1.0p 以前用的方式 -%\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号 -% {\usebibmacro{cite:init}% -% \usebibmacro{prenote}} -% {\usebibmacro{citeindex}% -% \usebibmacro{cite:comp}} -% {} -% {\usebibmacro{cite:dump}% -% \usebibmacro{postnote}} - -% -% 定义upcite命令 -% 20180604,v1.0l,hzz -% 20190409,v1.0r,hzz -% 方法:对supercite增加[] -\newrobustcmd*{\upcite}{% - \cite} - -% -% 重定义parencite命令,以满足标签带页码的国标要求 -% -\DeclareCiteCommand{\parencite}%[\mkbibbrackets] - {[\usebibmacro{cite:init}%] - \usebibmacro{prenote}}% - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {%[ - \usebibmacro{cite:dump}]% - \mkbibsuperscript{\printfield{postnote}}} - -% -% 新定义pagescite命令,以满足标签带页码的国标要求 -% -% 原理方法: -% 1.新增页码输出宏 -\newbibmacro*{postpages}{% - \iffieldundef{postnote} - {\printfield[postnote]{pages}} - {\printfield{postnote}}} -% 2.新增\pagescite引用命令 -\DeclareCiteCommand{\pagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 - {[\usebibmacro{cite:init}%]直接添加方括号 - \usebibmacro{prenote}% - } - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {\usebibmacro{cite:dump}]% - \usebibmacro{postpages}} - -% -% 定义yearpagescite,为与ay样式兼容,等同于\pagescite -% -\DeclareCiteCommand{\yearpagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 - {[\usebibmacro{cite:init}%]直接添加方括号 - \usebibmacro{prenote}% - } - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {\usebibmacro{cite:dump}]% - \usebibmacro{postpages}} - -% -% 定义\yearcite命令,为与ay样式兼容,且提供不输出页码的标签格式, -% -% 原理方法:等同于\pagescite,但不要页码 -\DeclareCiteCommand{\yearcite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 - {[\usebibmacro{cite:init}%]直接添加方括号 - \usebibmacro{prenote}% - } - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {\usebibmacro{cite:dump}]} - -% -% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码 -% 20180427,v1.0k,增加,hzz -% gb7714样式新定义的命令都把cite放到最后,比如前面的pagescite,yearcite,这里的\authornumcite -% 区别于biblatex定义的命令都把cite放到前面,比如citeauthor等。 -%见numeric.CBX -\newbibmacro*{cite}{% - \printtext[bibhyperref]{% - \printfield{labelprefix}% - \printfield{labelnumber}% - \ifbool{bbx:subentry} - {\printfield{entrysetcount}} - {}}} -%见numeric.CBX,\DeclareCiteCommand{\cite}, -\DeclareCiteCommand{\authornumcite}%[\mkbibsuperscript] - {\usebibmacro{prenote}} - {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace - {\renewcommand*{\andothersdelim}{\addspace}}% - \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}% - \usebibmacro{cite}}}} - {\multicitedelim} - {\mkbibsuperscript{\printfield{postnote}}} - - -% -% 增加如下多个命令 -% 20190409,v1.0r,hzz -% 方法:利用newcommand或newrobustcmd命令进行定义 -% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突 -%\DeclareCiteCommand{\citet}% -% {\usebibmacro{prenote}} -% {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace -% {\renewcommand*{\andothersdelim}{\addspace}}% -% \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}% -% \usebibmacro{cite}}}} -% {\multicitedelim} -% {\mkbibsuperscript{\printfield{postnote}}} - -% -% 重定义citet,因为前面与\authornumcite同定义的命令无法正确处理多个bibtexkey同时给出的压缩情况 -% 20200721,v1.0v,hzz -% 方法:利用textcite命令进行定义 -% 基本利用textcite命令来写citet,仅利用bool{cbx:incitet}做判断,进而处理不同的上标和页码形式 -\newbool{cbx:incitet} -\global\booltrue{cbx:incitet} - -\newbibmacro*{citet}{% - \iffieldequals{namehash}{\cbx@lasthash}% - {\usebibmacro{cite:comp}}% - {\usebibmacro{cite:dump}% - \ifbool{cbx:parens}% - {\mkbibsuperscript{\printtext{\bibclosebracket}}\global\boolfalse{cbx:parens}}% - {}% - \iffirstcitekey - {} - {\textcitedelim}% - \usebibmacro{cite:init}% - \ifnameundef{labelname} - {\printfield[citetitle]{labeltitle}} - {\printnames{labelname}}% - \setunit*{\printdelim{namelabeldelim}}% - \mkbibsuperscript{\printtext{\bibopenbracket}\global\booltrue{cbx:parens}% - \ifnumequal{\value{citecount}}{1} - {\usebibmacro{prenote}}% - {}% - \usebibmacro{cite:comp}% - \stepcounter{textcitecount}% - \savefield{namehash}{\cbx@lasthash}}}} - -\DeclareCiteCommand{\cbx@textcite}% - {\usebibmacro{cite:init}}% - {\usebibmacro{citeindex}% - \ifbool{cbx:incitet}{\usebibmacro{citet}}{\usebibmacro{textcite}}% - }% - {}% - {\ifbool{cbx:incitet}{\mkbibsuperscript{\usebibmacro{cite:dump}\usebibmacro{postnote}}}% - {\usebibmacro{cite:dump}\usebibmacro{postnote}}% - \ifbool{cbx:parens}% - {\ifbool{cbx:incitet}{\mkbibsuperscript{\bibclosebracket}}{\bibclosebracket}% - \global\boolfalse{cbx:parens}}% - {}} - - \newrobustcmd{\cbx@citet@init}[2]{% - \global\booltrue{cbx:incitet}% - \setcounter{textcitetotal}{0}% - \setcounter{textcitecount}{0}% - \def\cbx@savedcites{#1}#2\cbx@savedcites\empty} - - \renewrobustcmd{\cbx@textcite@init}[2]{% - \global\boolfalse{cbx:incitet}% - \setcounter{textcitetotal}{0}% - \setcounter{textcitecount}{0}% - \def\cbx@savedcites{#1}#2\cbx@savedcites\empty} - -\DeclareCiteCommand{\citet}[\cbx@citet@init\cbx@textcite] - {\gdef\cbx@savedkeys{}% - \citetrackerfalse% - \pagetrackerfalse% - \DeferNextCitekeyHook% - \usebibmacro{cite:init}} - {\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0} - {\protected@xappto\cbx@savedcites{()(\thefield{multipostnote})}% - \global\clearfield{multipostnote}} - {}% - \xappto\cbx@savedkeys{\thefield{entrykey},}% - \iffieldequals{namehash}{\cbx@lasthash} - {} - {\stepcounter{textcitetotal}% - \savefield{namehash}{\cbx@lasthash}}} - {} - {\protected@xappto\cbx@savedcites{% - [\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}} - - - -\DeclareCiteCommand{\citep}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 - {[\usebibmacro{cite:init}% - \usebibmacro{prenote}} - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {\usebibmacro{cite:dump}]% - \printfield{postnote}} - -\newrobustcmd*{\citetns}% - {\textcite} - -\newrobustcmd*{\citepns}% - {\parencite} - -\newrobustcmd*{\inlinecite}% - {\parencite} - -% -% 增加如下复数的命令,以符合biblatex的复数命令习惯 -% 20190430,v1.0r,hzz -% citec和citecs命令是实现了[1]-[3]这样的压缩形式。 -% authornumcites是常用命令authornumcite的复数形式 -\DeclareFieldFormat{labelbracket}{\mkbibbrackets{#1}} - -\newbibmacro*{citec:comp:comp}{% - \ifboolexpr{ - ( test {\iffieldundef{labelprefix}} and test {\ifundef\cbx@lastprefix} ) - or - test {\iffieldequals{labelprefix}{\cbx@lastprefix}} - } - {\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}} - {\savefield{entrykey}{\cbx@lastkey}% - \savefield{labelnumber}{\cbx@lastnumber}% - \addtocounter{cbx@tempcnta}{1}} - {\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}-1} - {} - {\usebibmacro{citec:dump}% - \ifnumgreater{\value{cbx@tempcntb}}{-1} - {\multicitedelim} - {}% - \printtext[bibhyperref]{% - \printfield{labelprefix}% - \printtext[labelbracket]{\printfield{labelnumber}}}}}} - {\usebibmacro{cite:comp:end}}% - \setcounter{cbx@tempcntb}{\thefield{labelnumber}}% - \savefield{labelprefix}{\cbx@lastprefix}} - -\newbibmacro*{citec:comp}{% - \addtocounter{cbx@tempcntb}{1}% - \iffieldundef{shorthand} - {\ifbool{bbx:subentry} - {\iffieldundef{entrysetcount} - {\usebibmacro{citec:comp:comp}} - {\usebibmacro{cite:comp:inset}}} - {\usebibmacro{citec:comp:comp}}} - {\usebibmacro{cite:comp:shand}}} - -\newbibmacro*{citec:dump}{% - \ifnumgreater{\value{cbx@tempcnta}}{0} - {\ifnumgreater{\value{cbx@tempcnta}}{1} - {\bibrangedash} - {\multicitedelim}% - \bibhyperref[\cbx@lastkey]{% - \ifdef\cbx@lastprefix - {\printtext[labelprefix]{\cbx@lastprefix}} - {}% - \printtext[labelbracket]{\cbx@lastnumber}}}%labelnumber - {}% - \setcounter{cbx@tempcnta}{0}% - \global\undef\cbx@lastprefix} - -%\DeclareCiteCommand{\citec}[\mkbibsuperscript]%[\mkbibbrackets] -% {\usebibmacro{cite:init}% -% \usebibmacro{prenote}} -% {\usebibmacro{citeindex}% -% \usebibmacro{citec:comp}} -% {} -% {\usebibmacro{citec:dump}% -% \usebibmacro{postnote}} - -%上面这个用于非压缩情况,这里考虑了压缩的情况 -\DeclareCiteCommand{\citec}[\mkbibsuperscript]% - {\ifnumless{\value{multicitecount}}{2} - {\usebibmacro{cite:init}% - \usebibmacro{prenote}} - {\iffieldundef{prenote} - {\iffieldundef{postnote} - {} - {\usebibmacro{citec:dump}% - \usebibmacro{cite:init}% - \setunit{\multicitedelim}}} - {\usebibmacro{citec:dump}% - \usebibmacro{cite:init}% - \setunit{\multicitedelim}% - \usebibmacro{prenote}}}} - {\usebibmacro{citeindex}% - \usebibmacro{citec:comp}} - {} - {\ifboolexpr{ test {\ifnumequal{\value{multicitecount}}{\value{multicitetotal}}} - or not test {\iffieldundef{postnote}}} - {\usebibmacro{citec:dump}% - \usebibmacro{postnote}} - {}} - -\DeclareMultiCiteCommand{\citecs}[\mkbibsuperscript]{\citec}{} - -\DeclareMultiCiteCommand{\authornumcites}[]{\authornumcite}{\multicitedelim} +%% +%% --------------------------------------------------------------- +%% biblatex-gb7714-2015 --- A biblatex implementation of the +%% GBT7714-2015 citation style,numerical sequence +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% +\def\versionofgbtstyle{2021/01/19 v1.0w} +\ProvidesFile{gb7714-2015.cbx}[\versionofgbtstyle biblatex citation style] + +% +% 加载标准样式 +% +\RequireCitationStyle{numeric-comp} %numeric + + +% +% 选项设置 +% +\ExecuteBibliographyOptions{ + autocite = superscript , + autopunct = true , + %sorting = none , + maxcitenames=1, + mincitenames=1, +} + +%textcite标注命令中的标点设置 +%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% + +% +%将连续3篇文献压缩改为连续2篇文献压缩 +% +%该宏的目的是抛弃压缩内部的编号,而仅输出最后一个编号,主要通过cbx@tempcnta来控制 +%一般情况下cbx@tempcnta为0,所以该宏不输出任何内容。当cbx@tempcnta在cite:comp:comp宏中更改变大后 +%说明开始进入需要压缩的范围,当到压缩终点时,cbx@tempcnta必然大于1,则输出内容。 +%修改第二行的数字1为0即可将默认的3个开始压缩变为2个开始压缩。 +\renewbibmacro*{cite:dump}{% + \ifnumgreater{\value{cbx@tempcnta}}{0}% + {\ifnumgreater{\value{cbx@tempcnta}}{0}%1改为0,可以将压缩起始3个编号改为2个编号 + {\bibrangedash}% + {\multicitedelim}% + \bibhyperref[\cbx@lastkey]{% + \ifdef\cbx@lastprefix% + {\printtext[labelprefix]{\cbx@lastprefix}}% + {}% + \printtext[labelnumber]{\cbx@lastnumber}}}% + {}% + \setcounter{cbx@tempcnta}{0}% + \global\undef\cbx@lastprefix} + +% +% 定义一个上标方括号wrapper +% +\newcommand*\mkbibsuperbracket[1]{% + \mkbibsuperscript{\mkbibbrackets{#1}}% +} + +% 修改postnote的输出格式 +\DeclareFieldFormat{postnote}{#1} + +% +% 重定义cite命令 +% +% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode} +% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式 +\DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 + {[\usebibmacro{cite:init}% + \usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {\usebibmacro{cite:dump}]% + \printfield{postnote}} +% v1.0p 以前用的方式 +%\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号 +% {\usebibmacro{cite:init}% +% \usebibmacro{prenote}} +% {\usebibmacro{citeindex}% +% \usebibmacro{cite:comp}} +% {} +% {\usebibmacro{cite:dump}% +% \usebibmacro{postnote}} + +% +% 定义upcite命令 +% 20180604,v1.0l,hzz +% 20190409,v1.0r,hzz +% 方法:对supercite增加[] +\newrobustcmd*{\upcite}{% + \cite} + +% +% 重定义parencite命令,以满足标签带页码的国标要求 +% +\DeclareCiteCommand{\parencite}%[\mkbibbrackets] + {[\usebibmacro{cite:init}%] + \usebibmacro{prenote}}% + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {%[ + \usebibmacro{cite:dump}]% + \mkbibsuperscript{\printfield{postnote}}} + +% +% 新定义pagescite命令,以满足标签带页码的国标要求 +% +% 原理方法: +% 1.新增页码输出宏 +\newbibmacro*{postpages}{% + \iffieldundef{postnote} + {\printfield[postnote]{pages}} + {\printfield{postnote}}} +% 2.新增\pagescite引用命令 +\DeclareCiteCommand{\pagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 + {[\usebibmacro{cite:init}%]直接添加方括号 + \usebibmacro{prenote}% + } + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {\usebibmacro{cite:dump}]% + \usebibmacro{postpages}} + +% +% 定义yearpagescite,为与ay样式兼容,等同于\pagescite +% +\DeclareCiteCommand{\yearpagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 + {[\usebibmacro{cite:init}%]直接添加方括号 + \usebibmacro{prenote}% + } + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {\usebibmacro{cite:dump}]% + \usebibmacro{postpages}} + +% +% 定义\yearcite命令,为与ay样式兼容,且提供不输出页码的标签格式, +% +% 原理方法:等同于\pagescite,但不要页码 +\DeclareCiteCommand{\yearcite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 + {[\usebibmacro{cite:init}%]直接添加方括号 + \usebibmacro{prenote}% + } + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {\usebibmacro{cite:dump}]} + +% +% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码 +% 20180427,v1.0k,增加,hzz +% gb7714样式新定义的命令都把cite放到最后,比如前面的pagescite,yearcite,这里的\authornumcite +% 区别于biblatex定义的命令都把cite放到前面,比如citeauthor等。 +%见numeric.CBX +\newbibmacro*{cite}{% + \printtext[bibhyperref]{% + \printfield{labelprefix}% + \printfield{labelnumber}% + \ifbool{bbx:subentry} + {\printfield{entrysetcount}} + {}}} +%见numeric.CBX,\DeclareCiteCommand{\cite}, +\DeclareCiteCommand{\authornumcite}%[\mkbibsuperscript] + {\usebibmacro{prenote}} + {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace + {\renewcommand*{\andothersdelim}{\addspace}}% + \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}% + \usebibmacro{cite}}}} + {\multicitedelim} + {\mkbibsuperscript{\printfield{postnote}}} + + +% +% 增加如下多个命令 +% 20190409,v1.0r,hzz +% 方法:利用newcommand或newrobustcmd命令进行定义 +% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突 +%\DeclareCiteCommand{\citet}% +% {\usebibmacro{prenote}} +% {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace +% {\renewcommand*{\andothersdelim}{\addspace}}% +% \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}% +% \usebibmacro{cite}}}} +% {\multicitedelim} +% {\mkbibsuperscript{\printfield{postnote}}} + +% +% 重定义citet,因为前面与\authornumcite同定义的命令无法正确处理多个bibtexkey同时给出的压缩情况 +% 20200721,v1.0v,hzz +% 方法:利用textcite命令进行定义 +% 基本利用textcite命令来写citet,仅利用bool{cbx:incitet}做判断,进而处理不同的上标和页码形式 +\newbool{cbx:incitet} +\global\booltrue{cbx:incitet} + +\newbibmacro*{citet}{% + \iffieldequals{namehash}{\cbx@lasthash}% + {\usebibmacro{cite:comp}}% + {\usebibmacro{cite:dump}% + \ifbool{cbx:parens}% + {\mkbibsuperscript{\printtext{\bibclosebracket}}\global\boolfalse{cbx:parens}}% + {}% + \iffirstcitekey + {} + {\textcitedelim}% + \usebibmacro{cite:init}% + \ifnameundef{labelname} + {\printfield[citetitle]{labeltitle}} + {\printnames{labelname}}% + \setunit*{\printdelim{namelabeldelim}}% + \mkbibsuperscript{\printtext{\bibopenbracket}\global\booltrue{cbx:parens}% + \ifnumequal{\value{citecount}}{1} + {\usebibmacro{prenote}}% + {}% + \usebibmacro{cite:comp}% + \stepcounter{textcitecount}% + \savefield{namehash}{\cbx@lasthash}}}} + +\DeclareCiteCommand{\cbx@textcite}% + {\usebibmacro{cite:init}}% + {\usebibmacro{citeindex}% + \ifbool{cbx:incitet}{\usebibmacro{citet}}{\usebibmacro{textcite}}% + }% + {}% + {\ifbool{cbx:incitet}{\mkbibsuperscript{\usebibmacro{cite:dump}\usebibmacro{postnote}}}% + {\usebibmacro{cite:dump}\usebibmacro{postnote}}% + \ifbool{cbx:parens}% + {\ifbool{cbx:incitet}{\mkbibsuperscript{\bibclosebracket}}{\bibclosebracket}% + \global\boolfalse{cbx:parens}}% + {}} + + \newrobustcmd{\cbx@citet@init}[2]{% + \global\booltrue{cbx:incitet}% + \setcounter{textcitetotal}{0}% + \setcounter{textcitecount}{0}% + \def\cbx@savedcites{#1}#2\cbx@savedcites\empty} + + \renewrobustcmd{\cbx@textcite@init}[2]{% + \global\boolfalse{cbx:incitet}% + \setcounter{textcitetotal}{0}% + \setcounter{textcitecount}{0}% + \def\cbx@savedcites{#1}#2\cbx@savedcites\empty} + +\DeclareCiteCommand{\citet}[\cbx@citet@init\cbx@textcite] + {\gdef\cbx@savedkeys{}% + \citetrackerfalse% + \pagetrackerfalse% + \DeferNextCitekeyHook% + \usebibmacro{cite:init}} + {\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0} + {\protected@xappto\cbx@savedcites{()(\thefield{multipostnote})}% + \global\clearfield{multipostnote}} + {}% + \xappto\cbx@savedkeys{\thefield{entrykey},}% + \iffieldequals{namehash}{\cbx@lasthash} + {} + {\stepcounter{textcitetotal}% + \savefield{namehash}{\cbx@lasthash}}} + {} + {\protected@xappto\cbx@savedcites{% + [\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}} + + + +\DeclareCiteCommand{\citep}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 + {[\usebibmacro{cite:init}% + \usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {\usebibmacro{cite:dump}]% + \printfield{postnote}} + +\newrobustcmd*{\citetns}% + {\textcite} + +\newrobustcmd*{\citepns}% + {\parencite} + +\newrobustcmd*{\inlinecite}% + {\parencite} + +% +% 增加如下复数的命令,以符合biblatex的复数命令习惯 +% 20190430,v1.0r,hzz +% citec和citecs命令是实现了[1]-[3]这样的压缩形式。 +% authornumcites是常用命令authornumcite的复数形式 +\DeclareFieldFormat{labelbracket}{\mkbibbrackets{#1}} + +\newbibmacro*{citec:comp:comp}{% + \ifboolexpr{ + ( test {\iffieldundef{labelprefix}} and test {\ifundef\cbx@lastprefix} ) + or + test {\iffieldequals{labelprefix}{\cbx@lastprefix}} + } + {\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}} + {\savefield{entrykey}{\cbx@lastkey}% + \savefield{labelnumber}{\cbx@lastnumber}% + \addtocounter{cbx@tempcnta}{1}} + {\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}-1} + {} + {\usebibmacro{citec:dump}% + \ifnumgreater{\value{cbx@tempcntb}}{-1} + {\multicitedelim} + {}% + \printtext[bibhyperref]{% + \printfield{labelprefix}% + \printtext[labelbracket]{\printfield{labelnumber}}}}}} + {\usebibmacro{cite:comp:end}}% + \setcounter{cbx@tempcntb}{\thefield{labelnumber}}% + \savefield{labelprefix}{\cbx@lastprefix}} + +\newbibmacro*{citec:comp}{% + \addtocounter{cbx@tempcntb}{1}% + \iffieldundef{shorthand} + {\ifbool{bbx:subentry} + {\iffieldundef{entrysetcount} + {\usebibmacro{citec:comp:comp}} + {\usebibmacro{cite:comp:inset}}} + {\usebibmacro{citec:comp:comp}}} + {\usebibmacro{cite:comp:shand}}} + +\newbibmacro*{citec:dump}{% + \ifnumgreater{\value{cbx@tempcnta}}{0} + {\ifnumgreater{\value{cbx@tempcnta}}{1} + {\bibrangedash} + {\multicitedelim}% + \bibhyperref[\cbx@lastkey]{% + \ifdef\cbx@lastprefix + {\printtext[labelprefix]{\cbx@lastprefix}} + {}% + \printtext[labelbracket]{\cbx@lastnumber}}}%labelnumber + {}% + \setcounter{cbx@tempcnta}{0}% + \global\undef\cbx@lastprefix} + +%\DeclareCiteCommand{\citec}[\mkbibsuperscript]%[\mkbibbrackets] +% {\usebibmacro{cite:init}% +% \usebibmacro{prenote}} +% {\usebibmacro{citeindex}% +% \usebibmacro{citec:comp}} +% {} +% {\usebibmacro{citec:dump}% +% \usebibmacro{postnote}} + +%上面这个用于非压缩情况,这里考虑了压缩的情况 +\DeclareCiteCommand{\citec}[\mkbibsuperscript]% + {\ifnumless{\value{multicitecount}}{2} + {\usebibmacro{cite:init}% + \usebibmacro{prenote}} + {\iffieldundef{prenote} + {\iffieldundef{postnote} + {} + {\usebibmacro{citec:dump}% + \usebibmacro{cite:init}% + \setunit{\multicitedelim}}} + {\usebibmacro{citec:dump}% + \usebibmacro{cite:init}% + \setunit{\multicitedelim}% + \usebibmacro{prenote}}}} + {\usebibmacro{citeindex}% + \usebibmacro{citec:comp}} + {} + {\ifboolexpr{ test {\ifnumequal{\value{multicitecount}}{\value{multicitetotal}}} + or not test {\iffieldundef{postnote}}} + {\usebibmacro{citec:dump}% + \usebibmacro{postnote}} + {}} + +\DeclareMultiCiteCommand{\citecs}[\mkbibsuperscript]{\citec}{} + +\DeclareMultiCiteCommand{\authornumcites}[]{\authornumcite}{\multicitedelim} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx index a600997104..aca301fc9c 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx @@ -1,3844 +1,3845 @@ -%% -%% --------------------------------------------------------------- -%% biblatex-gb7714-2015 --- A biblatex implementation of the -%% GBT7714-2015 bibliography style,author year sequence -%% Maintained by huzhenzhen -%% E-mail: hzzmail@163.com -%% Released under the LaTeX Project Public License v1.3c or later -%% --------------------------------------------------------------- -%% -% -% 版本和时间信息 -% -\def\versionofgbtstyle{2020/07/21 v1.0v} -\def\versionofbiblatex{\abx@version} -\ProvidesFile{gb7714-2015ay.bbx}[\versionofgbtstyle biblatex bibliography style] -%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求 - -%===================================================================== -%加载标准样式 -%===================================================================== -\RequireBibliographyStyle{authoryear} -\RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题 - - -%===================================================================== -% 功能函数 -%===================================================================== - % - % biblatex版本判断 - % 20180405,v1.0k,为兼容biblatexv3.11增加toggle:iftlnine,HU zhenzhen - % 20181020,v1.0n,为不再使用xstring宏包做的修改,hzz - % - % 原理方法:当版本继续更新时,增加一个新的toggle用以处理新的旧版,最新版和未判断出来的版本永远用iftlatest - \providetoggle{iftlfive}\togglefalse{iftlfive} %处理biblatex3.2之前版本,时间2016-03-01前 - \providetoggle{iftlsix}\togglefalse{iftlsix} %处理biblatex3.3开始改变姓名机制后版本,时间2016-03-01及以后 - \providetoggle{iftlseven}\togglefalse{iftlseven}%处理biblatex3.7的兼容性,时间2016-12-01后 - \providetoggle{iftleight}\togglefalse{iftleight}%处理biblatex3.8到3.9的兼容性,时间2017-11-01后到2017-12-01前 - \providetoggle{iftlnine}\togglefalse{iftlnine} %处理biblatex10的兼容性,时间2017-12-01后 - \providetoggle{iftlatest}\toggletrue{iftlatest} %假设是最新版biblatex - \@ifpackagelater{biblatex}{2014/04/01}{ - \@ifpackagelater{biblatex}{2016/03/01}{ - \@ifpackagelater{biblatex}{2016/12/01}{ - \@ifpackagelater{biblatex}{2017/11/01}{ - \@ifpackagelater{biblatex}{2017/12/01}{ - \@ifpackagelater{biblatex}{2018/02/19}{} - {\toggletrue{iftlnine}\togglefalse{iftlatest}}} - {\toggletrue{iftleight}\togglefalse{iftlatest}}} - {\toggletrue{iftlseven}\togglefalse{iftlatest}}} - {\toggletrue{iftlsix}\togglefalse{iftlatest}}} - {\toggletrue{iftlfive}\togglefalse{iftlatest}}} - {\PackageError{biblatex}{Outdated 'biblatex' package} - {Please update biblatex, This is a fatal error.}} - - \newcommand\defversion[2]{\csdef{codeversion#1#2}}%定义不同版本的命令 - \newcommand\switchversion[2]{\csuse{codeversion#1#2}}%使用不同版本的命令 - - % - % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成 - % v1.0k,20180509,hzz - % - % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏 - % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8 - % 编码用xelatex编译的问题。 - % - % 原理是:利用perl正则将中文标识记录到域中, - % 然后利用\iffieldundef和\iffieldequalstr进行判断 - \providetoggle{ifCJKforgbt} - \def\testCJKfirst#1{% - \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{% - \iffieldequalstr{#1}{chinese}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}} - - % - % 2个卷的解析函数,用于连续出版物 - % - % 原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号 - \newcommand{\multivolparser}[1]{% - \IfSubStr{#1}{-}% - {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}% - {\def\multivolfirst{#1}\def\multivolsecond{}}% - } - - % - % 2个期的解析函数,用于连续出版物 - % - \newcommand{\multinumberparser}[1]{% - \IfSubStr{#1}{-}% - {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}% - {\def\multinumberfirst{#1}\def\multinumbersecond{}}% - } - - % 对没有分隔符环境命令的低版本biblatex做增补,避免报错 - % - \iftoggle{iftlfive}{ - - \def\blx@inf@delimdeclare#1#2{% - \blx@info{Delimiter '#1' in context '#2' already defined, overwriting}} - - \def\blx@warn@delimuse#1#2{% - \blx@warning{Delimiter '#1' in context '#2' undefined}} - % Delimiter interface - - % []{}{} - \newrobustcmd*{\DeclareDelimFormat}{% - \@ifstar - {\blx@declaredelimclear} - {\blx@declaredelim}} - - \newrobustcmd*{\blx@declaredelimclear}[3][]{% - \ifcsvoid{blx@declaredelimcontexts@#2} - {} - {\def\do##1{\csundef{blx@printdelim@##1@#2}}% - \dolistcsloop{blx@declaredelimcontexts@#2}}% - \cslet{blx@declaredelimcontexts@#2}\@empty - \ifblank{#1} - {\blx@declaredelim{#2}{#3}} - {\blx@declaredelim[#1]{#2}{#3}}} - - \newrobustcmd*{\blx@declaredelim}[3][]{% - \ifblank{#1} - {\blx@declaredelim@i{}{}{#2}{#3}} - {\def\do##1{% - \listcsadd{blx@declaredelimcontexts@#2}{##1}% - \blx@declaredelim@i{blx@printdelim@##1@}{##1}{#2}{#3}}% - \docsvlist{#1}}}% - - \def\blx@declaredelim@i#1#2#3#4{% - \def\do@i##1{% - \ifcsdef{#1##1} - {\blx@inf@delimdeclare{##1}{#2}} - {}% - \csdef{#1##1}{#4}}% - \forcsvlist{\do@i}{#3}} - - % *[]{}{} - \newrobustcmd*{\DeclareDelimAlias}{% - \@ifstar - {\blx@declaredelimalias} - {\blx@declaredelimaliasauto}} - - \newrobustcmd*{\blx@declaredelimalias}[3][]{% - \ifblank{#1} - {\blx@declaredelimalias@i{}{#2}{#3}} - {\def\do##1{% - \blx@declaredelimalias@i{blx@printdelim@##1@}{#2}{#3}}% - \docsvlist{#1}}} - - \newrobustcmd*{\blx@declaredelimaliasauto}[2]{% - \blx@declaredelimalias@i{}{#1}{#2}% - \ifcsvoid{blx@declaredelimcontexts@#2} - {} - {\def\do##1{% - \blx@declaredelimalias@i{blx@printdelim@##1@}{#1}{#2}}% - \dolistcsloop{blx@declaredelimcontexts@#2}}} - - \def\blx@declaredelimalias@i#1#2#3{% - \ifcsdef{#1#2} - {\blx@inf@delimdeclare{#2}{#1}} - {}% - \csdef{#1#2}{\csuse{#1#3}}} - - \def\blx@delimcontext{none} - \newcommand*{\printdelim}[2][]{% - \ifblank{#1} - {\ifcsdef{blx@printdelim@\blx@delimcontext @#2} - {\csuse{blx@printdelim@\blx@delimcontext @#2}} - {\ifcsdef{#2}% fall back on legacy macros - {\csuse{#2}} - {\blx@warn@delimuse{#2}{*}}}} - {\ifcsdef{blx@printdelim@#1@#2} - {\csuse{blx@printdelim@#1@#2}} - {\blx@warn@delimuse{#2}{#1}}}} - - \newcommand*{\delimcontext}[1]{% - \edef\blx@delimcontext{\blx@delimcontextalias{#1}}} - - \def\blx@delimcontextalias#1{% - \ifcsdef{blx@delimcontextalias@#1} - {\csuse{blx@delimcontextalias@#1}} - {#1}} - - \newcommand*{\DeclareDelimcontextAlias}[2]{% - \csgdef{blx@delimcontextalias@#1}{#2}} - }{} - - -%===================================================================== -% 数据模型定义 -%===================================================================== - %定义类型和载体标识,从gb内容看载体基本属于介质。 - %为与lee zeping的bst的样式统一,使用mark和medium这两域名 - %为单个条目的姓名格式控制增加nameformat和namefmtid两个域 - %为缩略信息文献表增加了shortbooktitle域 - %为多语言排序增加了lansortorder域 - \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat} - \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid} - \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle} - \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder} - - %因为biblatex更新3.14版本以后,biber对于为声明数据模型的条目类型 - %不再默认读取,而是以空字符串作为条目类型名,自然在条目定义alias时 - %就会出现问题,因此显式的声明一下newspaper,然后保留后面采用alias的方式 - %而standard类型则是采用另一种方式直接在sourcemap中转换为其它类型。 - \@ifpackagelater{biblatex}{2019/11/30}{%2019/12/01 v3.14 - \DeclareDatamodelEntrytypes{newspaper}% - }{} - -%===================================================================== -% 设置宏包选项 -%===================================================================== - % - % 增加一个控制是否输出文献载体的选项 - % 20191125,v1,0s,hzz - \newtoggle{bbx:gbmedium} - \DeclareBibliographyOption{gbmedium}[true]{%biblatex低版本 - \settoggle{bbx:gbmedium}{#1}} - \ExecuteBibliographyOptions{gbmedium} - - % - % 增加一个控制是否输出annotation域的选项,该域可以用于在文献条目后面输出一些注释信息 - % 20190509,v1,0s,hzz - \newtoggle{bbx:gbannote} - \DeclareBibliographyOption{gbannote}[false]{%biblatex低版本 - \settoggle{bbx:gbannote}{#1}} - \ExecuteBibliographyOptions{gbannote} - % - %用于在文献条目后面输出注释信息的宏 - %FieldFormat{annotation}用于设置注释信息的格式 - \DeclareFieldFormat{annotation}{% - \printtext{\addspace(#1)}% - } - \renewbibmacro*{annotation}{% - \iftoggle{bbx:gbannote}% - {\iffieldundef{annotation}% - {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}% - {\printfield{annotation}}}% - {}% - } - - - % - % 增加一个控制是否输出type域的选项 - % 20190212,v1,0q,hzz - \newtoggle{bbx:gbfieldtype} - \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本 - \settoggle{bbx:gbfieldtype}{#1}} - \ExecuteBibliographyOptions{gbfieldtype} - - % - % 增加一个控制是否根据页码重设脚注数字标号的选项 - % 20190422,v1,0r,hzz - \newtoggle{bbx:gbfnperpage} - \DeclareBibliographyOption{gbfnperpage}[false]{% - \settoggle{bbx:gbfnperpage}{#1}} - \ExecuteBibliographyOptions{gbfnperpage} - - % - % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表 - % 20190203,v1.0p,hzz - % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签 - % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式 - % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题 - \DeclareBibliographyOption{gbfootbib}[false]{% - \ifstrequal{#1}{false}{}{\execgbfootbib}} - \ExecuteBibliographyOptions{gbfootbib} - - %% - \newlength{\footbibmargin} - \newlength{\footbiblabelsep} - \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离 - \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距 - \def\execgbfootbib% - {% - %开启引用跟踪计数器,为使用\ifciteseen等测试命令 - \ExecuteBibliographyOptions{citetracker=true} - % - %利用footmisc宏包来实现脚注文献的悬挂对齐 - \AtEndPreamble{ - \@ifclassloaded{beamer}{}{ - %beamer类因为其特殊性,为避免冲突不调footmisc。 - %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接 - %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。 - %\PassOptionsToPackage{perpage,hang}{footmisc}% - %\RequirePackage{footmisc}% - - %重新实现脚注的根据单页重设脚注号码 - %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改 - %v1.0q 20190317 hzz - %v1.0r 20190422 hzz 根据gbfnperpage选项设置 - \iftoggle{bbx:gbfnperpage}% - {\@addtoreset{footnote}{page}}{}%重设计数器 - -\@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义 - \long\def\H@@footnotetext##1{\insert\footins{% - \reset@font\footnotesize - \interlinepenalty\interfootnotelinepenalty - \splittopskip\footnotesep - \splitmaxdepth \dp\strutbox \floatingpenalty \@MM - \hsize\columnwidth \@parboxrestore - \protected@edef\@currentlabel{% - \csname p@footnote\endcsname\@thefnmark - }% - \color@begingroup - \leftskip \footbibmargin%增加的左侧缩进 - \@makefntext{% - \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% - }% - \color@endgroup}}% - \long\def\H@@mpfootnotetext##1{% - \global\setbox\@mpfootins\vbox{% - \unvbox\@mpfootins - \reset@font\footnotesize - \hsize\columnwidth - \@parboxrestore - \protected@edef\@currentlabel - {\csname p@mpfootnote\endcsname\@thefnmark}% - \leftskip \footbibmargin%增加的左侧缩进 - \color@begingroup - \@makefntext{% - \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% - \color@endgroup}} - }{%否则对latex核心代码中的\@footnotetext做重定义 - \long\def\@footnotetext##1{\insert\footins{% - \reset@font\footnotesize - \interlinepenalty\interfootnotelinepenalty - \splittopskip\footnotesep - \splitmaxdepth \dp\strutbox \floatingpenalty \@MM - \hsize\columnwidth \@parboxrestore - \protected@edef\@currentlabel{% - \csname p@footnote\endcsname\@thefnmark - }% - \color@begingroup - \leftskip \footbibmargin%增加的左侧缩进 - \@makefntext{% - \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% - }% - \color@endgroup}}% - - \long\def\@mpfootnotetext##1{% - \global\setbox\@mpfootins\vbox{% - \unvbox\@mpfootins - \reset@font\footnotesize - \hsize\columnwidth - \@parboxrestore - \protected@edef\@currentlabel - {\csname p@mpfootnote\endcsname\@thefnmark}% - \leftskip \footbibmargin%增加的左侧缩进 - \color@begingroup - \@makefntext{% - \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% - \color@endgroup}} - } - - \long\def\@makefntext##1{%增加了脚注标记与正文的间隔 - \parindent 1em\noindent \hb@xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1} - - } - - % - %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式 - \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}} - %做patch使得脚注内容中的脚注数字标签不上标 - \pretocmd{\@makefntext}{% - \def\@makefnmark{% - \hbox{\textcircled{\tiny\@thefnmark}}% - }% - }{}{} - } - - % - %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容) - %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。 - %v1.0q 20190309 区分使脚注标注适应minipage中的情况 - \newbibmacro*{citesavefn}{% - \ifciteseen%当被引用过为true - {\ifcsdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%当已经定义过脚注序号信息 - {\csgdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% - \str@sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}% - \@makefnmark% - }}% - {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% - \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% - }}% - }% - {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% - \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% - %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断 - }}% - } - - % - %重定义\footfullcite使完成gb7714-2015的脚注文献要求 - \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% - {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 - \defcounter{minnames}{\blx@minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。 - \usebibmacro{prenote}% - \renewbibmacro*{postnote}{% - \iffieldundef{postnote}% - {}{\setunit{\addcolon\addspace}\printtext{\thefield{postnote}}}}%由于ay样式中没有修改postnote域,此处因为格式需要不使用默认域格式 - }% - {\usebibmacro{citesavefn}% - \ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}% - {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}\nopunct}% - {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}% - }% - {\multicitedelim}% - {\usebibmacro{postnote}} - - } - - % - % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式 - % 20180814,v1.0m,hzz - % 原理方法: - % 只为兼容性考虑不做任何处理 - \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本 - } - - % - % 增加一个控制是否输出文献类型和载体标识的选项 - % - % 原理方法: - % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的 - % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本 - \newtoggle{bbx:gbtype} - %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本 - \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本 - \settoggle{bbx:gbtype}{#1}} - \ExecuteBibliographyOptions{gbtype} - - % - % 增加一个源文件编码选择选项,当true时可以使用GBK编码。 - % v1.0k, 2018.05.08, by hzz - % - % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档 - % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def - % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用 - % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。 - % 另外注意: - % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码 - % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常 - % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。 - \newtoggle{bbx:codegbk} - \DeclareBibliographyOption{gbcodegbk}[false]{% - \settoggle{bbx:codegbk}{#1}} - \ExecuteBibliographyOptions{gbcodegbk} - - \def\str@bibliography{参考文献} - \def\str@references{参考文献} - \def\str@bytranslator{译} - \def\str@andotherscn{等} - \def\str@andcn{和} - \def\str@backrefpage{引用页} - \def\str@backrefpages{引用页} - \def\str@noaddress{出版地不详} - \def\str@nopublisher{出版者不详} - \def\str@edition{版} - \def\str@volumecn{卷} - \def\str@numbercn{册} - \def\str@serialcn{第} - \def\str@sameentry{同} - \def\str@incn{见} - \def\str@mathesiscn{硕士学位论文} - \def\str@phdthesiscn{博士学位论文} - \def\str@editorcn{主编} - - \AtEndOfPackage{% - \iftoggle{bbx:codegbk}{% - \ExecuteBibliographyOptions{texencoding = GBK} - \input{gb7714-2015-gbk.def} - }{}} - - % - % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项 - % v1.0k, 2018.05.08, by hzz - % - % 原理方法: - % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息 - % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式 - % 可能需要用于中英文判断的language域的信息。 - \newtoggle{bbx:gbstrict} - \DeclareBibliographyOption{gbstrict}[true]{% - \settoggle{bbx:gbstrict}{#1}} - \ExecuteBibliographyOptions{gbstrict} - - % - % 增加一个控制标题域超链接设置的选项 - % v1.0k, 2018.05.24, by hzz - % - % 原理方法: - % 利用标题域格式来实现,默认设置该选项为false,不做超链接。 - % 设置为true,则标题设置超链接 - \newtoggle{bbx:titlelink} - \DeclareBibliographyOption{gbtitlelink}[false]{% - \settoggle{bbx:titlelink}{#1}} - \ExecuteBibliographyOptions{gbtitlelink} - - % - % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项 - % v1.0l, 2018.07.02, by hzz - % - % 原理方法: - % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置 - \newtoggle{bbx:ctexset} - \DeclareBibliographyOption{gbctexset}[true]{% - \settoggle{bbx:ctexset}{#1}} - \ExecuteBibliographyOptions{gbctexset} - - \AtEndOfPackage{% - \iftoggle{bbx:ctexset}{% - \def\blx@defbibstrings#1#2{% - \def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}% - \abx@dostrings - \csuse{abx@strings@#1}% - \setkeys{blx@lbx}{#2}% - \let\do\blx@defbibstrings@i - \csxdef{abx@strings@#1}{\abx@dostrings}% - } - }{}} - - % - %增加一个处理佚名或noauthor的控制选项 - \DeclareBibliographyOption{gbnoauthor}[true]{% - \ifstrequal{#1}{false}{}{\dealnoathor}} - %\ExecuteBibliographyOptions{gbnoauthor=true}%对于需要展开较早(展开层级优先)的选项,这一执行无效,只能用宏包加载时给出的选项。 - - - % - % 增加一个恢复域格式为标准样式的控制选项 - % v1.0k, 2018.05.15, by hzz - % - % 原理方法: - % 默认设置该选项为false,采用国标要求的域格式输出相关域 - % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域 - \newtoggle{bbx:gbfieldstd} - \DeclareBibliographyOption{gbfieldstd}[false]{% - \settoggle{bbx:gbfieldstd}{#1}% - \ifstrequal{#1}{false}{}{\execgbfdfmtstd}% - } - \ExecuteBibliographyOptions{gbfieldstd} - - % - % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。 - % - \newtoggle{bbx:gbpub} - \DeclareBibliographyOption{gbpub}[true]{% - %\settoggle{bbx:gbpub}{#1} %或采用下面这一句 - \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}} - \ExecuteBibliographyOptions{gbpub} - - % - % 增加控制析出文献来源前的标点符号//输出的选项 - % v1.0k, 2018.04.20,added in by hzz - \newtoggle{bbx:gbpunctin} - \DeclareBibliographyOption{gbpunctin}[true]{% - \settoggle{bbx:gbpunctin}{#1}} - \ExecuteBibliographyOptions{gbpunctin} - - - % 选项设置 - % - \ExecuteBibliographyOptions{ - useprefix = true, %名字的信息包括前缀 - date = year, %日期仅写到年 - maxbibnames=3, %将文献列表和引用中最大名字数量区分开 - minbibnames=3, - maxitems = 1,%设置列表最大数量 - minitems = 1, %设置缩减后的列表最小数量 - isbn=false, - sorting=gb7714-2015, - sortlocale=zh__pinyin,%zh__big5han,%zh__stroke,%zh__gb2312han,%zh__pinyin, - } - - % - %为日期相关选项增加选项值gb7714-2015 - % - \csdef{mkdaterangegb7714-2015}#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year} - {} - {\printtext[#1date]{% - \blx@gbdate{#1}{}}}% - \endgroup} - - \newrobustcmd*{\blx@gbdate}[3][]{% - \dateeraprintpre{#2#3year}% - \blx@imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}% - \iffieldundef{#2#3month}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3month}}}% - \iffieldundef{#2#3day}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3day}}}} - - %为姓名格式选择增加的计数器 - \newcounter{gbnamefmtcase} - \def\thegbnamefmtcase{\the\c@gbnamefmtcase} - %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令 - \newcounter{gbcitelocalcase} - \newcounter{gbbiblocalcase} - \def\thegbcitelocalcase{\the\c@gbcitelocalcase} - \def\thegbbiblocalcase{\the\c@gbbiblocalcase} - - -\@ifpackagelater{biblatex}{2016/03/27} - { % 针对biblatex>=3.3版本的选项设置 - - % 增加不同语言排序的切换选项 - % gblanorder=chineseahead的顺序为cn,jp,kr,en,fr,ru - % gblanorder=englishahead的顺序为en,fr,ru,cn,jp,kr - % gblanorder=cn;en;ru;fr;jp;kr的顺序为指定的cn;en;ru;fr;jp;kr,自定义内容可以随意写以分号分隔 - % v1.0q,20190307,hzz - % - \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{% - \ifstrequal{#1}{chineseahead}%%中文在前的顺序 - {\gdef\lancnorder{1}\gdef\lanjporder{2}\gdef\lankrorder{3}% - \gdef\lanenorder{4}\gdef\lanfrorder{5}\gdef\lanruorder{6}}% - {% - \ifstrequal{#1}{englishahead}% - {\execlanodeah\dealsortlan}% - {\execlanodudf{#1}\dealsortlan}% - }% - } - \ExecuteBibliographyOptions{gblanorder} - - \def\execlanodeah{%中文在后的顺序 - \gdef\lancnorder{4} - \gdef\lanjporder{5} - \gdef\lankrorder{6} - \gdef\lanenorder{1} - \gdef\lanfrorder{2} - \gdef\lanruorder{3}} - - \newcounter{lanordernum} - \newcommand{\execlanodudf}[1]{%like:cn;en;ru;fr;jp;kr - \setcounter{lanordernum}{0} - \DeclareListParser{\parsinglanorder}{;} - \renewcommand*{\do}[1]{\stepcounter{lanordernum}\csxdef{lan##1order}{\thelanordernum}} - \parsinglanorder{#1} - } - - % 增加本地化字符串的中英文切换选项 - % gbcitelocal指标注中的本地化字符串 - % gbbiblocal 指文献表中的本地化字符串 - % gblocal 指设置文献表和标注中的本地化字符串 - % v1.0o,20190103,hzz - % - \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{% - \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}% - \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}% - \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}% - } - \ExecuteBibliographyOptions{gbcitelocal} - - \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{% - \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}% - \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}% - \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}% - } - \ExecuteBibliographyOptions{gbbiblocal} - - \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{% - \ExecuteBibliographyOptions{gbbiblocal=#1}% - \ExecuteBibliographyOptions{gbcitelocal=#1}% - } - %\ExecuteBibliographyOptions{gblocal} %默认值已经通过两个相关选项设置 - - - % - % 增加序号标签格式处理选项,作者年制不做处理,给出只为兼容选项考虑 - % v1.0l,20180623,hzz - % - \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{} - - % - % 增加姓名大小写格式处理选项 - % - \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{% - \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}% - \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}% - \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family - \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{}%family-given - \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}% - \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family - } - \ExecuteBibliographyOptions{gbnamefmt} - - % - % 增加标签对齐选项 - % - %因为在作者年制中,不需要使用,这里也增加,为了与顺序编码制的兼容性考虑。 - \DeclareBibliographyOption[string]{gbalign}[right]{}% - - - - - } - { - % 增加不同语言排序的切换选项 - % biblatex 3.4及以下版本不能使用多个stylesourcemap,所以不使用该选项 - % 这里给出仅为兼容性考虑 - % v1.0q,20190307,hzz - % - \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{} - - % - % 增加序号标签格式处理选项,作者年制不做处理,给出只为兼容选项考虑 - % v1.0l,20180623,hzz - % - \DeclareBibliographyOption{gbbiblabel}[bracket]{} - - % - % 增加姓名大小写格式处理选项 - % - \DeclareBibliographyOption{gbnamefmt}[uppercase]{% - \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}% - \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}% - \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family - \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{} - \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given - \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family - } - \ExecuteBibliographyOptions{gbnamefmt} - - % - % 增加标签对齐选项 - % - %因为在作者年制中,不需要使用,这里也增加,为了与顺序年制的兼容性考虑。 - \DeclareBibliographyOption{gbalign}[right]{}% - - } - - -% -% 针对biblatex<3.3版本的选项设置,比如texlive2015中的3.0版 -% -\defversion{3.0}{opt}{ - \ExecuteBibliographyOptions{ - firstinits = true, %名字有缩写,参考3.1.2.3 Internal - } -} -% -% 针对3.3<=biblatex<3.5版本的选项设置,比如texlive2016中的3.4版 -% -\defversion{3.4}{opt}{ - \ExecuteBibliographyOptions{ - giveninits = true, - } -} -% -% 针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版 -% -\defversion{3.7}{opt}{ - \ExecuteBibliographyOptions{ - giveninits = true, - urldate =edtf, - eventdate =edtf, - } -} -% -% 针对3.10<=biblatex版本的选项设置,比如texlive2018中的3.11版 -% -\defversion{3.10}{opt}{ - \ExecuteBibliographyOptions{ - giveninits = true, - urldate =gb7714-2015,%iso - eventdate =gb7714-2015,%iso - } -} - -% -% 针对3.13<=biblatex版本的选项设置,因为内容有限,所以不再增加版本区分,而用时间直接判断 -% -% 解决国标中“王临慧, 2010a.”和“王临慧, 等, 2010b.”的问题 -% 在没有这个选项之前无法加上a和b -% v1.0s,20190828 -\@ifpackagelater{biblatex}{2019/08/16}{% - \ExecuteBibliographyOptions{% - nohashothers=true}}{} - -% -% 根据biblatex版本信息,选择选项设置 -% -% 原理方法:如下这种选择机制能自动兼容更新的版本,但对于老版本 -% 必须要把情况列全。 -\iftoggle{iftlfive}{\switchversion{3.0}{opt}}{}%biblatex<=3.2 -\iftoggle{iftlsix}{\switchversion{3.4}{opt}}{}%3.3<=biblatex<=3.6 -\iftoggle{iftlseven}{\switchversion{3.7}{opt}}{}%biblatex=3.7 -\iftoggle{iftleight}{\switchversion{3.7}{opt}}{}%3.8<=biblatex<=3.9 -\iftoggle{iftlnine}{\switchversion{3.10}{opt}}{}%biblatex=3.10 -\iftoggle{iftlatest}{\switchversion{3.10}{opt}}{}%biblatex最新3.11 - - -%===================================================================== -%设置本地化字符串 -%===================================================================== - % - % 新建当地化字符串,用来记录“等”字符、“和”字符 - % - \NewBibliographyString{andotherscn} - \NewBibliographyString{andothersincitecn} - \NewBibliographyString{andothersincite} - \NewBibliographyString{andcn} - \NewBibliographyString{andothersjp} - \NewBibliographyString{andotherskr} - \NewBibliographyString{andjp} - \NewBibliographyString{andkr} - \NewBibliographyString{andincitecn} - \NewBibliographyString{andincite} - \NewBibliographyString{volumecn} - \NewBibliographyString{numbercn} - \NewBibliographyString{serialcn} - \NewBibliographyString{incn} - \NewBibliographyString{mathesiscn} - \NewBibliographyString{phdthesiscn} - \NewBibliographyString{editorcn} - \NewBibliographyString{editorscn} - - % - % 修改一些当地化字符串 - % - % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件 - % 当然也可以增加比如上面定义的andotherscn - % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别 - \DefineBibliographyStrings{english}{ - bibliography = {\str@bibliography}, - references = {\str@references}, - bytranslator= {\str@bytranslator\adddot}, %将trans. by 改成 译 - and = {\addcomma},%将第2和3人名见的and符号改成 逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 - andcn = {\addcomma},%\str@andcn\ and本地化字符串的中文对应词 - andincitecn = {\str@andcn},%将标注中的分开,便于与文献表中的区分 - andincite = {\addcomma}, - %andothers = {et al.}, %将超过3个人名的省略,et al.改成为 等 - andotherscn = {\str@andotherscn},%将超过3个人名的省略,et al.改成为 等 - andothersincitecn={\str@andotherscn},%将标注中的分开,便于与文献表中的区分 - andothersincite={et al\adddot}, - backrefpage = {\str@backrefpage:}, - backrefpages = {\str@backrefpages:}, - in={in\intitlepunct}, - volumecn={\str@volumecn}, - numbercn={\str@numbercn}, - serialcn={\str@serialcn}, - andothersjp={他}, - andotherskr={외}, - andjp={和}, - andkr={和}, - incn={\str@incn\addcolon\addspace}, - mathesiscn={\str@mathesiscn}, - phdthesiscn={\str@phdthesiscn}, - editorscn={\str@editorcn}, - editorcn={\str@editorcn}, - } - - % - % 增加两个命令用于临时的局部的修改本地化字符串 - % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串 - % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内 - % v1.0t,hzz,20190525 - \newcommand{\setlocalbibstring}[2]{% - \csdef{abx@sstr@#1}{#2}} - \newcommand{\setlocalbiblstring}[2]{% - \csdef{abx@lstr@#1}{#2}} - -%===================================================================== -% 动态数据修改 -%===================================================================== -% -% 各层次的数据映射和动态修改 -% -% 原理方法: -% 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中 -% 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性 -% 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个 -% 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次 -% 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。 -% 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符, -% 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息 -% -% 不同的文献类型使用相同的驱动输出可以有5种方法: -% 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型 -% 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型 -% 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型 -% 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名 -% 驱动别名定义本质上是做了驱动层映射 -% 5. 直接定义不同的类型的驱动,但驱动内容相同。 -% -% 关于数据映射和驱动使用的考虑如下: -% 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换 -% 2. 为减少代码量,尽量少做内容相同的不同类型驱动 -% 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名 -% 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type -% 可以在样式层映射做某些需要避免这种默认处置的转换 -% 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射 -% -% 文献类型和驱动考虑如下: -% 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article -% newpaper映射为article,并以note域做区分特殊处理 -% 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook -% standard映射为book或inbook,并以note域做区分特殊处理 -% collection和proceedings基本与book类似,因此做book驱动别名处理 -% incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理 -% 3. 专利类型有其特殊性,考虑patent类型 -% 4. 电子资源类型有其特殊性,考虑online类型 -% 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更新日期 -% 因此考虑用一种类型来输出,使用report类型 -% 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略, -% 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型 -% 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时, -% 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。 -% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述 -% 更多的信息,因此不存在网址时,独立做一个备选格式 -% 9. 出版项主要以如下方式处理: -% (a) location+institution+date 仅用于连续出版物 -% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report -% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型 -% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。 -% (e) 不输出,主要用于连续出版物析出的文献 -% 10. 日期以如下方式处理: -% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year -% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate -% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date -% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate - -\DeclareSourcemap{ -\maps[datatype=bibtex]{% - \map{%当没有作者时将editor转成author - \pernottype{inbook}%因为in系列中editor可能用来表示bookauthor,所以排除 - \pernottype{inproceedings} - \pernottype{incollection} - \pernottype{periodical}%因为peridical直接使用editor,所以排除 - %注意notfield在低版本biblatex中没有 - %\step[notfield=author,final]%当author不存在,将editor复制给author - \step[fieldsource=editor,fieldtarget=author]%并删除editor - } - \map{%当没有作者时将translator转成author - \pernottype{inbook} - \pernottype{inproceedings} - \pernottype{incollection} - %\step[notfield=author,final]%当author不存在,将translator复制给author - \step[fieldsource=translator,fieldtarget=author]%并删除translator - } - \map{%让address和location同步,biblatex中address是location的别名 - %因此输出的时候只有location信息,但处理过程中是可以存在address的。 - %\step[notfield=address,final] - \step[fieldsource=location,final] - \step[fieldset=address,origfieldval] - } - \map{%让address和location同步 - %\step[notfield=location,final] - \step[fieldsource=address,final] - \step[fieldset=location,origfieldval] - } - \map{%处理在bib文件用mark标记文献类型标识符的情况 - \step[fieldsource=mark,final] - \step[fieldset=usera, origfieldval] - } - \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况 - \step[fieldsource=nameformat,match=lowercase,final] - \step[fieldset=namefmtid,fieldvalue={1}] - } - \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况 - \step[fieldsource=nameformat,match=givenahead,final] - \step[fieldset=namefmtid,fieldvalue={2}] - } - \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况 - \step[fieldsource=nameformat,match=familyahead,final] - \step[fieldset=namefmtid,fieldvalue={3}] - } - \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况 - \step[fieldsource=nameformat,match=pinyin,final] - \step[fieldset=namefmtid,fieldvalue={4}] - } - \map{%根据article确定文献类型标识符 - \pertype{article} - \step[fieldset=usera, fieldvalue={J}] - } - \map{%根据periodical确定文献类型标识符 - \pertype{periodical} - \step[fieldset=usera, fieldvalue={J}] - \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor - \step[fieldset=editor, origfieldval] - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符 - \pertype{newspaper} - \step[fieldset=usera, fieldvalue={N}] - \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断 - } - \map{%对应增加的一个数据库类型database确定文献类型标识符 - \pertype{database} - \step[fieldset=usera, fieldvalue={DB}] - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%对应增加的一个数据集类型dataset确定文献类型标识符 - \pertype{dataset} - \step[fieldset=usera, fieldvalue={DS}]% - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%对应增加的一个软件类型software确定文献类型标识符 - \pertype{software} - \step[fieldset=usera, fieldvalue={CP}] - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%对应增加的一个舆图类型map确定文献类型标识符 - \pertype{map} - \step[fieldset=usera, fieldvalue={CM}]% - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%对应增加的一个档案类型archive确定文献类型标识符 - \pertype{archive} - \step[fieldset=usera, fieldvalue={A}] - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以 - %当misc类型带有网址时,直接将其转换为online类型 - \pertype{misc} - \step[fieldsource=url,final] - \step[typesource=misc,typetarget=online] - } - \map{%对应增加的一个备选类型misc确定文献类型标识符 - \pertype{misc} - \step[fieldset=usera, fieldvalue={Z}]% - } - \map{ - \pertype{book} - \pertype{inbook} - \step[fieldset=usera, fieldvalue={M}] - \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition - \step[fieldset=edition, origfieldval] - } - \map{%兼容老的standard类型,确定文献类型标识符 - \pertype{standard} - \step[fieldset=usera, fieldvalue={S}] - \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断 - } - \map{ - \pertype{patent} - \step[fieldset=usera, fieldvalue={P}] - } - \map{ - \pertype{inproceedings} - \pertype{conference}%兼容老的conference类型 - \step[fieldset=usera, fieldvalue={C}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{proceedings} - \step[fieldset=usera, fieldvalue={C}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{incollection} - \step[fieldset=usera, fieldvalue={G}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{collection} - \step[fieldset=usera, fieldvalue={G}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{report} - \pertype{techreport}%兼容老的techreport类型 - \step[fieldset=usera, fieldvalue={R}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{thesis} - \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型 - \pertype{phdthesis} - \step[fieldset=usera, fieldvalue={D}] - \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{ - \pertype{online} - \pertype{electronic}%兼容老的electronic类型 - \pertype{www}%兼容老的www类型 - \step[fieldset=usera, fieldvalue={EB}] - \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册 - \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 - \step[fieldset=institution, origfieldval] - } - \map{ - \pertype{manual} - \step[fieldset=usera, fieldvalue={A}] - \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version - \step[fieldset=version, origfieldval] - \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 - \step[fieldset=institution, origfieldval] - } - \map{ - \pertype{unpublished} - \step[fieldset=usera, fieldvalue={Z}] - } - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - }% - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={editor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - }% - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={translator}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - }% - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={bookauthor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - }% - \map{%处理一些用year表示date的情况 - %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。 - %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息 - \step[fieldsource=year] - \step[fieldset=date, origfieldval] - } - \map{%将entrykey放入keywords中用于后期使用 - \step[fieldsource=entrykey] - \step[fieldset=keywords, origfieldval] - } - \map{\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=userd,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=userd,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=userd,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=userd,fieldvalue={korean}]%韩语 - } - \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题 - \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]% - \step[fieldset=userd, fieldvalue={chinese}] - } - \map{%将没有设置userd,且存在title域的默认设置为英文 - \step[fieldsource=title,final] - \step[fieldset=userd,fieldvalue={english}] - } - \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=userf,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=author,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=userf,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=author,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=userf,fieldvalue={korean}]%韩语 - } - \map{%作者的中文判断 - \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=userf, fieldvalue={chinese}] - } - \map{%将没有设置userf,且存在author域的默认设置为英文 - \step[fieldsource=author,final] - \step[fieldset=userf,fieldvalue={english}] - } - \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=usere,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=translator,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=usere,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=translator,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=usere,fieldvalue={korean}]%韩语 - } - \map{%译者的中文判断 - \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=usere, fieldvalue={chinese}] - } - \map{%将没有设置usere,且存在translator域的默认设置为英文 - \step[fieldsource=translator,final] - \step[fieldset=usere,fieldvalue={english}] - } - \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=userc,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=userc,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=userc,fieldvalue={korean}]%韩语 - } - \map{%编者的中文判断 - \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 - \step[fieldset=userc, fieldvalue={chinese}] - } - \map{%将没有设置userc,且存在editor域的默认设置为英文 - \step[fieldsource=editor,final] - \step[fieldset=userc,fieldvalue={english}] - } - \map{\step[fieldsource=bookauthor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=userb,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=bookauthor,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=userb,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=bookauthor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=userb,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=bookauthor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=userb,fieldvalue={korean}]%韩语 - } - \map{%编者的中文判断 - \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 - \step[fieldset=userb, fieldvalue={chinese}] - } - \map{%将没有设置userc,且存在editor域的默认设置为英文 - \step[fieldsource=bookauthor,final] - \step[fieldset=userb,fieldvalue={english}] - } - \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language - \step[fieldset=language,origfieldval]%本身language存在则不设定 - } - \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language - \step[fieldset=language,origfieldval] - }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。 - \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。 - \step[fieldset=language,fieldvalue={english}] - } - \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断, - %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况, - %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd - \step[fieldsource=language] - \step[fieldset=userd,origfieldval] - } - \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言 - %biblatex 3.11及以下版本仅有match是区分大小写的,而3.12版开始用matchi来区分大小,而match不区分 - %这里为兼容3.11及以下版本,所以用一个复杂一点的正则表达式 - \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final] - \step[fieldset=langid,fieldvalue={english}] - \step[fieldset=lansortorder,fieldvalue=\lanenorder] - } - \map{ - \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final] - \step[fieldset=langid,fieldvalue={russian}] - \step[fieldset=lansortorder,fieldvalue=\lanruorder] - } - \map{% - \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final] - \step[fieldset=langid,fieldvalue={french}] - \step[fieldset=lansortorder,fieldvalue=\lanfrorder] - } - \map{% - \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, - \step[fieldset=langid,fieldvalue={english}] - \step[fieldset=lansortorder,fieldvalue=\lancnorder] - } - \map{% - \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, - \step[fieldset=langid,fieldvalue={english}] - \step[fieldset=lansortorder,fieldvalue=\lanjporder] - } - \map{% - \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english, - \step[fieldset=langid,fieldvalue={english}] - \step[fieldset=lansortorder,fieldvalue=\lankrorder] - } - \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook, - %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 - %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断 - \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook - \step[typesource=standard, typetarget=inbook, final] - } - \map{%剩下的全部映射为book - \step[typesource=standard, typetarget=book, final] - } -% \map{%先于标准样式的driver层映射,以取消type设置 -% \step[typesource=mastersthesis, typetarget=thesis, final] -% %\step[fieldset=type, fieldvalue=mathesis] -% } -% \map{%先于标准样式的driver层映射,以取消type设置 -% \step[typesource=phdthesis, typetarget=thesis, final] -% %\step[fieldset=type, fieldvalue=phdthesis] -% } - \map{%先于标准样式的driver层映射,以取消type设置 - \step[typesource=techreport, typetarget=report, final] - %\step[fieldset=type, fieldvalue=techreport] - } - \map{% - \pertype{report} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=report,typetarget=online] - \step[fieldset=note,fieldvalue={report}] - } - \map{% - \pertype{thesis} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=thesis,typetarget=online] - } - \map{% - \pertype{manual} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=manual,typetarget=online] - } - \map{% - \pertype{unpublished} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=unpublished,typetarget=online] - } - \map{% - \pertype{database} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=databasetypetarget=online] - } - \map{% - \pertype{dataset} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=dataset,typetarget=online] - } - \map{% - \pertype{software} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=software,typetarget=online] - } - \map{% - \pertype{map} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=map,typetarget=online] - } - \map{% - \pertype{archive} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=archive,typetarget=online] - } - \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确) - \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 - \step[fieldset=keywords, fieldvalue={,}, append] - \step[fieldset=keywords, origfieldval, append] - } - \map[overwrite]{%title,booktitle,journaltitle,journal,publisher,address,location,institution,organization - \step[fieldsource={title}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={booktitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={journaltitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={journal}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={publisher}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={address}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={location}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={institution}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - \map[overwrite]{ - \step[fieldsource={booktitle}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] - } - \map[overwrite]{ - \step[fieldsource={booktitle}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] - } - %对于高版本(3.4以上)可以用下面这一段取代前面那一段,为了兼容gbnoauthor选项,这些代码只能在sourcemap中使用,所以只能选择前面那一段 - %\map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ -% \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] -% } -% \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ -% \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] -% } -% \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,% -% address,location,institution,organization}]{ -% \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] -% } - } -} - -% -% 佚名/noauthor的处理 -% -% 原理方法:利用样式层的动态数据修改实现 -\def\dealnoathor{ - \DeclareStyleSourcemap{ - \maps[datatype=bibtex]{ - \map{%默认情况下将空缺作者的中文文献设置为佚名 - \step[fieldsource=language,match={chinese},final] - \step[fieldset=author, fieldvalue={佚名}] - } - \map{%默认情况下将空缺作者的英文文献设置为A{non} - \step[fieldsource=language,match={english},final] - \step[fieldset=author, fieldvalue={A{non}}]%noauthor换成Anon,同时为避免大写还加了{} - } - } - } -} - -% -% 不同语言分集调整的实现方式 -% -% 原理方法:利用样式层的动态数据修改lansortorder域来实现排序 -\def\dealsortlan{ - \DeclareStyleSourcemap{ - \maps[datatype=bibtex]{ - \map[overwrite]{%当文献给出language域时,设置文献要使用的本地化字符串的语言 - \step[fieldsource=language,match=english,final] - \step[fieldset=lansortorder,fieldvalue=\lanenorder] - } - \map[overwrite]{ - \step[fieldsource=language,match=russian,final] - \step[fieldset=lansortorder,fieldvalue=\lanruorder] - } - \map[overwrite]{% - \step[fieldsource=language,match=french,final] - \step[fieldset=lansortorder,fieldvalue=\lanfrorder] - } - \map[overwrite]{% - \step[fieldsource=language,match=chinese,final]%中日韩语目前都用english, - \step[fieldset=lansortorder,fieldvalue=\lancnorder] - } - \map[overwrite]{% - \step[fieldsource=language,match=japanese,final]%中日韩语目前都用english, - \step[fieldset=lansortorder,fieldvalue=\lanjporder] - } - \map[overwrite]{% - \step[fieldsource=language,match=korean,final]%中日韩语目前都用english, - \step[fieldset=lansortorder,fieldvalue=\lankrorder] - } - } - } -} - - -% -%驱动别名等价于驱动层映射 -% -\DeclareBibliographyAlias{newspaper}{article}% -\DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动 -\DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动 -\DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动 -\DeclareBibliographyAlias{collection}{book}%%文集类型驱动 -\DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动 -\DeclareBibliographyAlias{thesis}{manual}%学位论文驱动 -\DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动 -\DeclareBibliographyAlias{database}{manual} -\DeclareBibliographyAlias{dataset}{manual} -\DeclareBibliographyAlias{software}{manual} -\DeclareBibliographyAlias{map}{manual} -\DeclareBibliographyAlias{archive}{manual} - -%===================================================================== -% 设置排序格式 -%===================================================================== -% -% 排序格式,用降序,及userb域,针对biblatex3.7及以下版本 -% -\defversion{3.7}{sort}{%这是3.4版的,3.7版略有差异,但不大,后面有注释 - \DeclareSortingScheme{gb7714-2015}{ - \sort{ - \field{presort} - } - %\sort[final]{ - %\field{sortkey} - %} - \sort{ - \field{lansortorder}%language - } - \sort{ - \field{sortkey} - } - \sort{%[direction=descending] - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sortyear} - \field{year} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} - \literal{0000}%3.7版是\literal{0} - } - } - - %降序的nyt - \DeclareSortingScheme{gbnytd}{ - \sort{ - \field{presort} - } - %\sort[final]{ - %\field{sortkey} - %} - \sort{ - \field{lansortorder}%language - } - \sort[direction=descending]{ - \field{sortkey} - } - \sort[direction=descending]{ - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sortyear} - \field{year} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} - \literal{0000}%3.7版是\literal{0} - } - } - - %降序的ynt - \DeclareSortingScheme{gbyntd}{ - \sort{ - \field{presort} - } - %\sort[final]{ - %\field{sortkey} - %} - \sort{ - \field{lansortorder}%language - } - \sort[direction=descending]{ - \field{sortyear} - \field{year} - } - \sort{ - \field{sortkey} - } - \sort{ - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} - \literal{0000}%3.7版是\literal{0} - } - } - - %升序的ynt - \DeclareSortingScheme{gbynta}{ - \sort{ - \field{presort} - } - %\sort[final]{ - %\field{sortkey} - %} - \sort{ - \field{lansortorder}%language - } - \sort{ - \field{sortyear} - \field{year} - } - \sort{ - \field{sortkey} - } - \sort{ - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} - \literal{0000}%3.7版是\literal{0} - } - } -} - - -% -% 排序格式,用降序,及userb域,针对biblatex3.8及以上版本 -% -\defversion{3.8}{sort}{ - \DeclareSortingTemplate{gb7714-2015}{ - \sort{ - \field{presort} - } - %\sort[final]{ - %\field{sortkey} - %} - \sort{ - \field{lansortorder}%language - } - \sort{ - \field{sortkey} - } - \sort{%[direction=descending] - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sortyear} - \field{year} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field{volume} - \literal{0} - } - } - - %降序的nyt - \DeclareSortingTemplate{gbnytd}{ - \sort{ - \field{presort} - } -% \sort[final]{ -% \field{sortkey} -% } - \sort{ - \field{lansortorder}%language - } - \sort[direction=descending]{ - \field{sortkey} - } - \sort[direction=descending]{% - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sortyear} - \field{year} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field{volume} - \literal{0} - } - } - - %降序的ynt - \DeclareSortingTemplate{gbyntd}{ - \sort{ - \field{presort} - } -% \sort[final]{ -% \field{sortkey} -% } - \sort{ - \field{lansortorder}%language - } - \sort[direction=descending]{ - \field{sortyear} - \field{year} - } - \sort{ - \field{sortkey} - } - \sort{% - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field{volume} - \literal{0} - } - } - - %升序的ynt - \DeclareSortingTemplate{gbynta}{ - \sort{ - \field{presort} - } -% \sort[final]{ -% \field{sortkey} -% } - \sort{ - \field{lansortorder}%language - } - \sort{%[direction=ascending] - \field{sortyear} - \field{year} - } - \sort{ - \field{sortkey} - } - \sort{% - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field{volume} - \literal{0} - } - } - - % - % 定义命令\defdoublelangentry,用于biblatex>v3.8版利用related实现双语文献的处理 - % - %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了, - %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息 - %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中 - \newcommand{\defdoublelangentry}[2]{% - \edef\entrykeya{##1} - \edef\entrykeyb{##2} - \DeclareStyleSourcemap{ - \maps[datatype=bibtex]{ - \map{ - \step[fieldsource=entrykey, match=\entrykeya, final] - \step[fieldset=related, fieldvalue=\entrykeyb] - } - } - } - } -} - - -\ifboolexpr{ -test {\iftoggle{iftlfive}} -or -test {\iftoggle{iftlsix}} -or -test {\iftoggle{iftlseven}}%biblatex<=3.7 -}{\switchversion{3.7}{sort}}{\switchversion{3.8}{sort}}%3.8<=biblatex - - -%===================================================================== -%参考文献表环境 -%===================================================================== - -% -% 列表格式 -% -% 增加一个\bibitemindent尺寸用于控制list环境的itemindent -% v1.0l,20180615,hzz -\setlength{\bibhang}{1em} -\newlength{\bibitemindent} -\setlength{\bibitemindent}{-\bibhang} -\setlength{\bibitemsep}{4.5pt} - \defbibenvironment{bibliography} - {\list - {} - {\setlength{\leftmargin}{\bibhang}% - \setlength{\itemindent}{\bibitemindent}% - \setlength{\itemsep}{\bibitemsep}% - \setlength{\parsep}{\bibparsep}}} - {\endlist} - {\item} - - -%===================================================================== -% 设置单元或块等的标点 -%===================================================================== -\renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin -\renewcommand*{\subtitlepunct}{\addcolon\space} %修改标题和其它标题信息间的标点%来源biblatex.def -% -% 利用set实现的多语言文献不同语言间的分隔符 -% 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进 -% -% 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets -% 这里调整一下两种语言参考文献的间隔,源来自biblatex.def -\renewcommand*{\entrysetpunct}{\adddot\par\nobreak}%ay样式用par也可以,因为没有悬挂对齐问题 -\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号 -%\renewcommand{\relateddelim}{}%\par - -%===================================================================== -% 修改域的格式,重定义域的输出宏 -%===================================================================== -% -% 新增文献类型标识符的格式 -% []前的nobreak,从GB4.1节的例子看不应该加,所以去掉 -% 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上 -% 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉 -% -\DeclareFieldFormat{gbtypeflag}{% -\iftoggle{bbx:gbmedium}% -{\iftoggle{bbx:url}% - {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% - }% - {\ifentrytype{online}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% - }}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% -} - -% -% 新增用于报纸的文献类型标识符的格式 -% -\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper -\iftoggle{bbx:gbmedium}% -{\iftoggle{bbx:url}% - {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% - {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% - }% - {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% -}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}% -} - -% -% 新增用于标准的文献类型标识符的格式 -% -\DeclareFieldFormat{gbtypeflags}{%用于标准standard -\iftoggle{bbx:gbmedium}% -{\iftoggle{bbx:url}% - {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% - {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% - }% - {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% -}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}% -} - -% -% 重设title等参考文献信息的输出格式 -% -% 原理方法:修改来自biblatex.def文件的原格式 -\newcommand{\bibtitlefont}{} -\newcommand{\bibauthorfont}{} -\newcommand{\bibpubfont}{} -\DeclareFieldFormat{title}{#1\adddot\addthinspace} -\DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot,用于缩写名带点情况,将其转换为缩写点,便于标点的追踪 -\DeclareFieldFormat{issuetitle}{#1} -\DeclareFieldFormat{maintitle}{#1} -\DeclareFieldFormat{booktitle}{#1} -\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 - [article,patent,thesis,unpublished] - {title}{#1\adddot\addthinspace} -\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 - [inbook,incollection,inproceedings] - {title}{#1}%\nopunct\unspace -\DeclareFieldFormat{url}{\url{#1}} %url域修改如本行%url相关输出,源来自biblatex.def -\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily -%\urlstyle{rm} %使用这句也一样 -\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行 -\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行 -\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行 -\DeclareFieldFormat{doi}{% - \rmfamily{DOI}\addcolon\space - \ifhyperref - {\href{https://doi.org/#1}{\nolinkurl{#1}}} - {\nolinkurl{#1}}} -% -% 标题的字母大小写格式修改 -% -% 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase -% 因为titlecase is applied to the contents of the field directly,title is not -%\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写 -\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{% -\iffieldundef{url}{\MakeCapital#1}{% -\href{\thefield{url}}{#1}}}{\MakeCapital#1}}%重设标题格式,将其修改为首字母大写 -\DeclareFieldFormat{pages}{#1}%页码引用格式的修改%去掉前面引导页码的pp.等字符 -\DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}} - -\def\execgbfdfmtstd{%恢复到标准样式的设置 -\DeclareFieldFormat{title}{\mkbibemph{##1}} -\DeclareFieldFormat - [article,inbook,incollection,inproceedings,patent,thesis,unpublished] - {title}{\mkbibquote{##1\isdot}} -\DeclareFieldFormat - [suppbook,suppcollection,suppperiodical] - {title}{##1} -\DeclareFieldFormat{journaltitle}{\mkbibemph{##1}} -\DeclareFieldFormat{issuetitle}{\mkbibemph{##1}} -\DeclareFieldFormat{maintitle}{\mkbibemph{##1}} -\DeclareFieldFormat{booktitle}{\mkbibemph{##1}} -\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{##1}} -\DeclareFieldFormat{titlecase}{##1} -\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{##1}} -} - -% -% 文献标题后的标点问题 -% v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen -% -% 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况: -% texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于 -% 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响 -% 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct -\ifboolexpr{% - test{\iftoggle{iftlfive}} - or - test{\iftoggle{iftlsix}} - }{}% - {%texlive 2017对应iftlseven以上版本 - \@ifclassloaded{beamer}{ - \DeclareFieldFormat{title}{#1}% - \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1} - \AtBeginDocument{% - \patchcmd{\abx@macro@title}{\newunitpunct}{}{}{}}}{} - } - - -% -% 修改译者位置格式 -% -% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式 -\renewbibmacro*{bytranslator+others}{\bibauthorfont% - \ifnameundef{translator} - {} - {%\usebibmacro{bytranslator+othersstrg} - %\setunit{\addspace}% - \printnames[bytranslator]{translator}% - \clearname{translator}% - %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理 - %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串 - \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。 - %\setunit{\addspace}% - \newunit}% - \usebibmacro{withothers}} - - - -% -% 修改作者数量超过限定值,做省略时的处理格式 -% v1.0,20160701,hzz -% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim -% -% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。 -% \printnames由start-stop控制项数,默认是1和maxnames/minnames -\renewbibmacro*{name:andothers}{\bibauthorfont% - \ifboolexpr{ - test {\ifnumequal{\value{listcount}}{\value{liststop}}} - and - test \ifmorenames - }{\ifnumgreater{\value{liststop}}{1}%注意这里试图去区分姓名总数大于1的情况,当姓名总数大于1时,最后一个姓名后面先加入一个\finalandcomma - {\finalandcomma}%目前国标没有这样的区分要求,如果有需要也是可以这么去做的。 - {}% -\printdelim{andothersdelim}\printdelim{strandothersdelim}% -}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如: -%袁训来, 陈哲, 肖书海, 等. -%胡泳, 范海燕, 译. -%潘惠霞, 魏婧, 杨艳, 等译. -\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理 -}} - -% 修改省略作者后的本地化字符串,比如et al. -% v1.0o,20190103,hzz -% -% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。 -% 非默认情况,根据选项信息,选择选择强制中文或英文 -% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 -% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 -\DeclareDelimFormat{strandothersdelim}{% - \edef\userfieldabcde{userd}%这里使用\iffieldequalstr{labelnamesource}替代ifcurrentname因为标注中使用ifcurrentname无效 - \iffieldequalstr{labelnamesource}{translator}{\edef\userfieldabcde{usere}}{}% - \iffieldequalstr{labelnamesource}{editor}{\edef\userfieldabcde{userc}}{}% - \iffieldequalstr{labelnamesource}{author}{\edef\userfieldabcde{userf}}{}% - \iffieldequalstr{labelnamesource}{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbcitelocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\ifbibstring{andothersincitecn}{\bibstring{andothersincitecn}}{\bibstring{andothers}}}{}%中文已经通过english本地化字符串定义 - \iffieldequalstr{\userfieldabcde}{korean}{\ifbibstring{andotherskr}{\bibstring{andotherskr}}{\bibstring{andothers}}}{}%韩语未定义,所以与bib中一致 - \iffieldequalstr{\userfieldabcde}{japanese}{\ifbibstring{andothersjp}{\bibstring{andothersjp}}{\bibstring{andothers}}}{}%日与同韩语 - \iffieldequalstr{\userfieldabcde}{english}{\ifbibstring{andothersincite}{\bibstring{andothersincite}}{\bibstring{andothers}}}{}%英语已定义 - \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%法语未定义,若要定义需要针对french本地化字符串定义 - \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%俄语未定义,若要定义需要针对russian本地化字符串定义 - \or% - \bibstring{andothersincitecn}% - \or% - \bibstring{andothersincite}% - \fi} - - -\DeclareDelimFormat[bib,biblist]{strandothersdelim}{% - \edef\userfieldabcde{userd}% - \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbbiblocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}% - \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}% - \or% - \bibstring{andotherscn}% - \or% - \bibstring{andothers}% - \fi} - - -% -% 修改最后一个作者前的字符串,比如 and -% v1.0o,20190103,hzz -% -% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。 -% 非默认情况,根据选项信息,选择选择强制中文或英文 -% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 -% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 -\DeclareDelimFormat{finalnamedelim}{% - \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% -% \addspace% - \edef\userfieldabcde{userd}% - \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbcitelocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\space\bibstring{andincite}\space}{}% - \iffieldequalstr{\userfieldabcde}{french}{\space\bibstring{and}\space}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\space\bibstring{and}\space}{}% -%\space% - \or% - \bibstring{andincitecn}%\space% - \or% -\space\bibstring{andincite}\space% - \fi} - -\DeclareDelimFormat[bib,biblist]{finalnamedelim}{% - \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% - \addspace% - \edef\userfieldabcde{userd}% - \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbbiblocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}% - \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% -\space% - \or% - \bibstring{andcn}\space% - \or% - \bibstring{and}\space% - \fi} - - - -% -% 重设title的输出 -% -% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen -% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件 -% 利用toggle做标识符是否输出的判断 -\renewbibmacro*{title}{% - \ifboolexpr{% - test{\iffieldundef{title}}% - and - test{\iffieldundef{subtitle}}% - }% - {}% - {\printtext[title]{\bibtitlefont%增加字体控制命令 - \printfield[titlecase]{title}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct}% - \printfield[titlecase]{subtitle}}% - \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 - {\setunit{\subtitlepunct}\printfield{titleaddon}}% - \iftoggle{bbx:gbtype}{% - \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 - {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 - {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 - {\printfield[gbtypeflag]{usera}}}%其它 - }}{}% - %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 - %\newunit - }% -}} - - -% -% 作者信息的输出格式 -% -% 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen -% 20180603,v1.0l,增加使用nameformat域来选择姓名格式 -\DeclareNameFormat{namefmtselected}{% -\iffieldundef{namefmtid}{}% -{\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}% -\ifcase\value{gbnamefmtcase}% - \ifgiveninits - {\usebibmacro{name:gbuppercase} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:gbuppercase} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% -\or - \ifgiveninits - {\usebibmacro{name:gblowercase} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:gblowercase} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% -\or - \ifgiveninits - {\usebibmacro{name:given-family} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:given-family} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% -\or - \ifgiveninits - {\usebibmacro{name:family-given} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:family-given} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% -\or -\usebibmacro{name:gbpinyin} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}% -\or - \ifnumequal{\value{listcount}}{1} - {\ifgiveninits - {\usebibmacro{name:family-given} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:family-given} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% - \ifboolexpe{% - test {\ifdefvoid\namepartgiven} - and - test {\ifdefvoid\namepartprefix}} - {} - {\usebibmacro{name:revsdelim}}} - {\ifgiveninits - {\usebibmacro{name:given-family} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:given-family} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}}% -\fi - \usebibmacro{name:andothers}} - -\DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式 -\DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family -\DeclareNameAlias{citename}{default}% Default used by \citename - -\DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace} -%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% - -%GB/T 7714-2015 风格,全部大写 -\newbibmacro*{name:gbuppercase}[4]{\bibauthorfont% -\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 -\renewcommand*{\revsdnamepunct}{}% - \ifuseprefix% - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifdefvoid{#3}{}{% - \ifcapital% - {\mkbibnameprefix{\MakeCapital{#3}}\isdot}% - {\mkbibnameprefix{#3}\isdot}% - \ifprefchar{}{\bibnamedelimc}}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% - \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% - \ifboolexpe{% - test {\ifdefvoid{#2}} - and - test {\ifdefvoid{#3}}} - {}{\revsdnamepunct}% - \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital - \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% -} - -%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 -\newbibmacro*{name:gblowercase}[4]{\bibauthorfont% - \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 - \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifdefvoid{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifprefchar{}{\bibnamedelimc}}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% - \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}} - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% - \ifboolexpe{% - test {\ifdefvoid{#2}} - and - test {\ifdefvoid{#3}}} - {}{\revsdnamepunct}% - \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital - \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% -} - -%中文常见风格,汉语拼音全拼模式 -\newbibmacro*{name:gbpinyin}[4]{\bibauthorfont% -\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY -\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def -\renewrobustcmd*{\bibnamedelima}{\mbox{-}}% - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifdefvoid{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifprefchar{}{\bibnamedelimc}}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% - \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamegiven{#2}}\isdot}%\MakeCapital - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}} - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% - \ifboolexpe{% - test {\ifdefvoid{#2}} - and - test {\ifdefvoid{#3}}} - {} - {\revsdnamepunct}% - \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital - \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% -} - - -\@ifpackagelater{biblatex}{2016/03/27}%biblatex<3.2版的情况 - {}{ - %GB/T 7714-2015 风格,全部大写 - \renewbibmacro*{name:gbuppercase}[4]{\bibauthorfont% - \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 - \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifblank{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifpunctmark{'}{}{\bibnamedelimc}}% - %\mkbibnamelast{#1}\isdot - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase - %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开 - %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{} - %\mkbibnamelast{\MakeUppercase{#1}}\isdot - %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 - \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}} - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}} - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase - %\mkbibnamelast{\MakeUppercase{#1}}\isdot - %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 - \ifblank{#2#3}{}{\revsdnamepunct}% - \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% - \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% - \addcomma\addspace% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}% - }% - } - - %GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 - \renewbibmacro*{name:gblowercase}[4]{\bibauthorfont% - \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 - \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifblank{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifpunctmark{'}{}{\bibnamedelimc}}% - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase - \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}} - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase - \ifblank{#2#3}{}{\revsdnamepunct}% - \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}% - \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% - \addcomma\addspace% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}% - }% - } - - %中文常见风格,汉语拼音全拼模式 - \renewbibmacro*{name:gbpinyin}[4]{\bibauthorfont% - \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 - \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def - \renewrobustcmd*{\bibnamedelima}{\mbox{-}}% - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifblank{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifpunctmark{'}{}{\bibnamedelimc}}% - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase - \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamefirst{#2}}\isdot}% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}} - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase - \ifblank{#2#3}{}{\revsdnamepunct}% - \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% - \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% - \addcomma\addspace% - \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}% - }% - } - - %%biblatex<3.2版的情况,姓名的处理格式带参数 - \DeclareNameFormat{namefmtselected}{% - \iffieldundef{namefmtid}{}% - {\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}% - \ifcase\value{gbnamefmtcase}% - \iffirstinits - {\usebibmacro{name:gbuppercase}{#1}{#4}{#5}{#7}} - {\usebibmacro{name:gbuppercase}{#1}{#3}{#5}{#7}}% - \or - \iffirstinits - {\usebibmacro{name:gblowercase}{#1}{#4}{#5}{#7}} - {\usebibmacro{name:gblowercase}{#1}{#3}{#5}{#7}}% - \or - \iffirstinits - {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}} - {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}% - \ifblank{#3#5} - {} - {\usebibmacro{name:revsdelim}}% - \or - \iffirstinits - {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}} - {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}% - \or - \usebibmacro{name:gbpinyin}{#1}{#3}{#5}{#7}% - \or - \ifnumequal{\value{listcount}}{1} - {\iffirstinits - {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}} - {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}% - \ifblank{#3#5} - {} - {\usebibmacro{name:revsdelim}}} - {\iffirstinits - {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}} - {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}}% - \fi - \usebibmacro{name:andothers}} -} - -% -% url和url日期格式 -% -\renewbibmacro*{url+urldate}{% - %\usebibmacro{url}%%更换url的位置,放到下面 - \iffieldundef{urlyear}% - {}{%\setunit*{\addspace}% - \usebibmacro{urldate}}% - \setunit{\addperiod\addspace}% - \usebibmacro{url}} -\renewbibmacro*{url}{\printfield{url}} - -% -% 日期信息的输出格式,针对biblatex<3.7版本 -% -\defversion{3.4}{date}{ - \renewbibmacro*{urldate}{% - \addthinspace\printtext{[}\printfield{urlyear}% - \iffieldundef{urlmonth}{}{\bibrangedash\printfield{urlmonth}}% - \iffieldundef{urlday}{}{\bibrangedash\printfield{urlday}}\printtext{]}} - - \newbibmacro*{newsdate}{%%新增加一个公告日期,公开日期或新闻日期 - \iffieldundef{year}{}{\printfield{year}% - \iffieldundef{month}{}{\bibrangedash\printtext{\thefield{month}}% - \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}% - } - - \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 - \ifboolexpr{% - test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% - }% - {}%更新或修改日期通常有day信息 - {\iffieldequalstr{year}{}{%替换\iffieldundef{year},因为year总是存在,但为空 - \iffieldundef{endyear}{% - \iffieldundef{eventyear}{}{\printtext{\mkbibparens{\printtext{\printfield{eventyear}}% - \iffieldundef{eventmonth}{}{\bibrangedash\thefield{eventmonth}}% - \iffieldundef{eventday}{}{\bibrangedash\printfield{eventday}}}}% - }% - }{% - \iffieldundef{endyear}{}{\printtext{\mkbibparens{\printtext{\printfield{endyear}}% - \iffieldundef{endmonth}{}{\bibrangedash\thefield{endmonth}}% - \iffieldundef{endday}{}{\bibrangedash\printfield{endday}}}}% - }% - }% - }% - {% - \iffieldundef{year}{}{\printtext{\mkbibparens{\printtext{\printfield{year}}% - \iffieldundef{month}{}{\bibrangedash\thefield{month}}% - \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}% - }% - }% - }}% -} - -% -% 日期信息的输出格式,针对3.9>=biblatex>=3.7版本 -% -\defversion{3.7}{date}{ - \DeclareFieldFormat{urldate}{##1} - \renewbibmacro*{urldate}{% - \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 - - % - % 专利的公告日期、或报纸的日期的输出宏 - % 20160701,v1.0,新增加 - % 20180405,v1.0k,为biblatexv3.7-3.9版本,出现多出点bug做处理,Hu Zhenzhen - % - % 原理方法:加上printtext避免破坏异步标点机制 - % - \newbibmacro*{newsdate}{% - \printtext{\blx@edtfdate{}{}}% - } - - \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 - \ifboolexpr{% - test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% - }% - {}%更新或修改日期通常有day信息 - {\iffieldundef{year}{% - \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% - {\printtext{(}\printenddate\printtext{)}}% - }{\iffieldequalstr{year}{}{%因为year存在,但为空 - }{\printtext{(}\blx@edtfdate{}{}\printtext{)}}% - }% - }}% -} - -% -% 日期信息的输出格式,针对biblatex>=3.10版本 -% -\defversion{3.10}{date}{ - \DeclareFieldFormat{urldate}{##1} - \renewbibmacro*{urldate}{% - \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 - - % - % 专利的公告日期、或报纸的日期的输出宏 - % 20160701,v1.0,新增加 - % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen - % - % 原理方法:加上printtext避免破坏异步标点机制 - % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份 - % 所以无法再用选项设置的方法,印象需要用底层的命令 - % 这里可以用\blx@isodate,但用\blx@gbdate试图避免版本判断 - \newbibmacro*{newsdate}{%% - \printtext{\blx@gbdate{}{}}%%\blx@isodate{}{}% - } - - \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 - \ifboolexpr{% - test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% - }% - {}%更新或修改日期通常有day信息 - {\iffieldundef{year}{% - \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% - {\printtext{(}\printenddate\printtext{)}}% - }{\iffieldequalstr{year}{}{%因为year存在,但为空 - }{\printtext{(}\blx@gbdate{}{}\printtext{)}}% - }% - }}% -} - -% -% 关联文献的输出格式,针对3.9>=biblatex>=3.7版本 -% -% 原理方法:因为related宏中带有##了,所以无法封装到defversion中了。所以直接做判断 -% 下面这一段主要针对v3.8-3.10,因为我提问后,biblatex作者为3.11版增加了一个钩子控制relatedblock前的分隔符。 -\ifboolexpr{ -test{\iftoggle{iftleight}} -or -test{\iftoggle{iftlnine}} -}{\renewbibmacro*{related}{%standard.bbx - \ifboolexpr{ test {\iffieldundef{related}} or test {\ifrelatedloop} } - {} - {\usebibmacro{begrelated}% - \def\bbx@tempa{}% - \setcounter{bbx:relatedtotal}{0}% - \def\do##1{% - \entrydata{##1}{% - \ifrelatedloop - {} - {\stepcounter{bbx:relatedtotal}% - \gappto{\bbx@tempa}{##1,}}}}% - \docsvfield{related}% - \restorefield{related}{\bbx@tempa}% - \ifnumgreater{\value{bbx:relatedtotal}}{0} - {\listcsxadd{bbx:relatedloop}{\strfield{entrykey}}% - \iffieldundef{clonesourcekey} - {} - {\listcsxadd{bbx:relatedloop}{\strfield{clonesourcekey}}}% - \setcounter{bbx:relatedcount}{0}% - \def\do{% - \stepcounter{bbx:relatedcount}% - \ifnumgreater{\value{bbx:relatedcount}}{0}%这里从1改为0 - {\ifcsundef{relateddelim\strfield{relatedtype}} - {\printtext{\relateddelim}} - {\printtext{\csuse{relateddelim\strfield{relatedtype}}}}} - {}}% - \ifbibmacroundef{related:\strfield{relatedtype}} - {\appto{\do}{\usebibmacro{related:default}}} - {\appto{\do}{\usebibmacro*{related:\strfield{relatedtype}}}}% - \iffieldformatundef{related:\strfield{relatedtype}} - {\def\bbx@tempa{related}} - {\def\bbx@tempa{related:\strfield{relatedtype}}}% - \iffieldformatundef{relatedstring:\strfield{relatedtype}} - {\def\bbx@tempb{relatedstring:default}} - {\def\bbx@tempb{relatedstring:\strfield{relatedtype}}}% - \printtext[\bbx@tempa]{% - \usebibmacro{begrelatedloop}% - \iffieldundef{relatedstring} - {\ifboolexpr{ - test {\ifnumgreater{\value{bbx:relatedtotal}}{1}} - and - test {\ifbibxstring{\thefield{relatedtype}s}} - } - {\printtext[\bbx@tempb]{% - \bibstring[\mkrelatedstring]{\thefield{relatedtype}s}}} - {\iffieldbibstring{relatedtype} - {\printtext[\bbx@tempb]{% - \bibstring[\mkrelatedstring]{\thefield{relatedtype}}}} - {}}} - {\iffieldbibstring{relatedstring} - {\printtext[\bbx@tempb]{% - \bibstring[\mkrelatedstring]{\thefield{relatedstring}}}} - {\printfield[\bbx@tempb]{relatedstring}}}% - \docsvfield{related}% - \usebibmacro{endrelatedloop}}}% - {}% - \usebibmacro{endrelated}}} -}{} - -% -% 关联文献块前的分隔符,针对biblatex3.11 -% -% 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏 -\defversion{3.11}{related}{ -\renewcommand{\begrelateddelim}{\adddot\newline\nobreak} -} - -\iftoggle{iftlfive}{\switchversion{3.4}{date}}{}%biblatex<=3.2 -\iftoggle{iftlsix}{\switchversion{3.4}{date}}{}%3.3<=biblatex<=3.6 -\iftoggle{iftlseven}{\switchversion{3.7}{date}}{}%biblatex=3.7 -\iftoggle{iftleight}{\switchversion{3.7}{date}}{}%3.8<=biblatex<=3.9 -\iftoggle{iftlnine}{\switchversion{3.10}{date}}{}%biblatex3.10 -\iftoggle{iftlatest}{\switchversion{3.10}{date}\switchversion{3.11}{related}}{}%biblatex最新 - -% -% 调整doi+eprint+url格式 -% -% 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。 -\renewbibmacro*{doi+eprint+url}{% -% \iftoggle{bbx:doi}%把doi的位置放到url后面 -% {\printfield{doi}} -% {}% - %\newunit\newblock - \iftoggle{bbx:eprint} - {\iffieldundef{eprint}{}{\newunit\usebibmacro{eprint}}}%必须要做域判断否则容易产生多余的标点 - {}% - %\newunit\newblock - \iftoggle{bbx:url} - {\usebibmacro{url+urldate}} - {} - \newunit\newblock - \iftoggle{bbx:doi} - {\printfield{doi}} - {}} - -% -% 调整页码的格式,即chapter+pages格式 -% -\renewbibmacro*{chapter+pages}{% -\iftoggle{bbx:gbstrict}{}{% - \printfield{chapter}}% - \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出 - \setunit{\bibpagespunct}% - \printfield{pages}}% - %\newunit %这里的标点去掉 - } - -% -% 当location等出版项超过maxitem缩减后不再输出etal -% -\DeclareListFormat{location}{% - \usebibmacro{list:delim}{#1}% - #1\isdot} -\DeclareListAlias{institution}{location} -\DeclareListAlias{publisher}{location} - -% 新增一个样式用于输出连续出版物的地址,单位,时间, -% 用于periodical连续出版物的出版社和地址的处理 -% -% v1.0k,20180425,为出版信息增加字体控制命令,hzz -% %类似\newbibmacro*{publisher+location+date} -\newbibmacro*{location+institution+date}{\bibpubfont% -\iftoggle{bbx:gbpub}% -{\testCJKfirst{userd}% -\ifboolexpr{% -test {\iflistundef{location}} and test {\iflistundef{institution}}% -}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}% -{\printtext{[S.l.\space :\space s.n.\adddot]}}% -}{% -\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}% - {\printlist{location}}% -\addcolon\addspace% -\iflistundef{institution}{% -\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}% \bibstring{nopublisher}%[s.n.\adddot] -{\printlist{institution}}}% -\setunit{\addcomma\addspace}% - %\usebibmacro{date}% - \printfield{year}% - \bibrangedash% - \iffieldundef{endyear}{}{\printfield{endyear}}% - \newunit}% -{ \printlist{location}% - \iflistundef{institution}% - {\setunit*{\addcomma\space}} - {\setunit*{\addcolon\space}}% - \printlist{institution}% - \setunit*{\addcomma\space}% - \usebibmacro{date}% - \newunit}% -} -% -% 通用的出版社和地址的处理 -% -% 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。 -% 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。 -% 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理 -\renewbibmacro*{publisher+location+date}{\bibpubfont% -\iftoggle{bbx:gbpub}% -{\testCJKfirst{userd}% - \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }% - {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}% - {\iflistundef{location}{%\adddot - \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 - {\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress} - {\printlist{location}\addcolon\addspace}%%\addcolon\addspace% - \iflistundef{publisher}{% - \iffieldequalstr{note}{standard}{}% - {\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}% - {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}% - {\printlist{publisher}}}% -\setunit*{\addcomma\addspace}%\addcomma\addspace% -\usebibmacro{date}%%\newunit %去掉这个标点 -}% -{\printlist{location}% - \iflistundef{publisher} - {\setunit*{\addcomma\space}} - {\setunit*{\addcolon\space}}% - \printlist{publisher}% - \setunit*{\addcomma\space}% - \usebibmacro{date}%%\newunit - }% -} - -% -% 修改了一个institution+location+date用于manual、report、thesis等类型 -% -% 20180425,v1.0k,增加了字体控制命令,hzz -% 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉 -\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。 -{\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉 - \iflistundef{institution} - {\setunit*{\addcomma\space}} - {\setunit*{\addcolon\space}}% - \printlist{institution}% - \setunit*{\addcomma\space}% - \usebibmacro{date}% - %\newunit - }} - -% -% 对volume卷信息格式做出修改 -% v1.0o,20190105,hzz -% -\DeclareFieldFormat{volume}{% -\testCJKfirst{userd}% -\iftoggle{ifCJKforgbt}% -{\bibstring{serialcn}#1\bibstring{volumecn}}% -{\bibstring{volume}~#1}% -}% volume of a book -\DeclareFieldFormat[article,periodical]{volume}{#1}% volume of a journal - -% -% 对number册信息格式做出修改 -% v1.0o,20190105,hzz -% -\DeclareFieldFormat{number}{#1}% -\DeclareFieldFormat[book,collection,inbook,% -incollection,proceedings,inproceedings]{number}{% -\testCJKfirst{userd}% -\iftoggle{ifCJKforgbt}% -{\bibstring{serialcn}#1\bibstring{numbercn}}% -{#1}% -}% - -% -% 对edition版本信息格式做出修改 -% -\DeclareFieldFormat{edition}{\bibtitlefont%源来自biblatex.DEF -\testCJKfirst{userd}% -\iftoggle{ifCJKforgbt}% -{\ifinteger{#1}% -{\printtext{#1\str@edition}}% -{#1\isdot}}% -{\ifinteger{#1}% -{\mkbibordedition{#1}~\bibstring{edition}}% -{#1\isdot}}} - -% -% 对version的版本信息做出修改 -% -\DeclareFieldFormat{version}{\bibtitlefont%源来自biblatex.DEF -\testCJKfirst{userd}% - \ifinteger{#1}% - {\iftoggle{ifCJKforgbt}{\printtext{#1\str@edition}}% - {\mkbibordedition{#1}~\bibstring{version}}}% - {#1\isdot}} - -% -% 作者域的输出控制宏 -% -% 当两篇文献作者相同且连续时,标准样式是用-代替后面的文献的作者,这里取消这一设置 -\renewbibmacro*{author}{%author for biblatex version <=3.7 - \ifboolexpr{ - test \ifuseauthor - and - not test {\ifnameundef{author}} - } - {\usebibmacro{bbx:dashcheck} - {%\bibnamedash - \printnames{author}% - }% - {\usebibmacro{bbx:savehash}% - \printnames{author}% - \iffieldundef{authortype} - {\setunit{\addspace}} - {\setunit{\addcomma\space}}}% - \iffieldundef{authortype} - {} - {\usebibmacro{authorstrg}% - \setunit{\addspace}}}% - {\global\undef\bbx@lasthash - \usebibmacro{labeltitle}% - \setunit*{\addspace}}% - \setunit{\addcomma\space}%增加一个逗号 - \usebibmacro{date+extrayear} - } - -% -% 设置标注和文献表中作者和年份之间的分隔符 -% -% 原理方法:注意3.4版已经有\nameyeardelim,上述修改的author宏虽然定义了著录表中的标点,但标注中的未定义 -% 设置因为mergedate默认为true时的情况,来自\bbx@opt@mergedate@compact -% 去掉作者后面包围年份的圆括号 -% 这里因为biblatex版本的不同,做不同的处理,texlive2017版/2016等低版本分开处理 -\defversion{3.0}{dateextra}{ -\renewcommand*{\nameyeardelim}{\addcomma\space} - \renewbibmacro*{date+extrayear}{%%重设date+extrayear格式,源来自authoryear.BBX - \iffieldundef{\thefield{datelabelsource}year} - {} - {\printtext{%[parens]%这里把括号去掉 - \iffieldsequal{year}{\thefield{datelabelsource}year} - {\printdateextralabel}% - {\printfield{labelyear}% - \printfield{extrayear}}}}}% - \newbibmacro{date+extradate}{\usebibmacro{date+extrayear}} -} - -\defversion{3.4}{dateextra}{ - \DeclareDelimFormat{nameyeardelim}{\addcomma\space} - \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space} - \renewbibmacro*{date+extrayear}{%%重设date+extrayear格式,源来自authoryear.BBX - \iffieldundef{\thefield{datelabelsource}year} - {} - {\printtext{%[parens]%这里把括号去掉 - \iffieldsequal{year}{\thefield{datelabelsource}year} - {\printdateextralabel}% - {\printfield{labelyear}% - \printfield{extrayear}}}}}% - \newbibmacro{date+extradate}{\usebibmacro{date+extrayear}} -} -\defversion{3.7}{dateextra}{ - \DeclareDelimFormat{nameyeardelim}{\addcomma\space} - \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space} - \renewbibmacro*{date+extrayear}{%以前的\printdateextralabel宏变为了\printlabeldateextra - \iffieldundef{labelyear} - {} - {\printtext{%[parens] - \iffieldsequal{year}{labelyear} - {\printlabeldateextra}% - {\printfield{labelyear}% - \printfield{extrayear}}}}}% - -\newbibmacro{date+extradate}{\usebibmacro{date+extrayear}} -} -\defversion{3.8}{dateextra}{ - \DeclareDelimFormat{nameyeardelim}{\addcomma\space} - \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space} -%注意这里当没有作者只有标题时在年份之前的标点是否需要标准并未涉及,所以未做处理。 -\renewbibmacro*{author}{%以前的date+extrayear变为date+extradate,所以对3.8以上版本重定义一下author - \ifboolexpr{ - test \ifuseauthor - and - not test {\ifnameundef{author}} - } - {\usebibmacro{bbx:dashcheck} - {%\bibnamedash %去掉相同作者用横线代替的处理 - \printnames{author}\setunit{\printdelim{nameyeardelim}}%把标点也带上 - } - {\usebibmacro{bbx:savehash}% - \printnames{author}% - \iffieldundef{authortype} - {\setunit{\printdelim{nameyeardelim}}} - {\setunit{\printdelim{authortypedelim}}}}% - \iffieldundef{authortype} - {} - {\usebibmacro{authorstrg}% - \setunit{\printdelim{nameyeardelim}}}}% - {\global\undef\bbx@lasthash - \usebibmacro{labeltitle}% - \setunit*{\printdelim{nonameyeardelim}}}% - \usebibmacro{date+extradate}} - \renewbibmacro*{date+extradate}{% - \iffieldundef{labelyear} - {} - {\printtext{%[parens]%这里去掉括号 - \iflabeldateisdate - {\printdateextra} - {\printlabeldateextra}}}}% - -} - - -% -%为mergedate增加选项none,即实现年份不提前到作者后面的标签中 -%也不打印用于区分同作者同年份文献的标识符如(a,b,c) -%目的是实现一些特殊的文献表样式比如ucas的作者年制 -%v1.0q,20190212,hzz -\def\bbx@opt@mergedate@none{% - \renewbibmacro*{date+extradate}{% - \iffieldundef{labelyear} - {} - {}}%[parens]\printtext{\printlabeldateextra} -\renewbibmacro*{bbx:ifmergeddate}{\@secondoftwo}%这一句用于3.12版本 -\renewbibmacro*{date}{\printdate}%这一句用于biblatex3.11以下版本 -\renewbibmacro*{issue+date}{%去掉括号 -\setunit{\addcomma\addspace}% - \printtext{%去掉了[parens] - \iffieldundef{issue} - {%\usebibmacro{date} - \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 - {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 - {\usebibmacro{date}}% - }}% - {\iftoggle{bbx:gbstrict}{}{\printfield{issue}% - \setunit*{\addspace}}% - %\usebibmacro{date} - \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 - {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 - {\usebibmacro{date}}% - }}}% - %\newunit - }% - } - -\iftoggle{iftlfive}{\switchversion{3.0}{dateextra}}{}%biblatex<=3.2 -\iftoggle{iftlsix}{\switchversion{3.4}{dateextra}}{}%3.3<=biblatex<=3.6 -\iftoggle{iftlseven}{\switchversion{3.7}{dateextra}}{}%biblatex=3.7 -\iftoggle{iftleight}{\switchversion{3.8}{dateextra}}{}%<=3.8biblatex<=3.9 -\iftoggle{iftlnine}{\switchversion{3.8}{dateextra}}{}%biblatex3.10 -\iftoggle{iftlatest}{\switchversion{3.8}{dateextra}}{}%biblatex最新3.11 - -% -% 修改析出文献的文集的标题与附加标题间的符号 -% -\renewbibmacro*{booktitle}{% - \ifboolexpr{ - test {\iffieldundef{booktitle}} - and - test {\iffieldundef{booksubtitle}} - } - {} - {\printtext[booktitle]{\bibtitlefont% - \printfield[titlecase]{booktitle}% - \setunit{\subtitlepunct}% - \printfield[titlecase]{booksubtitle}}% - \newunit%标点换成下一句 - \setunit{\subtitlepunct}}% - \printfield{booktitleaddon}} - -% -% 调整期刊名的格式 -% -% 原理方法:因为作者年制年份提到前面,因此涉及到期刊名与后面的卷期的关系。 -% v1.0k,20180425,增加了字体控制命令,hzz -\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx - \usebibmacro{journal}% - %\setunit*{\addspace}% - %\setunit*{\addcomma\addspace}%修改为增加一个逗号 - \iffieldundef{series}% - {}% - {\newunit% - \printfield{series}% - \setunit{\addspace}}% - %\usebibmacro{volume+number+eid}% - %\setunit{\addspace}% - \usebibmacro{issue+date}% - %\setunit{\addcolon\space}% - \iffieldundef{volume}{}{\setunit{\addcomma\space}}% - %换成逗号和空格 - \usebibmacro{issue}% - \usebibmacro{volume+number+eid}%把卷期放到年份后面 - %\newunit - } - -% -% 增加一个number带括号的格式,避免使用mkbibparens而引入一个不必要的空格 -% -\DeclareFieldFormat{addnumflag}{% -\nobreak\printtext{(}\nobreak #1\nobreak\printtext{)}} - -% -% 调整journal输出 -% -% 原理方法:首先判断子标题,然后再设置标点。 -% 避免直接设置标点后,当volume不存在时需要使用\nopuct去标点进而引入不必要的空格 -\renewbibmacro*{journal}{% - \iffieldundef{journaltitle}% - {}% - {\printtext[journaltitle]{% - \printfield[titlecase]{journaltitle}% - \iffieldundef{journalsubtitle}{}{\setunit{\subtitlepunct}% - \printfield[titlecase]{journalsubtitle}}}}} - - - -% -% 调整期刊卷和期的格式 -% -\renewbibmacro*{volume+number+eid}{%源来自standard.bbx -\iftoggle{bbx:gbfieldstd}{% - \printfield{volume}% - \setunit*{\adddot}% - \printfield{number}% - \setunit{\addcomma\space}% - \printfield{eid}}{% - \printfield{volume}% - %\setunit*{\adddot}%去掉点号 - %\printfield{number}% - \iffieldundef{number}{}{\printfield[addnumflag]{number}}%区别于顺序编码制 - \iffieldundef{eid}{}{% - \setunit{\addcomma\space}% - \printfield{eid}}}} - -% -% 调整期刊年份的格式 -% -% 原理方法:原在authoryear.BBX中\bbx@opt@mergedate@compact中定义 -% 当issue存在时,才设置newunit。避免直接设置标点后,当volume不存在是需要使用\nopuct去标点进而引入不必要的空格 - \renewbibmacro*{issue+date}{% - \iffieldundef{issue}% - {}% - {\iftoggle{bbx:gbstrict}{}{\printtext[parens]{\printfield{issue}}\newunit}}} - - - -% -% 调整页码前的标点和去掉期刊文章等页码后面的标点 -% -\renewbibmacro*{note+pages}{%源来自standard.bbx - %\printfield{note}%不要note,note用来判断是否是报纸newspaper - \iffieldundef{pages}{}{ - \setunit{\bibpagespunct}% - \printfield{pages}}% - %\newunit - } - -% -% 编者的符号修改一下 -% v1.0 2016-07-01 -% v1.0q 2019-03-01 hzz 修改editortype前的标点 -% -\renewbibmacro*{editor}{% - \ifboolexpr{ - test \ifuseeditor - and - not test {\ifnameundef{editor}} - } - {\usebibmacro{bbx:dashcheck} - {%\bibnamedash - \printnames{editor}% - } - {\printnames{editor}% - %\setunit{\printdelim{editortypedelim}}% - %\usebibmacro{bbx:savehash} - }% - \usebibmacro{editorstrg}% - %\clearname{editor}% - \setunit{\printdelim{nameyeardelim}}}% - {\global\undef\bbx@lasthash - \usebibmacro{labeltitle}% - \setunit*{\printdelim{nonameyeardelim}}}% - \ifboolexpr{% -test {\ifentrytype{inbook}} -or -test {\ifentrytype{incollection}} -or -test {\ifentrytype{inproceedings}} -or -test {\ifentrytype{conference}} -}% -{}% -{\usebibmacro{date+extradate}}} - -% -% 编者类型做一修改 -% v1.0 2016-07-01 -% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串 -% -\renewbibmacro*{editorstrg}{%源来自biblatex.DEF - \printtext[editortype]{% - \iffieldundef{editortype} - {% -% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理 -% test {\ifnumgreater{\value{editor}}{1}} -% or -% test {\ifandothers{editor}} -% } -% {\bibstring{editors}} -% {\bibstring{editor}} - } - {\ifbibxstring{\thefield{editortype}} %定义编者类型情况下处理,以后根据需要修改 - {\ifboolexpr{ - test {\ifnumgreater{\value{editor}}{1}} - or - test {\ifandothers{editor}} - } - {\printdelim{streditortypes}} - {\printdelim{streditortype}}} - {\thefield{editortype}}}% - }} - -% -% 编者类型的本地化字符串输出 -% v1.0q 2019-03-01 hzz -% 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符 -% 能对不同文境作设置的包括排序,标签等 -% 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串 -% -\DeclareDelimFormat{streditortypes}{% - \edef\userfieldabcde{userd}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbbiblocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% - \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% - \or% - \bibstring{\thefield{editortype}scn}% - \or% - \addcomma\addthinspace\bibstring{\thefield{editortype}s}% - \fi} -% -\DeclareDelimFormat{streditortype}{% - \edef\userfieldabcde{userd}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbbiblocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% - \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% - \or% - \bibstring{\thefield{editortype}cn}% - \or% - \addcomma\addthinspace\bibstring{\thefield{editortype}}% - \fi} - - -% -% bookauthor域的输出, -% v1.0q 2019-03-01 hzz -% 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替, -% 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype -\renewbibmacro*{bybookauthor}{% - \ifnameundef{bookauthor}% - {\ifnameundef{editor}% - {}% - {\ifnamesequal{author}{editor}% - {}{\usebibmacro{editor}}}% - }% - {\ifnamesequal{author}{bookauthor}% - {}{\printnames{bookauthor}}% - }% -} - -% -% 修改期刊的标题 -% -\renewbibmacro*{periodical}{%源来自biblatex.DEF - \iffieldundef{title} - {} - {\printtext[title]{\bibtitlefont% - \printfield[titlecase]{title}% - %\setunit{\subtitlepunct}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct} - \printfield[titlecase]{subtitle}}% - %}%把编组结束移到后面去 - \iftoggle{bbx:gbtype}{% - \iffieldundef{usera}{}{%在标题后直接给出文献标识字母 - \printfield[gbtypeflag]{usera}}}{} - }} - } - -% -% 期刊的标题做修改 -% -\renewbibmacro*{title+issuetitle}{%源来自standard.BBX - \usebibmacro{periodical}% - %\setunit*{\addspace}% - \setunit*{\adddot\addspace}%标点修改为句点 - \iffieldundef{series} - {} - {\newunit - \printfield{series}% - \setunit{\addspace}}% - \usebibmacro{periodical+issue}%将issue调整到上面来,并修改 -\iffieldundef{number}{}{%%进一步处理有范围的数字 - \multinumberparser{\thefield{number}}}% - \iffieldundef{volume}% - {\printfield{year}% - \printtext{\mkbibparens{\multinumberfirst}}% - \bibrangedash% - \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}% - }% - {\multivolparser{\thefield{volume}}% - \printfield{year}% - \setunit{\addcomma\space}%将冒号修改为逗号 - \printtext{\multivolfirst}% - \printtext{\mkbibparens{\multinumberfirst}}% - \bibrangedash% - \iffieldundef{endyear}{}{% - \printfield{endyear}% - \setunit{\addcomma\space}%将冒号修改为逗号 - \printtext{\multivolsecond}% - \printtext{\mkbibparens{\multinumbersecond}}}% - }% - \setunit{\addcomma\space}% - \printfield{eid}% - \setunit{\addspace}% - %\usebibmacro{issue+date}% - %\setunit{\addcolon\space}% - \usebibmacro{issue}% - \newunit} - -% -% 新增一个样式用于调整期刊年份的格式,只打印年份 -% -\newbibmacro*{periodical+issue}{% - \printtext{%去掉了[parens] - \iffieldundef{issue} - {%\usebibmacro{date}%修改为下一句 - }% - {\printfield{issue}% - \setunit*{\addspace}% - %\usebibmacro{date}%修改为下一句 - }% - }% - %\newunit -} - -% -% 重设专利title的输出,将文献类型标识符输出出去 -% -\newbibmacro*{patenttitle}{%原输出来自biblatex.def文件 - \ifboolexpr{% - test{\iffieldundef{title}}% - and% - test{\iffieldundef{subtitle}}% - }% - {}% - {\printtext[title]{\bibtitlefont% - \printfield[titlecase]{title}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct}% - \printfield[titlecase]{subtitle}}% - \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 - {\setunit{\subtitlepunct}\printfield{titleaddon}}% - \setunit{\subtitlepunct}\printfield{number}%写专利号 - \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}% - %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 - %\newunit - }% -}% -} - - - -% -% 修改in:用于inbook、incollection、inproceedings等类型 -% 2018.04.20,v1.0k,renewed marco,by hzz -% 20190212,v1.0q,增加中英文区分,by hzz -% -% 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。 -\renewbibmacro*{in:}{% - \iftoggle{bbx:gbpunctin}{\printtext{\texttt{//}\allowbreak}}%\addthinspace - {\setunit{\adddot\addspace}% - \iffieldequalstr{userd}{chinese}% - {\printtext{\bibstring{incn}}}% - {\printtext{\bibstring{in}}}% - }}%\newunit\newblock\intitlepunct - -% -% 修改type域的输出格式 -% 2019.02.12,v1.0q,byhzz -% 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文 -\DeclareFieldFormat{type}% -{\iffieldequalstr{userd}{chinese}% - {\ifbibxstring{#1cn}{\bibxstring{#1cn}}{#1}}% - {\ifbibstring{#1}{\bibstring{#1}}{#1}}% -} - - -% -% 修改series域的输出格式 -% 2019.05.01,v1.0r,byhzz -\renewbibmacro*{series+number}{% - \printfield{series}% - %\setunit*{\addspace}% - %\printfield{number}% - %\newunit - } - -%===================================================================== -%设置驱动格式 -%===================================================================== -% -% book条目类的驱动 -% - \DeclareBibliographyDriver{book}{%源来自standard.bbx文件 - \usebibmacro{bibindex}% - \usebibmacro{begentry}% -\usebibmacro{author/editor+others/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 -\usebibmacro{maintitle+title}% -\iftoggle{bbx:gbstrict}{}{% -\newunit -\printlist{language}% -\newunit\newblock% -\usebibmacro{byauthor}% -\newunit\newblock}% -\usebibmacro{byeditor+others}% -\newunit -\printfield{edition}% -\newunit\newblock%% -\iftoggle{bbx:gbstrict}{}{% -\iffieldundef{maintitle}% -{\printfield{volume}% -\printfield{part}}% -{}% -\newunit% -\printfield{volumes}% -\newunit\newblock% -\usebibmacro{series+number}}% -\newunit\newblock% -%\printfield{note}% -%\newunit\newblock% -\usebibmacro{publisher+location+date}% -%\newunit\newblock %这里标点去掉 -\usebibmacro{chapter+pages}% - \iffieldundef{url}{}{%当没有网址时也不输出 - \usebibmacro{modifydate}}%带括号的修改或更新日期, -\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 - \newunit\newblock% - \printfield{pagetotal}% - \newunit\newblock% - \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% - \newunit\newblock - %\usebibmacro{doi+eprint+url}% - %\newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - - - - -% -% 期刊文章,连续出版物中的析出文献的格式 -% - \DeclareBibliographyDriver{article}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}% - \newunit\newblock - \usebibmacro{bytranslator+others}% - \newunit\newblock - \printfield{version}}% - \newunit\newblock - %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物 - \usebibmacro{journal+issuetitle}% -% \newunit -% \usebibmacro{byeditor+others}% -% \newunit - \usebibmacro{note+pages}% - \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期 - \iffieldundef{url}{}{%当没有网址时也不输出 - \iftoggle{bbx:url}{%当url选项为false时,也不输出 - \usebibmacro{modifydate}}{}}}%带括号的修改或更新日期, - \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置 - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{issn}} - {}% - \newunit\newblock - %\usebibmacro{doi+eprint+url}% - %\newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - - -% -% 连续出版物的驱动 -% - \DeclareBibliographyDriver{periodical}{%源来自standard.BBX - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{editor}% - %\setunit{\labelnamepunct}\newblock - \newunit\newblock %删除上面一行,添加这一行 - \usebibmacro{title+issuetitle}% - \newunit\newblock% - \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间 - \newunit\newblock%添加这一行 - \iftoggle{bbx:gbstrict}{}{% - \printlist{language}% - \newunit\newblock - \usebibmacro{byeditor}% - \newunit\newblock - \printfield{note}% - \newunit\newblock} - \iftoggle{bbx:isbn} - {\printfield{issn}} - {}% - \newunit\newblock - \usebibmacro{doi+eprint+url}% - \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - -% -% 专利文献驱动 -% - \DeclareBibliographyDriver{patent}{%源来自standard.BBX - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - %\usebibmacro{title}% - \usebibmacro{patenttitle}%给出专利专用的标题输出 - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}}% - \newunit\newblock - \printfield{type}% - \setunit*{\addspace}% - %\printfield{number}%已放到patenttitle中处理 - \iflistundef{location} - {} - {\setunit*{\addspace}% - \printtext{%[parens] - \printlist[][-\value{listtotal}]{location}}}% - \newunit\newblock - \usebibmacro{byholder}% - \newunit\newblock - \printfield{note}% - \newunit\newblock - \usebibmacro{newsdate}% - %\newunit\newblock - \usebibmacro{doi+eprint+url}% - \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - - -% -% 在线文献驱动 -% -\DeclareBibliographyDriver{online}{%源来自standard.BBX - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/editor+others/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}% - \newunit\newblock - \usebibmacro{byeditor+others}% - \newunit\newblock - \printfield{note}}% - \newunit - \printfield{version}% - \newunit\newblock -% \printlist{organization}% - \printlist{institution}% - \newunit\newblock -\ifboolexpr{% -test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% -}{\usebibmacro{date}}% -{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间 - \usebibmacro{url+urldate}%从下面移上来 - \newunit\newblock - \iftoggle{bbx:eprint} - {\usebibmacro{eprint}} - {}% - \newunit\newblock - %\usebibmacro{url+urldate}% - %\newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - - - - -% -% 报告类型驱动 -% 当有网址无出版项时,用online输出 -% -\DeclareBibliographyDriver{report}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}}% - \newunit\newblock - \usebibmacro{byeditor+others}%增加的译者信息 - \newunit\newblock - \printfield{type}% - \setunit*{\addspace}% - \printfield{number}% - \newunit\newblock - \printfield{version}% - \newunit - \printfield{note}% - \newunit\newblock - \usebibmacro{publisher+location+date}% - %\newunit\newblock - \usebibmacro{chapter+pages}% - \usebibmacro{doi+eprint+url}% - \newunit - \printfield{pagetotal}% - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{isrn}} - {}% - \newunit\newblock -% \usebibmacro{doi+eprint+url}% -% \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - -% -% 论文、手册类型驱动 -% 2016-11-11,增加了译者信息 -% -\DeclareBibliographyDriver{manual}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}}% - \newunit\newblock - \usebibmacro{byeditor+others}%增加的译者信息 - \newunit\newblock - \iftoggle{bbx:gbfieldtype}{% - \printfield{type}% - \setunit*{\addspace}% - }{}% - \printfield{number}% - \newunit\newblock - \printfield{version}% - \newunit - \printfield{note}% - \newunit\newblock - \usebibmacro{institution+location+date}% - %\newunit\newblock - \usebibmacro{chapter+pages}% - \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期 - \usebibmacro{modifydate}}%修改或更新日期为带括号的时间 - \usebibmacro{doi+eprint+url}% - \newunit - \printfield{pagetotal}% - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{isrn}} - {}% - \newunit\newblock -% \usebibmacro{doi+eprint+url}% -% \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - -% -% 备选类型驱动 -% -% 利用biblatex的misc驱动 -\DeclareBibliographyDriver{misc}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/editor+others/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% -\iftoggle{bbx:gbstrict}{}{% - \newunit - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}% - \newunit\newblock - \usebibmacro{byeditor+others}}% - \newunit\newblock - \printfield{howpublished}% - \newunit\newblock - \printfield{type}% - \newunit - \printfield{version}% - \newunit - \printfield{note}% - \newunit\newblock - \usebibmacro{institution+location+date}% - %\usebibmacro{organization+location+date}% - %\newunit\newblock - \usebibmacro{doi+eprint+url}% - \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - - - - - -% -% 专著中的析出文献的格式修改 -% -\DeclareBibliographyDriver{inbook}{%源来自standard.bbx - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 -\usebibmacro{title}% -\usebibmacro{in:}% -%\printtext{\texttt{//}\addthinspace}% - \usebibmacro{bybookauthor}% - \ifnameundef{bookauthor}{% - \ifnameundef{editor}{}{\newunit}% - }{\newunit}%替换下一句 - %\newunit\newblock -\iffieldundef{series}{}{\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加 - \usebibmacro{maintitle+booktitle}% -\iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}% -\iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息 - \newunit\newblock% -% \usebibmacro{byeditor+others}% -% \newunit\newblock - \printfield{edition}% - \newunit - \iftoggle{bbx:gbstrict}{}{% -% \iffieldundef{maintitle} -% {\printfield{volume}% -% \printfield{part}} -% {}% -% \newunit -% \printfield{volumes}% -% \newunit\newblock -% \usebibmacro{series+number} - }% - \newunit\newblock - %\printfield{note}% - %\newunit\newblock - \usebibmacro{publisher+location+date}% - %\newunit\newblock - \usebibmacro{chapter+pages}% - %\newunit\newblock - \usebibmacro{doi+eprint+url}%移到上面来 - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% - \newunit\newblock -% \usebibmacro{doi+eprint+url}% -% \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} +%% +%% --------------------------------------------------------------- +%% biblatex-gb7714-2015 --- A biblatex implementation of the +%% GBT7714-2015 bibliography style,author year sequence +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% +% +% 版本和时间信息 +% +\def\versionofgbtstyle{2021/01/19 v1.0w} +\def\versionofbiblatex{\abx@version} +\ProvidesFile{gb7714-2015ay.bbx}[\versionofgbtstyle biblatex bibliography style] +%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求 + +%===================================================================== +%加载标准样式 +%===================================================================== +\RequireBibliographyStyle{authoryear} +\RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题 + + +%===================================================================== +% 功能函数 +%===================================================================== + % + % biblatex版本判断 + % 20180405,v1.0k,为兼容biblatexv3.11增加toggle:iftlnine,HU zhenzhen + % 20181020,v1.0n,为不再使用xstring宏包做的修改,hzz + % + % 原理方法:当版本继续更新时,增加一个新的toggle用以处理新的旧版,最新版和未判断出来的版本永远用iftlatest + \providetoggle{iftlfive}\togglefalse{iftlfive} %处理biblatex3.2之前版本,时间2016-03-01前 + \providetoggle{iftlsix}\togglefalse{iftlsix} %处理biblatex3.3开始改变姓名机制后版本,时间2016-03-01及以后 + \providetoggle{iftlseven}\togglefalse{iftlseven}%处理biblatex3.7的兼容性,时间2016-12-01后 + \providetoggle{iftleight}\togglefalse{iftleight}%处理biblatex3.8到3.9的兼容性,时间2017-11-01后到2017-12-01前 + \providetoggle{iftlnine}\togglefalse{iftlnine} %处理biblatex10的兼容性,时间2017-12-01后 + \providetoggle{iftlatest}\toggletrue{iftlatest} %假设是最新版biblatex + \@ifpackagelater{biblatex}{2014/04/01}{ + \@ifpackagelater{biblatex}{2016/03/01}{ + \@ifpackagelater{biblatex}{2016/12/01}{ + \@ifpackagelater{biblatex}{2017/11/01}{ + \@ifpackagelater{biblatex}{2017/12/01}{ + \@ifpackagelater{biblatex}{2018/02/19}{} + {\toggletrue{iftlnine}\togglefalse{iftlatest}}} + {\toggletrue{iftleight}\togglefalse{iftlatest}}} + {\toggletrue{iftlseven}\togglefalse{iftlatest}}} + {\toggletrue{iftlsix}\togglefalse{iftlatest}}} + {\toggletrue{iftlfive}\togglefalse{iftlatest}}} + {\PackageError{biblatex}{Outdated 'biblatex' package} + {Please update biblatex, This is a fatal error.}} + + \newcommand\defversion[2]{\csdef{codeversion#1#2}}%定义不同版本的命令 + \newcommand\switchversion[2]{\csuse{codeversion#1#2}}%使用不同版本的命令 + + % + % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成 + % v1.0k,20180509,hzz + % + % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏 + % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8 + % 编码用xelatex编译的问题。 + % + % 原理是:利用perl正则将中文标识记录到域中, + % 然后利用\iffieldundef和\iffieldequalstr进行判断 + \providetoggle{ifCJKforgbt} + \def\testCJKfirst#1{% + \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{% + \iffieldequalstr{#1}{chinese}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}} + + % + % 2个卷的解析函数,用于连续出版物 + % + % 原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号 + \newcommand{\multivolparser}[1]{% + \IfSubStr{#1}{-}% + {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}% + {\def\multivolfirst{#1}\def\multivolsecond{}}% + } + + % + % 2个期的解析函数,用于连续出版物 + % + \newcommand{\multinumberparser}[1]{% + \IfSubStr{#1}{-}% + {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}% + {\def\multinumberfirst{#1}\def\multinumbersecond{}}% + } + + % 对没有分隔符环境命令的低版本biblatex做增补,避免报错 + % + \iftoggle{iftlfive}{ + + \def\blx@inf@delimdeclare#1#2{% + \blx@info{Delimiter '#1' in context '#2' already defined, overwriting}} + + \def\blx@warn@delimuse#1#2{% + \blx@warning{Delimiter '#1' in context '#2' undefined}} + % Delimiter interface + + % []{}{} + \newrobustcmd*{\DeclareDelimFormat}{% + \@ifstar + {\blx@declaredelimclear} + {\blx@declaredelim}} + + \newrobustcmd*{\blx@declaredelimclear}[3][]{% + \ifcsvoid{blx@declaredelimcontexts@#2} + {} + {\def\do##1{\csundef{blx@printdelim@##1@#2}}% + \dolistcsloop{blx@declaredelimcontexts@#2}}% + \cslet{blx@declaredelimcontexts@#2}\@empty + \ifblank{#1} + {\blx@declaredelim{#2}{#3}} + {\blx@declaredelim[#1]{#2}{#3}}} + + \newrobustcmd*{\blx@declaredelim}[3][]{% + \ifblank{#1} + {\blx@declaredelim@i{}{}{#2}{#3}} + {\def\do##1{% + \listcsadd{blx@declaredelimcontexts@#2}{##1}% + \blx@declaredelim@i{blx@printdelim@##1@}{##1}{#2}{#3}}% + \docsvlist{#1}}}% + + \def\blx@declaredelim@i#1#2#3#4{% + \def\do@i##1{% + \ifcsdef{#1##1} + {\blx@inf@delimdeclare{##1}{#2}} + {}% + \csdef{#1##1}{#4}}% + \forcsvlist{\do@i}{#3}} + + % *[]{}{} + \newrobustcmd*{\DeclareDelimAlias}{% + \@ifstar + {\blx@declaredelimalias} + {\blx@declaredelimaliasauto}} + + \newrobustcmd*{\blx@declaredelimalias}[3][]{% + \ifblank{#1} + {\blx@declaredelimalias@i{}{#2}{#3}} + {\def\do##1{% + \blx@declaredelimalias@i{blx@printdelim@##1@}{#2}{#3}}% + \docsvlist{#1}}} + + \newrobustcmd*{\blx@declaredelimaliasauto}[2]{% + \blx@declaredelimalias@i{}{#1}{#2}% + \ifcsvoid{blx@declaredelimcontexts@#2} + {} + {\def\do##1{% + \blx@declaredelimalias@i{blx@printdelim@##1@}{#1}{#2}}% + \dolistcsloop{blx@declaredelimcontexts@#2}}} + + \def\blx@declaredelimalias@i#1#2#3{% + \ifcsdef{#1#2} + {\blx@inf@delimdeclare{#2}{#1}} + {}% + \csdef{#1#2}{\csuse{#1#3}}} + + \def\blx@delimcontext{none} + \newcommand*{\printdelim}[2][]{% + \ifblank{#1} + {\ifcsdef{blx@printdelim@\blx@delimcontext @#2} + {\csuse{blx@printdelim@\blx@delimcontext @#2}} + {\ifcsdef{#2}% fall back on legacy macros + {\csuse{#2}} + {\blx@warn@delimuse{#2}{*}}}} + {\ifcsdef{blx@printdelim@#1@#2} + {\csuse{blx@printdelim@#1@#2}} + {\blx@warn@delimuse{#2}{#1}}}} + + \newcommand*{\delimcontext}[1]{% + \edef\blx@delimcontext{\blx@delimcontextalias{#1}}} + + \def\blx@delimcontextalias#1{% + \ifcsdef{blx@delimcontextalias@#1} + {\csuse{blx@delimcontextalias@#1}} + {#1}} + + \newcommand*{\DeclareDelimcontextAlias}[2]{% + \csgdef{blx@delimcontextalias@#1}{#2}} + }{} + + +%===================================================================== +% 数据模型定义 +%===================================================================== + %定义类型和载体标识,从gb内容看载体基本属于介质。 + %为与lee zeping的bst的样式统一,使用mark和medium这两域名 + %为单个条目的姓名格式控制增加nameformat和namefmtid两个域 + %为缩略信息文献表增加了shortbooktitle域 + %为多语言排序增加了lansortorder域 + \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat} + \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid} + \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle} + \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder} + + %因为biblatex更新3.14版本以后,biber对于为声明数据模型的条目类型 + %不再默认读取,而是以空字符串作为条目类型名,自然在条目定义alias时 + %就会出现问题,因此显式的声明一下newspaper,然后保留后面采用alias的方式 + %而standard类型则是采用另一种方式直接在sourcemap中转换为其它类型。 + \@ifpackagelater{biblatex}{2019/11/30}{%2019/12/01 v3.14 + \DeclareDatamodelEntrytypes{newspaper}% + }{} + +%===================================================================== +% 设置宏包选项 +%===================================================================== + % + % 增加一个控制是否输出文献载体的选项 + % 20191125,v1,0s,hzz + \newtoggle{bbx:gbmedium} + \DeclareBibliographyOption{gbmedium}[true]{%biblatex低版本 + \settoggle{bbx:gbmedium}{#1}} + \ExecuteBibliographyOptions{gbmedium} + + % + % 增加一个控制是否输出annotation域的选项,该域可以用于在文献条目后面输出一些注释信息 + % 20190509,v1,0s,hzz + \newtoggle{bbx:gbannote} + \DeclareBibliographyOption{gbannote}[false]{%biblatex低版本 + \settoggle{bbx:gbannote}{#1}} + \ExecuteBibliographyOptions{gbannote} + % + %用于在文献条目后面输出注释信息的宏 + %FieldFormat{annotation}用于设置注释信息的格式 + \DeclareFieldFormat{annotation}{% + \printtext{\addspace(#1)}% + } + \renewbibmacro*{annotation}{% + \iftoggle{bbx:gbannote}% + {\iffieldundef{annotation}% + {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}% + {\printfield{annotation}}}% + {}% + } + + + % + % 增加一个控制是否输出type域的选项 + % 20190212,v1,0q,hzz + \newtoggle{bbx:gbfieldtype} + \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本 + \settoggle{bbx:gbfieldtype}{#1}} + \ExecuteBibliographyOptions{gbfieldtype} + + % + % 增加一个控制是否根据页码重设脚注数字标号的选项 + % 20190422,v1,0r,hzz + \newtoggle{bbx:gbfnperpage} + \DeclareBibliographyOption{gbfnperpage}[false]{% + \settoggle{bbx:gbfnperpage}{#1}} + \ExecuteBibliographyOptions{gbfnperpage} + + % + % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表 + % 20190203,v1.0p,hzz + % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签 + % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式 + % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题 + \DeclareBibliographyOption{gbfootbib}[false]{% + \ifstrequal{#1}{false}{}{\execgbfootbib}} + \ExecuteBibliographyOptions{gbfootbib} + + %% + \newlength{\footbibmargin} + \newlength{\footbiblabelsep} + \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离 + \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距 + \def\execgbfootbib% + {% + %开启引用跟踪计数器,为使用\ifciteseen等测试命令 + \ExecuteBibliographyOptions{citetracker=true} + % + %利用footmisc宏包来实现脚注文献的悬挂对齐 + \AtEndPreamble{ + \@ifclassloaded{beamer}{}{ + %beamer类因为其特殊性,为避免冲突不调footmisc。 + %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接 + %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。 + %\PassOptionsToPackage{perpage,hang}{footmisc}% + %\RequirePackage{footmisc}% + + %重新实现脚注的根据单页重设脚注号码 + %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改 + %v1.0q 20190317 hzz + %v1.0r 20190422 hzz 根据gbfnperpage选项设置 + \iftoggle{bbx:gbfnperpage}% + {\@addtoreset{footnote}{page}}{}%重设计数器 + +\@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义 + \long\def\H@@footnotetext##1{\insert\footins{% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \leftskip \footbibmargin%增加的左侧缩进 + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% + }% + \color@endgroup}}% + \long\def\H@@mpfootnotetext##1{% + \global\setbox\@mpfootins\vbox{% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \leftskip \footbibmargin%增加的左侧缩进 + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \color@endgroup}} + }{%否则对latex核心代码中的\@footnotetext做重定义 + \long\def\@footnotetext##1{\insert\footins{% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \leftskip \footbibmargin%增加的左侧缩进 + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% + }% + \color@endgroup}}% + + \long\def\@mpfootnotetext##1{% + \global\setbox\@mpfootins\vbox{% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \leftskip \footbibmargin%增加的左侧缩进 + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \color@endgroup}} + } + + \long\def\@makefntext##1{%增加了脚注标记与正文的间隔 + \parindent 1em\noindent \hb@xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1} + + } + + % + %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式 + \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}} + %做patch使得脚注内容中的脚注数字标签不上标 + \pretocmd{\@makefntext}{% + \def\@makefnmark{% + \hbox{\textcircled{\tiny\@thefnmark}}% + }% + }{}{} + } + + % + %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容) + %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。 + %v1.0q 20190309 区分使脚注标注适应minipage中的情况 + \newbibmacro*{citesavefn}{% + \ifciteseen%当被引用过为true + {\ifcsdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%当已经定义过脚注序号信息 + {\csgdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% + \str@sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}% + \@makefnmark% + }}% + {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% + \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% + }}% + }% + {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% + \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% + %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断 + }}% + } + + % + %重定义\footfullcite使完成gb7714-2015的脚注文献要求 + \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% + {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 + \defcounter{minnames}{\blx@minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。 + \usebibmacro{prenote}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {}{\setunit{\addcolon\addspace}\printtext{\thefield{postnote}}}}%由于ay样式中没有修改postnote域,此处因为格式需要不使用默认域格式 + }% + {\usebibmacro{citesavefn}% + \ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}% + {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}\nopunct}% + {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}% + }% + {\multicitedelim}% + {\usebibmacro{postnote}} + + } + + % + % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式 + % 20180814,v1.0m,hzz + % 原理方法: + % 只为兼容性考虑不做任何处理 + \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本 + } + + % + % 增加一个控制是否输出文献类型和载体标识的选项 + % + % 原理方法: + % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的 + % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本 + \newtoggle{bbx:gbtype} + %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本 + \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本 + \settoggle{bbx:gbtype}{#1}} + \ExecuteBibliographyOptions{gbtype} + + % + % 增加一个源文件编码选择选项,当true时可以使用GBK编码。 + % v1.0k, 2018.05.08, by hzz + % + % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档 + % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def + % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用 + % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。 + % 另外注意: + % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码 + % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常 + % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。 + \newtoggle{bbx:codegbk} + \DeclareBibliographyOption{gbcodegbk}[false]{% + \settoggle{bbx:codegbk}{#1}} + \ExecuteBibliographyOptions{gbcodegbk} + + \def\str@bibliography{参考文献} + \def\str@references{参考文献} + \def\str@bytranslator{译} + \def\str@andotherscn{等} + \def\str@andcn{和} + \def\str@backrefpage{引用页} + \def\str@backrefpages{引用页} + \def\str@noaddress{出版地不详} + \def\str@nopublisher{出版者不详} + \def\str@edition{版} + \def\str@volumecn{卷} + \def\str@numbercn{册} + \def\str@serialcn{第} + \def\str@sameentry{同} + \def\str@incn{见} + \def\str@mathesiscn{硕士学位论文} + \def\str@phdthesiscn{博士学位论文} + \def\str@editorcn{主编} + + \AtEndOfPackage{% + \iftoggle{bbx:codegbk}{% + \ExecuteBibliographyOptions{texencoding = GBK} + \input{gb7714-2015-gbk.def} + }{}} + + % + % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项 + % v1.0k, 2018.05.08, by hzz + % + % 原理方法: + % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息 + % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式 + % 可能需要用于中英文判断的language域的信息。 + \newtoggle{bbx:gbstrict} + \DeclareBibliographyOption{gbstrict}[true]{% + \settoggle{bbx:gbstrict}{#1}} + \ExecuteBibliographyOptions{gbstrict} + + % + % 增加一个控制标题域超链接设置的选项 + % v1.0k, 2018.05.24, by hzz + % + % 原理方法: + % 利用标题域格式来实现,默认设置该选项为false,不做超链接。 + % 设置为true,则标题设置超链接 + \newtoggle{bbx:titlelink} + \DeclareBibliographyOption{gbtitlelink}[false]{% + \settoggle{bbx:titlelink}{#1}} + \ExecuteBibliographyOptions{gbtitlelink} + + % + % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项 + % v1.0l, 2018.07.02, by hzz + % + % 原理方法: + % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置 + \newtoggle{bbx:ctexset} + \DeclareBibliographyOption{gbctexset}[true]{% + \settoggle{bbx:ctexset}{#1}} + \ExecuteBibliographyOptions{gbctexset} + + \AtEndOfPackage{% + \iftoggle{bbx:ctexset}{% + \def\blx@defbibstrings#1#2{% + \def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}% + \abx@dostrings + \csuse{abx@strings@#1}% + \setkeys{blx@lbx}{#2}% + \let\do\blx@defbibstrings@i + \csxdef{abx@strings@#1}{\abx@dostrings}% + } + }{}} + + % + %增加一个处理佚名或noauthor的控制选项 + \DeclareBibliographyOption{gbnoauthor}[true]{% + \ifstrequal{#1}{false}{}{\dealnoathor}} + %\ExecuteBibliographyOptions{gbnoauthor=true}%对于需要展开较早(展开层级优先)的选项,这一执行无效,只能用宏包加载时给出的选项。 + + + % + % 增加一个恢复域格式为标准样式的控制选项 + % v1.0k, 2018.05.15, by hzz + % + % 原理方法: + % 默认设置该选项为false,采用国标要求的域格式输出相关域 + % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域 + \newtoggle{bbx:gbfieldstd} + \DeclareBibliographyOption{gbfieldstd}[false]{% + \settoggle{bbx:gbfieldstd}{#1}% + \ifstrequal{#1}{false}{}{\execgbfdfmtstd}% + } + \ExecuteBibliographyOptions{gbfieldstd} + + % + % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。 + % + \newtoggle{bbx:gbpub} + \DeclareBibliographyOption{gbpub}[true]{% + %\settoggle{bbx:gbpub}{#1} %或采用下面这一句 + \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}} + \ExecuteBibliographyOptions{gbpub} + + % + % 增加控制析出文献来源前的标点符号//输出的选项 + % v1.0k, 2018.04.20,added in by hzz + \newtoggle{bbx:gbpunctin} + \DeclareBibliographyOption{gbpunctin}[true]{% + \settoggle{bbx:gbpunctin}{#1}} + \ExecuteBibliographyOptions{gbpunctin} + + + % 选项设置 + % + \ExecuteBibliographyOptions{ + useprefix = true, %名字的信息包括前缀 + date = year, %日期仅写到年 + maxbibnames=3, %将文献列表和引用中最大名字数量区分开 + minbibnames=3, + maxitems = 1,%设置列表最大数量 + minitems = 1, %设置缩减后的列表最小数量 + isbn=false, + sorting=gb7714-2015, + sortlocale=zh__pinyin,%zh__big5han,%zh__stroke,%zh__gb2312han,%zh__pinyin, + } + + % + %为日期相关选项增加选项值gb7714-2015 + % + \csdef{mkdaterangegb7714-2015}#1{% + \begingroup + \blx@metadateinfo{#1}% + \iffieldundef{#1year} + {} + {\printtext[#1date]{% + \blx@gbdate{#1}{}}}% + \endgroup} + + \newrobustcmd*{\blx@gbdate}[3][]{% + \dateeraprintpre{#2#3year}% + \blx@imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}% + \iffieldundef{#2#3month}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3month}}}% + \iffieldundef{#2#3day}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3day}}}} + + %为姓名格式选择增加的计数器 + \newcounter{gbnamefmtcase} + \def\thegbnamefmtcase{\the\c@gbnamefmtcase} + %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令 + \newcounter{gbcitelocalcase} + \newcounter{gbbiblocalcase} + \def\thegbcitelocalcase{\the\c@gbcitelocalcase} + \def\thegbbiblocalcase{\the\c@gbbiblocalcase} + + +\@ifpackagelater{biblatex}{2016/03/27} + { % 针对biblatex>=3.3版本的选项设置 + + % 增加不同语言排序的切换选项 + % gblanorder=chineseahead的顺序为cn,jp,kr,en,fr,ru + % gblanorder=englishahead的顺序为en,fr,ru,cn,jp,kr + % gblanorder=cn;en;ru;fr;jp;kr的顺序为指定的cn;en;ru;fr;jp;kr,自定义内容可以随意写以分号分隔 + % v1.0q,20190307,hzz + % + \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{% + \ifstrequal{#1}{chineseahead}%%中文在前的顺序 + {\gdef\lancnorder{1}\gdef\lanjporder{2}\gdef\lankrorder{3}% + \gdef\lanenorder{4}\gdef\lanfrorder{5}\gdef\lanruorder{6}}% + {% + \ifstrequal{#1}{englishahead}% + {\execlanodeah\dealsortlan}% + {\execlanodudf{#1}\dealsortlan}% + }% + } + \ExecuteBibliographyOptions{gblanorder} + + \def\execlanodeah{%中文在后的顺序 + \gdef\lancnorder{4} + \gdef\lanjporder{5} + \gdef\lankrorder{6} + \gdef\lanenorder{1} + \gdef\lanfrorder{2} + \gdef\lanruorder{3}} + + \newcounter{lanordernum} + \newcommand{\execlanodudf}[1]{%like:cn;en;ru;fr;jp;kr + \setcounter{lanordernum}{0} + \DeclareListParser{\parsinglanorder}{;} + \renewcommand*{\do}[1]{\stepcounter{lanordernum}\csxdef{lan##1order}{\thelanordernum}} + \parsinglanorder{#1} + } + + % 增加本地化字符串的中英文切换选项 + % gbcitelocal指标注中的本地化字符串 + % gbbiblocal 指文献表中的本地化字符串 + % gblocal 指设置文献表和标注中的本地化字符串 + % v1.0o,20190103,hzz + % + \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{% + \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}% + \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}% + \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}% + } + \ExecuteBibliographyOptions{gbcitelocal} + + \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{% + \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}% + \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}% + \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}% + } + \ExecuteBibliographyOptions{gbbiblocal} + + \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{% + \ExecuteBibliographyOptions{gbbiblocal=#1}% + \ExecuteBibliographyOptions{gbcitelocal=#1}% + } + %\ExecuteBibliographyOptions{gblocal} %默认值已经通过两个相关选项设置 + + + % + % 增加序号标签格式处理选项,作者年制不做处理,给出只为兼容选项考虑 + % v1.0l,20180623,hzz + % + \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{} + + % + % 增加姓名大小写格式处理选项 + % + \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{% + \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}% + \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}% + \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family + \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{}%family-given + \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}% + \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family + } + \ExecuteBibliographyOptions{gbnamefmt} + + % + % 增加标签对齐选项 + % + %因为在作者年制中,不需要使用,这里也增加,为了与顺序编码制的兼容性考虑。 + \DeclareBibliographyOption[string]{gbalign}[right]{}% + + + + + } + { + % 增加不同语言排序的切换选项 + % biblatex 3.4及以下版本不能使用多个stylesourcemap,所以不使用该选项 + % 这里给出仅为兼容性考虑 + % v1.0q,20190307,hzz + % + \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{} + + % + % 增加序号标签格式处理选项,作者年制不做处理,给出只为兼容选项考虑 + % v1.0l,20180623,hzz + % + \DeclareBibliographyOption{gbbiblabel}[bracket]{} + + % + % 增加姓名大小写格式处理选项 + % + \DeclareBibliographyOption{gbnamefmt}[uppercase]{% + \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}% + \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}% + \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family + \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{} + \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given + \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family + } + \ExecuteBibliographyOptions{gbnamefmt} + + % + % 增加标签对齐选项 + % + %因为在作者年制中,不需要使用,这里也增加,为了与顺序年制的兼容性考虑。 + \DeclareBibliographyOption{gbalign}[right]{}% + + } + + +% +% 针对biblatex<3.3版本的选项设置,比如texlive2015中的3.0版 +% +\defversion{3.0}{opt}{ + \ExecuteBibliographyOptions{ + firstinits = true, %名字有缩写,参考3.1.2.3 Internal + } +} +% +% 针对3.3<=biblatex<3.5版本的选项设置,比如texlive2016中的3.4版 +% +\defversion{3.4}{opt}{ + \ExecuteBibliographyOptions{ + giveninits = true, + } +} +% +% 针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版 +% +\defversion{3.7}{opt}{ + \ExecuteBibliographyOptions{ + giveninits = true, + urldate =edtf, + eventdate =edtf, + } +} +% +% 针对3.10<=biblatex版本的选项设置,比如texlive2018中的3.11版 +% +\defversion{3.10}{opt}{ + \ExecuteBibliographyOptions{ + giveninits = true, + urldate =gb7714-2015,%iso + eventdate =gb7714-2015,%iso + } +} + +% +% 针对3.13<=biblatex版本的选项设置,因为内容有限,所以不再增加版本区分,而用时间直接判断 +% +% 解决国标中“王临慧, 2010a.”和“王临慧, 等, 2010b.”的问题 +% 在没有这个选项之前无法加上a和b +% v1.0s,20190828 +\@ifpackagelater{biblatex}{2019/08/16}{% + \ExecuteBibliographyOptions{% + nohashothers=true}}{} + +% +% 根据biblatex版本信息,选择选项设置 +% +% 原理方法:如下这种选择机制能自动兼容更新的版本,但对于老版本 +% 必须要把情况列全。 +\iftoggle{iftlfive}{\switchversion{3.0}{opt}}{}%biblatex<=3.2 +\iftoggle{iftlsix}{\switchversion{3.4}{opt}}{}%3.3<=biblatex<=3.6 +\iftoggle{iftlseven}{\switchversion{3.7}{opt}}{}%biblatex=3.7 +\iftoggle{iftleight}{\switchversion{3.7}{opt}}{}%3.8<=biblatex<=3.9 +\iftoggle{iftlnine}{\switchversion{3.10}{opt}}{}%biblatex=3.10 +\iftoggle{iftlatest}{\switchversion{3.10}{opt}}{}%biblatex最新3.11 + + +%===================================================================== +%设置本地化字符串 +%===================================================================== + % + % 新建当地化字符串,用来记录“等”字符、“和”字符 + % + \NewBibliographyString{andotherscn} + \NewBibliographyString{andothersincitecn} + \NewBibliographyString{andothersincite} + \NewBibliographyString{andcn} + \NewBibliographyString{andothersjp} + \NewBibliographyString{andotherskr} + \NewBibliographyString{andjp} + \NewBibliographyString{andkr} + \NewBibliographyString{andincitecn} + \NewBibliographyString{andincite} + \NewBibliographyString{volumecn} + \NewBibliographyString{numbercn} + \NewBibliographyString{serialcn} + \NewBibliographyString{incn} + \NewBibliographyString{mathesiscn} + \NewBibliographyString{phdthesiscn} + \NewBibliographyString{editorcn} + \NewBibliographyString{editorscn} + + % + % 修改一些当地化字符串 + % + % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件 + % 当然也可以增加比如上面定义的andotherscn + % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别 + \DefineBibliographyStrings{english}{ + bibliography = {\str@bibliography}, + references = {\str@references}, + bytranslator= {\str@bytranslator\adddot}, %将trans. by 改成 译 + and = {\addcomma},%将第2和3人名见的and符号改成 逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 + andcn = {\addcomma},%\str@andcn\ and本地化字符串的中文对应词 + andincitecn = {\str@andcn},%将标注中的分开,便于与文献表中的区分 + andincite = {\addcomma}, + %andothers = {et al.}, %将超过3个人名的省略,et al.改成为 等 + andotherscn = {\str@andotherscn},%将超过3个人名的省略,et al.改成为 等 + andothersincitecn={\str@andotherscn},%将标注中的分开,便于与文献表中的区分 + andothersincite={et al\adddot}, + backrefpage = {\str@backrefpage:}, + backrefpages = {\str@backrefpages:}, + in={in\intitlepunct}, + volumecn={\str@volumecn}, + numbercn={\str@numbercn}, + serialcn={\str@serialcn}, + andothersjp={他}, + andotherskr={외}, + andjp={和}, + andkr={和}, + incn={\str@incn\addcolon\addspace}, + mathesiscn={\str@mathesiscn}, + phdthesiscn={\str@phdthesiscn}, + editorscn={\str@editorcn}, + editorcn={\str@editorcn}, + } + + % + % 增加两个命令用于临时的局部的修改本地化字符串 + % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串 + % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内 + % v1.0t,hzz,20190525 + \newcommand{\setlocalbibstring}[2]{% + \csdef{abx@sstr@#1}{#2}} + \newcommand{\setlocalbiblstring}[2]{% + \csdef{abx@lstr@#1}{#2}} + +%===================================================================== +% 动态数据修改 +%===================================================================== +% +% 各层次的数据映射和动态修改 +% +% 原理方法: +% 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中 +% 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性 +% 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个 +% 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次 +% 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。 +% 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符, +% 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息 +% +% 不同的文献类型使用相同的驱动输出可以有5种方法: +% 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型 +% 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型 +% 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型 +% 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名 +% 驱动别名定义本质上是做了驱动层映射 +% 5. 直接定义不同的类型的驱动,但驱动内容相同。 +% +% 关于数据映射和驱动使用的考虑如下: +% 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换 +% 2. 为减少代码量,尽量少做内容相同的不同类型驱动 +% 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名 +% 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type +% 可以在样式层映射做某些需要避免这种默认处置的转换 +% 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射 +% +% 文献类型和驱动考虑如下: +% 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article +% newpaper映射为article,并以note域做区分特殊处理 +% 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook +% standard映射为book或inbook,并以note域做区分特殊处理 +% collection和proceedings基本与book类似,因此做book驱动别名处理 +% incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理 +% 3. 专利类型有其特殊性,考虑patent类型 +% 4. 电子资源类型有其特殊性,考虑online类型 +% 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更新日期 +% 因此考虑用一种类型来输出,使用report类型 +% 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略, +% 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型 +% 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时, +% 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。 +% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述 +% 更多的信息,因此不存在网址时,独立做一个备选格式 +% 9. 出版项主要以如下方式处理: +% (a) location+institution+date 仅用于连续出版物 +% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report +% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型 +% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。 +% (e) 不输出,主要用于连续出版物析出的文献 +% 10. 日期以如下方式处理: +% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year +% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate +% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date +% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate + +\DeclareSourcemap{ +\maps[datatype=bibtex]{% + \map{%当没有作者时将editor转成author + \pernottype{inbook}%因为in系列中editor可能用来表示bookauthor,所以排除 + \pernottype{inproceedings} + \pernottype{incollection} + \pernottype{periodical}%因为peridical直接使用editor,所以排除 + %注意notfield在低版本biblatex中没有 + %\step[notfield=author,final]%当author不存在,将editor复制给author + \step[fieldsource=editor,fieldtarget=author]%并删除editor + } + \map{%当没有作者时将translator转成author + \pernottype{inbook} + \pernottype{inproceedings} + \pernottype{incollection} + %\step[notfield=author,final]%当author不存在,将translator复制给author + \step[fieldsource=translator,fieldtarget=author]%并删除translator + } + \map{%让address和location同步,biblatex中address是location的别名 + %因此输出的时候只有location信息,但处理过程中是可以存在address的。 + %\step[notfield=address,final] + \step[fieldsource=location,final] + \step[fieldset=address,origfieldval] + } + \map{%让address和location同步 + %\step[notfield=location,final] + \step[fieldsource=address,final] + \step[fieldset=location,origfieldval] + } + \map{%处理在bib文件用mark标记文献类型标识符的情况 + \step[fieldsource=mark,final] + \step[fieldset=usera, origfieldval] + } + \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况 + \step[fieldsource=nameformat,match=lowercase,final] + \step[fieldset=namefmtid,fieldvalue={1}] + } + \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况 + \step[fieldsource=nameformat,match=givenahead,final] + \step[fieldset=namefmtid,fieldvalue={2}] + } + \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况 + \step[fieldsource=nameformat,match=familyahead,final] + \step[fieldset=namefmtid,fieldvalue={3}] + } + \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况 + \step[fieldsource=nameformat,match=pinyin,final] + \step[fieldset=namefmtid,fieldvalue={4}] + } + \map{%根据article确定文献类型标识符 + \pertype{article} + \step[fieldset=usera, fieldvalue={J}] + } + \map{%根据periodical确定文献类型标识符 + \pertype{periodical} + \step[fieldset=usera, fieldvalue={J}] + \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor + \step[fieldset=editor, origfieldval] + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符 + \pertype{newspaper} + \step[fieldset=usera, fieldvalue={N}] + \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断 + } + \map{%对应增加的一个数据库类型database确定文献类型标识符 + \pertype{database} + \step[fieldset=usera, fieldvalue={DB}] + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%对应增加的一个数据集类型dataset确定文献类型标识符 + \pertype{dataset} + \step[fieldset=usera, fieldvalue={DS}]% + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%对应增加的一个软件类型software确定文献类型标识符 + \pertype{software} + \step[fieldset=usera, fieldvalue={CP}] + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%对应增加的一个舆图类型map确定文献类型标识符 + \pertype{map} + \step[fieldset=usera, fieldvalue={CM}]% + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%对应增加的一个档案类型archive确定文献类型标识符 + \pertype{archive} + \step[fieldset=usera, fieldvalue={A}] + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以 + %当misc类型带有网址时,直接将其转换为online类型 + \pertype{misc} + \step[fieldsource=url,final] + \step[typesource=misc,typetarget=online] + } + \map{%对应增加的一个备选类型misc确定文献类型标识符 + \pertype{misc} + \step[fieldset=usera, fieldvalue={Z}]% + } + \map{ + \pertype{book} + \pertype{inbook} + \step[fieldset=usera, fieldvalue={M}] + \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition + \step[fieldset=edition, origfieldval] + } + \map{%兼容老的standard类型,确定文献类型标识符 + \pertype{standard} + \step[fieldset=usera, fieldvalue={S}] + \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断 + } + \map{ + \pertype{patent} + \step[fieldset=usera, fieldvalue={P}] + } + \map{ + \pertype{inproceedings} + \pertype{conference}%兼容老的conference类型 + \step[fieldset=usera, fieldvalue={C}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{proceedings} + \step[fieldset=usera, fieldvalue={C}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{incollection} + \step[fieldset=usera, fieldvalue={G}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{collection} + \step[fieldset=usera, fieldvalue={G}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{report} + \pertype{techreport}%兼容老的techreport类型 + \step[fieldset=usera, fieldvalue={R}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{thesis} + \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型 + \pertype{phdthesis} + \step[fieldset=usera, fieldvalue={D}] + \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{ + \pertype{online} + \pertype{electronic}%兼容老的electronic类型 + \pertype{www}%兼容老的www类型 + \step[fieldset=usera, fieldvalue={EB}] + \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册 + \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 + \step[fieldset=institution, origfieldval] + } + \map{ + \pertype{manual} + \step[fieldset=usera, fieldvalue={A}] + \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version + \step[fieldset=version, origfieldval] + \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 + \step[fieldset=institution, origfieldval] + } + \map{ + \pertype{unpublished} + \step[fieldset=usera, fieldvalue={Z}] + } + \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 + \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] + }% + \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 + \step[fieldsource={editor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] + }% + \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 + \step[fieldsource={translator}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] + }% + \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 + \step[fieldsource={bookauthor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] + }% + \map{%处理一些用year表示date的情况 + %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。 + %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息 + \step[fieldsource=year] + \step[fieldset=date, origfieldval] + } + \map{%将entrykey放入keywords中用于后期使用 + \step[fieldsource=entrykey] + \step[fieldset=keywords, origfieldval] + } + \map{\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userd,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userd,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userd,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userd,fieldvalue={korean}]%韩语 + } + \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题 + \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]% + \step[fieldset=userd, fieldvalue={chinese}] + } + \map{%将没有设置userd,且存在title域的默认设置为英文 + \step[fieldsource=title,final] + \step[fieldset=userd,fieldvalue={english}] + } + \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userf,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=author,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userf,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=author,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userf,fieldvalue={korean}]%韩语 + } + \map{%作者的中文判断 + \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] + \step[fieldset=userf, fieldvalue={chinese}] + } + \map{%将没有设置userf,且存在author域的默认设置为英文 + \step[fieldsource=author,final] + \step[fieldset=userf,fieldvalue={english}] + } + \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=usere,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=translator,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=usere,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=translator,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=usere,fieldvalue={korean}]%韩语 + } + \map{%译者的中文判断 + \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] + \step[fieldset=usere, fieldvalue={chinese}] + } + \map{%将没有设置usere,且存在translator域的默认设置为英文 + \step[fieldsource=translator,final] + \step[fieldset=usere,fieldvalue={english}] + } + \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userc,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userc,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userc,fieldvalue={korean}]%韩语 + } + \map{%编者的中文判断 + \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 + \step[fieldset=userc, fieldvalue={chinese}] + } + \map{%将没有设置userc,且存在editor域的默认设置为英文 + \step[fieldsource=editor,final] + \step[fieldset=userc,fieldvalue={english}] + } + \map{\step[fieldsource=bookauthor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userb,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=bookauthor,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userb,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=bookauthor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userb,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=bookauthor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userb,fieldvalue={korean}]%韩语 + } + \map{%编者的中文判断 + \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 + \step[fieldset=userb, fieldvalue={chinese}] + } + \map{%将没有设置userc,且存在editor域的默认设置为英文 + \step[fieldsource=bookauthor,final] + \step[fieldset=userb,fieldvalue={english}] + } + \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language + \step[fieldset=language,origfieldval]%本身language存在则不设定 + } + \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language + \step[fieldset=language,origfieldval] + }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。 + \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。 + \step[fieldset=language,fieldvalue={english}] + } + \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断, + %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况, + %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd + \step[fieldsource=language] + \step[fieldset=userd,origfieldval] + } + \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言 + %biblatex 3.11及以下版本仅有match是区分大小写的,而3.12版开始用matchi来区分大小,而match不区分 + %这里为兼容3.11及以下版本,所以用一个复杂一点的正则表达式 + \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final] + \step[fieldset=langid,fieldvalue={english}] + \step[fieldset=lansortorder,fieldvalue=\lanenorder] + } + \map{ + \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final] + \step[fieldset=langid,fieldvalue={russian}] + \step[fieldset=lansortorder,fieldvalue=\lanruorder] + } + \map{% + \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final] + \step[fieldset=langid,fieldvalue={french}] + \step[fieldset=lansortorder,fieldvalue=\lanfrorder] + } + \map{% + \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + \step[fieldset=lansortorder,fieldvalue=\lancnorder] + } + \map{% + \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + \step[fieldset=lansortorder,fieldvalue=\lanjporder] + } + \map{% + \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + \step[fieldset=lansortorder,fieldvalue=\lankrorder] + } + \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook, + %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 + %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断 + \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook + \step[typesource=standard, typetarget=inbook, final] + } + \map{%剩下的全部映射为book + \step[typesource=standard, typetarget=book, final] + } +% \map{%先于标准样式的driver层映射,以取消type设置 +% \step[typesource=mastersthesis, typetarget=thesis, final] +% %\step[fieldset=type, fieldvalue=mathesis] +% } +% \map{%先于标准样式的driver层映射,以取消type设置 +% \step[typesource=phdthesis, typetarget=thesis, final] +% %\step[fieldset=type, fieldvalue=phdthesis] +% } + \map{%先于标准样式的driver层映射,以取消type设置 + \step[typesource=techreport, typetarget=report, final] + %\step[fieldset=type, fieldvalue=techreport] + } + \map{% + \pertype{report} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=report,typetarget=online] + \step[fieldset=note,fieldvalue={report}] + } + \map{% + \pertype{thesis} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=thesis,typetarget=online] + } + \map{% + \pertype{manual} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=manual,typetarget=online] + } + \map{% + \pertype{unpublished} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=unpublished,typetarget=online] + } + \map{% + \pertype{database} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=databasetypetarget=online] + } + \map{% + \pertype{dataset} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=dataset,typetarget=online] + } + \map{% + \pertype{software} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=software,typetarget=online] + } + \map{% + \pertype{map} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=map,typetarget=online] + } + \map{% + \pertype{archive} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=archive,typetarget=online] + } + \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确) + \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 + \step[fieldset=keywords, fieldvalue={,}, append] + \step[fieldset=keywords, origfieldval, append] + } + \map[overwrite]{%title,booktitle,journaltitle,journal,publisher,address,location,institution,organization + \step[fieldsource={title}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={booktitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={journaltitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={journal}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={publisher}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={address}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={location}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={institution}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + \map[overwrite]{ + \step[fieldsource={booktitle}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] + } + \map[overwrite]{ + \step[fieldsource={booktitle}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] + } + %对于高版本(3.4以上)可以用下面这一段取代前面那一段,为了兼容gbnoauthor选项,这些代码只能在sourcemap中使用,所以只能选择前面那一段 + %\map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ +% \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] +% } +% \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ +% \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] +% } +% \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,% +% address,location,institution,organization}]{ +% \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] +% } + } +} + +% +% 佚名/noauthor的处理 +% +% 原理方法:利用样式层的动态数据修改实现 +\def\dealnoathor{ + \DeclareStyleSourcemap{ + \maps[datatype=bibtex]{ + \map{%默认情况下将空缺作者的中文文献设置为佚名 + \step[fieldsource=language,match={chinese},final] + \step[fieldset=author, fieldvalue={佚名}] + } + \map{%默认情况下将空缺作者的英文文献设置为A{non} + \step[fieldsource=language,match={english},final] + \step[fieldset=author, fieldvalue={A{non}}]%noauthor换成Anon,同时为避免大写还加了{} + } + } + } +} + +% +% 不同语言分集调整的实现方式 +% +% 原理方法:利用样式层的动态数据修改lansortorder域来实现排序 +\def\dealsortlan{ + \DeclareStyleSourcemap{ + \maps[datatype=bibtex]{ + \map[overwrite]{%当文献给出language域时,设置文献要使用的本地化字符串的语言 + \step[fieldsource=language,match=english,final] + \step[fieldset=lansortorder,fieldvalue=\lanenorder] + } + \map[overwrite]{ + \step[fieldsource=language,match=russian,final] + \step[fieldset=lansortorder,fieldvalue=\lanruorder] + } + \map[overwrite]{% + \step[fieldsource=language,match=french,final] + \step[fieldset=lansortorder,fieldvalue=\lanfrorder] + } + \map[overwrite]{% + \step[fieldsource=language,match=chinese,final]%中日韩语目前都用english, + \step[fieldset=lansortorder,fieldvalue=\lancnorder] + } + \map[overwrite]{% + \step[fieldsource=language,match=japanese,final]%中日韩语目前都用english, + \step[fieldset=lansortorder,fieldvalue=\lanjporder] + } + \map[overwrite]{% + \step[fieldsource=language,match=korean,final]%中日韩语目前都用english, + \step[fieldset=lansortorder,fieldvalue=\lankrorder] + } + } + } +} + + +% +%驱动别名等价于驱动层映射 +% +\DeclareBibliographyAlias{newspaper}{article}% +\DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动 +\DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动 +\DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动 +\DeclareBibliographyAlias{collection}{book}%%文集类型驱动 +\DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动 +\DeclareBibliographyAlias{thesis}{manual}%学位论文驱动 +\DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动 +\DeclareBibliographyAlias{database}{manual} +\DeclareBibliographyAlias{dataset}{manual} +\DeclareBibliographyAlias{software}{manual} +\DeclareBibliographyAlias{map}{manual} +\DeclareBibliographyAlias{archive}{manual} + +%===================================================================== +% 设置排序格式 +%===================================================================== +% +% 排序格式,用降序,及userb域,针对biblatex3.7及以下版本 +% +\defversion{3.7}{sort}{%这是3.4版的,3.7版略有差异,但不大,后面有注释 + \DeclareSortingScheme{gb7714-2015}{ + \sort{ + \field{presort} + } + %\sort[final]{ + %\field{sortkey} + %} + \sort{ + \field{lansortorder}%language + } + \sort{ + \field{sortkey} + } + \sort{%[direction=descending] + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sortyear} + \field{year} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} + \literal{0000}%3.7版是\literal{0} + } + } + + %降序的nyt + \DeclareSortingScheme{gbnytd}{ + \sort{ + \field{presort} + } + %\sort[final]{ + %\field{sortkey} + %} + \sort{ + \field{lansortorder}%language + } + \sort[direction=descending]{ + \field{sortkey} + } + \sort[direction=descending]{ + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sortyear} + \field{year} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} + \literal{0000}%3.7版是\literal{0} + } + } + + %降序的ynt + \DeclareSortingScheme{gbyntd}{ + \sort{ + \field{presort} + } + %\sort[final]{ + %\field{sortkey} + %} + \sort{ + \field{lansortorder}%language + } + \sort[direction=descending]{ + \field{sortyear} + \field{year} + } + \sort{ + \field{sortkey} + } + \sort{ + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} + \literal{0000}%3.7版是\literal{0} + } + } + + %升序的ynt + \DeclareSortingScheme{gbynta}{ + \sort{ + \field{presort} + } + %\sort[final]{ + %\field{sortkey} + %} + \sort{ + \field{lansortorder}%language + } + \sort{ + \field{sortyear} + \field{year} + } + \sort{ + \field{sortkey} + } + \sort{ + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} + \literal{0000}%3.7版是\literal{0} + } + } +} + + +% +% 排序格式,用降序,及userb域,针对biblatex3.8及以上版本 +% +\defversion{3.8}{sort}{ + \DeclareSortingTemplate{gb7714-2015}{ + \sort{ + \field{presort} + } + %\sort[final]{ + %\field{sortkey} + %} + \sort{ + \field{lansortorder}%language + } + \sort{ + \field{sortkey} + } + \sort{%[direction=descending] + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sortyear} + \field{year} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field{volume} + \literal{0} + } + } + + %降序的nyt + \DeclareSortingTemplate{gbnytd}{ + \sort{ + \field{presort} + } +% \sort[final]{ +% \field{sortkey} +% } + \sort{ + \field{lansortorder}%language + } + \sort[direction=descending]{ + \field{sortkey} + } + \sort[direction=descending]{% + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sortyear} + \field{year} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field{volume} + \literal{0} + } + } + + %降序的ynt + \DeclareSortingTemplate{gbyntd}{ + \sort{ + \field{presort} + } +% \sort[final]{ +% \field{sortkey} +% } + \sort{ + \field{lansortorder}%language + } + \sort[direction=descending]{ + \field{sortyear} + \field{year} + } + \sort{ + \field{sortkey} + } + \sort{% + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field{volume} + \literal{0} + } + } + + %升序的ynt + \DeclareSortingTemplate{gbynta}{ + \sort{ + \field{presort} + } +% \sort[final]{ +% \field{sortkey} +% } + \sort{ + \field{lansortorder}%language + } + \sort{%[direction=ascending] + \field{sortyear} + \field{year} + } + \sort{ + \field{sortkey} + } + \sort{% + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field{volume} + \literal{0} + } + } + + % + % 定义命令\defdoublelangentry,用于biblatex>v3.8版利用related实现双语文献的处理 + % + %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了, + %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息 + %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中 + \newcommand{\defdoublelangentry}[2]{% + \edef\entrykeya{##1} + \edef\entrykeyb{##2} + \DeclareStyleSourcemap{ + \maps[datatype=bibtex]{ + \map{ + \step[fieldsource=entrykey, match=\entrykeya, final] + \step[fieldset=related, fieldvalue=\entrykeyb] + } + } + } + } +} + + +\ifboolexpr{ +test {\iftoggle{iftlfive}} +or +test {\iftoggle{iftlsix}} +or +test {\iftoggle{iftlseven}}%biblatex<=3.7 +}{\switchversion{3.7}{sort}}{\switchversion{3.8}{sort}}%3.8<=biblatex + + +%===================================================================== +%参考文献表环境 +%===================================================================== + +% +% 列表格式 +% +% 增加一个\bibitemindent尺寸用于控制list环境的itemindent +% v1.0l,20180615,hzz +\setlength{\bibhang}{1em} +\newlength{\bibitemindent} +\setlength{\bibitemindent}{-\bibhang} +\setlength{\bibitemsep}{4.5pt} + \defbibenvironment{bibliography} + {\list + {} + {\setlength{\leftmargin}{\bibhang}% + \setlength{\itemindent}{\bibitemindent}% + \setlength{\itemsep}{\bibitemsep}% + \setlength{\parsep}{\bibparsep}}} + {\endlist} + {\item} + + +%===================================================================== +% 设置单元或块等的标点 +%===================================================================== +\renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin +\renewcommand*{\subtitlepunct}{\addcolon\space} %修改标题和其它标题信息间的标点%来源biblatex.def +% +% 利用set实现的多语言文献不同语言间的分隔符 +% 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进 +% +% 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets +% 这里调整一下两种语言参考文献的间隔,源来自biblatex.def +\renewcommand*{\entrysetpunct}{\adddot\par\nobreak}%ay样式用par也可以,因为没有悬挂对齐问题 +\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号 +%\renewcommand{\relateddelim}{}%\par + +%===================================================================== +% 修改域的格式,重定义域的输出宏 +%===================================================================== +% +% 新增文献类型标识符的格式 +% []前的nobreak,从GB4.1节的例子看不应该加,所以去掉 +% 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上 +% 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉 +% +\DeclareFieldFormat{gbtypeflag}{% +\iftoggle{bbx:gbmedium}% +{\iftoggle{bbx:url}% + {\iffieldundef{url}%当存在url时,增加一个OL标识符 + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% + }% + {\ifentrytype{online}% + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% + }}% + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% +} + +% +% 新增用于报纸的文献类型标识符的格式 +% +\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper +\iftoggle{bbx:gbmedium}% +{\iftoggle{bbx:url}% + {\iffieldundef{url}%当存在url时,增加一个OL标识符 + {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% + {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% + }% + {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% +}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}% +} + +% +% 新增用于标准的文献类型标识符的格式 +% +\DeclareFieldFormat{gbtypeflags}{%用于标准standard +\iftoggle{bbx:gbmedium}% +{\iftoggle{bbx:url}% + {\iffieldundef{url}%当存在url时,增加一个OL标识符 + {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% + {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% + }% + {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% +}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}% +} + +% +% 重设title等参考文献信息的输出格式 +% +% 原理方法:修改来自biblatex.def文件的原格式 +\newcommand{\bibtitlefont}{} +\newcommand{\bibauthorfont}{} +\newcommand{\bibpubfont}{} +\DeclareFieldFormat{title}{#1\adddot\addthinspace} +\DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot,用于缩写名带点情况,将其转换为缩写点,便于标点的追踪 +\DeclareFieldFormat{issuetitle}{#1} +\DeclareFieldFormat{maintitle}{#1} +\DeclareFieldFormat{booktitle}{#1} +\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 + [article,patent,thesis,unpublished] + {title}{#1\adddot\addthinspace} +\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 + [inbook,incollection,inproceedings] + {title}{#1}%\nopunct\unspace +\DeclareFieldFormat{url}{\url{#1}} %url域修改如本行%url相关输出,源来自biblatex.def +\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily +%\urlstyle{rm} %使用这句也一样 +\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行 +\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行 +\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行 +\DeclareFieldFormat{doi}{% + \rmfamily{DOI}\addcolon\space + \ifhyperref + {\href{https://doi.org/#1}{\nolinkurl{#1}}} + {\nolinkurl{#1}}} +% +% 标题的字母大小写格式修改 +% +% 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase +% 因为titlecase is applied to the contents of the field directly,title is not +%\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写 +\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{% +\iffieldundef{url}{\MakeCapital#1}{% +\href{\thefield{url}}{#1}}}{\MakeCapital#1}}%重设标题格式,将其修改为首字母大写 +\DeclareFieldFormat{pages}{#1}%页码引用格式的修改%去掉前面引导页码的pp.等字符 +\DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}} +\DefineBibliographyExtras{russian}{\renewcommand*{\bibrangedash}{-}} + +\def\execgbfdfmtstd{%恢复到标准样式的设置 +\DeclareFieldFormat{title}{\mkbibemph{##1}} +\DeclareFieldFormat + [article,inbook,incollection,inproceedings,patent,thesis,unpublished] + {title}{\mkbibquote{##1\isdot}} +\DeclareFieldFormat + [suppbook,suppcollection,suppperiodical] + {title}{##1} +\DeclareFieldFormat{journaltitle}{\mkbibemph{##1}} +\DeclareFieldFormat{issuetitle}{\mkbibemph{##1}} +\DeclareFieldFormat{maintitle}{\mkbibemph{##1}} +\DeclareFieldFormat{booktitle}{\mkbibemph{##1}} +\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{##1}} +\DeclareFieldFormat{titlecase}{##1} +\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{##1}} +} + +% +% 文献标题后的标点问题 +% v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen +% +% 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况: +% texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于 +% 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响 +% 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct +\ifboolexpr{% + test{\iftoggle{iftlfive}} + or + test{\iftoggle{iftlsix}} + }{}% + {%texlive 2017对应iftlseven以上版本 + \@ifclassloaded{beamer}{ + \DeclareFieldFormat{title}{#1}% + \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1} + \AtBeginDocument{% + \patchcmd{\abx@macro@title}{\newunitpunct}{}{}{}}}{} + } + + +% +% 修改译者位置格式 +% +% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式 +\renewbibmacro*{bytranslator+others}{\bibauthorfont% + \ifnameundef{translator} + {} + {%\usebibmacro{bytranslator+othersstrg} + %\setunit{\addspace}% + \printnames[bytranslator]{translator}% + \clearname{translator}% + %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理 + %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串 + \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。 + %\setunit{\addspace}% + \newunit}% + \usebibmacro{withothers}} + + + +% +% 修改作者数量超过限定值,做省略时的处理格式 +% v1.0,20160701,hzz +% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim +% +% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。 +% \printnames由start-stop控制项数,默认是1和maxnames/minnames +\renewbibmacro*{name:andothers}{\bibauthorfont% + \ifboolexpr{ + test {\ifnumequal{\value{listcount}}{\value{liststop}}} + and + test \ifmorenames + }{\ifnumgreater{\value{liststop}}{1}%注意这里试图去区分姓名总数大于1的情况,当姓名总数大于1时,最后一个姓名后面先加入一个\finalandcomma + {\finalandcomma}%目前国标没有这样的区分要求,如果有需要也是可以这么去做的。 + {}% +\printdelim{andothersdelim}\printdelim{strandothersdelim}% +}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如: +%袁训来, 陈哲, 肖书海, 等. +%胡泳, 范海燕, 译. +%潘惠霞, 魏婧, 杨艳, 等译. +\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理 +}} + +% 修改省略作者后的本地化字符串,比如et al. +% v1.0o,20190103,hzz +% +% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。 +% 非默认情况,根据选项信息,选择选择强制中文或英文 +% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 +% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 +\DeclareDelimFormat{strandothersdelim}{% + \edef\userfieldabcde{userd}%这里使用\iffieldequalstr{labelnamesource}替代ifcurrentname因为标注中使用ifcurrentname无效 + \iffieldequalstr{labelnamesource}{translator}{\edef\userfieldabcde{usere}}{}% + \iffieldequalstr{labelnamesource}{editor}{\edef\userfieldabcde{userc}}{}% + \iffieldequalstr{labelnamesource}{author}{\edef\userfieldabcde{userf}}{}% + \iffieldequalstr{labelnamesource}{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbcitelocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\ifbibstring{andothersincitecn}{\bibstring{andothersincitecn}}{\bibstring{andothers}}}{}%中文已经通过english本地化字符串定义 + \iffieldequalstr{\userfieldabcde}{korean}{\ifbibstring{andotherskr}{\bibstring{andotherskr}}{\bibstring{andothers}}}{}%韩语未定义,所以与bib中一致 + \iffieldequalstr{\userfieldabcde}{japanese}{\ifbibstring{andothersjp}{\bibstring{andothersjp}}{\bibstring{andothers}}}{}%日与同韩语 + \iffieldequalstr{\userfieldabcde}{english}{\ifbibstring{andothersincite}{\bibstring{andothersincite}}{\bibstring{andothers}}}{}%英语已定义 + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%法语未定义,若要定义需要针对french本地化字符串定义 + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%俄语未定义,若要定义需要针对russian本地化字符串定义 + \or% + \bibstring{andothersincitecn}% + \or% + \bibstring{andothersincite}% + \fi} + + +\DeclareDelimFormat[bib,biblist]{strandothersdelim}{% + \edef\userfieldabcde{userd}% + \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}% + \or% + \bibstring{andotherscn}% + \or% + \bibstring{andothers}% + \fi} + + +% +% 修改最后一个作者前的字符串,比如 and +% v1.0o,20190103,hzz +% +% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。 +% 非默认情况,根据选项信息,选择选择强制中文或英文 +% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 +% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 +\DeclareDelimFormat{finalnamedelim}{% + \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% +% \addspace% + \edef\userfieldabcde{userd}% + \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbcitelocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\space\bibstring{andincite}\space}{}% + \iffieldequalstr{\userfieldabcde}{french}{\space\bibstring{and}\space}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\space\bibstring{and}\space}{}% +%\space% + \or% + \bibstring{andincitecn}%\space% + \or% +\space\bibstring{andincite}\space% + \fi} + +\DeclareDelimFormat[bib,biblist]{finalnamedelim}{% + \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% + \addspace% + \edef\userfieldabcde{userd}% + \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% +\space% + \or% + \bibstring{andcn}\space% + \or% + \bibstring{and}\space% + \fi} + + + +% +% 重设title的输出 +% +% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen +% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件 +% 利用toggle做标识符是否输出的判断 +\renewbibmacro*{title}{% + \ifboolexpr{% + test{\iffieldundef{title}}% + and + test{\iffieldundef{subtitle}}% + }% + {}% + {\printtext[title]{\bibtitlefont%增加字体控制命令 + \printfield[titlecase]{title}% + \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 + {}{\setunit{\subtitlepunct}% + \printfield[titlecase]{subtitle}}% + \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 + {\setunit{\subtitlepunct}\printfield{titleaddon}}% + \iftoggle{bbx:gbtype}{% + \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 + {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 + {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 + {\printfield[gbtypeflag]{usera}}}%其它 + }}{}% + %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 + %\newunit + }% +}} + + +% +% 作者信息的输出格式 +% +% 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen +% 20180603,v1.0l,增加使用nameformat域来选择姓名格式 +\DeclareNameFormat{namefmtselected}{% +\iffieldundef{namefmtid}{}% +{\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}% +\ifcase\value{gbnamefmtcase}% + \ifgiveninits + {\usebibmacro{name:gbuppercase} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:gbuppercase} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% +\or + \ifgiveninits + {\usebibmacro{name:gblowercase} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:gblowercase} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% +\or + \ifgiveninits + {\usebibmacro{name:given-family} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:given-family} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% +\or + \ifgiveninits + {\usebibmacro{name:family-given} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:family-given} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% +\or +\usebibmacro{name:gbpinyin} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}% +\or + \ifnumequal{\value{listcount}}{1} + {\ifgiveninits + {\usebibmacro{name:family-given} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:family-given} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% + \ifboolexpe{% + test {\ifdefvoid\namepartgiven} + and + test {\ifdefvoid\namepartprefix}} + {} + {\usebibmacro{name:revsdelim}}} + {\ifgiveninits + {\usebibmacro{name:given-family} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:given-family} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}}% +\fi + \usebibmacro{name:andothers}} + +\DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式 +\DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family +\DeclareNameAlias{citename}{default}% Default used by \citename + +\DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace} +%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% + +%GB/T 7714-2015 风格,全部大写 +\newbibmacro*{name:gbuppercase}[4]{\bibauthorfont% +\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 +\renewcommand*{\revsdnamepunct}{}% + \ifuseprefix% + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifdefvoid{#3}{}{% + \ifcapital% + {\mkbibnameprefix{\MakeCapital{#3}}\isdot}% + {\mkbibnameprefix{#3}\isdot}% + \ifprefchar{}{\bibnamedelimc}}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% + \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital + \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% + \ifboolexpe{% + test {\ifdefvoid{#2}} + and + test {\ifdefvoid{#3}}} + {}{\revsdnamepunct}% + \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital + \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% + \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% +} + +%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 +\newbibmacro*{name:gblowercase}[4]{\bibauthorfont% + \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 + \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def + \ifuseprefix + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifdefvoid{#3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{#3}}\isdot} + {\mkbibnameprefix{#3}\isdot}% + \ifprefchar{}{\bibnamedelimc}}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% + \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital + \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}} + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% + \ifboolexpe{% + test {\ifdefvoid{#2}} + and + test {\ifdefvoid{#3}}} + {}{\revsdnamepunct}% + \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital + \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} + \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% +} + +%中文常见风格,汉语拼音全拼模式 +\newbibmacro*{name:gbpinyin}[4]{\bibauthorfont% +\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY +\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def +\renewrobustcmd*{\bibnamedelima}{\mbox{-}}% + \ifuseprefix + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifdefvoid{#3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{#3}}\isdot} + {\mkbibnameprefix{#3}\isdot}% + \ifprefchar{}{\bibnamedelimc}}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% + \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamegiven{#2}}\isdot}%\MakeCapital + \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}} + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% + \ifboolexpe{% + test {\ifdefvoid{#2}} + and + test {\ifdefvoid{#3}}} + {} + {\revsdnamepunct}% + \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital + \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} + \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% +} + + +\@ifpackagelater{biblatex}{2016/03/27}%biblatex<3.2版的情况 + {}{ + %GB/T 7714-2015 风格,全部大写 + \renewbibmacro*{name:gbuppercase}[4]{\bibauthorfont% + \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 + \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def + \ifuseprefix + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifblank{#3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{#3}}\isdot} + {\mkbibnameprefix{#3}\isdot}% + \ifpunctmark{'}{}{\bibnamedelimc}}% + %\mkbibnamelast{#1}\isdot + \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase + %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开 + %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{} + %\mkbibnamelast{\MakeUppercase{#1}}\isdot + %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 + \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% + \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}} + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}} + \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase + %\mkbibnamelast{\MakeUppercase{#1}}\isdot + %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 + \ifblank{#2#3}{}{\revsdnamepunct}% + \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% + \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% + \addcomma\addspace% + \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}% + }% + } + + %GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 + \renewbibmacro*{name:gblowercase}[4]{\bibauthorfont% + \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 + \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def + \ifuseprefix + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifblank{#3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{#3}}\isdot} + {\mkbibnameprefix{#3}\isdot}% + \ifpunctmark{'}{}{\bibnamedelimc}}% + \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase + \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}% + \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}} + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase + \ifblank{#2#3}{}{\revsdnamepunct}% + \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}% + \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% + \addcomma\addspace% + \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}% + }% + } + + %中文常见风格,汉语拼音全拼模式 + \renewbibmacro*{name:gbpinyin}[4]{\bibauthorfont% + \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 + \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def + \renewrobustcmd*{\bibnamedelima}{\mbox{-}}% + \ifuseprefix + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifblank{#3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{#3}}\isdot} + {\mkbibnameprefix{#3}\isdot}% + \ifpunctmark{'}{}{\bibnamedelimc}}% + \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase + \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamefirst{#2}}\isdot}% + \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}} + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase + \ifblank{#2#3}{}{\revsdnamepunct}% + \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% + \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% + \addcomma\addspace% + \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}% + }% + } + + %%biblatex<3.2版的情况,姓名的处理格式带参数 + \DeclareNameFormat{namefmtselected}{% + \iffieldundef{namefmtid}{}% + {\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}% + \ifcase\value{gbnamefmtcase}% + \iffirstinits + {\usebibmacro{name:gbuppercase}{#1}{#4}{#5}{#7}} + {\usebibmacro{name:gbuppercase}{#1}{#3}{#5}{#7}}% + \or + \iffirstinits + {\usebibmacro{name:gblowercase}{#1}{#4}{#5}{#7}} + {\usebibmacro{name:gblowercase}{#1}{#3}{#5}{#7}}% + \or + \iffirstinits + {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}} + {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}% + \ifblank{#3#5} + {} + {\usebibmacro{name:revsdelim}}% + \or + \iffirstinits + {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}} + {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}% + \or + \usebibmacro{name:gbpinyin}{#1}{#3}{#5}{#7}% + \or + \ifnumequal{\value{listcount}}{1} + {\iffirstinits + {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}} + {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}% + \ifblank{#3#5} + {} + {\usebibmacro{name:revsdelim}}} + {\iffirstinits + {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}} + {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}}% + \fi + \usebibmacro{name:andothers}} +} + +% +% url和url日期格式 +% +\renewbibmacro*{url+urldate}{% + %\usebibmacro{url}%%更换url的位置,放到下面 + \iffieldundef{urlyear}% + {}{%\setunit*{\addspace}% + \usebibmacro{urldate}}% + \setunit{\addperiod\addspace}% + \usebibmacro{url}} +\renewbibmacro*{url}{\printfield{url}} + +% +% 日期信息的输出格式,针对biblatex<3.7版本 +% +\defversion{3.4}{date}{ + \renewbibmacro*{urldate}{% + \addthinspace\printtext{[}\printfield{urlyear}% + \iffieldundef{urlmonth}{}{\bibrangedash\printfield{urlmonth}}% + \iffieldundef{urlday}{}{\bibrangedash\printfield{urlday}}\printtext{]}} + + \newbibmacro*{newsdate}{%%新增加一个公告日期,公开日期或新闻日期 + \iffieldundef{year}{}{\printfield{year}% + \iffieldundef{month}{}{\bibrangedash\printtext{\thefield{month}}% + \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}% + } + + \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 + \ifboolexpr{% + test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% + }% + {}%更新或修改日期通常有day信息 + {\iffieldequalstr{year}{}{%替换\iffieldundef{year},因为year总是存在,但为空 + \iffieldundef{endyear}{% + \iffieldundef{eventyear}{}{\printtext{\mkbibparens{\printtext{\printfield{eventyear}}% + \iffieldundef{eventmonth}{}{\bibrangedash\thefield{eventmonth}}% + \iffieldundef{eventday}{}{\bibrangedash\printfield{eventday}}}}% + }% + }{% + \iffieldundef{endyear}{}{\printtext{\mkbibparens{\printtext{\printfield{endyear}}% + \iffieldundef{endmonth}{}{\bibrangedash\thefield{endmonth}}% + \iffieldundef{endday}{}{\bibrangedash\printfield{endday}}}}% + }% + }% + }% + {% + \iffieldundef{year}{}{\printtext{\mkbibparens{\printtext{\printfield{year}}% + \iffieldundef{month}{}{\bibrangedash\thefield{month}}% + \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}% + }% + }% + }}% +} + +% +% 日期信息的输出格式,针对3.9>=biblatex>=3.7版本 +% +\defversion{3.7}{date}{ + \DeclareFieldFormat{urldate}{##1} + \renewbibmacro*{urldate}{% + \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 + + % + % 专利的公告日期、或报纸的日期的输出宏 + % 20160701,v1.0,新增加 + % 20180405,v1.0k,为biblatexv3.7-3.9版本,出现多出点bug做处理,Hu Zhenzhen + % + % 原理方法:加上printtext避免破坏异步标点机制 + % + \newbibmacro*{newsdate}{% + \printtext{\blx@edtfdate{}{}}% + } + + \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 + \ifboolexpr{% + test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% + }% + {}%更新或修改日期通常有day信息 + {\iffieldundef{year}{% + \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% + {\printtext{(}\printenddate\printtext{)}}% + }{\iffieldequalstr{year}{}{%因为year存在,但为空 + }{\printtext{(}\blx@edtfdate{}{}\printtext{)}}% + }% + }}% +} + +% +% 日期信息的输出格式,针对biblatex>=3.10版本 +% +\defversion{3.10}{date}{ + \DeclareFieldFormat{urldate}{##1} + \renewbibmacro*{urldate}{% + \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 + + % + % 专利的公告日期、或报纸的日期的输出宏 + % 20160701,v1.0,新增加 + % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen + % + % 原理方法:加上printtext避免破坏异步标点机制 + % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份 + % 所以无法再用选项设置的方法,印象需要用底层的命令 + % 这里可以用\blx@isodate,但用\blx@gbdate试图避免版本判断 + \newbibmacro*{newsdate}{%% + \printtext{\blx@gbdate{}{}}%%\blx@isodate{}{}% + } + + \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 + \ifboolexpr{% + test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% + }% + {}%更新或修改日期通常有day信息 + {\iffieldundef{year}{% + \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% + {\printtext{(}\printenddate\printtext{)}}% + }{\iffieldequalstr{year}{}{%因为year存在,但为空 + }{\printtext{(}\blx@gbdate{}{}\printtext{)}}% + }% + }}% +} + +% +% 关联文献的输出格式,针对3.9>=biblatex>=3.7版本 +% +% 原理方法:因为related宏中带有##了,所以无法封装到defversion中了。所以直接做判断 +% 下面这一段主要针对v3.8-3.10,因为我提问后,biblatex作者为3.11版增加了一个钩子控制relatedblock前的分隔符。 +\ifboolexpr{ +test{\iftoggle{iftleight}} +or +test{\iftoggle{iftlnine}} +}{\renewbibmacro*{related}{%standard.bbx + \ifboolexpr{ test {\iffieldundef{related}} or test {\ifrelatedloop} } + {} + {\usebibmacro{begrelated}% + \def\bbx@tempa{}% + \setcounter{bbx:relatedtotal}{0}% + \def\do##1{% + \entrydata{##1}{% + \ifrelatedloop + {} + {\stepcounter{bbx:relatedtotal}% + \gappto{\bbx@tempa}{##1,}}}}% + \docsvfield{related}% + \restorefield{related}{\bbx@tempa}% + \ifnumgreater{\value{bbx:relatedtotal}}{0} + {\listcsxadd{bbx:relatedloop}{\strfield{entrykey}}% + \iffieldundef{clonesourcekey} + {} + {\listcsxadd{bbx:relatedloop}{\strfield{clonesourcekey}}}% + \setcounter{bbx:relatedcount}{0}% + \def\do{% + \stepcounter{bbx:relatedcount}% + \ifnumgreater{\value{bbx:relatedcount}}{0}%这里从1改为0 + {\ifcsundef{relateddelim\strfield{relatedtype}} + {\printtext{\relateddelim}} + {\printtext{\csuse{relateddelim\strfield{relatedtype}}}}} + {}}% + \ifbibmacroundef{related:\strfield{relatedtype}} + {\appto{\do}{\usebibmacro{related:default}}} + {\appto{\do}{\usebibmacro*{related:\strfield{relatedtype}}}}% + \iffieldformatundef{related:\strfield{relatedtype}} + {\def\bbx@tempa{related}} + {\def\bbx@tempa{related:\strfield{relatedtype}}}% + \iffieldformatundef{relatedstring:\strfield{relatedtype}} + {\def\bbx@tempb{relatedstring:default}} + {\def\bbx@tempb{relatedstring:\strfield{relatedtype}}}% + \printtext[\bbx@tempa]{% + \usebibmacro{begrelatedloop}% + \iffieldundef{relatedstring} + {\ifboolexpr{ + test {\ifnumgreater{\value{bbx:relatedtotal}}{1}} + and + test {\ifbibxstring{\thefield{relatedtype}s}} + } + {\printtext[\bbx@tempb]{% + \bibstring[\mkrelatedstring]{\thefield{relatedtype}s}}} + {\iffieldbibstring{relatedtype} + {\printtext[\bbx@tempb]{% + \bibstring[\mkrelatedstring]{\thefield{relatedtype}}}} + {}}} + {\iffieldbibstring{relatedstring} + {\printtext[\bbx@tempb]{% + \bibstring[\mkrelatedstring]{\thefield{relatedstring}}}} + {\printfield[\bbx@tempb]{relatedstring}}}% + \docsvfield{related}% + \usebibmacro{endrelatedloop}}}% + {}% + \usebibmacro{endrelated}}} +}{} + +% +% 关联文献块前的分隔符,针对biblatex3.11 +% +% 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏 +\defversion{3.11}{related}{ +\renewcommand{\begrelateddelim}{\adddot\newline\nobreak} +} + +\iftoggle{iftlfive}{\switchversion{3.4}{date}}{}%biblatex<=3.2 +\iftoggle{iftlsix}{\switchversion{3.4}{date}}{}%3.3<=biblatex<=3.6 +\iftoggle{iftlseven}{\switchversion{3.7}{date}}{}%biblatex=3.7 +\iftoggle{iftleight}{\switchversion{3.7}{date}}{}%3.8<=biblatex<=3.9 +\iftoggle{iftlnine}{\switchversion{3.10}{date}}{}%biblatex3.10 +\iftoggle{iftlatest}{\switchversion{3.10}{date}\switchversion{3.11}{related}}{}%biblatex最新 + +% +% 调整doi+eprint+url格式 +% +% 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。 +\renewbibmacro*{doi+eprint+url}{% +% \iftoggle{bbx:doi}%把doi的位置放到url后面 +% {\printfield{doi}} +% {}% + %\newunit\newblock + \iftoggle{bbx:eprint} + {\iffieldundef{eprint}{}{\newunit\usebibmacro{eprint}}}%必须要做域判断否则容易产生多余的标点 + {}% + %\newunit\newblock + \iftoggle{bbx:url} + {\usebibmacro{url+urldate}} + {} + \newunit\newblock + \iftoggle{bbx:doi} + {\printfield{doi}} + {}} + +% +% 调整页码的格式,即chapter+pages格式 +% +\renewbibmacro*{chapter+pages}{% +\iftoggle{bbx:gbstrict}{}{% + \printfield{chapter}}% + \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出 + \setunit{\bibpagespunct}% + \printfield{pages}}% + %\newunit %这里的标点去掉 + } + +% +% 当location等出版项超过maxitem缩减后不再输出etal +% +\DeclareListFormat{location}{% + \usebibmacro{list:delim}{#1}% + #1\isdot} +\DeclareListAlias{institution}{location} +\DeclareListAlias{publisher}{location} + +% 新增一个样式用于输出连续出版物的地址,单位,时间, +% 用于periodical连续出版物的出版社和地址的处理 +% +% v1.0k,20180425,为出版信息增加字体控制命令,hzz +% %类似\newbibmacro*{publisher+location+date} +\newbibmacro*{location+institution+date}{\bibpubfont% +\iftoggle{bbx:gbpub}% +{\testCJKfirst{userd}% +\ifboolexpr{% +test {\iflistundef{location}} and test {\iflistundef{institution}}% +}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}% +{\printtext{[S.l.\space :\space s.n.\adddot]}}% +}{% +\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}% + {\printlist{location}}% +\addcolon\addspace% +\iflistundef{institution}{% +\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}% \bibstring{nopublisher}%[s.n.\adddot] +{\printlist{institution}}}% +\setunit{\addcomma\addspace}% + %\usebibmacro{date}% + \printfield{year}% + \bibrangedash% + \iffieldundef{endyear}{}{\printfield{endyear}}% + \newunit}% +{ \printlist{location}% + \iflistundef{institution}% + {\setunit*{\addcomma\space}} + {\setunit*{\addcolon\space}}% + \printlist{institution}% + \setunit*{\addcomma\space}% + \usebibmacro{date}% + \newunit}% +} +% +% 通用的出版社和地址的处理 +% +% 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。 +% 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。 +% 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理 +\renewbibmacro*{publisher+location+date}{\bibpubfont% +\iftoggle{bbx:gbpub}% +{\testCJKfirst{userd}% + \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }% + {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}% + {\iflistundef{location}{%\adddot + \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 + {\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress} + {\printlist{location}\addcolon\addspace}%%\addcolon\addspace% + \iflistundef{publisher}{% + \iffieldequalstr{note}{standard}{}% + {\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}% + {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}% + {\printlist{publisher}}}% +\setunit*{\addcomma\addspace}%\addcomma\addspace% +\usebibmacro{date}%%\newunit %去掉这个标点 +}% +{\printlist{location}% + \iflistundef{publisher} + {\setunit*{\addcomma\space}} + {\setunit*{\addcolon\space}}% + \printlist{publisher}% + \setunit*{\addcomma\space}% + \usebibmacro{date}%%\newunit + }% +} + +% +% 修改了一个institution+location+date用于manual、report、thesis等类型 +% +% 20180425,v1.0k,增加了字体控制命令,hzz +% 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉 +\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。 +{\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉 + \iflistundef{institution} + {\setunit*{\addcomma\space}} + {\setunit*{\addcolon\space}}% + \printlist{institution}% + \setunit*{\addcomma\space}% + \usebibmacro{date}% + %\newunit + }} + +% +% 对volume卷信息格式做出修改 +% v1.0o,20190105,hzz +% +\DeclareFieldFormat{volume}{% +\testCJKfirst{userd}% +\iftoggle{ifCJKforgbt}% +{\bibstring{serialcn}#1\bibstring{volumecn}}% +{\bibstring{volume}~#1}% +}% volume of a book +\DeclareFieldFormat[article,periodical]{volume}{#1}% volume of a journal + +% +% 对number册信息格式做出修改 +% v1.0o,20190105,hzz +% +\DeclareFieldFormat{number}{#1}% +\DeclareFieldFormat[book,collection,inbook,% +incollection,proceedings,inproceedings]{number}{% +\testCJKfirst{userd}% +\iftoggle{ifCJKforgbt}% +{\bibstring{serialcn}#1\bibstring{numbercn}}% +{#1}% +}% + +% +% 对edition版本信息格式做出修改 +% +\DeclareFieldFormat{edition}{\bibtitlefont%源来自biblatex.DEF +\testCJKfirst{userd}% +\iftoggle{ifCJKforgbt}% +{\ifinteger{#1}% +{\printtext{#1\str@edition}}% +{#1\isdot}}% +{\ifinteger{#1}% +{\mkbibordedition{#1}~\bibstring{edition}}% +{#1\isdot}}} + +% +% 对version的版本信息做出修改 +% +\DeclareFieldFormat{version}{\bibtitlefont%源来自biblatex.DEF +\testCJKfirst{userd}% + \ifinteger{#1}% + {\iftoggle{ifCJKforgbt}{\printtext{#1\str@edition}}% + {\mkbibordedition{#1}~\bibstring{version}}}% + {#1\isdot}} + +% +% 作者域的输出控制宏 +% +% 当两篇文献作者相同且连续时,标准样式是用-代替后面的文献的作者,这里取消这一设置 +\renewbibmacro*{author}{%author for biblatex version <=3.7 + \ifboolexpr{ + test \ifuseauthor + and + not test {\ifnameundef{author}} + } + {\usebibmacro{bbx:dashcheck} + {%\bibnamedash + \printnames{author}% + }% + {\usebibmacro{bbx:savehash}% + \printnames{author}% + \iffieldundef{authortype} + {\setunit{\addspace}} + {\setunit{\addcomma\space}}}% + \iffieldundef{authortype} + {} + {\usebibmacro{authorstrg}% + \setunit{\addspace}}}% + {\global\undef\bbx@lasthash + \usebibmacro{labeltitle}% + \setunit*{\addspace}}% + \setunit{\addcomma\space}%增加一个逗号 + \usebibmacro{date+extrayear} + } + +% +% 设置标注和文献表中作者和年份之间的分隔符 +% +% 原理方法:注意3.4版已经有\nameyeardelim,上述修改的author宏虽然定义了著录表中的标点,但标注中的未定义 +% 设置因为mergedate默认为true时的情况,来自\bbx@opt@mergedate@compact +% 去掉作者后面包围年份的圆括号 +% 这里因为biblatex版本的不同,做不同的处理,texlive2017版/2016等低版本分开处理 +\defversion{3.0}{dateextra}{ +\renewcommand*{\nameyeardelim}{\addcomma\space} + \renewbibmacro*{date+extrayear}{%%重设date+extrayear格式,源来自authoryear.BBX + \iffieldundef{\thefield{datelabelsource}year} + {} + {\printtext{%[parens]%这里把括号去掉 + \iffieldsequal{year}{\thefield{datelabelsource}year} + {\printdateextralabel}% + {\printfield{labelyear}% + \printfield{extrayear}}}}}% + \newbibmacro{date+extradate}{\usebibmacro{date+extrayear}} +} + +\defversion{3.4}{dateextra}{ + \DeclareDelimFormat{nameyeardelim}{\addcomma\space} + \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space} + \renewbibmacro*{date+extrayear}{%%重设date+extrayear格式,源来自authoryear.BBX + \iffieldundef{\thefield{datelabelsource}year} + {} + {\printtext{%[parens]%这里把括号去掉 + \iffieldsequal{year}{\thefield{datelabelsource}year} + {\printdateextralabel}% + {\printfield{labelyear}% + \printfield{extrayear}}}}}% + \newbibmacro{date+extradate}{\usebibmacro{date+extrayear}} +} +\defversion{3.7}{dateextra}{ + \DeclareDelimFormat{nameyeardelim}{\addcomma\space} + \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space} + \renewbibmacro*{date+extrayear}{%以前的\printdateextralabel宏变为了\printlabeldateextra + \iffieldundef{labelyear} + {} + {\printtext{%[parens] + \iffieldsequal{year}{labelyear} + {\printlabeldateextra}% + {\printfield{labelyear}% + \printfield{extrayear}}}}}% + +\newbibmacro{date+extradate}{\usebibmacro{date+extrayear}} +} +\defversion{3.8}{dateextra}{ + \DeclareDelimFormat{nameyeardelim}{\addcomma\space} + \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space} +%注意这里当没有作者只有标题时在年份之前的标点是否需要标准并未涉及,所以未做处理。 +\renewbibmacro*{author}{%以前的date+extrayear变为date+extradate,所以对3.8以上版本重定义一下author + \ifboolexpr{ + test \ifuseauthor + and + not test {\ifnameundef{author}} + } + {\usebibmacro{bbx:dashcheck} + {%\bibnamedash %去掉相同作者用横线代替的处理 + \printnames{author}\setunit{\printdelim{nameyeardelim}}%把标点也带上 + } + {\usebibmacro{bbx:savehash}% + \printnames{author}% + \iffieldundef{authortype} + {\setunit{\printdelim{nameyeardelim}}} + {\setunit{\printdelim{authortypedelim}}}}% + \iffieldundef{authortype} + {} + {\usebibmacro{authorstrg}% + \setunit{\printdelim{nameyeardelim}}}}% + {\global\undef\bbx@lasthash + \usebibmacro{labeltitle}% + \setunit*{\printdelim{nonameyeardelim}}}% + \usebibmacro{date+extradate}} + \renewbibmacro*{date+extradate}{% + \iffieldundef{labelyear} + {} + {\printtext{%[parens]%这里去掉括号 + \iflabeldateisdate + {\printdateextra} + {\printlabeldateextra}}}}% + +} + + +% +%为mergedate增加选项none,即实现年份不提前到作者后面的标签中 +%也不打印用于区分同作者同年份文献的标识符如(a,b,c) +%目的是实现一些特殊的文献表样式比如ucas的作者年制 +%v1.0q,20190212,hzz +\def\bbx@opt@mergedate@none{% + \renewbibmacro*{date+extradate}{% + \iffieldundef{labelyear} + {} + {}}%[parens]\printtext{\printlabeldateextra} +\renewbibmacro*{bbx:ifmergeddate}{\@secondoftwo}%这一句用于3.12版本 +\renewbibmacro*{date}{\printdate}%这一句用于biblatex3.11以下版本 +\renewbibmacro*{issue+date}{%去掉括号 +\setunit{\addcomma\addspace}% + \printtext{%去掉了[parens] + \iffieldundef{issue} + {%\usebibmacro{date} + \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 + {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 + {\usebibmacro{date}}% + }}% + {\iftoggle{bbx:gbstrict}{}{\printfield{issue}% + \setunit*{\addspace}}% + %\usebibmacro{date} + \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 + {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 + {\usebibmacro{date}}% + }}}% + %\newunit + }% + } + +\iftoggle{iftlfive}{\switchversion{3.0}{dateextra}}{}%biblatex<=3.2 +\iftoggle{iftlsix}{\switchversion{3.4}{dateextra}}{}%3.3<=biblatex<=3.6 +\iftoggle{iftlseven}{\switchversion{3.7}{dateextra}}{}%biblatex=3.7 +\iftoggle{iftleight}{\switchversion{3.8}{dateextra}}{}%<=3.8biblatex<=3.9 +\iftoggle{iftlnine}{\switchversion{3.8}{dateextra}}{}%biblatex3.10 +\iftoggle{iftlatest}{\switchversion{3.8}{dateextra}}{}%biblatex最新3.11 + +% +% 修改析出文献的文集的标题与附加标题间的符号 +% +\renewbibmacro*{booktitle}{% + \ifboolexpr{ + test {\iffieldundef{booktitle}} + and + test {\iffieldundef{booksubtitle}} + } + {} + {\printtext[booktitle]{\bibtitlefont% + \printfield[titlecase]{booktitle}% + \setunit{\subtitlepunct}% + \printfield[titlecase]{booksubtitle}}% + \newunit%标点换成下一句 + \setunit{\subtitlepunct}}% + \printfield{booktitleaddon}} + +% +% 调整期刊名的格式 +% +% 原理方法:因为作者年制年份提到前面,因此涉及到期刊名与后面的卷期的关系。 +% v1.0k,20180425,增加了字体控制命令,hzz +\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx + \usebibmacro{journal}% + %\setunit*{\addspace}% + %\setunit*{\addcomma\addspace}%修改为增加一个逗号 + \iffieldundef{series}% + {}% + {\newunit% + \printfield{series}% + \setunit{\addspace}}% + %\usebibmacro{volume+number+eid}% + %\setunit{\addspace}% + \usebibmacro{issue+date}% + %\setunit{\addcolon\space}% + \iffieldundef{volume}{}{\setunit{\addcomma\space}}% + %换成逗号和空格 + \usebibmacro{issue}% + \usebibmacro{volume+number+eid}%把卷期放到年份后面 + %\newunit + } + +% +% 增加一个number带括号的格式,避免使用mkbibparens而引入一个不必要的空格 +% +\DeclareFieldFormat{addnumflag}{% +\nobreak\printtext{(}\nobreak #1\nobreak\printtext{)}} + +% +% 调整journal输出 +% +% 原理方法:首先判断子标题,然后再设置标点。 +% 避免直接设置标点后,当volume不存在时需要使用\nopuct去标点进而引入不必要的空格 +\renewbibmacro*{journal}{% + \iffieldundef{journaltitle}% + {}% + {\printtext[journaltitle]{% + \printfield[titlecase]{journaltitle}% + \iffieldundef{journalsubtitle}{}{\setunit{\subtitlepunct}% + \printfield[titlecase]{journalsubtitle}}}}} + + + +% +% 调整期刊卷和期的格式 +% +\renewbibmacro*{volume+number+eid}{%源来自standard.bbx +\iftoggle{bbx:gbfieldstd}{% + \printfield{volume}% + \setunit*{\adddot}% + \printfield{number}% + \setunit{\addcomma\space}% + \printfield{eid}}{% + \printfield{volume}% + %\setunit*{\adddot}%去掉点号 + %\printfield{number}% + \iffieldundef{number}{}{\printfield[addnumflag]{number}}%区别于顺序编码制 + \iffieldundef{eid}{}{% + \setunit{\addcomma\space}% + \printfield{eid}}}} + +% +% 调整期刊年份的格式 +% +% 原理方法:原在authoryear.BBX中\bbx@opt@mergedate@compact中定义 +% 当issue存在时,才设置newunit。避免直接设置标点后,当volume不存在是需要使用\nopuct去标点进而引入不必要的空格 + \renewbibmacro*{issue+date}{% + \iffieldundef{issue}% + {}% + {\iftoggle{bbx:gbstrict}{}{\printtext[parens]{\printfield{issue}}\newunit}}} + + + +% +% 调整页码前的标点和去掉期刊文章等页码后面的标点 +% +\renewbibmacro*{note+pages}{%源来自standard.bbx + %\printfield{note}%不要note,note用来判断是否是报纸newspaper + \iffieldundef{pages}{}{ + \setunit{\bibpagespunct}% + \printfield{pages}}% + %\newunit + } + +% +% 编者的符号修改一下 +% v1.0 2016-07-01 +% v1.0q 2019-03-01 hzz 修改editortype前的标点 +% +\renewbibmacro*{editor}{% + \ifboolexpr{ + test \ifuseeditor + and + not test {\ifnameundef{editor}} + } + {\usebibmacro{bbx:dashcheck} + {%\bibnamedash + \printnames{editor}% + } + {\printnames{editor}% + %\setunit{\printdelim{editortypedelim}}% + %\usebibmacro{bbx:savehash} + }% + \usebibmacro{editorstrg}% + %\clearname{editor}% + \setunit{\printdelim{nameyeardelim}}}% + {\global\undef\bbx@lasthash + \usebibmacro{labeltitle}% + \setunit*{\printdelim{nonameyeardelim}}}% + \ifboolexpr{% +test {\ifentrytype{inbook}} +or +test {\ifentrytype{incollection}} +or +test {\ifentrytype{inproceedings}} +or +test {\ifentrytype{conference}} +}% +{}% +{\usebibmacro{date+extradate}}} + +% +% 编者类型做一修改 +% v1.0 2016-07-01 +% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串 +% +\renewbibmacro*{editorstrg}{%源来自biblatex.DEF + \printtext[editortype]{% + \iffieldundef{editortype} + {% +% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理 +% test {\ifnumgreater{\value{editor}}{1}} +% or +% test {\ifandothers{editor}} +% } +% {\bibstring{editors}} +% {\bibstring{editor}} + } + {\ifbibxstring{\thefield{editortype}} %定义编者类型情况下处理,以后根据需要修改 + {\ifboolexpr{ + test {\ifnumgreater{\value{editor}}{1}} + or + test {\ifandothers{editor}} + } + {\printdelim{streditortypes}} + {\printdelim{streditortype}}} + {\thefield{editortype}}}% + }} + +% +% 编者类型的本地化字符串输出 +% v1.0q 2019-03-01 hzz +% 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符 +% 能对不同文境作设置的包括排序,标签等 +% 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串 +% +\DeclareDelimFormat{streditortypes}{% + \edef\userfieldabcde{userd}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% + \or% + \bibstring{\thefield{editortype}scn}% + \or% + \addcomma\addthinspace\bibstring{\thefield{editortype}s}% + \fi} +% +\DeclareDelimFormat{streditortype}{% + \edef\userfieldabcde{userd}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% + \or% + \bibstring{\thefield{editortype}cn}% + \or% + \addcomma\addthinspace\bibstring{\thefield{editortype}}% + \fi} + + +% +% bookauthor域的输出, +% v1.0q 2019-03-01 hzz +% 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替, +% 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype +\renewbibmacro*{bybookauthor}{% + \ifnameundef{bookauthor}% + {\ifnameundef{editor}% + {}% + {\ifnamesequal{author}{editor}% + {}{\usebibmacro{editor}}}% + }% + {\ifnamesequal{author}{bookauthor}% + {}{\printnames{bookauthor}}% + }% +} + +% +% 修改期刊的标题 +% +\renewbibmacro*{periodical}{%源来自biblatex.DEF + \iffieldundef{title} + {} + {\printtext[title]{\bibtitlefont% + \printfield[titlecase]{title}% + %\setunit{\subtitlepunct}% + \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 + {}{\setunit{\subtitlepunct} + \printfield[titlecase]{subtitle}}% + %}%把编组结束移到后面去 + \iftoggle{bbx:gbtype}{% + \iffieldundef{usera}{}{%在标题后直接给出文献标识字母 + \printfield[gbtypeflag]{usera}}}{} + }} + } + +% +% 期刊的标题做修改 +% +\renewbibmacro*{title+issuetitle}{%源来自standard.BBX + \usebibmacro{periodical}% + %\setunit*{\addspace}% + \setunit*{\adddot\addspace}%标点修改为句点 + \iffieldundef{series} + {} + {\newunit + \printfield{series}% + \setunit{\addspace}}% + \usebibmacro{periodical+issue}%将issue调整到上面来,并修改 +\iffieldundef{number}{}{%%进一步处理有范围的数字 + \multinumberparser{\thefield{number}}}% + \iffieldundef{volume}% + {\printfield{year}% + \printtext{\mkbibparens{\multinumberfirst}}% + \bibrangedash% + \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}% + }% + {\multivolparser{\thefield{volume}}% + \printfield{year}% + \setunit{\addcomma\space}%将冒号修改为逗号 + \printtext{\multivolfirst}% + \printtext{\mkbibparens{\multinumberfirst}}% + \bibrangedash% + \iffieldundef{endyear}{}{% + \printfield{endyear}% + \setunit{\addcomma\space}%将冒号修改为逗号 + \printtext{\multivolsecond}% + \printtext{\mkbibparens{\multinumbersecond}}}% + }% + \setunit{\addcomma\space}% + \printfield{eid}% + \setunit{\addspace}% + %\usebibmacro{issue+date}% + %\setunit{\addcolon\space}% + \usebibmacro{issue}% + \newunit} + +% +% 新增一个样式用于调整期刊年份的格式,只打印年份 +% +\newbibmacro*{periodical+issue}{% + \printtext{%去掉了[parens] + \iffieldundef{issue} + {%\usebibmacro{date}%修改为下一句 + }% + {\printfield{issue}% + \setunit*{\addspace}% + %\usebibmacro{date}%修改为下一句 + }% + }% + %\newunit +} + +% +% 重设专利title的输出,将文献类型标识符输出出去 +% +\newbibmacro*{patenttitle}{%原输出来自biblatex.def文件 + \ifboolexpr{% + test{\iffieldundef{title}}% + and% + test{\iffieldundef{subtitle}}% + }% + {}% + {\printtext[title]{\bibtitlefont% + \printfield[titlecase]{title}% + \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 + {}{\setunit{\subtitlepunct}% + \printfield[titlecase]{subtitle}}% + \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 + {\setunit{\subtitlepunct}\printfield{titleaddon}}% + \setunit{\subtitlepunct}\printfield{number}%写专利号 + \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}% + %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 + %\newunit + }% +}% +} + + + +% +% 修改in:用于inbook、incollection、inproceedings等类型 +% 2018.04.20,v1.0k,renewed marco,by hzz +% 20190212,v1.0q,增加中英文区分,by hzz +% +% 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。 +\renewbibmacro*{in:}{% + \iftoggle{bbx:gbpunctin}{\printtext{\allowbreak\texttt{//}\allowbreak}}%\addthinspace + {\setunit{\adddot\addspace}% + \iffieldequalstr{userd}{chinese}% + {\printtext{\bibstring{incn}}}% + {\printtext{\bibstring{in}}}% + }}%\newunit\newblock\intitlepunct + +% +% 修改type域的输出格式 +% 2019.02.12,v1.0q,byhzz +% 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文 +\DeclareFieldFormat{type}% +{\iffieldequalstr{userd}{chinese}% + {\ifbibxstring{#1cn}{\bibxstring{#1cn}}{#1}}% + {\ifbibstring{#1}{\bibstring{#1}}{#1}}% +} + + +% +% 修改series域的输出格式 +% 2019.05.01,v1.0r,byhzz +\renewbibmacro*{series+number}{% + \printfield{series}% + %\setunit*{\addspace}% + %\printfield{number}% + %\newunit + } + +%===================================================================== +%设置驱动格式 +%===================================================================== +% +% book条目类的驱动 +% + \DeclareBibliographyDriver{book}{%源来自standard.bbx文件 + \usebibmacro{bibindex}% + \usebibmacro{begentry}% +\usebibmacro{author/editor+others/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 +\usebibmacro{maintitle+title}% +\iftoggle{bbx:gbstrict}{}{% +\newunit +\printlist{language}% +\newunit\newblock% +\usebibmacro{byauthor}% +\newunit\newblock}% +\usebibmacro{byeditor+others}% +\newunit +\printfield{edition}% +\newunit\newblock%% +\iftoggle{bbx:gbstrict}{}{% +\iffieldundef{maintitle}% +{\printfield{volume}% +\printfield{part}}% +{}% +\newunit% +\printfield{volumes}% +\newunit\newblock% +\usebibmacro{series+number}}% +\newunit\newblock% +%\printfield{note}% +%\newunit\newblock% +\usebibmacro{publisher+location+date}% +%\newunit\newblock %这里标点去掉 +\usebibmacro{chapter+pages}% + \iffieldundef{url}{}{%当没有网址时也不输出 + \usebibmacro{modifydate}}%带括号的修改或更新日期, +\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 + \newunit\newblock% + \printfield{pagetotal}% + \newunit\newblock% + \iftoggle{bbx:isbn} + {\printfield{isbn}} + {}% + \newunit\newblock + %\usebibmacro{doi+eprint+url}% + %\newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + + + + +% +% 期刊文章,连续出版物中的析出文献的格式 +% + \DeclareBibliographyDriver{article}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}% + \newunit\newblock + \usebibmacro{bytranslator+others}% + \newunit\newblock + \printfield{version}}% + \newunit\newblock + %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物 + \usebibmacro{journal+issuetitle}% +% \newunit +% \usebibmacro{byeditor+others}% +% \newunit + \usebibmacro{note+pages}% + \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期 + \iffieldundef{url}{}{%当没有网址时也不输出 + \iftoggle{bbx:url}{%当url选项为false时,也不输出 + \usebibmacro{modifydate}}{}}}%带括号的修改或更新日期, + \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置 + \newunit\newblock + \iftoggle{bbx:isbn} + {\printfield{issn}} + {}% + \newunit\newblock + %\usebibmacro{doi+eprint+url}% + %\newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + + +% +% 连续出版物的驱动 +% + \DeclareBibliographyDriver{periodical}{%源来自standard.BBX + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{editor}% + %\setunit{\labelnamepunct}\newblock + \newunit\newblock %删除上面一行,添加这一行 + \usebibmacro{title+issuetitle}% + \newunit\newblock% + \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间 + \newunit\newblock%添加这一行 + \iftoggle{bbx:gbstrict}{}{% + \printlist{language}% + \newunit\newblock + \usebibmacro{byeditor}% + \newunit\newblock + \printfield{note}% + \newunit\newblock} + \iftoggle{bbx:isbn} + {\printfield{issn}} + {}% + \newunit\newblock + \usebibmacro{doi+eprint+url}% + \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + +% +% 专利文献驱动 +% + \DeclareBibliographyDriver{patent}{%源来自standard.BBX + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + %\usebibmacro{title}% + \usebibmacro{patenttitle}%给出专利专用的标题输出 + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}}% + \newunit\newblock + \printfield{type}% + \setunit*{\addspace}% + %\printfield{number}%已放到patenttitle中处理 + \iflistundef{location} + {} + {\setunit*{\addspace}% + \printtext{%[parens] + \printlist[][-\value{listtotal}]{location}}}% + \newunit\newblock + \usebibmacro{byholder}% + \newunit\newblock + \printfield{note}% + \newunit\newblock + \usebibmacro{newsdate}% + %\newunit\newblock + \usebibmacro{doi+eprint+url}% + \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + + +% +% 在线文献驱动 +% +\DeclareBibliographyDriver{online}{%源来自standard.BBX + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/editor+others/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}% + \newunit\newblock + \usebibmacro{byeditor+others}% + \newunit\newblock + \printfield{note}}% + \newunit + \printfield{version}% + \newunit\newblock +% \printlist{organization}% + \printlist{institution}% + \newunit\newblock +\ifboolexpr{% +test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% +}{\usebibmacro{date}}% +{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间 + \usebibmacro{url+urldate}%从下面移上来 + \newunit\newblock + \iftoggle{bbx:eprint} + {\usebibmacro{eprint}} + {}% + \newunit\newblock + %\usebibmacro{url+urldate}% + %\newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + + + + +% +% 报告类型驱动 +% 当有网址无出版项时,用online输出 +% +\DeclareBibliographyDriver{report}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}}% + \newunit\newblock + \usebibmacro{byeditor+others}%增加的译者信息 + \newunit\newblock + \printfield{type}% + \setunit*{\addspace}% + \printfield{number}% + \newunit\newblock + \printfield{version}% + \newunit + \printfield{note}% + \newunit\newblock + \usebibmacro{publisher+location+date}% + %\newunit\newblock + \usebibmacro{chapter+pages}% + \usebibmacro{doi+eprint+url}% + \newunit + \printfield{pagetotal}% + \newunit\newblock + \iftoggle{bbx:isbn} + {\printfield{isrn}} + {}% + \newunit\newblock +% \usebibmacro{doi+eprint+url}% +% \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + +% +% 论文、手册类型驱动 +% 2016-11-11,增加了译者信息 +% +\DeclareBibliographyDriver{manual}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}}% + \newunit\newblock + \usebibmacro{byeditor+others}%增加的译者信息 + \newunit\newblock + \iftoggle{bbx:gbfieldtype}{% + \printfield{type}% + \setunit*{\addspace}% + }{}% + \printfield{number}% + \newunit\newblock + \printfield{version}% + \newunit + \printfield{note}% + \newunit\newblock + \usebibmacro{institution+location+date}% + %\newunit\newblock + \usebibmacro{chapter+pages}% + \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期 + \usebibmacro{modifydate}}%修改或更新日期为带括号的时间 + \usebibmacro{doi+eprint+url}% + \newunit + \printfield{pagetotal}% + \newunit\newblock + \iftoggle{bbx:isbn} + {\printfield{isrn}} + {}% + \newunit\newblock +% \usebibmacro{doi+eprint+url}% +% \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + +% +% 备选类型驱动 +% +% 利用biblatex的misc驱动 +\DeclareBibliographyDriver{misc}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/editor+others/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% +\iftoggle{bbx:gbstrict}{}{% + \newunit + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}% + \newunit\newblock + \usebibmacro{byeditor+others}}% + \newunit\newblock + \printfield{howpublished}% + \newunit\newblock + \printfield{type}% + \newunit + \printfield{version}% + \newunit + \printfield{note}% + \newunit\newblock + \usebibmacro{institution+location+date}% + %\usebibmacro{organization+location+date}% + %\newunit\newblock + \usebibmacro{doi+eprint+url}% + \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + + + + + +% +% 专著中的析出文献的格式修改 +% +\DeclareBibliographyDriver{inbook}{%源来自standard.bbx + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 +\usebibmacro{title}% +\usebibmacro{in:}% +%\printtext{\texttt{//}\addthinspace}% + \usebibmacro{bybookauthor}% + \ifnameundef{bookauthor}{% + \ifnameundef{editor}{}{\newunit}% + }{\newunit}%替换下一句 + %\newunit\newblock +\iffieldundef{series}{}{\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加 + \usebibmacro{maintitle+booktitle}% +\iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}% +\iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息 + \newunit\newblock% +% \usebibmacro{byeditor+others}% +% \newunit\newblock + \printfield{edition}% + \newunit + \iftoggle{bbx:gbstrict}{}{% +% \iffieldundef{maintitle} +% {\printfield{volume}% +% \printfield{part}} +% {}% +% \newunit +% \printfield{volumes}% +% \newunit\newblock +% \usebibmacro{series+number} + }% + \newunit\newblock + %\printfield{note}% + %\newunit\newblock + \usebibmacro{publisher+location+date}% + %\newunit\newblock + \usebibmacro{chapter+pages}% + %\newunit\newblock + \usebibmacro{doi+eprint+url}%移到上面来 + \newunit\newblock + \iftoggle{bbx:isbn} + {\printfield{isbn}} + {}% + \newunit\newblock +% \usebibmacro{doi+eprint+url}% +% \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.cbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.cbx index 868af8c863..077b5c8bb9 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.cbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.cbx @@ -1,345 +1,429 @@ -%% -%% --------------------------------------------------------------- -%% biblatex-gb7714-2015 --- A biblatex implementation of the -%% GBT7714-2015 citation style,author year sequence -%% Maintained by huzhenzhen -%% E-mail: hzzmail@163.com -%% Released under the LaTeX Project Public License v1.3c or later -%% --------------------------------------------------------------- -%% -\def\versionofgbtstyle{2020/07/21 v1.0v} -\ProvidesFile{gb7714-2015ay.cbx}[\versionofgbtstyle biblatex citation style] - -% -% 加载标准样式 -% -\RequireCitationStyle{authoryear-comp} - -\ExecuteBibliographyOptions{ - %autocite = superscript , - %autopunct = true , - %sorting = none , - maxcitenames=1, - mincitenames=1, - uniquename=init,%因为使用了名字缩写选项,所以需要设置uniquename=init而不是full避免冲突 - uniquelist=minyear -} - -% -% 选项设置,针对3.7以下版本 -% -% 原理方法:labeldate用于控制是否给引用标签提供日期的成分 -\defversion{3.4}{cbxopt}{ - \ExecuteBibliographyOptions{ - labeldate=true - } -} - -% -% 选项设置,针对3.7以上版本 -% -% 原理方法:labeldateparts用于控制是否给引用标签提供日期的成分 -\defversion{3.7}{cbxopt}{ - \ExecuteBibliographyOptions{ - labeldateparts=true - } -} - -\ifboolexpr{%选择选项设置 -test {\iftoggle{iftlfive}}%biblatex<=3.2 -or -test {\iftoggle{iftlsix}}%3.3<=biblatex<=3.6 -}{\switchversion{3.4}{cbxopt}}{\switchversion{3.7}{cbxopt}}%else: biblatex>=3.7 - - -\ifboolexpr{%兼容cite:labelyear+extrayear -test {\iftoggle{iftlfive}}%biblatex<=3.2 -or -test {\iftoggle{iftlsix}}%3.3<=biblatex<=3.6 -or -test {\iftoggle{iftlseven}}%3.7=biblatex -}{\newbibmacro{cite:labeldate+extradate}{\usebibmacro{cite:labelyear+extrayear}}}{}%else: biblatex>3.7 - -%textcite标注命令中的标点设置,注意只针对textcite命令。 -% v-old -% v1.0t,20200320,hzz,修改如下 -% 在cbx中增加标注中的nameyeardelim标点定义,避免bbx使用其它样式时出现问题 -% 同时设置textcite的nameyeardelim为一个短空格,似乎原来直接连上去的不够美观 -\DeclareDelimFormat[cite,parencite,pagescite]{nameyeardelim}{\addcomma\space}%\addcomma\space -\DeclareDelimFormat[textcite]{nameyeardelim}{\addthinspace}%\addcomma\space -\DeclareDelimFormat[textcite]{andothersdelim}{\iffieldequalstr{userf}{chinese}{\addthinspace}{\addspace}}% -\AtEveryCitekey{% -\iffieldequalstr{userf}{chinese}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace - {\renewcommand*{\andothersdelim}{\addspace}}% -} - - -% -% 重定义cite:label,针对biblatex3.8以上版本set条目集的标注(引用)标签 -% -% 原理方法:当条目是set时,v3.8以上版本,都没有有用的信息(区别于3.7以下版本set复制第一个成员的信息), -% 于是利用entrykey来给出标签,那么就要set的条目关键字是需要的字符串,注意字符串中间不能有空格 -\renewbibmacro*{cite:label}{% - \iffieldundef{label}% - {\iffieldundef{labeltitle}{\printtext[bibhyperref]{\printfield{entrykey}}}%entrykey - {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}}% - {\printtext[bibhyperref]{\printfield{label}}}} - -% -% 重定义cite命令 -% -% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode} -% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式 -\DeclareCiteCommand{\cite} - {\usebibmacro{cite:init}% - \renewbibmacro*{postnote}{% - \iffieldundef{postnote}% - {}% - {\thefield{postnote}}}% - (\usebibmacro{prenote}}%) - {\usebibmacro{citeindex}% - \usebibmacro{cite}} - {} - {%( - )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote} - } - -% -% 定义upcite命令 -% 20180604,v1.0l,hzz -% 20190409,v1.0r,hzz -% 方法:与cite命令相同 -\newrobustcmd*{\upcite}{% - \cite} - -% -% 重定义parencite命令 -% -%\DeclareCiteCommand{\parencite} -% {\usebibmacro{cite:init}% -% \renewbibmacro*{postnote}{% -% \iffieldundef{postnote}% -% {}% -% {\nopunct% -% \printfield{postnote}}}% -% (\usebibmacro{prenote}}%) -% {\usebibmacro{citeindex}% -% \usebibmacro{cite}} -% {} -% {%( -% )\mkbibsuperscript{\usebibmacro{postnote}}} - - -% -% 新定义pagescite命令,以满足标签带页码的国标要求 -% -% 原理方法: -% 新增\pagescite引用命令 -\DeclareCiteCommand{\pagescite} - {\usebibmacro{cite:init}% - \renewbibmacro*{postnote}{% - \iffieldundef{postnote}% - {\thefield{pages}}% - {\thefield{postnote}}}% - (\usebibmacro{prenote}%) - }% - {\usebibmacro{citeindex}% - \usebibmacro{cite}} - {} - {%( - )\mkbibsuperscript{\usebibmacro{postnote}}} - -% -% 定义yearpagescite,用于当文中作者已经存在,需要页码和年份的情况 -% -% 原理:增加一个命令yearpagescite -% 参考biblatex.DEF中的\DeclareCiteCommand*{\citeyear}命令 -\DeclareCiteCommand{\yearpagescite} - {\usebibmacro{cite:init}% - \renewbibmacro*{postnote}{% - \iffieldundef{postnote}% - {\thefield{pages}}% - {\thefield{postnote}}}% - \printtext{(}\usebibmacro{prenote}}% - {\usebibmacro{cite:labeldate+extradate}}%\printfield{year}\printfield{extrayear} - {\multicitedelim}% - {\printtext{)}\textsuperscript{\usebibmacro{postnote}}} - -% -% 定义yearcite,用于当文中作者已经存在,仅需要年份的情况 -% -% 原理:增加一个命令yearcite -\DeclareCiteCommand{\yearcite}%仅输出年份,不要页码 - {\usebibmacro{cite:init}% - \printtext{(}\usebibmacro{prenote}}% - {\usebibmacro{cite:labeldate+extradate}}%\printfield{year}\printfield{extrayear} - {\multicitedelim}% - {\printtext{)}} - -% -% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码 -% 20180427,v1.0k,增加,hzz -% 20190409,v1.0r,hzz -% 为与顺序编码制兼容,增加了命令,定义与citet相同 -\newbibmacro*{citeta}{% - \iffieldundef{shorthand} - {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}} - {\usebibmacro{cite:label}% - \setunit{\printdelim{nonameyeardelim}}% - \usebibmacro{cite:labeldate+extradate}% - \usebibmacro{cite:reinit}} - {\iffieldequals{namehash}{\cbx@lasthash} - {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND - \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} - {\setunit{\addcomma}% - \usebibmacro{cite:extradate}} - {\setunit{\compcitedelim}% - \usebibmacro{cite:labeldate+extradate}% - \savefield{labelyear}{\cbx@lastyear}}} - {\printnames{labelname}% - %\setunit{\printdelim{nameyeardelim}}% - (\usebibmacro{cite:labeldate+extradate})% - \savefield{namehash}{\cbx@lasthash}% - \savefield{labelyear}{\cbx@lastyear}}}} - {\usebibmacro{cite:shorthand}% - \usebibmacro{cite:reinit}}% - \setunit{\multicitedelim}} - -\DeclareCiteCommand{\authornumcite}% - {\usebibmacro{cite:init}% - \renewbibmacro*{postnote}{% - \iffieldundef{postnote}% - {}% - {\thefield{postnote}}}% - \usebibmacro{prenote}}% - {\usebibmacro{citeindex}% - \usebibmacro{citeta}} - {} - {\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote} - } - -% -% 增加如下多个命令 -% 20190409,v1.0r,hzz -% 方法:利用newcommand或newrobustcmd命令进行定义 -% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突 - -%同\authornumcite -%\DeclareCiteCommand{\citet}% -% {\usebibmacro{cite:init}% -% \renewbibmacro*{postnote}{% -% \iffieldundef{postnote}% -% {}% -% {\thefield{postnote}}}% -% \usebibmacro{prenote}}% -% {\usebibmacro{citeindex}% -% \usebibmacro{citet}} -% {} -% {%( -% )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote} -% } - - -% -% 重定义citet,因为前面与\authornumcite同定义的命令无法正确处理多个bibtexkey同时给出的压缩情况 -% 20200721,v1.0v,hzz -% 方法:利用textcite命令进行定义 -% 基本利用textcite命令来写citet,仅利用bool{cbx:incitet}做判断,进而处理不同的页码形式 -\newbool{cbx:incitet} -\newbibmacro*{citet:postnote}{% - \ifthenelse{\value{multicitecount}=\value{multicitetotal}} - {\setunit{}% - \printtext{% - \ifbool{cbx:parens} - {\bibcloseparen\global\boolfalse{cbx:parens}} - {}}} - {\setunit{% - \ifbool{cbx:parens} - {\bibcloseparen\global\boolfalse{cbx:parens}} - {}% - \textcitedelim}}% - \renewbibmacro*{postnote}{% - \iffieldundef{postnote}% - {}% - {\thefield{postnote}}}% - \mkbibsuperscript{\usebibmacro{postnote}}% - } - -\DeclareCiteCommand{\cbx@textcite} - {\usebibmacro{cite:init}} - {\usebibmacro{citeindex}% - \usebibmacro{textcite}} - {} - {\ifbool{cbx:incitet}{\usebibmacro{citet:postnote}}{\usebibmacro{textcite:postnote}}} - - \newrobustcmd{\cbx@citet@init}[2]{% - \global\booltrue{cbx:incitet}% - \setcounter{textcitetotal}{0}% - \setcounter{textcitecount}{0}% - \def\cbx@savedcites{#1}#2\cbx@savedcites\empty} - - \renewrobustcmd{\cbx@textcite@init}[2]{% - \global\boolfalse{cbx:incitet}% - \setcounter{textcitetotal}{0}% - \setcounter{textcitecount}{0}% - \def\cbx@savedcites{#1}#2\cbx@savedcites\empty} - -\DeclareCiteCommand{\citet}[\cbx@citet@init\cbx@textcite] - {\gdef\cbx@savedkeys{}% - \citetrackerfalse% - \pagetrackerfalse% - \DeferNextCitekeyHook% - \usebibmacro{cite:init}} - {\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0} - {\protected@xappto\cbx@savedcites{()(\thefield{multipostnote})}% - \global\clearfield{multipostnote}} - {}% - \xappto\cbx@savedkeys{\thefield{entrykey},}% - \iffieldequals{namehash}{\cbx@lasthash} - {} - {\stepcounter{textcitetotal}% - \savefield{namehash}{\cbx@lasthash}}} - {} - {\protected@xappto\cbx@savedcites{% - [\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}} - -\let\cbx@citets@init\cbx@citet@init -\pretocmd{\cbx@citets@init}{\UseNextMultiCiteHook}{}{} -\DeclareMultiCiteCommand{\citets}[\cbx@citets@init\cbx@textcites]{\citet}{} - -%同cite -\DeclareCiteCommand{\citep} - {\usebibmacro{cite:init}% - \renewbibmacro*{postnote}{% - \iffieldundef{postnote}% - {}% - {\thefield{postnote}}}% - (\usebibmacro{prenote}}%) - {\usebibmacro{citeindex}% - \usebibmacro{cite}} - {} - {%( - )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote} - } - -\newrobustcmd*{\citetns}% - {\textcite} - -\newrobustcmd*{\citepns}% - {\parencite} - -\newrobustcmd*{\inlinecite}% - {\parencite} - - -% -% 增加如下复数的命令,以符合biblatex的复数命令习惯 -% 20190430,v1.0r,hzz -% citec和citecs命令是为了兼容顺序编码制。 -% authornumcites是常用命令authornumcite的复数形式 -\newrobustcmd*{\citec}% - {\cite} - -\DeclareMultiCiteCommand{\citecs}[]{\cite}{\multicitedelim} - -\DeclareMultiCiteCommand{\authornumcites}[]{\authornumcite}{\multicitedelim} +%% +%% --------------------------------------------------------------- +%% biblatex-gb7714-2015 --- A biblatex implementation of the +%% GBT7714-2015 citation style,author year sequence +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% +\def\versionofgbtstyle{2021/01/19 v1.0w} +\ProvidesFile{gb7714-2015ay.cbx}[\versionofgbtstyle biblatex citation style] + +% +% 加载标准样式 +% +\RequireCitationStyle{authoryear-comp} + + +% +% 增加一个控制是否将标准标签中的作者加上超链接的选项 +% 20210119,v1.0v,hzz +\newtoggle{bbx:gblabelref} +\DeclareBibliographyOption{gblabelref}[true]{%biblatex低版本 + \settoggle{bbx:gblabelref}{#1}} +\ExecuteBibliographyOptions{gblabelref} + + +\ExecuteBibliographyOptions{ + %autocite = superscript , + %autopunct = true , + %sorting = none , + maxcitenames=1, + mincitenames=1, + uniquename=init,%因为使用了名字缩写选项,所以需要设置uniquename=init而不是full避免冲突 + uniquelist=minyear +} + +% +% 选项设置,针对3.7以下版本 +% +% 原理方法:labeldate用于控制是否给引用标签提供日期的成分 +\defversion{3.4}{cbxopt}{ + \ExecuteBibliographyOptions{ + labeldate=true + } +} + +% +% 选项设置,针对3.7以上版本 +% +% 原理方法:labeldateparts用于控制是否给引用标签提供日期的成分 +\defversion{3.7}{cbxopt}{ + \ExecuteBibliographyOptions{ + labeldateparts=true + } +} + +\ifboolexpr{%选择选项设置 +test {\iftoggle{iftlfive}}%biblatex<=3.2 +or +test {\iftoggle{iftlsix}}%3.3<=biblatex<=3.6 +}{\switchversion{3.4}{cbxopt}}{\switchversion{3.7}{cbxopt}}%else: biblatex>=3.7 + + +\ifboolexpr{%兼容cite:labelyear+extrayear +test {\iftoggle{iftlfive}}%biblatex<=3.2 +or +test {\iftoggle{iftlsix}}%3.3<=biblatex<=3.6 +or +test {\iftoggle{iftlseven}}%3.7=biblatex +}{\newbibmacro{cite:labeldate+extradate}{\usebibmacro{cite:labelyear+extrayear}}}{}%else: biblatex>3.7 + +%textcite标注命令中的标点设置,注意只针对textcite命令。 +% v-old +% v1.0t,20200320,hzz,修改如下 +% 在cbx中增加标注中的nameyeardelim标点定义,避免bbx使用其它样式时出现问题 +% 同时设置textcite的nameyeardelim为一个短空格,似乎原来直接连上去的不够美观 +\DeclareDelimFormat[cite,parencite,pagescite]{nameyeardelim}{\addcomma\space}%\addcomma\space +\DeclareDelimFormat[textcite]{nameyeardelim}{\addthinspace}%\addcomma\space +\DeclareDelimFormat[textcite]{andothersdelim}{\iffieldequalstr{userf}{chinese}{\addthinspace}{\addspace}}% +\AtEveryCitekey{% +\iffieldequalstr{userf}{chinese}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace + {\renewcommand*{\andothersdelim}{\addspace}}% +} + +% +% 修订使可用选项gblabelref来控制是否将标准标签中的作者加上超链接 +% 20210119,v1.0v,hzz +\iftoggle{iftlatest}% +{\renewbibmacro*{cite}{% + \iffieldundef{shorthand} + {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}} + {\usebibmacro{cite:label}% + \setunit{\printdelim{nonameyeardelim}}% + \usebibmacro{cite:labeldate+extradate}% + \usebibmacro{cite:reinit}} + {\iffieldequals{namehash}{\cbx@lasthash} + {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND + \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} + {\setunit{\addcomma}% + \usebibmacro{cite:extradate}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:labeldate+extradate}% + \savefield{labelyear}{\cbx@lastyear}}} + {\iftoggle{bbx:gblabelref}{\printtext[bibhyperref]{\printnames{labelname}}}{\printnames{labelname}}% + \setunit{\printdelim{nameyeardelim}}% + \usebibmacro{cite:labeldate+extradate}% + \savefield{namehash}{\cbx@lasthash}% + \savefield{labelyear}{\cbx@lastyear}}}} + {\usebibmacro{cite:shorthand}% + \usebibmacro{cite:reinit}}% + \setunit{\multicitedelim}} +\renewbibmacro*{textcite}{% + \iffieldequals{namehash}{\cbx@lasthash} + {\iffieldundef{shorthand} + {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND + \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} + {\setunit{\addcomma}% + \usebibmacro{cite:extradate}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:labeldate+extradate}% + \savefield{labelyear}{\cbx@lastyear}}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:shorthand}% + \global\undef\cbx@lastyear}} + {\ifnameundef{labelname} + {\iffieldundef{shorthand} + {\usebibmacro{cite:label}% + \setunit{% + \global\booltrue{cbx:parens}% + \printdelim{nonameyeardelim}\bibopenparen}% + \ifnumequal{\value{citecount}}{1} + {\usebibmacro{prenote}} + {}% + \usebibmacro{cite:labeldate+extradate}} + {\usebibmacro{cite:shorthand}}} + {\iftoggle{bbx:gblabelref}{\printtext[bibhyperref]{\printnames{labelname}}}{\printnames{labelname}}% + \setunit{% + \global\booltrue{cbx:parens}% + \printdelim{nameyeardelim}\bibopenparen}% + \ifnumequal{\value{citecount}}{1} + {\usebibmacro{prenote}} + {}% + \iffieldundef{shorthand} + {\iffieldundef{labelyear} + {\usebibmacro{cite:label}} + {\usebibmacro{cite:labeldate+extradate}}% + \savefield{labelyear}{\cbx@lastyear}} + {\usebibmacro{cite:shorthand}% + \global\undef\cbx@lastyear}}% + \stepcounter{textcitecount}% + \savefield{namehash}{\cbx@lasthash}}% + \setunit{% + \ifbool{cbx:parens} + {\bibcloseparen\global\boolfalse{cbx:parens}} + {}% + \textcitedelim}}}{} + + + +% +% 重定义cite:label,针对biblatex3.8以上版本set条目集的标注(引用)标签 +% +% 原理方法:当条目是set时,v3.8以上版本,都没有有用的信息(区别于3.7以下版本set复制第一个成员的信息), +% 于是利用entrykey来给出标签,那么就要set的条目关键字是需要的字符串,注意字符串中间不能有空格 +\renewbibmacro*{cite:label}{% + \iffieldundef{label}% + {\iffieldundef{labeltitle}{\printtext[bibhyperref]{\printfield{entrykey}}}%entrykey + {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}}% + {\printtext[bibhyperref]{\printfield{label}}}} + +% +% 重定义cite命令 +% +% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode} +% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式 +\DeclareCiteCommand{\cite} + {\usebibmacro{cite:init}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {}% + {\thefield{postnote}}}% + (\usebibmacro{prenote}}%) + {\usebibmacro{citeindex}% + \usebibmacro{cite}} + {} + {%( + )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote} + } + +% +% 定义upcite命令 +% 20180604,v1.0l,hzz +% 20190409,v1.0r,hzz +% 方法:与cite命令相同 +\newrobustcmd*{\upcite}{% + \cite} + +% +% 重定义parencite命令 +% +%\DeclareCiteCommand{\parencite} +% {\usebibmacro{cite:init}% +% \renewbibmacro*{postnote}{% +% \iffieldundef{postnote}% +% {}% +% {\nopunct% +% \printfield{postnote}}}% +% (\usebibmacro{prenote}}%) +% {\usebibmacro{citeindex}% +% \usebibmacro{cite}} +% {} +% {%( +% )\mkbibsuperscript{\usebibmacro{postnote}}} + + +% +% 新定义pagescite命令,以满足标签带页码的国标要求 +% +% 原理方法: +% 新增\pagescite引用命令 +\DeclareCiteCommand{\pagescite} + {\usebibmacro{cite:init}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {\thefield{pages}}% + {\thefield{postnote}}}% + (\usebibmacro{prenote}%) + }% + {\usebibmacro{citeindex}% + \usebibmacro{cite}} + {} + {%( + )\mkbibsuperscript{\usebibmacro{postnote}}} + +% +% 定义yearpagescite,用于当文中作者已经存在,需要页码和年份的情况 +% +% 原理:增加一个命令yearpagescite +% 参考biblatex.DEF中的\DeclareCiteCommand*{\citeyear}命令 +\DeclareCiteCommand{\yearpagescite} + {\usebibmacro{cite:init}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {\thefield{pages}}% + {\thefield{postnote}}}% + \printtext{(}\usebibmacro{prenote}}% + {\usebibmacro{cite:labeldate+extradate}}%\printfield{year}\printfield{extrayear} + {\multicitedelim}% + {\printtext{)}\textsuperscript{\usebibmacro{postnote}}} + +% +% 定义yearcite,用于当文中作者已经存在,仅需要年份的情况 +% +% 原理:增加一个命令yearcite +\DeclareCiteCommand{\yearcite}%仅输出年份,不要页码 + {\usebibmacro{cite:init}% + \printtext{(}\usebibmacro{prenote}}% + {\usebibmacro{cite:labeldate+extradate}}%\printfield{year}\printfield{extrayear} + {\multicitedelim}% + {\printtext{)}} + +% +% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码 +% 20180427,v1.0k,增加,hzz +% 20190409,v1.0r,hzz +% 为与顺序编码制兼容,增加了命令,定义与citet相同 +\newbibmacro*{citeta}{% + \iffieldundef{shorthand} + {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}} + {\usebibmacro{cite:label}% + \setunit{\printdelim{nonameyeardelim}}% + \usebibmacro{cite:labeldate+extradate}% + \usebibmacro{cite:reinit}} + {\iffieldequals{namehash}{\cbx@lasthash} + {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND + \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} + {\setunit{\addcomma}% + \usebibmacro{cite:extradate}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:labeldate+extradate}% + \savefield{labelyear}{\cbx@lastyear}}} + {\iftoggle{bbx:gblabelref}{\printtext[bibhyperref]{\printnames{labelname}}}{\printnames{labelname}}%% + %\setunit{\printdelim{nameyeardelim}}% + (\usebibmacro{cite:labeldate+extradate})% + \savefield{namehash}{\cbx@lasthash}% + \savefield{labelyear}{\cbx@lastyear}}}} + {\usebibmacro{cite:shorthand}% + \usebibmacro{cite:reinit}}% + \setunit{\multicitedelim}} + +\DeclareCiteCommand{\authornumcite}% + {\usebibmacro{cite:init}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {}% + {\thefield{postnote}}}% + \usebibmacro{prenote}}% + {\usebibmacro{citeindex}% + \usebibmacro{citeta}} + {} + {\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote} + } + +% +% 增加如下多个命令 +% 20190409,v1.0r,hzz +% 方法:利用newcommand或newrobustcmd命令进行定义 +% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突 + +%同\authornumcite +%\DeclareCiteCommand{\citet}% +% {\usebibmacro{cite:init}% +% \renewbibmacro*{postnote}{% +% \iffieldundef{postnote}% +% {}% +% {\thefield{postnote}}}% +% \usebibmacro{prenote}}% +% {\usebibmacro{citeindex}% +% \usebibmacro{citet}} +% {} +% {%( +% )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote} +% } + + +% +% 重定义citet,因为前面与\authornumcite同定义的命令无法正确处理多个bibtexkey同时给出的压缩情况 +% 20200721,v1.0v,hzz +% 方法:利用textcite命令进行定义 +% 基本利用textcite命令来写citet,仅利用bool{cbx:incitet}做判断,进而处理不同的页码形式 +\newbool{cbx:incitet} +\newbibmacro*{citet:postnote}{% + \ifthenelse{\value{multicitecount}=\value{multicitetotal}} + {\setunit{}% + \printtext{% + \ifbool{cbx:parens} + {\bibcloseparen\global\boolfalse{cbx:parens}} + {}}} + {\setunit{% + \ifbool{cbx:parens} + {\bibcloseparen\global\boolfalse{cbx:parens}} + {}% + \textcitedelim}}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {}% + {\thefield{postnote}}}% + \mkbibsuperscript{\usebibmacro{postnote}}% + } + +\DeclareCiteCommand{\cbx@textcite} + {\usebibmacro{cite:init}} + {\usebibmacro{citeindex}% + \usebibmacro{textcite}} + {} + {\ifbool{cbx:incitet}{\usebibmacro{citet:postnote}}{\usebibmacro{textcite:postnote}}} + + \newrobustcmd{\cbx@citet@init}[2]{% + \global\booltrue{cbx:incitet}% + \setcounter{textcitetotal}{0}% + \setcounter{textcitecount}{0}% + \def\cbx@savedcites{#1}#2\cbx@savedcites\empty} + + \renewrobustcmd{\cbx@textcite@init}[2]{% + \global\boolfalse{cbx:incitet}% + \setcounter{textcitetotal}{0}% + \setcounter{textcitecount}{0}% + \def\cbx@savedcites{#1}#2\cbx@savedcites\empty} + +\DeclareCiteCommand{\citet}[\cbx@citet@init\cbx@textcite] + {\gdef\cbx@savedkeys{}% + \citetrackerfalse% + \pagetrackerfalse% + \DeferNextCitekeyHook% + \usebibmacro{cite:init}} + {\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0} + {\protected@xappto\cbx@savedcites{()(\thefield{multipostnote})}% + \global\clearfield{multipostnote}} + {}% + \xappto\cbx@savedkeys{\thefield{entrykey},}% + \iffieldequals{namehash}{\cbx@lasthash} + {} + {\stepcounter{textcitetotal}% + \savefield{namehash}{\cbx@lasthash}}} + {} + {\protected@xappto\cbx@savedcites{% + [\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}} + +\let\cbx@citets@init\cbx@citet@init +\pretocmd{\cbx@citets@init}{\UseNextMultiCiteHook}{}{} +\DeclareMultiCiteCommand{\citets}[\cbx@citets@init\cbx@textcites]{\citet}{} + +%同cite +\DeclareCiteCommand{\citep} + {\usebibmacro{cite:init}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {}% + {\thefield{postnote}}}% + (\usebibmacro{prenote}}%) + {\usebibmacro{citeindex}% + \usebibmacro{cite}} + {} + {%( + )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote} + } + +\newrobustcmd*{\citetns}% + {\textcite} + +\newrobustcmd*{\citepns}% + {\parencite} + +\newrobustcmd*{\inlinecite}% + {\parencite} + + +% +% 增加如下复数的命令,以符合biblatex的复数命令习惯 +% 20190430,v1.0r,hzz +% citec和citecs命令是为了兼容顺序编码制。 +% authornumcites是常用命令authornumcite的复数形式 +\newrobustcmd*{\citec}% + {\cite} + +\DeclareMultiCiteCommand{\citecs}[]{\cite}{\multicitedelim} + +\DeclareMultiCiteCommand{\authornumcites}[]{\authornumcite}{\multicitedelim} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx index 3747757004..3c5fe9097a 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx @@ -1,2735 +1,2735 @@ -%% -%% --------------------------------------------------------------- -%% biblatex-gb7714-2015 --- A biblatex implementation of the -%% GBT7714-2015 bibliography style,numerical sequence -%% Maintained by huzhenzhen -%% E-mail: hzzmail@163.com -%% Released under the LaTeX Project Public License v1.3c or later -%% --------------------------------------------------------------- -%% - -% -% 版本和时间信息 -% -\def\versionofgbtstyle{2020/07/21 v1.0v} -\def\versionofbiblatex{\abx@version} -\ProvidesFile{gb7714-2015ms.bbx}[\versionofgbtstyle biblatex bibliography style] -%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求 - - -%===================================================================== -% 加载标准样式 -%===================================================================== -\RequireBibliographyStyle{numeric-comp} -\RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题 - -%===================================================================== -% 功能函数 -%===================================================================== - % - % biblatex版本判断 - % 20180629,v1.0k,hzz - % - % 原理方法:适用于3.10以上版本的biblatex,否则给出警告 - \@ifpackagelater{biblatex}{2017/12/28}{}{ - \blx@warning@noline{% - biblatex version is too old for this style\MessageBreak - if errors raised,Please update biblatex to the latest version.} - } - - - % - % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成 - % v1.0k,20180509,hzz - % - % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏 - % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8 - % 编码用xelatex编译的问题。 - % - % 原理是:利用perl正则将中文标识记录到域中, - % 然后利用\iffieldundef和\iffieldequalstr进行判断 - \providetoggle{ifCJKforgbt} - \def\testCJKfirst#1{% - \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{% - \iffieldequalstr{#1}{chinese}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}} - - % - % 2个卷的解析函数,用于连续出版物 - % - % 原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号 - \newcommand{\multivolparser}[1]{% - \IfSubStr{#1}{-}% - {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}% - {\def\multivolfirst{#1}\def\multivolsecond{}}% - } - - - % - % 2个期的解析函数,用于连续出版物 - % - \newcommand{\multinumberparser}[1]{% - \IfSubStr{#1}{-}% - {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}% - {\def\multinumberfirst{#1}\def\multinumbersecond{}}% - } - - -%===================================================================== -% 数据模型定义 -%===================================================================== - %定义类型和载体标识,从gb内容看载体基本属于介质。 - %为与lee zeping的bst的样式统一,使用mark和medium这两域名 - %为单个条目的姓名格式控制增加nameformat和namefmtid两个域 - %为缩略信息文献表增加了shortbooktitle域 - %为多语言排序增加了lansortorder域 - \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat} - \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid} - \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle} - \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder} - - %因为biblatex更新3.14版本以后,biber对于为声明数据模型的条目类型 - %不再默认读取,而是以空字符串作为条目类型名,自然在条目定义alias时 - %就会出现问题,因此显式的声明一下newspaper,然后保留后面采用alias的方式 - %而standard类型则是采用另一种方式直接在sourcemap中转换为其它类型。 - \@ifpackagelater{biblatex}{2019/11/30}{%2019/12/01 v3.14 - \DeclareDatamodelEntrytypes{newspaper}% - }{} - -%===================================================================== -% 设置宏包选项 -%===================================================================== - % - % 增加一个控制是否输出文献载体的选项 - % 20191125,v1,0s,hzz - \newtoggle{bbx:gbmedium} - \DeclareBibliographyOption{gbmedium}[true]{%biblatex低版本 - \settoggle{bbx:gbmedium}{#1}} - \ExecuteBibliographyOptions{gbmedium} - - % - % 增加一个控制是否输出annotation域的选项,该域可以用于在文献条目后面输出一些注释信息 - % 20190509,v1,0s,hzz - \newtoggle{bbx:gbannote} - \DeclareBibliographyOption{gbannote}[false]{%biblatex低版本 - \settoggle{bbx:gbannote}{#1}} - \ExecuteBibliographyOptions{gbannote} - % - %用于在文献条目后面输出注释信息的宏 - %FieldFormat{annotation}用于设置注释信息的格式 - \DeclareFieldFormat{annotation}{% - \printtext{\addspace(#1)}% - } - \renewbibmacro*{annotation}{% - \iftoggle{bbx:gbannote}% - {\iffieldundef{annotation}% - {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}% - {\printfield{annotation}}}% - {}% - } - - - % - % 增加一个控制是否输出type域的选项 - % 20190212,v1,0q,hzz - \newtoggle{bbx:gbfieldtype} - \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本 - \settoggle{bbx:gbfieldtype}{#1}} - \ExecuteBibliographyOptions{gbfieldtype} - - % - % 增加一个控制是否根据页码重设脚注数字标号的选项 - % 20190422,v1,0r,hzz - \newtoggle{bbx:gbfnperpage} - \DeclareBibliographyOption{gbfnperpage}[false]{% - \settoggle{bbx:gbfnperpage}{#1}} - \ExecuteBibliographyOptions{gbfnperpage} - - % - % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表 - % 20190203,v1.0p,hzz - % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签 - % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式 - % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题 - \DeclareBibliographyOption{gbfootbib}[false]{% - \ifstrequal{#1}{false}{}{\execgbfootbib}} - \ExecuteBibliographyOptions{gbfootbib} - - %% - \newlength{\footbibmargin} - \newlength{\footbiblabelsep} - \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离 - \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距 - \def\execgbfootbib% - {% - %开启引用跟踪计数器,为使用\ifciteseen等测试命令 - \ExecuteBibliographyOptions{citetracker=true} - % - %利用footmisc宏包来实现脚注文献的悬挂对齐 - \AtEndPreamble{ - \@ifclassloaded{beamer}{}{ - %beamer类因为其特殊性,为避免冲突不调footmisc。 - %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接 - %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。 - %\PassOptionsToPackage{perpage,hang}{footmisc}% - %\RequirePackage{footmisc}% - - %重新实现脚注的根据单页重设脚注号码 - %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改 - %v1.0q 20190317 hzz - %v1.0r 20190422 hzz 根据gbfnperpage选项设置 - \iftoggle{bbx:gbfnperpage}% - {\@addtoreset{footnote}{page}}{}%重设计数器 - -\@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义 - \long\def\H@@footnotetext##1{\insert\footins{% - \reset@font\footnotesize - \interlinepenalty\interfootnotelinepenalty - \splittopskip\footnotesep - \splitmaxdepth \dp\strutbox \floatingpenalty \@MM - \hsize\columnwidth \@parboxrestore - \protected@edef\@currentlabel{% - \csname p@footnote\endcsname\@thefnmark - }% - \color@begingroup - \leftskip \footbibmargin%增加的左侧缩进 - \@makefntext{% - \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% - }% - \color@endgroup}}% - - \long\def\H@@mpfootnotetext##1{% - \global\setbox\@mpfootins\vbox{% - \unvbox\@mpfootins - \reset@font\footnotesize - \hsize\columnwidth - \@parboxrestore - \protected@edef\@currentlabel - {\csname p@mpfootnote\endcsname\@thefnmark}% - \leftskip \footbibmargin%增加的左侧缩进 - \color@begingroup - \@makefntext{% - \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% - \color@endgroup}} - }{%否则对latex核心代码中的\@footnotetext做重定义 - \long\def\@footnotetext##1{\insert\footins{% - \reset@font\footnotesize - \interlinepenalty\interfootnotelinepenalty - \splittopskip\footnotesep - \splitmaxdepth \dp\strutbox \floatingpenalty \@MM - \hsize\columnwidth \@parboxrestore - \protected@edef\@currentlabel{% - \csname p@footnote\endcsname\@thefnmark - }% - \color@begingroup - \leftskip \footbibmargin%增加的左侧缩进 - \@makefntext{% - \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% - }% - \color@endgroup}}% - - \long\def\@mpfootnotetext##1{% - \global\setbox\@mpfootins\vbox{% - \unvbox\@mpfootins - \reset@font\footnotesize - \hsize\columnwidth - \@parboxrestore - \protected@edef\@currentlabel - {\csname p@mpfootnote\endcsname\@thefnmark}% - \leftskip \footbibmargin%增加的左侧缩进 - \color@begingroup - \@makefntext{% - \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% - \color@endgroup}} - } - - \long\def\@makefntext##1{%增加了脚注标记与正文的间隔 - \parindent 1em\noindent \hb@xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1} - - } - - % - %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式 - \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}} - %做patch使得脚注内容中的脚注数字标签不上标 - \pretocmd{\@makefntext}{% - \def\@makefnmark{% - \hbox{\textcircled{\tiny\@thefnmark}}% - }% - }{}{} - } - - % - %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容) - %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。 - %v1.0q 20190309 区分使脚注标注适应minipage中的情况 - \newbibmacro*{citesavefn}{% - \ifciteseen%当被引用过为true - {\ifcsdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%当已经定义过脚注序号信息 - {\csgdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% - \str@sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}% - \@makefnmark% - }}% - {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% - \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% - }}% - }% - {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% - \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% - %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断 - }}% - } - - % - %重定义\footfullcite使完成gb7714-2015的脚注文献要求 - \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% - {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 - \defcounter{minnames}{\blx@minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。 - \usebibmacro{prenote}% - \renewbibmacro*{postnote}{% - \iffieldundef{postnote}% - {}{\setunit{\addcolon\addspace}\printfield{postnote}}}%与ay样式不同,由于已修改postnote域格式,直接用printfield - }% - {\usebibmacro{citesavefn}% - \ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}% - {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}\nopunct}% - {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}% - }% - {\multicitedelim}% - {\usebibmacro{postnote}} - - } - - % - % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式 - % 20180814,v1.0m,hzz - % 原理方法: - % 当gbstyle=true,则所有的文献使用国标样式,否则仅中文文献使用国标样式 - \newtoggle{bbx:gbstyle} - \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本 - \settoggle{bbx:gbstyle}{#1}} - - % - % 增加一个控制是否输出文献类型和载体标识的选项 - % - % 原理方法: - % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的 - % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本 - \newtoggle{bbx:gbtype} - %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本 - \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本 - \settoggle{bbx:gbtype}{#1}} - - % - % 增加一个源文件编码选择选项,当true时可以使用GBK编码。 - % v1.0k, 2018.05.08, by hzz - % - % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档 - % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def - % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用 - % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。 - % 另外注意: - % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码 - % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常 - % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。 - \newtoggle{bbx:codegbk} - \DeclareBibliographyOption{gbcodegbk}[false]{% - \settoggle{bbx:codegbk}{#1}} - - \def\str@bibliography{参考文献} - \def\str@references{参考文献} - \def\str@bytranslator{译} - \def\str@andotherscn{等} - \def\str@backrefpage{引用页} - \def\str@backrefpages{引用页} - \def\str@noaddress{出版地不详} - \def\str@nopublisher{出版者不详} - \def\str@edition{版} - \def\str@volumecn{卷} - \def\str@numbercn{册} - \def\str@serialcn{第} - \def\str@sameentry{同} - \def\str@incn{见} - \def\str@mathesiscn{硕士学位论文} - \def\str@phdthesiscn{博士学位论文} - \def\str@editorcn{主编} - - \AtEndOfPackage{% - \iftoggle{bbx:codegbk}{% - \ExecuteBibliographyOptions{texencoding = GBK} - \input{gb7714-2015-gbk.def} - }{}} - - % - % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项 - % v1.0k, 2018.05.08, by hzz - % - % 原理方法: - % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息 - % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式 - % 可能需要用于中英文判断的language域的信息。 - \newtoggle{bbx:gbstrict} - \DeclareBibliographyOption{gbstrict}[true]{% - \settoggle{bbx:gbstrict}{#1}} - - % - % 增加一个控制标题域超链接设置的选项 - % v1.0k, 2018.05.24, by hzz - % - % 原理方法: - % 利用标题域格式来实现,默认设置该选项为false,不做超链接。 - % 设置为true,则标题设置超链接 - \newtoggle{bbx:titlelink} - \DeclareBibliographyOption{gbtitlelink}[false]{% - \settoggle{bbx:titlelink}{#1}} - - % - % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项 - % v1.0l, 2018.07.02, by hzz - % - % 原理方法: - % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置 - \newtoggle{bbx:ctexset} - \DeclareBibliographyOption{gbctexset}[true]{% - \settoggle{bbx:ctexset}{#1}} - - \AtEndOfPackage{% - \iftoggle{bbx:ctexset}{% - \def\blx@defbibstrings#1#2{% - \def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}% - \abx@dostrings - \csuse{abx@strings@#1}% - \setkeys{blx@lbx}{#2}% - \let\do\blx@defbibstrings@i - \csxdef{abx@strings@#1}{\abx@dostrings}% - } - }{}} - - % - % 增加一个恢复域格式为标准样式的控制选项 - % v1.0k, 2018.05.15, by hzz - % - % 原理方法: - % 默认设置该选项为false,采用国标要求的域格式输出相关域 - % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域 - \newtoggle{bbx:gbfieldstd} - \DeclareBibliographyOption{gbfieldstd}[false]{% - \settoggle{bbx:gbfieldstd}{#1}% - } - - % - % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。 - % - \newtoggle{bbx:gbpub} - \DeclareBibliographyOption{gbpub}[true]{% - %\settoggle{bbx:gbpub}{#1} %或采用下面这一句 - \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}} - - % - % 增加控制析出文献来源前的标点符号//输出的选项 - % v1.0k, 2018.04.20,added in by hzz - \newtoggle{bbx:gbpunctin} - \DeclareBibliographyOption{gbpunctin}[true]{% - \settoggle{bbx:gbpunctin}{#1}} - - % - % 增加一个处理佚名或noauthor的控制选项 - % - % 原理方法:在顺序编码制中不需要使用,为与作者年制的兼容性考虑,这里也增加避免报错 - \DeclareBibliographyOption{gbnoauthor}[true]{}% - - - % - %为日期控制格式增加一个gb7714-2015选项 - % - \csdef{mkdaterangegb7714-2015}#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year} - {} - {\printtext[#1date]{% - \blx@gbdate{#1}{}}}% - \endgroup} - - \newrobustcmd*{\blx@gbdate}[3][]{% - \dateeraprintpre{#2#3year}% - \blx@imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}% - \iffieldundef{#2#3month}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3month}}}% - \iffieldundef{#2#3day}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3day}}}} - - %为姓名格式选择增加的计数器 - \newcounter{gbnamefmtcase} - \def\thegbnamefmtcase{\the\c@gbnamefmtcase} - %为数字标签格式选择增加的计数器/命令 - \newcommand{\mkgbnumlabel}[1]{\mkbibbrackets{#1}} - \def\gbbiblabelopt@bracket{\renewcommand{\mkgbnumlabel}[1]{\mkbibbrackets{##1}}} - \def\gbbiblabelopt@parens{\renewcommand{\mkgbnumlabel}[1]{\mkbibparens{##1}}} - \def\gbbiblabelopt@dot{\renewcommand{\mkgbnumlabel}[1]{##1\adddot}} - \def\gbbiblabelopt@plain{\renewcommand{\mkgbnumlabel}[1]{##1}} - \def\gbbiblabelopt@box{\renewcommand{\mkgbnumlabel}[1]{\framebox{##1}}} - \def\gbbiblabelopt@circle{\renewcommand{\mkgbnumlabel}[1]{\textcircled{##1}}} - %为文献表中数字标签对齐方式选择增加的计数器/命令 - \newcounter{gbalignlabel} - \def\thegbalignlabel{\the\c@gbalignlabel} - %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令 - \newcounter{gbcitelocalcase} - \newcounter{gbbiblocalcase} - \def\thegbcitelocalcase{\the\c@gbcitelocalcase} - \def\thegbbiblocalcase{\the\c@gbbiblocalcase} - - % 增加不同语言排序的切换选项 - % numeric样式,不使用该选项,这里给出仅为兼容性考虑 - % v1.0q,20190307,hzz - % - \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{} - - - % - % 增加本地化字符串的中英文切换选项 - % gbcitelocal指标注中的本地化字符串 - % gbbiblocal 指文献表中的本地化字符串 - % gblocal 指设置文献表和标注中的本地化字符串 - % v1.0o,20190103,hzz - % - \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{% - \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}% - \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}% - \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}% - } - - \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{% - \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}% - \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}% - \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}% - } - - \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{% - \ExecuteBibliographyOptions{gbbiblocal=#1}% - \ExecuteBibliographyOptions{gbcitelocal=#1}% - } - - % - % 增加序号标签格式处理选项 - % v1.0l,20180623,hzz - % - \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{% - \csuse{gbbiblabelopt@#1} - } - - % - % 增加姓名大小写格式处理选项 - % - \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{% - \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}% - \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}% - \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family - \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{} - \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given - \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family - } - - - % - % 增加标签对齐选项 - % - % right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式 - \DeclareBibliographyOption[string]{gbalign}[right]{% - \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{} - \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{} - \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{} - \ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{} - } - - - % - % 选项设置 - % - \ExecuteBibliographyOptions{ - %firstinits=true, 针对biblatex<3.3版本的选项设置,比如texlive2015中的3.0版 - giveninits=true, %针对3.3<=biblatex<3.5版本,比如texlive2016中的3.4版 - sorting=none, - useprefix=true, %名字的信息包括前缀 - date = year, %日期仅写到年 - maxbibnames = 3,%设置名字最大数量 - minbibnames = 3, %设置缩减后的名字最小数量 - maxitems = 1,%设置列表最大数量 - minitems = 1, %设置缩减后的列表最小数量 - isbn=false, - gbstyle=true, - gbtype=true, - gbcodegbk=false, - gbstrict=true, - gbtitlelink=false, - gbfieldstd=false, - gbpub=true, - gbpunctin=true, - gbbiblabel=bracket, - gbnamefmt=uppercase, - gbalign=right, - gbctexset=true, - %urldate =edtf, %针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版 - %eventdate =edtf,%针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版 - urldate =gb7714-2015, %iso,针对3.10<=biblatex版本的选项设置,比如texlive2018中的3.11版 - eventdate =gb7714-2015, - gblocal=gb7714-2015, - } - - -%===================================================================== -% 设置本地化字符串 -%===================================================================== - % - % 新建当地化字符串,用来记录“等”字符、“和”字符 - % - \NewBibliographyString{andotherscn} - \NewBibliographyString{andothersincitecn} - \NewBibliographyString{andothersincite} - \NewBibliographyString{andcn} - \NewBibliographyString{andothersjp} - \NewBibliographyString{andotherskr} - \NewBibliographyString{andjp} - \NewBibliographyString{andkr} - \NewBibliographyString{andincitecn} - \NewBibliographyString{andincite} - \NewBibliographyString{volumecn} - \NewBibliographyString{numbercn} - \NewBibliographyString{serialcn} - \NewBibliographyString{incn} - \NewBibliographyString{mathesiscn} - \NewBibliographyString{phdthesiscn} - \NewBibliographyString{editorcn} - \NewBibliographyString{editorscn} - - - % - % 修改一些当地化字符串 - % - % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件 - % 当然也可以增加比如上面定义的andotherscn - % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别 - \DefineBibliographyStrings{english}{ - bibliography = {\str@bibliography}, - references = {\str@references}, - bytranslator= {\str@bytranslator},%\addperiod,%将trans. by 改成 译 - and = {\addcomma},%将第2和3人名间的and符号改成逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 - andcn = {\addcomma},%and本地化字符串的中文对应词 - andincitecn = {\addcomma},%将标注中的分开,便于与文献表中的区分 - andincite = {\addcomma}, - %andothers = {et al.}, %将超过3个人名的省略,et al.改成为 等 - andotherscn = {\str@andotherscn}, %将超过3个人名的省略,et al.改成为 等 - andothersincitecn={\str@andotherscn},%将标注中的分开,便于与文献表中的区分 - andothersincite={et al\adddot}, - backrefpage = {\str@backrefpage:}, - backrefpages = {\str@backrefpages:}, - in={in\intitlepunct}, - volumecn={\str@volumecn}, - numbercn={\str@numbercn}, - serialcn={\str@serialcn}, - andothersjp={他}, - andotherskr={외}, - andjp={和}, - andkr={和}, - incn={\str@incn\addcolon\addspace}, - mathesiscn={\str@mathesiscn}, - phdthesiscn={\str@phdthesiscn}, - editorscn={\str@editorcn}, - editorcn={\str@editorcn}, -} - - % - % 增加两个命令用于临时的局部的修改本地化字符串 - % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串 - % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内 - % v1.0t,hzz,20190525 - \newcommand{\setlocalbibstring}[2]{% - \csdef{abx@sstr@#1}{#2}} - \newcommand{\setlocalbiblstring}[2]{% - \csdef{abx@lstr@#1}{#2}} - -%===================================================================== -% 动态数据修改 -%===================================================================== -% -% 各层次的数据映射和动态修改 -% -% 原理方法: -% 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中 -% 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性 -% 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个 -% 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次 -% 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。 -% 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符, -% 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息 -% -% 不同的文献类型使用相同的驱动输出可以有5种方法: -% 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型 -% 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型 -% 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型 -% 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名 -% 驱动别名定义本质上是做了驱动层映射 -% 5. 直接定义不同的类型的驱动,但驱动内容相同。 -% -% 关于数据映射和驱动使用的考虑如下: -% 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换 -% 2. 为减少代码量,尽量少做内容相同的不同类型驱动 -% 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名 -% 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type -% 可以在样式层映射做某些需要避免这种默认处置的转换 -% 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射 -% -% 文献类型和驱动考虑如下: -% 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article -% newpaper映射为article,并以note域做区分特殊处理 -% 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook -% standard映射为book或inbook,并以note域做区分特殊处理 -% collection和proceedings基本与book类似,因此做book驱动别名处理 -% incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理 -% 3. 专利类型有其特殊性,考虑patent类型 -% 4. 电子资源类型有其特殊性,考虑online类型 -% 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更细日期 -% 因此考虑用一种类型来输出,使用report类型 -% 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略, -% 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型 -% 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时, -% 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。 -% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述 -% 更多的信息,因此不存在网址时,独立做一个备选格式 -% 9. 出版项主要以如下方式处理: -% (a) location+institution+date 仅用于连续出版物 -% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report -% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型 -% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。 -% (e) 不输出,主要用于连续出版物析出的文献 -% 10. 日期以如下方式处理: -% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year -% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate -% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date -% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate - -\DeclareSourcemap{%\perdatasource{examples.bib} -\maps[datatype=bibtex]{% - \map{%当没有作者时将editor转成author - \pernottype{inbook}%因为in系列中editor可能用来表示bookauthor,所以排除 - \pernottype{inproceedings} - \pernottype{incollection} - \pernottype{periodical}%因为peridical直接使用editor,所以排除 - %注意notfield在低版本biblatex中没有 - %\step[notfield=author,final]%当author不存在,将editor复制给author - \step[fieldsource=editor,fieldtarget=author]%并删除editor - } - \map{%当没有作者时将translator转成author - \pernottype{inbook} - \pernottype{inproceedings} - \pernottype{incollection} - %\step[notfield=author,final]%当author不存在,将translator复制给author - \step[fieldsource=translator,fieldtarget=author]%并删除translator - } - \map{%让address和location同步,biblatex中address是location的别名 - %因此输出的时候只有location信息,但处理过程中是可以存在address的。 - \step[notfield=address,final]% - \step[fieldsource=location,final] - \step[fieldset=address,origfieldval] - } - \map{ - \step[notfield=location,final]% - \step[fieldsource=address,final] - \step[fieldset=location,origfieldval] - } - \map{%处理在bib文件用mark标记文献类型标识符的情况 - \step[fieldsource=mark,final] - \step[fieldset=usera, origfieldval] - } - \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况 - \step[fieldsource=nameformat,match=lowercase,final] - \step[fieldset=namefmtid,fieldvalue={1}] - } - \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况 - \step[fieldsource=nameformat,match=givenahead,final] - \step[fieldset=namefmtid,fieldvalue={2}] - } - \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况 - \step[fieldsource=nameformat,match=familyahead,final] - \step[fieldset=namefmtid,fieldvalue={3}] - } - \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况 - \step[fieldsource=nameformat,match=pinyin,final] - \step[fieldset=namefmtid,fieldvalue={4}] - } - \map{%根据article确定文献类型标识符 - \pertype{article} - \step[fieldset=usera, fieldvalue={J}] - } - \map{%根据periodical确定文献类型标识符 - \pertype{periodical} - \step[fieldset=usera, fieldvalue={J}] - \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor - \step[fieldset=editor, origfieldval] - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符 - \pertype{newspaper} - \step[fieldset=usera, fieldvalue={N}] - \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断 - } - \map{%对应增加的一个数据库类型database确定文献类型标识符 - \pertype{database} - \step[fieldset=usera, fieldvalue={DB}] - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%对应增加的一个数据集类型dataset确定文献类型标识符 - \pertype{dataset} - \step[fieldset=usera, fieldvalue={DS}]% - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%对应增加的一个软件类型software确定文献类型标识符 - \pertype{software} - \step[fieldset=usera, fieldvalue={CP}] - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%对应增加的一个舆图类型map确定文献类型标识符 - \pertype{map} - \step[fieldset=usera, fieldvalue={CM}]% - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%对应增加的一个档案类型archive确定文献类型标识符 - \pertype{archive} - \step[fieldset=usera, fieldvalue={A}] - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以 - %当misc类型带有网址时,直接将其转换为online类型 - \pertype{misc} - \step[fieldsource=url,final] - \step[typesource=misc,typetarget=online] - } - \map{%对应增加的一个备选类型misc确定文献类型标识符 - \pertype{misc} - \step[fieldset=usera, fieldvalue={Z}]% - } - \map{ - \pertype{book} - \pertype{inbook} - \step[fieldset=usera, fieldvalue={M}] - \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition - \step[fieldset=edition, origfieldval] - } - \map{%兼容老的standard类型,确定文献类型标识符 - \pertype{standard} - \step[fieldset=usera, fieldvalue={S}] - \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断 - } - \map{ - \pertype{patent} - \step[fieldset=usera, fieldvalue={P}] - } - \map{ - \pertype{inproceedings} - \pertype{conference}%兼容老的conference类型 - \step[fieldset=usera, fieldvalue={C}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{proceedings} - \step[fieldset=usera, fieldvalue={C}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{incollection} - \step[fieldset=usera, fieldvalue={G}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{collection} - \step[fieldset=usera, fieldvalue={G}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{report} - \pertype{techreport}%兼容老的techreport类型 - \step[fieldset=usera, fieldvalue={R}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{thesis} - \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型 - \pertype{phdthesis} - \step[fieldset=usera, fieldvalue={D}] - \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{ - \pertype{online} - \pertype{electronic}%兼容老的electronic类型 - \pertype{www}%兼容老的www类型 - \step[fieldset=usera, fieldvalue={EB}] - \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册 - \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 - \step[fieldset=institution, origfieldval] - } - \map{ - \pertype{manual} - \step[fieldset=usera, fieldvalue={A}] - \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version - \step[fieldset=version, origfieldval] - \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 - \step[fieldset=institution, origfieldval] - } - \map{ - \pertype{unpublished} - \step[fieldset=usera, fieldvalue={Z}] - } - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - } - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={editor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - }% - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={translator}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - }% - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={bookauthor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - }% - \map{%处理一些用year表示date的情况 - %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。 - %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息 - \step[fieldsource=year] - \step[fieldset=date, origfieldval] - } - \map{%将entrykey放入keywords中用于后期使用 - \step[fieldsource=entrykey] - \step[fieldset=keywords, origfieldval] - } - \map{\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=userd,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=userd,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=userd,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=userd,fieldvalue={korean}]%韩语 - } - \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题 - \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]% - \step[fieldset=userd, fieldvalue={chinese}] - } - \map{%将没有设置userd,且存在title域的默认设置为英文 - \step[fieldsource=title,final] - \step[fieldset=userd,fieldvalue={english}] - } - \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=userf,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=author,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=userf,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=author,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=userf,fieldvalue={korean}]%韩语 - } - \map{%作者的中文判断 - \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=userf, fieldvalue={chinese}] - } - \map{%将没有设置userf,且存在author域的默认设置为英文 - \step[fieldsource=author,final] - \step[fieldset=userf,fieldvalue={english}] - } - \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=usere,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=translator,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=usere,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=translator,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=usere,fieldvalue={korean}]%韩语 - } - \map{%译者的中文判断 - \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=usere, fieldvalue={chinese}] - } - \map{%将没有设置usere,且存在translator域的默认设置为英文 - \step[fieldsource=translator,final] - \step[fieldset=usere,fieldvalue={english}] - } - \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=userc,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=userc,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=userc,fieldvalue={korean}]%韩语 - } - \map{%编者的中文判断 - \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 - \step[fieldset=userc, fieldvalue={chinese}] - } - \map{%将没有设置userc,且存在editor域的默认设置为英文 - \step[fieldsource=editor,final] - \step[fieldset=userc,fieldvalue={english}] - } - \map{\step[fieldsource=bookauthor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=userb,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=bookauthor,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=userb,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=bookauthor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=userb,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=bookauthor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=userb,fieldvalue={korean}]%韩语 - } - \map{%编者的中文判断 - \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 - \step[fieldset=userb, fieldvalue={chinese}] - } - \map{%将没有设置userc,且存在editor域的默认设置为英文 - \step[fieldsource=bookauthor,final] - \step[fieldset=userb,fieldvalue={english}] - } - \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language - \step[fieldset=language,origfieldval]%本身language存在则不设定 - } - \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language - \step[fieldset=language,origfieldval] - }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。 - \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。 - \step[fieldset=language,fieldvalue={english}] - } - \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断, - %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况, - %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd - \step[fieldsource=language] - \step[fieldset=userd,origfieldval] - } - \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言 - \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final] - \step[fieldset=langid,fieldvalue={english}] - } - \map{ - \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final] - \step[fieldset=langid,fieldvalue={russian}] - } - \map{% - \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final] - \step[fieldset=langid,fieldvalue={french}] - } - \map{% - \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, - \step[fieldset=langid,fieldvalue={english}] - } - \map{% - \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, - \step[fieldset=langid,fieldvalue={english}] - } - \map{% - \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english, - \step[fieldset=langid,fieldvalue={english}] - } -} -} - - - % - % 修改输入的参考文献数据,样式层的操作 - % - % 原理方法:biblatex3.4以上版本map可使用foreach选项来处理特殊字符 - \DeclareStyleSourcemap{ - \maps[datatype=bibtex]{ - \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook, - %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 - %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断 - \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook - \step[typesource=standard, typetarget=inbook, final] - } - \map{%尝试未定义数据模型的standard类型映射为book,standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 - \step[typesource=standard, typetarget=book, final]%当不存在booktitle域是映射为book - } -% \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置 -% \step[typesource=mastersthesis, typetarget=thesis, final] -% %\step[fieldset=type, fieldvalue=mathesis] -% } -% \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置 -% \step[typesource=phdthesis, typetarget=thesis, final] -% %\step[fieldset=type, fieldvalue=phdthesis] -% } - \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置 - \step[typesource=techreport, typetarget=report, final] - %\step[fieldset=type, fieldvalue=techreport] - } - \map{% - \pertype{report} - \step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=report,typetarget=online] - \step[fieldset=note,fieldvalue={report}] - } - \map{% - \pertype{thesis} - \step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=thesis,typetarget=online] - } - \map{% - \pertype{manual} - \step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=manual,typetarget=online] - } - \map{% - \pertype{unpublished} - \step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=unpublished,typetarget=online] - } - \map{% - \pertype{database} - \step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=databasetypetarget=online] - } - \map{% - \pertype{dataset} - \step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=dataset,typetarget=online] - } - \map{% - \pertype{software} - \step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=software,typetarget=online] - } - \map{% - \pertype{map} - \step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=map,typetarget=online] - } - \map{% - \pertype{archive} - \step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=archive,typetarget=online] - } - \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确) - \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 - \step[fieldset=keywords, fieldvalue={,}, append] - \step[fieldset=keywords, origfieldval, append] - } - \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ - \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] - } - \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ - \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] - } - \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,% - address,location,institution,organization}]{ - \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - } - } - -% -%驱动别名等价于驱动层映射 -% -\DeclareBibliographyAlias{newspaper}{article}% -\DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动 -\DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动 -\DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动 -\DeclareBibliographyAlias{collection}{book}%%文集类型驱动 -\DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动 -\DeclareBibliographyAlias{thesis}{manual}%学位论文驱动 -\DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动 -\DeclareBibliographyAlias{database}{manual} -\DeclareBibliographyAlias{dataset}{manual} -\DeclareBibliographyAlias{software}{manual} -\DeclareBibliographyAlias{map}{manual} -\DeclareBibliographyAlias{archive}{manual} - - -%===================================================================== -% 参考文献表环境 -%===================================================================== -% -% 列表格式 -% -% 增加一个\bibitemindent尺寸用于控制list环境的itemindent -% v1.0l,20180615,hzz -% v1.0t,20200319,hzz,增加尺寸\biblabelextend使某些字体下标签宽度不足时可增加标签宽度 -\setlength{\bibhang}{\biblabelsep}% -\newlength{\bibitemindent} -\setlength{\bibitemindent}{0pt} -\newlength{\biblabelextend} -\setlength{\biblabelextend}{0pt} - - -\defbibenvironment{bibliography} - {\list - {\printtext[labelnumberwidth]{% - \printfield{labelprefix}% - \printfield{labelnumber}}} - {\addtolength{\labelnumberwidth}{\biblabelextend}% - \setlength{\labelwidth}{\labelnumberwidth}% - \setlength{\labelsep}{\biblabelsep}% - \setlength{\leftmargin}{\bibhang}% - \addtolength{\leftmargin}{\labelnumberwidth}% - \setlength{\itemindent}{\bibitemindent}% - \setlength{\itemsep}{\bibitemsep}% - \setlength{\parsep}{\bibparsep}}% - \renewcommand*{\makelabel}[1]{\hss##1}} - {\endlist} - {\item} - -% -% 顺序编码制-标签对齐方式处理 -% -% 原理方法:利用选项提供的计数器数值做选择 -% 左对齐,右对齐为list环境下的处理,此时list环境的\labelwidth只能设置一个,是最宽标签的宽度 -% 项对齐则是在段落环境下做的处理。 -% 左对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距可变 -% 右对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距相等,标签与页边距离可变 -% 项对齐时,序号标签贴在页边,序号标签与参考文献项内容的间距相等 -% 修改序号标签格式为: -% \DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} %源来自numeric.BBX -% \DeclareFieldFormat{labelnumberwidth}{\ttfamily\mkbibbrackets{#1}\hfill} -\DeclareFieldFormat{labelnumberwidth}{% -\ifcase\value{gbalignlabel}%右对齐,整个标签为右对齐 - \mkgbnumlabel{#1}% -\or%左对齐,整个标签为左对齐 - \mkgbnumlabel{#1}\hfill% -\or%中间对齐,比如:序号数字居于[]中间 - \hfil\mkgbnumlabel{\hfill#1\hfill}\hfil% -\fi} - -% -% 修改序号标签格式为以各条参文献为基础进行对齐的方式,即序号与条目内容间隔相等的方式。 -\def\setaligngbstyle{% -\def\blx@bibitem##1{% - \blx@ifdata{##1} - {\begingroup - \blx@getdata{##1}% - \blx@bibcheck - \iftoggle{blx@skipentry}{}{% - \blx@setdefaultrefcontext{##1}% - \global\let\blx@noitem\@empty - \blx@setoptions@type\abx@field@entrytype - \blx@setoptions@entry - \blx@thelabelnumber - \addtocounter{instcount}\@ne - \blx@initsep - \blx@namesep - \csuse{blx@item@\blx@theenv}\relax -% \blx@initsep %移动到上面去,恢复bibnamesep等的作用机制 -% \blx@namesep - \csuse{blx@hook@bibitem}% - \blx@execute - \blx@initunit - \blx@anchor - \blx@beglangbib - \bibsentence - \blx@pagetracker - \blx@driver\abx@field@entrytype - \blx@postpunct - \blx@endlangbib}% - \par\endgroup}%这里增加了一个\par - {}} -\newlength{\lengthid} -\newlength{\lengthlw} -\newcommand{\itemcmd}{% -\settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}} -\addtolength{\lengthid}{\biblabelsep} -\setlength{\lengthlw}{\textwidth} -\addtolength{\lengthlw}{-\lengthid} -\addvspace{\bibitemsep}%恢复\bibitemsep的作用 -%\parshape 2 0em \textwidth \lengthid \lengthlw -\hangindent\lengthid -\mkgbnumlabel{\printfield{labelnumber}}% -\hspace{\biblabelsep}} -% -% 简单的段落环境 -\defbibenvironment{bibliography} -{\begingroup\setlength{\parindent}{0em}} -{\endgroup} -{\itemcmd}} - - -%===================================================================== -% 设置单元或块等的标点 -%===================================================================== -\renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin -\renewcommand*{\subtitlepunct}{\addcolon\addspace} %修改标题和其它标题信息间的标点,来源biblatex.def, -% -% 利用set实现的多语言文献不同语言间的分隔符 -% 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进 -% -% 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets -% 这里调整一下两种语言参考文献的间隔,源来自biblatex.def -\renewcommand*{\entrysetpunct}{\adddot\newline\nobreak} -\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号 -%\renewcommand{\relateddelim}{}%\par - -%===================================================================== -% 修改域的格式,重定义域的输出宏 -%===================================================================== -% -% 新增文献类型标识符的格式 -% []前的nobreak,从GB4.1节的例子看不应该加,所以去掉 -% 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上 -% 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉 -% -\DeclareFieldFormat{gbtypeflag}{% -\iftoggle{bbx:gbmedium}% -{\iftoggle{bbx:url}% - {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% - }% - {\ifentrytype{online}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% - }}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% -} - -% -% 新增用于报纸的文献类型标识符的格式 -% -\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper -\iftoggle{bbx:gbmedium}% -{\iftoggle{bbx:url}% - {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% - {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% - }% - {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% -}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}% -} - -% -% 新增用于标准的文献类型标识符的格式 -% -\DeclareFieldFormat{gbtypeflags}{%用于标准standard -\iftoggle{bbx:gbmedium}% -{\iftoggle{bbx:url}% - {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% - {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% - }% - {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% -}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}% -} - -% -% 重设title等参考文献信息的输出格式 -% -% 原理方法:修改来自biblatex.def文件的原格式 -\newcommand{\bibtitlefont}{} -\newcommand{\bibauthorfont}{} -\newcommand{\bibpubfont}{} - -% -% 作者信息的输出格式 -% -% 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen -% 20180603,v1.0l,增加使用nameformat域来选择姓名格式 -\DeclareNameFormat{namefmtselected}{% -\iffieldundef{namefmtid}{}% -{\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}% -\ifcase\value{gbnamefmtcase}% - \ifgiveninits - {\usebibmacro{name:gbuppercase} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:gbuppercase} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% -\or - \ifgiveninits - {\usebibmacro{name:gblowercase} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:gblowercase} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% -\or - \ifgiveninits - {\usebibmacro{name:given-family} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:given-family} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% -\or - \ifgiveninits - {\usebibmacro{name:family-given} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:family-given} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% -\or -\usebibmacro{name:gbpinyin} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}% -\or - \ifnumequal{\value{listcount}}{1} - {\ifgiveninits - {\usebibmacro{name:family-given} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:family-given} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% - \ifboolexpe{% - test {\ifdefvoid\namepartgiven} - and - test {\ifdefvoid\namepartprefix}} - {} - {\usebibmacro{name:revsdelim}}} - {\ifgiveninits - {\usebibmacro{name:given-family} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:given-family} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}}% -\fi - \usebibmacro{name:andothers}} - -\DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式 -\DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family -\DeclareNameAlias{citename}{default}% Default used by \citename - -\DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace} -%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% - -%GB/T 7714-2015 风格,全部大写 -\newbibmacro*{name:gbuppercase}[4]{\bibauthorfont% -\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 -\renewcommand*{\revsdnamepunct}{}% - \ifuseprefix% - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifdefvoid{#3}{}{% - \ifcapital% - {\mkbibnameprefix{\MakeCapital{#3}}\isdot}% - {\mkbibnameprefix{#3}\isdot}% - \ifprefchar{}{\bibnamedelimc}}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% - \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital - \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号 - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% - \ifboolexpe{% - test {\ifdefvoid{#2}} - and - test {\ifdefvoid{#3}}} - {}{\revsdnamepunct}% - \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital - \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% - \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号 -} - -%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 -\newbibmacro*{name:gblowercase}[4]{\bibauthorfont% - \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 - \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifdefvoid{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifprefchar{}{\bibnamedelimc}}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% - \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital - \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号 - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% - \ifboolexpe{% - test {\ifdefvoid{#2}} - and - test {\ifdefvoid{#3}}} - {}{\revsdnamepunct}% - \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital - \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} - \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号 -} - -%中文常见风格,汉语拼音全拼模式 -\newbibmacro*{name:gbpinyin}[4]{\bibauthorfont% -\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY -\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def -\renewrobustcmd*{\bibnamedelima}{\mbox{-}}% - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifdefvoid{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifprefchar{}{\bibnamedelimc}}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% - \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamegiven{#2}}\isdot}%\MakeCapital - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}} - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% - \ifboolexpe{% - test {\ifdefvoid{#2}} - and - test {\ifdefvoid{#3}}} - {} - {\revsdnamepunct}% - \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital - \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% -} - - -\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily -%\urlstyle{rm} %使用这句也一样 -\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行 -\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行 -\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行 -\DeclareFieldFormat{doi}{% - \rmfamily{DOI}\addcolon\space - \ifhyperref - {\href{https://doi.org/#1}{\nolinkurl{#1}}} - {\nolinkurl{#1}}} - -\DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线 - -% -% beamer中文献标题后的标点问题 -% v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen -% -% 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况: -% texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于 -% 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响 -% 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct -\@ifclassloaded{beamer}{ - \DeclareFieldFormat{title}{#1}% - \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1} - \AtBeginDocument{% - \patchcmd{\abx@macro@title}{\newunitpunct}{}{}{}}}{} - - - % - % 专利的公告日期、或报纸的日期的输出宏 - % 20160701,v1.0,新增加 - % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen - % - % 原理方法:加上printtext避免破坏异步标点机制 - % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份 - % 所以无法再用选项设置的方法,印象需要用底层的命令 - % 这里可以用\blx@isodate,但用自定义的\blx@gbdate,以避免版本判断 - \newbibmacro*{newsdate}{%% - \printtext{\blx@gbdate{}{}}%%\blx@isodate{}{}% - } - - \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 - \ifboolexpr{% - test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% - }% - {}%更新或修改日期通常有day信息 - {\iffieldundef{year}{% - \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% - {\printtext{(}\printenddate\printtext{)}}% - }{\iffieldequalstr{year}{}{%因为year存在,但为空 - }{\printtext{(}\blx@gbdate{}{}\printtext{)}}% - }% - }}% - - - % - % biblatex>v3.8版利用related实现双语文献的处理 - % - %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了, - %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息 - %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中 - \newcommand{\defdoublelangentry}[2]{% - \edef\entrykeya{#1} - \edef\entrykeyb{#2} - \DeclareStyleSourcemap{ - \maps[datatype=bibtex]{ - \map{ - \step[fieldsource=entrykey, match=\entrykeya, final] - \step[fieldset=related, fieldvalue=\entrykeyb] - } - } - } - } - - % 关联文献的输出格式 - % - % 关联文献间的分隔符 - % - \renewcommand{\relateddelim}{\adddot\newline\nobreak}%\par,而作者年样式不需要修改,因为没有项对齐的标签问题 - % - % 关联文献块前的分隔符,针对biblatex>3.11 - % - % 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏 - \ifdef{\begrelateddelim}{\renewcommand{\begrelateddelim}{\adddot\newline\nobreak}}{} - - - -% -% 新增一个样式用于调整期刊年份的格式,只打印年份 -% -\newbibmacro*{periodical+issue}{% - \printtext{%去掉了[parens] - \iffieldundef{issue} - {%\usebibmacro{date}%修改为下一句 - }% - {\printfield{issue}% - \setunit*{\addspace}% - %\usebibmacro{date}%修改为下一句 - }% - }% - %\newunit -} - -% -% 重设专利title的输出,将文献类型标识符输出出去 -% -\renewbibmacro*{patenttitle}{%原输出来自biblatex.def文件 - \ifboolexpr{% - test{\iffieldundef{title}}% - and% - test{\iffieldundef{subtitle}}% - }% - {}% - {\printtext[title]{\bibtitlefont% - \printfield[titlecase]{title}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct}% - \printfield[titlecase]{subtitle}}% - \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 - {\setunit{\subtitlepunct}\printfield{titleaddon}}% - \setunit{\subtitlepunct}\printfield{number}%写专利号 - \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}% - %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 - %\newunit - }% -}% -} - -% -% 编者类型的本地化字符串输出 -% v1.0q 2019-03-01 hzz -% 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符 -% 能对不同文境作设置的包括排序,标签等 -% 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串 -% -\DeclareDelimFormat{streditortypes}{% - \edef\userfieldabcde{userd}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbbiblocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% - \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% - \or% - \bibstring{\thefield{editortype}scn}% - \or% - \addcomma\addthinspace\bibstring{\thefield{editortype}s}% - \fi}% -% -\DeclareDelimFormat{streditortype}{% - \edef\userfieldabcde{userd}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbbiblocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% - \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% - \or% - \bibstring{\thefield{editortype}cn}% - \or% - \addcomma\addthinspace\bibstring{\thefield{editortype}}% - \fi}% - - -% -% 修改series域的输出格式 -% 2019.05.01,v1.0r,byhzz -\renewbibmacro*{series+number}{% - \printfield{series}% - %\setunit*{\addspace}% - %\printfield{number}% - %\newunit - } - -%===================================================================== -%设置驱动格式 -%===================================================================== - -%中文环境的局部化代码 -\def\localsetchinesecode{% -\ifboolexpr{% -togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}% -}% -{% -\iftoggle{bbx:gbfieldstd}{}{% -\DeclareFieldFormat{title}{##1\adddot\addthinspace}% -\DeclareFieldFormat{journaltitle}{##1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪 -\DeclareFieldFormat{issuetitle}{##1}% -\DeclareFieldFormat{maintitle}{##1}% -\DeclareFieldFormat{booktitle}{##1}% -\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 - [article,patent,thesis,unpublished]% - {title}{##1\adddot\addthinspace}%\mkbibquote{##1\isdot} -\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 - [inbook,incollection,inproceedings]% - {title}{##1}%\nopunct\unspace -\DeclareFieldFormat{url}{\url{##1}}%%url相关输出,url域修改如本行,源来自biblatex.def -% -% 标题的字母大小写格式修改 -% -% 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase -% 因为titlecase is applied to the contents of the field directly,title is not -%\DeclareFieldFormat{titlecase}{\MakeCapital##1}%重设标题格式,将其修改为首字母大写 -\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{% -\iffieldundef{url}{\MakeCapital##1}{% -\href{\thefield{url}}{##1}}}{\MakeCapital##1}}%重设标题格式,将其修改为首字母大写 -\DeclareFieldFormat{pages}{##1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{##1} -}% -% -% 修改译者位置格式 -% -% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式 -\renewbibmacro*{bytranslator+others}{% - \ifnameundef{translator}% - {}% - {%\usebibmacro{bytranslator+othersstrg} - %\setunit{\addspace}% - \printnames[bytranslator]{translator}% - \clearname{translator}% - %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理 - %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串 - \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。 - %\setunit{\addspace}% - \newunit}% - \usebibmacro{withothers}}% -% -% 修改作者数量超过限定值,做省略时的处理格式 -% v1.0,20160701,hzz -% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim -% -% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。 -\renewbibmacro*{name:andothers}{% - \ifboolexpr{% - test {\ifnumequal{\value{listcount}}{\value{liststop}}}% - and - test \ifmorenames - }{\ifnumgreater{\value{liststop}}{1}% - {\finalandcomma}% - {}% -\printdelim{andothersdelim}\printdelim{strandothersdelim}% -}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如: -%袁训来, 陈哲, 肖书海, 等. -%胡泳, 范海燕, 译. -%潘惠霞, 魏婧, 杨艳, 等译. -\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理 -}}% -% -% 修改省略作者后的本地化字符串,比如et al. -% v1.0o,20190103,hzz -% -% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。 -% 非默认情况,根据选项信息,选择选择强制中文或英文 -% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 -% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 -\DeclareDelimFormat{strandothersdelim}{% - \edef\userfieldabcde{userd}% - \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbbiblocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}% - \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}% - \or% - \bibstring{andotherscn}% - \or% - \bibstring{andothers}% - \fi}% -% -% 修改最后一个作者前的字符串,比如 and -% v1.0o,20190103,hzz -% -% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。 -% 非默认情况,根据选项信息,选择选择强制中文或英文 -% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 -% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 -\DeclareDelimFormat{finalnamedelim}{% - \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% - \addspace% - \edef\userfieldabcde{userd}% - \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbbiblocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}% - \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% -\space% - \or% - \bibstring{andcn}\space% - \or% - \bibstring{and}\space% - \fi}% -% -% url和url日期格式 -% - \renewbibmacro*{url+urldate}{% - %\usebibmacro{url}%%更换url的位置,放到下面 - \iffieldundef{urlyear}% - {}{%\setunit*{\addspace}% - \usebibmacro{urldate}}% - \setunit{\addperiod\addspace}% - \usebibmacro{url}}% - \renewbibmacro*{url}{\printfield{url}}% -% -% 重设title的输出 -% -% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen -% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件 -% 利用toggle做标识符是否输出的判断 -\renewbibmacro*{title}{% - \ifboolexpr{% - test{\iffieldundef{title}}% - and - test{\iffieldundef{subtitle}}% - }% - {}% - {\printtext[title]{\bibtitlefont%增加字体控制命令 - \printfield[titlecase]{title}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct}% - \printfield[titlecase]{subtitle}}% - \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 - {\setunit{\subtitlepunct}\printfield{titleaddon}}% - \iftoggle{bbx:gbtype}{% - \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 - {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 - {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 - {\printfield[gbtypeflag]{usera}}}%其它 - }}{}% - %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 - %\newunit -}% -}}% -% -% 日期信息的输出格式,针对biblatex<3.7版本 -% -\DeclareFieldFormat{urldate}{##1}% -\renewbibmacro*{urldate}{% -\addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 -% -% 调整doi+eprint+url格式 -% -% 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。 -\renewbibmacro*{doi+eprint+url}{% -% \iftoggle{bbx:doi}%把doi的位置放到url后面 -% {\printfield{doi}} -% {}% - %\newunit\newblock - \iftoggle{bbx:eprint} - {\iffieldundef{eprint}{}{\newunit\usebibmacro{eprint}}} - {}% - %\newunit\newblock - \iftoggle{bbx:url} - {\usebibmacro{url+urldate}} - {} - \newunit\newblock - \iftoggle{bbx:doi} - {\printfield{doi}} - {}}% -% -% 调整页码的格式,即chapter+pages格式 -% -\renewbibmacro*{chapter+pages}{% -\iftoggle{bbx:gbstrict}{}{% - \printfield{chapter}}% - \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出 - \setunit{\bibpagespunct}% - \printfield{pages}}% - %\newunit %这里的标点去掉 -}% -% -% 当location等出版项超过maxitem缩减后不再输出etal -% -\DeclareListFormat{location}{% - \usebibmacro{list:delim}{##1}% - ##1\isdot}% -\DeclareListAlias{institution}{location}% -\DeclareListAlias{publisher}{location}% -% 新增一个样式用于输出连续出版物的地址,单位,时间, -% 用于periodical连续出版物的出版社和地址的处理 -% -% v1.0k,20180425,为出版信息增加字体控制命令,hzz -% %类似\newbibmacro*{publisher+location+date} -\newbibmacro*{location+institution+date}{\bibpubfont% -\iftoggle{bbx:gbpub}% -{\testCJKfirst{userd}% -\ifboolexpr{% -test {\iflistundef{location}} and test {\iflistundef{institution}}% -}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}% -{\printtext{[S.l.\space :\space s.n.\adddot]}}% -}{% -\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}% - {\printlist{location}}% -\addcolon\addspace% -\iflistundef{institution}{% -\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}% \bibstring{nopublisher}%[s.n.\adddot] -{\printlist{institution}}}% -\setunit{\addcomma\addspace}% - %\usebibmacro{date}% - \printfield{year}% - \bibrangedash% - \iffieldundef{endyear}{}{\printfield{endyear}}% - \newunit}% -{\printlist{location}% - \iflistundef{institution}% - {\setunit*{\addcomma\space}} - {\setunit*{\addcolon\space}}% - \printlist{institution}% - \setunit*{\addcomma\space}% - \usebibmacro{date}% - \newunit}% -}% -% -% 通用的出版社和地址的处理 -% -% 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。 -% 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。 -% 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理 -\renewbibmacro*{publisher+location+date}{\bibpubfont% -\iftoggle{bbx:gbpub}% -{\testCJKfirst{userd}% - \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }% - {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}% - {\iflistundef{location}{%\adddot - \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 - {\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress} - {\printlist{location}\addcolon\addspace}%%\addcolon\addspace% - \iflistundef{publisher}{% - \iffieldequalstr{note}{standard}{}% - {\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}% - {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}% - {\printlist{publisher}}}% -\setunit*{\addcomma\addspace}%\addcomma\addspace% -\usebibmacro{date}%%\newunit %去掉这个标点 -}% -{\printlist{location}% - \iflistundef{publisher} - {\setunit*{\addcomma\space}} - {\setunit*{\addcolon\space}}% - \printlist{publisher}% - \setunit*{\addcomma\space}% - \usebibmacro{date}%%\newunit - }% -}% -% -% 修改了一个institution+location+date用于manual、report、thesis等类型 -% -% 20180425,v1.0k,增加了字体控制命令,hzz -% 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉 -\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。 -{\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉 - \iflistundef{institution} - {\setunit*{\addcomma\space}} - {\setunit*{\addcolon\space}}% - \printlist{institution}% - \setunit*{\addcomma\space}% - \usebibmacro{date}% - %\newunit - }}% -% -% 对volume卷信息格式做出修改 -% v1.0o,20190105,hzz -% -\DeclareFieldFormat{volume}{% -\testCJKfirst{userd}% -\iftoggle{ifCJKforgbt}% -{\bibstring{serialcn}##1\bibstring{volumecn}}% -{\bibstring{volume}~##1}% -}% volume of a book -\DeclareFieldFormat[article,periodical]{volume}{##1}% volume of a journal -% -% 对number册信息格式做出修改 -% v1.0o,20190105,hzz -% -\DeclareFieldFormat{number}{##1}% -\DeclareFieldFormat[book,collection,inbook,% -incollection,proceedings,inproceedings]{number}{% -\testCJKfirst{userd}% -\iftoggle{ifCJKforgbt}% -{\bibstring{serialcn}##1\bibstring{numbercn}}% -{##1}% -}% -% -% 对edition版本信息格式做出修改 -% -\DeclareFieldFormat{edition}{%源来自biblatex.DEF -\testCJKfirst{userd}% -\iftoggle{ifCJKforgbt}% -{\ifinteger{##1}% -{\printtext{##1\str@edition}}% -{##1\isdot}}% -{\ifinteger{##1}% -{\mkbibordedition{##1}~\bibstring{edition}}% -{##1\isdot}}}% -% -% 对version的版本信息做出修改 -% -\DeclareFieldFormat{version}{%源来自biblatex.DEF -\testCJKfirst{userd}% -\ifinteger{##1}% -{\iftoggle{ifCJKforgbt}{\printtext{##1\str@edition}}% -{\mkbibordedition{##1}~\bibstring{version}}}% -{##1\isdot}}% -% -% 修改析出文献的文集的标题与附加标题间的符号 -% -\renewbibmacro*{booktitle}{% - \ifboolexpr{% - test {\iffieldundef{booktitle}} - and - test {\iffieldundef{booksubtitle}} - }% - {}% - {\printtext[booktitle]{\bibtitlefont% - \printfield[titlecase]{booktitle}% - \setunit{\subtitlepunct}% - \printfield[titlecase]{booksubtitle}}% - \newunit%标点换成下一句 - \setunit{\subtitlepunct}}% - \printfield{booktitleaddon}}% -% -% 调整期刊名的格式 -% -% v1.0k,20180425,增加了字体控制命令,hzz -\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx - \usebibmacro{journal}% - %\setunit*{\addspace}% - \setunit*{\addcomma\addspace}%修改为增加一个逗号 - \iffieldundef{series} - {} - {\newunit - \printfield{series}% - \setunit{\addspace}}% - %\usebibmacro{volume+number+eid}% - %\setunit{\addspace}% - \usebibmacro{issue+date}% - %\setunit{\addcolon\space}% - \iffieldundef{volume}{}{\setunit{\addcomma\space}}% - %换成逗号和空格 - \usebibmacro{issue}% - \usebibmacro{volume+number+eid}%把卷期放到年份后面 - %\newunit - }% -% -% 调整期刊卷和期的格式 -% -\renewbibmacro*{volume+number+eid}{%源来自standard.bbx -\iftoggle{bbx:gbfieldstd}{% - \printfield{volume}% - \setunit*{\adddot}% - \printfield{number}% - \setunit{\addcomma\space}% - \printfield{eid}}{% - \printfield{volume}% - %\setunit*{\adddot}%去掉点号 - %\printfield{number}% - \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号 - \iffieldundef{eid}{}{% - \setunit{\addcomma\space}% - \printfield{eid}}}}% -% -% 调整期刊年份的格式 -% -\renewbibmacro*{issue+date}{%去掉括号 - \printtext{%去掉了[parens] - \iffieldundef{issue} - {%\usebibmacro{date} - \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 - {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 - {\usebibmacro{date}}% - }}% - {\iftoggle{bbx:gbstrict}{}{\printfield{issue}% - \setunit*{\addspace}}% - %\usebibmacro{date} - \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 - {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 - {\usebibmacro{date}}% - }}}% - %\newunit - }% -% -% 调整页码前的标点和去掉期刊文章等页码后面的标点 -% -\renewbibmacro*{note+pages}{%源来自standard.bbx - %\printfield{note}%不要note,note用来判断是否是报纸newspaper - \iffieldundef{pages}{}{% - \setunit{\bibpagespunct}% - \printfield{pages}}% - %\newunit - }% -% -% 编者的符号修改一下 -% v1.0 2016-07-01 -% v1.0q 2019-03-01 hzz 修改editortype前的标点 -% -\renewbibmacro*{editor}{%源来自biblatex.DEF - \ifboolexpr{% - test \ifuseeditor - and - not test {\ifnameundef{editor}}% - }% - {\printnames{editor}% - \iffieldundef{editortype}%增加一个类型判断,用于存在editortype的情况 - {\setunit\addspace}%当没有editortype时,直接用句点 - {%\setunit{\addcomma\space}% - \usebibmacro{editorstrg}}% - %\clearname{editor} - }% - {}}% -% -% 编者类型做一修改 -% v1.0 2016-07-01 -% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串 -% -\renewbibmacro*{editorstrg}{%源来自biblatex.DEF - \printtext[editortype]{% - \iffieldundef{editortype}% - {% -% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理 -% test {\ifnumgreater{\value{editor}}{1}} -% or -% test {\ifandothers{editor}} -% } -% {\bibstring{editors}} -% {\bibstring{editor}} - }% - {\ifbibxstring{\thefield{editortype}}%定义编者类型情况下处理,以后根据需要修改 - {\ifboolexpr{% - test {\ifnumgreater{\value{editor}}{1}}% - or - test {\ifandothers{editor}}% - }% - {\printdelim{streditortypes}}% - {\printdelim{streditortype}}}% - {\thefield{editortype}}}% - }}% -% -% bookauthor域的输出, -% v1.0q 2019-03-01 hzz -% 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替, -% 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype -\renewbibmacro*{bybookauthor}{% - \ifnameundef{bookauthor}% - {\ifnameundef{editor}% - {}% - {\ifnamesequal{author}{editor}% - {}{\usebibmacro{editor}}}% - }% - {\ifnamesequal{author}{bookauthor}% - {}{\printnames{bookauthor}}% - }% -}% -% -% 修改期刊的标题 -% -\renewbibmacro*{periodical}{%源来自biblatex.DEF - \iffieldundef{title} - {}% - {\printtext[title]{\bibtitlefont% - \printfield[titlecase]{title}% - %\setunit{\subtitlepunct}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct} - \printfield[titlecase]{subtitle}}% - %}%把编组结束移到后面去 - \iftoggle{bbx:gbtype}{% - \iffieldundef{usera}{}{%在标题后直接给出文献标识字母 - \printfield[gbtypeflag]{usera}}}{}% - }}% - }% -% -% 期刊的标题做修改 -% -\renewbibmacro*{title+issuetitle}{%源来自standard.BBX - \usebibmacro{periodical}% - %\setunit*{\addspace}% - \setunit*{\adddot\addspace}%标点修改为句点 - \iffieldundef{series} - {}% - {\newunit - \printfield{series}% - \setunit{\addspace}}% - \usebibmacro{periodical+issue}%将issue调整到上面来,并修改 -\iffieldundef{number}{}{%%进一步处理有范围的数字 - \multinumberparser{\thefield{number}}}% - \iffieldundef{volume}% - {\printfield{year}% - \printtext{\mkbibparens{\multinumberfirst}}% - \bibrangedash% - \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}% - }% - {\multivolparser{\thefield{volume}}% - \printfield{year}% - \setunit{\addcomma\space}%将冒号修改为逗号 - \printtext{\multivolfirst}% - \printtext{\mkbibparens{\multinumberfirst}}% - \bibrangedash% - \iffieldundef{endyear}{}{% - \printfield{endyear}% - \setunit{\addcomma\space}%将冒号修改为逗号 - \printtext{\multivolsecond}% - \printtext{\mkbibparens{\multinumbersecond}}}% - }% - \setunit{\addcomma\space}% - \printfield{eid}% - \setunit{\addspace}% - %\usebibmacro{issue+date}% - %\setunit{\addcolon\space}% - \usebibmacro{issue}% - \newunit}% -% -% 修改in:用于inbook、incollection、inproceedings等类型 -% 2018.04.20,v1.0k,renewed marco,by hzz -% 20190212,v1.0q,增加中英文区分,by hzz -% -% 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。 -\renewbibmacro*{in:}{% - \iftoggle{bbx:gbpunctin}{\printtext{\texttt{//}\allowbreak}}%\addthinspace - {\setunit{\adddot\addspace}% - \iffieldequalstr{userd}{chinese}% - {\printtext{\bibstring{incn}}}% - {\printtext{\bibstring{in}}}% - }}%\newunit\newblock\intitlepunct -% -% 修改type域的输出格式 -% 2019.02.12,v1.0q,byhzz -% 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文 -\DeclareFieldFormat{type}% -{\iffieldequalstr{userd}{chinese}% - {\ifbibxstring{##1cn}{\bibxstring{##1cn}}{##1}}% - {\ifbibstring{##1}{\bibstring{##1}}{##1}}% -}% -% -% book条目类的驱动 -% -\csdef{blx@bbx@book}{%%源来自standard.bbx文件 - \usebibmacro{bibindex}% - \usebibmacro{begentry}% -\usebibmacro{author/editor+others/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 -\usebibmacro{maintitle+title}% -\iftoggle{bbx:gbstrict}{}{% -\newunit -\printlist{language}% -\newunit\newblock% -\usebibmacro{byauthor}% -\newunit\newblock}% -\usebibmacro{byeditor+others}% -\newunit -\printfield{edition}% -\newunit\newblock%% -\iftoggle{bbx:gbstrict}{}{% -\iffieldundef{maintitle}% -{\printfield{volume}% -\printfield{part}}% -{}% -\newunit% -\printfield{volumes}% -\newunit\newblock% -\usebibmacro{series+number}}% -\newunit\newblock% -%\printfield{note}% -%\newunit\newblock% -\usebibmacro{publisher+location+date}% -%\newunit\newblock %这里标点去掉 -\usebibmacro{chapter+pages}% - \iffieldundef{url}{}{%当没有网址时也不输出 - \usebibmacro{modifydate}}%带括号的修改或更新日期, -\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 - \newunit\newblock% - \printfield{pagetotal}% - \newunit\newblock% - \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% - \newunit\newblock - %\usebibmacro{doi+eprint+url}% - %\newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}}% -% -% 期刊文章,连续出版物中的析出文献的格式 -% -\csdef{blx@bbx@article}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}% - \newunit\newblock - \usebibmacro{bytranslator+others}% - \newunit\newblock - \printfield{version}}% - \newunit\newblock - %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物 - \usebibmacro{journal+issuetitle}% - %\newunit -% \usebibmacro{byeditor+others}% -% \newunit - \usebibmacro{note+pages}% - \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期 - \iffieldundef{url}{}{%当没有网址时也不输出 - \iftoggle{bbx:url}{%当url选项为false时,也不输出 - \usebibmacro{modifydate}}{}}}%带括号的修改或更新日期, - \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置 - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{issn}} - {}% - \newunit\newblock - %\usebibmacro{doi+eprint+url}% - %\newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}}% -% -% 连续出版物的驱动 -% -\csdef{blx@bbx@periodical}{%源来自standard.BBX - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{editor}% - %\setunit{\labelnamepunct}\newblock - \newunit\newblock %删除上面一行,添加这一行 - \usebibmacro{title+issuetitle}% - \newunit\newblock% - \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间 - \newunit\newblock%添加这一行 - \iftoggle{bbx:gbstrict}{}{% - \printlist{language}% - \newunit\newblock - \usebibmacro{byeditor}% - \newunit\newblock - \printfield{note}% - \newunit\newblock} - \iftoggle{bbx:isbn} - {\printfield{issn}} - {}% - \newunit\newblock - \usebibmacro{doi+eprint+url}% - \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}}% -% -% 专利文献驱动 -% -\csdef{blx@bbx@patent}{%源来自standard.BBX - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - %\usebibmacro{title}% - \usebibmacro{patenttitle}%给出专利专用的标题输出 - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}}% - \newunit\newblock - \printfield{type}% - \setunit*{\addspace}% - %\printfield{number}%已放到patenttitle中处理 - \iflistundef{location} - {} - {\setunit*{\addspace}% - \printtext{%[parens] - \printlist[][-\value{listtotal}]{location}}}% - \newunit\newblock - \usebibmacro{byholder}% - \newunit\newblock - \printfield{note}% - \newunit\newblock - \usebibmacro{newsdate}% - %\newunit\newblock - \usebibmacro{doi+eprint+url}% - \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}}% -% -% 在线文献驱动 -% -\csdef{blx@bbx@online}{%源来自standard.BBX - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/editor+others/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}% - \newunit\newblock - \usebibmacro{byeditor+others}% - \newunit\newblock - \printfield{note}}% - \newunit - \printfield{version}% - \newunit\newblock -%\printlist{organization}% - \printlist{institution}% - \newunit\newblock -\ifboolexpr{% -test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% -}{\usebibmacro{date}}% -{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间 - \usebibmacro{url+urldate}%从下面移上来 - \newunit\newblock - \iftoggle{bbx:eprint} - {\usebibmacro{eprint}} - {}% - \newunit\newblock - %\usebibmacro{url+urldate}% - %\newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}}% -% -% 报告类型驱动 -% 2016-11-11,增加了译者信息 -% -\csdef{blx@bbx@report}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}}% - \newunit\newblock - \usebibmacro{byeditor+others}%增加的译者信息 - \newunit\newblock - \printfield{type}% - \setunit*{\addspace}% - \printfield{number}% - \newunit\newblock - \printfield{version}% - \newunit - \printfield{note}% - \newunit\newblock - \usebibmacro{publisher+location+date}% - %\newunit\newblock - \usebibmacro{chapter+pages}% - \usebibmacro{doi+eprint+url}% - \newunit - \printfield{pagetotal}% - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{isrn}} - {}% - \newunit\newblock -% \usebibmacro{doi+eprint+url}% -% \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}}% -% -% 手册类型驱动 -% 2016-11-11,增加了译者信息 -% -% -\csdef{blx@bbx@manual}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}}% - \newunit\newblock - \usebibmacro{byeditor+others}%增加的译者信息 - \newunit\newblock - \iftoggle{bbx:gbfieldtype}{% - \printfield{type}% - \setunit*{\addspace}}{}% - \printfield{number}% - \newunit\newblock - \printfield{version}% - \newunit - \printfield{note}% - \newunit\newblock - \usebibmacro{institution+location+date}% - %\newunit\newblock - \usebibmacro{chapter+pages}% - \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期 - \usebibmacro{modifydate}}%修改或更新日期为带括号的时间 - \usebibmacro{doi+eprint+url}% - \newunit - \printfield{pagetotal}% - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{isrn}} - {}% - \newunit\newblock -% \usebibmacro{doi+eprint+url}% -% \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}}% -% -% 备选类型驱动 -% -% 利用biblatex的misc驱动 -\csdef{blx@bbx@misc}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/editor+others/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% -\iftoggle{bbx:gbstrict}{}{% - \newunit - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}% - \newunit\newblock - \usebibmacro{byeditor+others}}% - \newunit\newblock - \printfield{howpublished}% - \newunit\newblock - \printfield{type}% - \newunit - \printfield{version}% - \newunit - \printfield{note}% - \newunit\newblock - \usebibmacro{institution+location+date}% - %\usebibmacro{organization+location+date}% - %\newunit\newblock - \usebibmacro{doi+eprint+url}% - \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}}% -% -% 专著中的析出文献的格式修改 -% -\csdef{blx@bbx@inbook}{%源来自standard.bbx - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 -\usebibmacro{title}% -\usebibmacro{in:}% -%\printtext{\texttt{//}\addthinspace}% - \usebibmacro{bybookauthor}% - \ifnameundef{bookauthor}{% - \ifnameundef{editor}{}{\newunit}% - }{\newunit}%替换下一句 - %\newunit\newblock -\iffieldundef{series}{}{\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加 - \usebibmacro{maintitle+booktitle}% -\iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}% -\iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息 - \newunit\newblock% -% \usebibmacro{byeditor+others}% -% \newunit\newblock - \printfield{edition}% - \newunit - \iftoggle{bbx:gbstrict}{}{% -% \iffieldundef{maintitle} -% {\printfield{volume}% -% \printfield{part}} -% {}% -% \newunit -% \printfield{volumes}% -% \newunit\newblock -% \usebibmacro{series+number} - }% - \newunit\newblock - %\printfield{note}% - %\newunit\newblock - \usebibmacro{publisher+location+date}% -%\newunit\newblock - \usebibmacro{chapter+pages}% - %\newunit\newblock - \usebibmacro{doi+eprint+url}%移到上面来 - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% - \newunit\newblock - %\usebibmacro{doi+eprint+url}% -% \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}}% -}{}% -} - -\AtEveryBibitem{\localsetchinesecode}% -\AtEveryCite{\localsetchinesecode}% -\AtEveryLositem{\localsetchinesecode}% +%% +%% --------------------------------------------------------------- +%% biblatex-gb7714-2015 --- A biblatex implementation of the +%% GBT7714-2015 bibliography style,numerical sequence +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% + +% +% 版本和时间信息 +% +\def\versionofgbtstyle{2021/01/19 v1.0w} +\def\versionofbiblatex{\abx@version} +\ProvidesFile{gb7714-2015ms.bbx}[\versionofgbtstyle biblatex bibliography style] +%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求 + + +%===================================================================== +% 加载标准样式 +%===================================================================== +\RequireBibliographyStyle{numeric-comp} +\RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题 + +%===================================================================== +% 功能函数 +%===================================================================== + % + % biblatex版本判断 + % 20180629,v1.0k,hzz + % + % 原理方法:适用于3.10以上版本的biblatex,否则给出警告 + \@ifpackagelater{biblatex}{2017/12/28}{}{ + \blx@warning@noline{% + biblatex version is too old for this style\MessageBreak + if errors raised,Please update biblatex to the latest version.} + } + + + % + % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成 + % v1.0k,20180509,hzz + % + % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏 + % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8 + % 编码用xelatex编译的问题。 + % + % 原理是:利用perl正则将中文标识记录到域中, + % 然后利用\iffieldundef和\iffieldequalstr进行判断 + \providetoggle{ifCJKforgbt} + \def\testCJKfirst#1{% + \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{% + \iffieldequalstr{#1}{chinese}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}} + + % + % 2个卷的解析函数,用于连续出版物 + % + % 原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号 + \newcommand{\multivolparser}[1]{% + \IfSubStr{#1}{-}% + {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}% + {\def\multivolfirst{#1}\def\multivolsecond{}}% + } + + + % + % 2个期的解析函数,用于连续出版物 + % + \newcommand{\multinumberparser}[1]{% + \IfSubStr{#1}{-}% + {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}% + {\def\multinumberfirst{#1}\def\multinumbersecond{}}% + } + + +%===================================================================== +% 数据模型定义 +%===================================================================== + %定义类型和载体标识,从gb内容看载体基本属于介质。 + %为与lee zeping的bst的样式统一,使用mark和medium这两域名 + %为单个条目的姓名格式控制增加nameformat和namefmtid两个域 + %为缩略信息文献表增加了shortbooktitle域 + %为多语言排序增加了lansortorder域 + \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat} + \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid} + \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle} + \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder} + + %因为biblatex更新3.14版本以后,biber对于为声明数据模型的条目类型 + %不再默认读取,而是以空字符串作为条目类型名,自然在条目定义alias时 + %就会出现问题,因此显式的声明一下newspaper,然后保留后面采用alias的方式 + %而standard类型则是采用另一种方式直接在sourcemap中转换为其它类型。 + \@ifpackagelater{biblatex}{2019/11/30}{%2019/12/01 v3.14 + \DeclareDatamodelEntrytypes{newspaper}% + }{} + +%===================================================================== +% 设置宏包选项 +%===================================================================== + % + % 增加一个控制是否输出文献载体的选项 + % 20191125,v1,0s,hzz + \newtoggle{bbx:gbmedium} + \DeclareBibliographyOption{gbmedium}[true]{%biblatex低版本 + \settoggle{bbx:gbmedium}{#1}} + \ExecuteBibliographyOptions{gbmedium} + + % + % 增加一个控制是否输出annotation域的选项,该域可以用于在文献条目后面输出一些注释信息 + % 20190509,v1,0s,hzz + \newtoggle{bbx:gbannote} + \DeclareBibliographyOption{gbannote}[false]{%biblatex低版本 + \settoggle{bbx:gbannote}{#1}} + \ExecuteBibliographyOptions{gbannote} + % + %用于在文献条目后面输出注释信息的宏 + %FieldFormat{annotation}用于设置注释信息的格式 + \DeclareFieldFormat{annotation}{% + \printtext{\addspace(#1)}% + } + \renewbibmacro*{annotation}{% + \iftoggle{bbx:gbannote}% + {\iffieldundef{annotation}% + {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}% + {\printfield{annotation}}}% + {}% + } + + + % + % 增加一个控制是否输出type域的选项 + % 20190212,v1,0q,hzz + \newtoggle{bbx:gbfieldtype} + \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本 + \settoggle{bbx:gbfieldtype}{#1}} + \ExecuteBibliographyOptions{gbfieldtype} + + % + % 增加一个控制是否根据页码重设脚注数字标号的选项 + % 20190422,v1,0r,hzz + \newtoggle{bbx:gbfnperpage} + \DeclareBibliographyOption{gbfnperpage}[false]{% + \settoggle{bbx:gbfnperpage}{#1}} + \ExecuteBibliographyOptions{gbfnperpage} + + % + % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表 + % 20190203,v1.0p,hzz + % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签 + % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式 + % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题 + \DeclareBibliographyOption{gbfootbib}[false]{% + \ifstrequal{#1}{false}{}{\execgbfootbib}} + \ExecuteBibliographyOptions{gbfootbib} + + %% + \newlength{\footbibmargin} + \newlength{\footbiblabelsep} + \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离 + \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距 + \def\execgbfootbib% + {% + %开启引用跟踪计数器,为使用\ifciteseen等测试命令 + \ExecuteBibliographyOptions{citetracker=true} + % + %利用footmisc宏包来实现脚注文献的悬挂对齐 + \AtEndPreamble{ + \@ifclassloaded{beamer}{}{ + %beamer类因为其特殊性,为避免冲突不调footmisc。 + %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接 + %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。 + %\PassOptionsToPackage{perpage,hang}{footmisc}% + %\RequirePackage{footmisc}% + + %重新实现脚注的根据单页重设脚注号码 + %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改 + %v1.0q 20190317 hzz + %v1.0r 20190422 hzz 根据gbfnperpage选项设置 + \iftoggle{bbx:gbfnperpage}% + {\@addtoreset{footnote}{page}}{}%重设计数器 + +\@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义 + \long\def\H@@footnotetext##1{\insert\footins{% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \leftskip \footbibmargin%增加的左侧缩进 + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% + }% + \color@endgroup}}% + + \long\def\H@@mpfootnotetext##1{% + \global\setbox\@mpfootins\vbox{% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \leftskip \footbibmargin%增加的左侧缩进 + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \color@endgroup}} + }{%否则对latex核心代码中的\@footnotetext做重定义 + \long\def\@footnotetext##1{\insert\footins{% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \leftskip \footbibmargin%增加的左侧缩进 + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% + }% + \color@endgroup}}% + + \long\def\@mpfootnotetext##1{% + \global\setbox\@mpfootins\vbox{% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \leftskip \footbibmargin%增加的左侧缩进 + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \color@endgroup}} + } + + \long\def\@makefntext##1{%增加了脚注标记与正文的间隔 + \parindent 1em\noindent \hb@xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1} + + } + + % + %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式 + \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}} + %做patch使得脚注内容中的脚注数字标签不上标 + \pretocmd{\@makefntext}{% + \def\@makefnmark{% + \hbox{\textcircled{\tiny\@thefnmark}}% + }% + }{}{} + } + + % + %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容) + %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。 + %v1.0q 20190309 区分使脚注标注适应minipage中的情况 + \newbibmacro*{citesavefn}{% + \ifciteseen%当被引用过为true + {\ifcsdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%当已经定义过脚注序号信息 + {\csgdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% + \str@sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}% + \@makefnmark% + }}% + {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% + \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% + }}% + }% + {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% + \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% + %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断 + }}% + } + + % + %重定义\footfullcite使完成gb7714-2015的脚注文献要求 + \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% + {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 + \defcounter{minnames}{\blx@minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。 + \usebibmacro{prenote}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {}{\setunit{\addcolon\addspace}\printfield{postnote}}}%与ay样式不同,由于已修改postnote域格式,直接用printfield + }% + {\usebibmacro{citesavefn}% + \ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}% + {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}\nopunct}% + {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}% + }% + {\multicitedelim}% + {\usebibmacro{postnote}} + + } + + % + % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式 + % 20180814,v1.0m,hzz + % 原理方法: + % 当gbstyle=true,则所有的文献使用国标样式,否则仅中文文献使用国标样式 + \newtoggle{bbx:gbstyle} + \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本 + \settoggle{bbx:gbstyle}{#1}} + + % + % 增加一个控制是否输出文献类型和载体标识的选项 + % + % 原理方法: + % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的 + % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本 + \newtoggle{bbx:gbtype} + %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本 + \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本 + \settoggle{bbx:gbtype}{#1}} + + % + % 增加一个源文件编码选择选项,当true时可以使用GBK编码。 + % v1.0k, 2018.05.08, by hzz + % + % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档 + % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def + % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用 + % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。 + % 另外注意: + % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码 + % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常 + % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。 + \newtoggle{bbx:codegbk} + \DeclareBibliographyOption{gbcodegbk}[false]{% + \settoggle{bbx:codegbk}{#1}} + + \def\str@bibliography{参考文献} + \def\str@references{参考文献} + \def\str@bytranslator{译} + \def\str@andotherscn{等} + \def\str@backrefpage{引用页} + \def\str@backrefpages{引用页} + \def\str@noaddress{出版地不详} + \def\str@nopublisher{出版者不详} + \def\str@edition{版} + \def\str@volumecn{卷} + \def\str@numbercn{册} + \def\str@serialcn{第} + \def\str@sameentry{同} + \def\str@incn{见} + \def\str@mathesiscn{硕士学位论文} + \def\str@phdthesiscn{博士学位论文} + \def\str@editorcn{主编} + + \AtEndOfPackage{% + \iftoggle{bbx:codegbk}{% + \ExecuteBibliographyOptions{texencoding = GBK} + \input{gb7714-2015-gbk.def} + }{}} + + % + % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项 + % v1.0k, 2018.05.08, by hzz + % + % 原理方法: + % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息 + % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式 + % 可能需要用于中英文判断的language域的信息。 + \newtoggle{bbx:gbstrict} + \DeclareBibliographyOption{gbstrict}[true]{% + \settoggle{bbx:gbstrict}{#1}} + + % + % 增加一个控制标题域超链接设置的选项 + % v1.0k, 2018.05.24, by hzz + % + % 原理方法: + % 利用标题域格式来实现,默认设置该选项为false,不做超链接。 + % 设置为true,则标题设置超链接 + \newtoggle{bbx:titlelink} + \DeclareBibliographyOption{gbtitlelink}[false]{% + \settoggle{bbx:titlelink}{#1}} + + % + % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项 + % v1.0l, 2018.07.02, by hzz + % + % 原理方法: + % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置 + \newtoggle{bbx:ctexset} + \DeclareBibliographyOption{gbctexset}[true]{% + \settoggle{bbx:ctexset}{#1}} + + \AtEndOfPackage{% + \iftoggle{bbx:ctexset}{% + \def\blx@defbibstrings#1#2{% + \def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}% + \abx@dostrings + \csuse{abx@strings@#1}% + \setkeys{blx@lbx}{#2}% + \let\do\blx@defbibstrings@i + \csxdef{abx@strings@#1}{\abx@dostrings}% + } + }{}} + + % + % 增加一个恢复域格式为标准样式的控制选项 + % v1.0k, 2018.05.15, by hzz + % + % 原理方法: + % 默认设置该选项为false,采用国标要求的域格式输出相关域 + % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域 + \newtoggle{bbx:gbfieldstd} + \DeclareBibliographyOption{gbfieldstd}[false]{% + \settoggle{bbx:gbfieldstd}{#1}% + } + + % + % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。 + % + \newtoggle{bbx:gbpub} + \DeclareBibliographyOption{gbpub}[true]{% + %\settoggle{bbx:gbpub}{#1} %或采用下面这一句 + \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}} + + % + % 增加控制析出文献来源前的标点符号//输出的选项 + % v1.0k, 2018.04.20,added in by hzz + \newtoggle{bbx:gbpunctin} + \DeclareBibliographyOption{gbpunctin}[true]{% + \settoggle{bbx:gbpunctin}{#1}} + + % + % 增加一个处理佚名或noauthor的控制选项 + % + % 原理方法:在顺序编码制中不需要使用,为与作者年制的兼容性考虑,这里也增加避免报错 + \DeclareBibliographyOption{gbnoauthor}[true]{}% + + + % + %为日期控制格式增加一个gb7714-2015选项 + % + \csdef{mkdaterangegb7714-2015}#1{% + \begingroup + \blx@metadateinfo{#1}% + \iffieldundef{#1year} + {} + {\printtext[#1date]{% + \blx@gbdate{#1}{}}}% + \endgroup} + + \newrobustcmd*{\blx@gbdate}[3][]{% + \dateeraprintpre{#2#3year}% + \blx@imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}% + \iffieldundef{#2#3month}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3month}}}% + \iffieldundef{#2#3day}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3day}}}} + + %为姓名格式选择增加的计数器 + \newcounter{gbnamefmtcase} + \def\thegbnamefmtcase{\the\c@gbnamefmtcase} + %为数字标签格式选择增加的计数器/命令 + \newcommand{\mkgbnumlabel}[1]{\mkbibbrackets{#1}} + \def\gbbiblabelopt@bracket{\renewcommand{\mkgbnumlabel}[1]{\mkbibbrackets{##1}}} + \def\gbbiblabelopt@parens{\renewcommand{\mkgbnumlabel}[1]{\mkbibparens{##1}}} + \def\gbbiblabelopt@dot{\renewcommand{\mkgbnumlabel}[1]{##1\adddot}} + \def\gbbiblabelopt@plain{\renewcommand{\mkgbnumlabel}[1]{##1}} + \def\gbbiblabelopt@box{\renewcommand{\mkgbnumlabel}[1]{\framebox{##1}}} + \def\gbbiblabelopt@circle{\renewcommand{\mkgbnumlabel}[1]{\textcircled{##1}}} + %为文献表中数字标签对齐方式选择增加的计数器/命令 + \newcounter{gbalignlabel} + \def\thegbalignlabel{\the\c@gbalignlabel} + %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令 + \newcounter{gbcitelocalcase} + \newcounter{gbbiblocalcase} + \def\thegbcitelocalcase{\the\c@gbcitelocalcase} + \def\thegbbiblocalcase{\the\c@gbbiblocalcase} + + % 增加不同语言排序的切换选项 + % numeric样式,不使用该选项,这里给出仅为兼容性考虑 + % v1.0q,20190307,hzz + % + \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{} + + + % + % 增加本地化字符串的中英文切换选项 + % gbcitelocal指标注中的本地化字符串 + % gbbiblocal 指文献表中的本地化字符串 + % gblocal 指设置文献表和标注中的本地化字符串 + % v1.0o,20190103,hzz + % + \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{% + \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}% + \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}% + \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}% + } + + \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{% + \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}% + \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}% + \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}% + } + + \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{% + \ExecuteBibliographyOptions{gbbiblocal=#1}% + \ExecuteBibliographyOptions{gbcitelocal=#1}% + } + + % + % 增加序号标签格式处理选项 + % v1.0l,20180623,hzz + % + \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{% + \csuse{gbbiblabelopt@#1} + } + + % + % 增加姓名大小写格式处理选项 + % + \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{% + \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}% + \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}% + \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family + \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{} + \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given + \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family + } + + + % + % 增加标签对齐选项 + % + % right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式 + \DeclareBibliographyOption[string]{gbalign}[right]{% + \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{} + \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{} + \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{} + \ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{} + } + + + % + % 选项设置 + % + \ExecuteBibliographyOptions{ + %firstinits=true, 针对biblatex<3.3版本的选项设置,比如texlive2015中的3.0版 + giveninits=true, %针对3.3<=biblatex<3.5版本,比如texlive2016中的3.4版 + sorting=none, + useprefix=true, %名字的信息包括前缀 + date = year, %日期仅写到年 + maxbibnames = 3,%设置名字最大数量 + minbibnames = 3, %设置缩减后的名字最小数量 + maxitems = 1,%设置列表最大数量 + minitems = 1, %设置缩减后的列表最小数量 + isbn=false, + gbstyle=true, + gbtype=true, + gbcodegbk=false, + gbstrict=true, + gbtitlelink=false, + gbfieldstd=false, + gbpub=true, + gbpunctin=true, + gbbiblabel=bracket, + gbnamefmt=uppercase, + gbalign=right, + gbctexset=true, + %urldate =edtf, %针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版 + %eventdate =edtf,%针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版 + urldate =gb7714-2015, %iso,针对3.10<=biblatex版本的选项设置,比如texlive2018中的3.11版 + eventdate =gb7714-2015, + gblocal=gb7714-2015, + } + + +%===================================================================== +% 设置本地化字符串 +%===================================================================== + % + % 新建当地化字符串,用来记录“等”字符、“和”字符 + % + \NewBibliographyString{andotherscn} + \NewBibliographyString{andothersincitecn} + \NewBibliographyString{andothersincite} + \NewBibliographyString{andcn} + \NewBibliographyString{andothersjp} + \NewBibliographyString{andotherskr} + \NewBibliographyString{andjp} + \NewBibliographyString{andkr} + \NewBibliographyString{andincitecn} + \NewBibliographyString{andincite} + \NewBibliographyString{volumecn} + \NewBibliographyString{numbercn} + \NewBibliographyString{serialcn} + \NewBibliographyString{incn} + \NewBibliographyString{mathesiscn} + \NewBibliographyString{phdthesiscn} + \NewBibliographyString{editorcn} + \NewBibliographyString{editorscn} + + + % + % 修改一些当地化字符串 + % + % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件 + % 当然也可以增加比如上面定义的andotherscn + % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别 + \DefineBibliographyStrings{english}{ + bibliography = {\str@bibliography}, + references = {\str@references}, + bytranslator= {\str@bytranslator},%\addperiod,%将trans. by 改成 译 + and = {\addcomma},%将第2和3人名间的and符号改成逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 + andcn = {\addcomma},%and本地化字符串的中文对应词 + andincitecn = {\addcomma},%将标注中的分开,便于与文献表中的区分 + andincite = {\addcomma}, + %andothers = {et al.}, %将超过3个人名的省略,et al.改成为 等 + andotherscn = {\str@andotherscn}, %将超过3个人名的省略,et al.改成为 等 + andothersincitecn={\str@andotherscn},%将标注中的分开,便于与文献表中的区分 + andothersincite={et al\adddot}, + backrefpage = {\str@backrefpage:}, + backrefpages = {\str@backrefpages:}, + in={in\intitlepunct}, + volumecn={\str@volumecn}, + numbercn={\str@numbercn}, + serialcn={\str@serialcn}, + andothersjp={他}, + andotherskr={외}, + andjp={和}, + andkr={和}, + incn={\str@incn\addcolon\addspace}, + mathesiscn={\str@mathesiscn}, + phdthesiscn={\str@phdthesiscn}, + editorscn={\str@editorcn}, + editorcn={\str@editorcn}, +} + + % + % 增加两个命令用于临时的局部的修改本地化字符串 + % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串 + % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内 + % v1.0t,hzz,20190525 + \newcommand{\setlocalbibstring}[2]{% + \csdef{abx@sstr@#1}{#2}} + \newcommand{\setlocalbiblstring}[2]{% + \csdef{abx@lstr@#1}{#2}} + +%===================================================================== +% 动态数据修改 +%===================================================================== +% +% 各层次的数据映射和动态修改 +% +% 原理方法: +% 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中 +% 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性 +% 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个 +% 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次 +% 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。 +% 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符, +% 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息 +% +% 不同的文献类型使用相同的驱动输出可以有5种方法: +% 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型 +% 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型 +% 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型 +% 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名 +% 驱动别名定义本质上是做了驱动层映射 +% 5. 直接定义不同的类型的驱动,但驱动内容相同。 +% +% 关于数据映射和驱动使用的考虑如下: +% 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换 +% 2. 为减少代码量,尽量少做内容相同的不同类型驱动 +% 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名 +% 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type +% 可以在样式层映射做某些需要避免这种默认处置的转换 +% 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射 +% +% 文献类型和驱动考虑如下: +% 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article +% newpaper映射为article,并以note域做区分特殊处理 +% 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook +% standard映射为book或inbook,并以note域做区分特殊处理 +% collection和proceedings基本与book类似,因此做book驱动别名处理 +% incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理 +% 3. 专利类型有其特殊性,考虑patent类型 +% 4. 电子资源类型有其特殊性,考虑online类型 +% 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更细日期 +% 因此考虑用一种类型来输出,使用report类型 +% 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略, +% 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型 +% 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时, +% 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。 +% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述 +% 更多的信息,因此不存在网址时,独立做一个备选格式 +% 9. 出版项主要以如下方式处理: +% (a) location+institution+date 仅用于连续出版物 +% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report +% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型 +% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。 +% (e) 不输出,主要用于连续出版物析出的文献 +% 10. 日期以如下方式处理: +% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year +% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate +% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date +% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate + +\DeclareSourcemap{%\perdatasource{examples.bib} +\maps[datatype=bibtex]{% + \map{%当没有作者时将editor转成author + \pernottype{inbook}%因为in系列中editor可能用来表示bookauthor,所以排除 + \pernottype{inproceedings} + \pernottype{incollection} + \pernottype{periodical}%因为peridical直接使用editor,所以排除 + %注意notfield在低版本biblatex中没有 + %\step[notfield=author,final]%当author不存在,将editor复制给author + \step[fieldsource=editor,fieldtarget=author]%并删除editor + } + \map{%当没有作者时将translator转成author + \pernottype{inbook} + \pernottype{inproceedings} + \pernottype{incollection} + %\step[notfield=author,final]%当author不存在,将translator复制给author + \step[fieldsource=translator,fieldtarget=author]%并删除translator + } + \map{%让address和location同步,biblatex中address是location的别名 + %因此输出的时候只有location信息,但处理过程中是可以存在address的。 + \step[notfield=address,final]% + \step[fieldsource=location,final] + \step[fieldset=address,origfieldval] + } + \map{ + \step[notfield=location,final]% + \step[fieldsource=address,final] + \step[fieldset=location,origfieldval] + } + \map{%处理在bib文件用mark标记文献类型标识符的情况 + \step[fieldsource=mark,final] + \step[fieldset=usera, origfieldval] + } + \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况 + \step[fieldsource=nameformat,match=lowercase,final] + \step[fieldset=namefmtid,fieldvalue={1}] + } + \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况 + \step[fieldsource=nameformat,match=givenahead,final] + \step[fieldset=namefmtid,fieldvalue={2}] + } + \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况 + \step[fieldsource=nameformat,match=familyahead,final] + \step[fieldset=namefmtid,fieldvalue={3}] + } + \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况 + \step[fieldsource=nameformat,match=pinyin,final] + \step[fieldset=namefmtid,fieldvalue={4}] + } + \map{%根据article确定文献类型标识符 + \pertype{article} + \step[fieldset=usera, fieldvalue={J}] + } + \map{%根据periodical确定文献类型标识符 + \pertype{periodical} + \step[fieldset=usera, fieldvalue={J}] + \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor + \step[fieldset=editor, origfieldval] + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符 + \pertype{newspaper} + \step[fieldset=usera, fieldvalue={N}] + \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断 + } + \map{%对应增加的一个数据库类型database确定文献类型标识符 + \pertype{database} + \step[fieldset=usera, fieldvalue={DB}] + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%对应增加的一个数据集类型dataset确定文献类型标识符 + \pertype{dataset} + \step[fieldset=usera, fieldvalue={DS}]% + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%对应增加的一个软件类型software确定文献类型标识符 + \pertype{software} + \step[fieldset=usera, fieldvalue={CP}] + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%对应增加的一个舆图类型map确定文献类型标识符 + \pertype{map} + \step[fieldset=usera, fieldvalue={CM}]% + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%对应增加的一个档案类型archive确定文献类型标识符 + \pertype{archive} + \step[fieldset=usera, fieldvalue={A}] + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以 + %当misc类型带有网址时,直接将其转换为online类型 + \pertype{misc} + \step[fieldsource=url,final] + \step[typesource=misc,typetarget=online] + } + \map{%对应增加的一个备选类型misc确定文献类型标识符 + \pertype{misc} + \step[fieldset=usera, fieldvalue={Z}]% + } + \map{ + \pertype{book} + \pertype{inbook} + \step[fieldset=usera, fieldvalue={M}] + \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition + \step[fieldset=edition, origfieldval] + } + \map{%兼容老的standard类型,确定文献类型标识符 + \pertype{standard} + \step[fieldset=usera, fieldvalue={S}] + \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断 + } + \map{ + \pertype{patent} + \step[fieldset=usera, fieldvalue={P}] + } + \map{ + \pertype{inproceedings} + \pertype{conference}%兼容老的conference类型 + \step[fieldset=usera, fieldvalue={C}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{proceedings} + \step[fieldset=usera, fieldvalue={C}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{incollection} + \step[fieldset=usera, fieldvalue={G}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{collection} + \step[fieldset=usera, fieldvalue={G}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{report} + \pertype{techreport}%兼容老的techreport类型 + \step[fieldset=usera, fieldvalue={R}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{thesis} + \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型 + \pertype{phdthesis} + \step[fieldset=usera, fieldvalue={D}] + \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{ + \pertype{online} + \pertype{electronic}%兼容老的electronic类型 + \pertype{www}%兼容老的www类型 + \step[fieldset=usera, fieldvalue={EB}] + \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册 + \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 + \step[fieldset=institution, origfieldval] + } + \map{ + \pertype{manual} + \step[fieldset=usera, fieldvalue={A}] + \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version + \step[fieldset=version, origfieldval] + \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 + \step[fieldset=institution, origfieldval] + } + \map{ + \pertype{unpublished} + \step[fieldset=usera, fieldvalue={Z}] + } + \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 + \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] + } + \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 + \step[fieldsource={editor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] + }% + \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 + \step[fieldsource={translator}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] + }% + \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 + \step[fieldsource={bookauthor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] + }% + \map{%处理一些用year表示date的情况 + %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。 + %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息 + \step[fieldsource=year] + \step[fieldset=date, origfieldval] + } + \map{%将entrykey放入keywords中用于后期使用 + \step[fieldsource=entrykey] + \step[fieldset=keywords, origfieldval] + } + \map{\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userd,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userd,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userd,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userd,fieldvalue={korean}]%韩语 + } + \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题 + \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]% + \step[fieldset=userd, fieldvalue={chinese}] + } + \map{%将没有设置userd,且存在title域的默认设置为英文 + \step[fieldsource=title,final] + \step[fieldset=userd,fieldvalue={english}] + } + \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userf,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=author,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userf,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=author,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userf,fieldvalue={korean}]%韩语 + } + \map{%作者的中文判断 + \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] + \step[fieldset=userf, fieldvalue={chinese}] + } + \map{%将没有设置userf,且存在author域的默认设置为英文 + \step[fieldsource=author,final] + \step[fieldset=userf,fieldvalue={english}] + } + \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=usere,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=translator,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=usere,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=translator,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=usere,fieldvalue={korean}]%韩语 + } + \map{%译者的中文判断 + \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] + \step[fieldset=usere, fieldvalue={chinese}] + } + \map{%将没有设置usere,且存在translator域的默认设置为英文 + \step[fieldsource=translator,final] + \step[fieldset=usere,fieldvalue={english}] + } + \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userc,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userc,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userc,fieldvalue={korean}]%韩语 + } + \map{%编者的中文判断 + \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 + \step[fieldset=userc, fieldvalue={chinese}] + } + \map{%将没有设置userc,且存在editor域的默认设置为英文 + \step[fieldsource=editor,final] + \step[fieldset=userc,fieldvalue={english}] + } + \map{\step[fieldsource=bookauthor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userb,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=bookauthor,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userb,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=bookauthor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userb,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=bookauthor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userb,fieldvalue={korean}]%韩语 + } + \map{%编者的中文判断 + \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 + \step[fieldset=userb, fieldvalue={chinese}] + } + \map{%将没有设置userc,且存在editor域的默认设置为英文 + \step[fieldsource=bookauthor,final] + \step[fieldset=userb,fieldvalue={english}] + } + \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language + \step[fieldset=language,origfieldval]%本身language存在则不设定 + } + \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language + \step[fieldset=language,origfieldval] + }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。 + \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。 + \step[fieldset=language,fieldvalue={english}] + } + \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断, + %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况, + %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd + \step[fieldsource=language] + \step[fieldset=userd,origfieldval] + } + \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言 + \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final] + \step[fieldset=langid,fieldvalue={english}] + } + \map{ + \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final] + \step[fieldset=langid,fieldvalue={russian}] + } + \map{% + \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final] + \step[fieldset=langid,fieldvalue={french}] + } + \map{% + \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + } + \map{% + \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + } + \map{% + \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + } +} +} + + + % + % 修改输入的参考文献数据,样式层的操作 + % + % 原理方法:biblatex3.4以上版本map可使用foreach选项来处理特殊字符 + \DeclareStyleSourcemap{ + \maps[datatype=bibtex]{ + \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook, + %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 + %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断 + \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook + \step[typesource=standard, typetarget=inbook, final] + } + \map{%尝试未定义数据模型的standard类型映射为book,standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 + \step[typesource=standard, typetarget=book, final]%当不存在booktitle域是映射为book + } +% \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置 +% \step[typesource=mastersthesis, typetarget=thesis, final] +% %\step[fieldset=type, fieldvalue=mathesis] +% } +% \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置 +% \step[typesource=phdthesis, typetarget=thesis, final] +% %\step[fieldset=type, fieldvalue=phdthesis] +% } + \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置 + \step[typesource=techreport, typetarget=report, final] + %\step[fieldset=type, fieldvalue=techreport] + } + \map{% + \pertype{report} + \step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=report,typetarget=online] + \step[fieldset=note,fieldvalue={report}] + } + \map{% + \pertype{thesis} + \step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=thesis,typetarget=online] + } + \map{% + \pertype{manual} + \step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=manual,typetarget=online] + } + \map{% + \pertype{unpublished} + \step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=unpublished,typetarget=online] + } + \map{% + \pertype{database} + \step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=databasetypetarget=online] + } + \map{% + \pertype{dataset} + \step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=dataset,typetarget=online] + } + \map{% + \pertype{software} + \step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=software,typetarget=online] + } + \map{% + \pertype{map} + \step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=map,typetarget=online] + } + \map{% + \pertype{archive} + \step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=archive,typetarget=online] + } + \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确) + \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 + \step[fieldset=keywords, fieldvalue={,}, append] + \step[fieldset=keywords, origfieldval, append] + } + \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ + \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] + } + \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ + \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] + } + \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,% + address,location,institution,organization}]{ + \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + } + } + +% +%驱动别名等价于驱动层映射 +% +\DeclareBibliographyAlias{newspaper}{article}% +\DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动 +\DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动 +\DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动 +\DeclareBibliographyAlias{collection}{book}%%文集类型驱动 +\DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动 +\DeclareBibliographyAlias{thesis}{manual}%学位论文驱动 +\DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动 +\DeclareBibliographyAlias{database}{manual} +\DeclareBibliographyAlias{dataset}{manual} +\DeclareBibliographyAlias{software}{manual} +\DeclareBibliographyAlias{map}{manual} +\DeclareBibliographyAlias{archive}{manual} + + +%===================================================================== +% 参考文献表环境 +%===================================================================== +% +% 列表格式 +% +% 增加一个\bibitemindent尺寸用于控制list环境的itemindent +% v1.0l,20180615,hzz +% v1.0t,20200319,hzz,增加尺寸\biblabelextend使某些字体下标签宽度不足时可增加标签宽度 +\setlength{\bibhang}{\biblabelsep}% +\newlength{\bibitemindent} +\setlength{\bibitemindent}{0pt} +\newlength{\biblabelextend} +\setlength{\biblabelextend}{0pt} + + +\defbibenvironment{bibliography} + {\list + {\printtext[labelnumberwidth]{% + \printfield{labelprefix}% + \printfield{labelnumber}}} + {\addtolength{\labelnumberwidth}{\biblabelextend}% + \setlength{\labelwidth}{\labelnumberwidth}% + \setlength{\labelsep}{\biblabelsep}% + \setlength{\leftmargin}{\bibhang}% + \addtolength{\leftmargin}{\labelnumberwidth}% + \setlength{\itemindent}{\bibitemindent}% + \setlength{\itemsep}{\bibitemsep}% + \setlength{\parsep}{\bibparsep}}% + \renewcommand*{\makelabel}[1]{\hss##1}} + {\endlist} + {\item} + +% +% 顺序编码制-标签对齐方式处理 +% +% 原理方法:利用选项提供的计数器数值做选择 +% 左对齐,右对齐为list环境下的处理,此时list环境的\labelwidth只能设置一个,是最宽标签的宽度 +% 项对齐则是在段落环境下做的处理。 +% 左对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距可变 +% 右对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距相等,标签与页边距离可变 +% 项对齐时,序号标签贴在页边,序号标签与参考文献项内容的间距相等 +% 修改序号标签格式为: +% \DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} %源来自numeric.BBX +% \DeclareFieldFormat{labelnumberwidth}{\ttfamily\mkbibbrackets{#1}\hfill} +\DeclareFieldFormat{labelnumberwidth}{% +\ifcase\value{gbalignlabel}%右对齐,整个标签为右对齐 + \mkgbnumlabel{#1}% +\or%左对齐,整个标签为左对齐 + \mkgbnumlabel{#1}\hfill% +\or%中间对齐,比如:序号数字居于[]中间 + \hfil\mkgbnumlabel{\hfill#1\hfill}\hfil% +\fi} + +% +% 修改序号标签格式为以各条参文献为基础进行对齐的方式,即序号与条目内容间隔相等的方式。 +\def\setaligngbstyle{% +\def\blx@bibitem##1{% + \blx@ifdata{##1} + {\begingroup + \blx@getdata{##1}% + \blx@bibcheck + \iftoggle{blx@skipentry}{}{% + \blx@setdefaultrefcontext{##1}% + \global\let\blx@noitem\@empty + \blx@setoptions@type\abx@field@entrytype + \blx@setoptions@entry + \blx@thelabelnumber + \addtocounter{instcount}\@ne + \blx@initsep + \blx@namesep + \csuse{blx@item@\blx@theenv}\relax +% \blx@initsep %移动到上面去,恢复bibnamesep等的作用机制 +% \blx@namesep + \csuse{blx@hook@bibitem}% + \blx@execute + \blx@initunit + \blx@anchor + \blx@beglangbib + \bibsentence + \blx@pagetracker + \blx@driver\abx@field@entrytype + \blx@postpunct + \blx@endlangbib}% + \par\endgroup}%这里增加了一个\par + {}} +\newlength{\lengthid} +\newlength{\lengthlw} +\newcommand{\itemcmd}{% +\settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}} +\addtolength{\lengthid}{\biblabelsep} +\setlength{\lengthlw}{\textwidth} +\addtolength{\lengthlw}{-\lengthid} +\addvspace{\bibitemsep}%恢复\bibitemsep的作用 +%\parshape 2 0em \textwidth \lengthid \lengthlw +\hangindent\lengthid +\mkgbnumlabel{\printfield{labelnumber}}% +\hspace{\biblabelsep}} +% +% 简单的段落环境 +\defbibenvironment{bibliography} +{\begingroup\setlength{\parindent}{0em}} +{\endgroup} +{\itemcmd}} + + +%===================================================================== +% 设置单元或块等的标点 +%===================================================================== +\renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin +\renewcommand*{\subtitlepunct}{\addcolon\addspace} %修改标题和其它标题信息间的标点,来源biblatex.def, +% +% 利用set实现的多语言文献不同语言间的分隔符 +% 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进 +% +% 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets +% 这里调整一下两种语言参考文献的间隔,源来自biblatex.def +\renewcommand*{\entrysetpunct}{\adddot\newline\nobreak} +\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号 +%\renewcommand{\relateddelim}{}%\par + +%===================================================================== +% 修改域的格式,重定义域的输出宏 +%===================================================================== +% +% 新增文献类型标识符的格式 +% []前的nobreak,从GB4.1节的例子看不应该加,所以去掉 +% 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上 +% 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉 +% +\DeclareFieldFormat{gbtypeflag}{% +\iftoggle{bbx:gbmedium}% +{\iftoggle{bbx:url}% + {\iffieldundef{url}%当存在url时,增加一个OL标识符 + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% + }% + {\ifentrytype{online}% + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% + }}% + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% +} + +% +% 新增用于报纸的文献类型标识符的格式 +% +\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper +\iftoggle{bbx:gbmedium}% +{\iftoggle{bbx:url}% + {\iffieldundef{url}%当存在url时,增加一个OL标识符 + {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% + {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% + }% + {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% +}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}% +} + +% +% 新增用于标准的文献类型标识符的格式 +% +\DeclareFieldFormat{gbtypeflags}{%用于标准standard +\iftoggle{bbx:gbmedium}% +{\iftoggle{bbx:url}% + {\iffieldundef{url}%当存在url时,增加一个OL标识符 + {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% + {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% + }% + {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% +}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}% +} + +% +% 重设title等参考文献信息的输出格式 +% +% 原理方法:修改来自biblatex.def文件的原格式 +\newcommand{\bibtitlefont}{} +\newcommand{\bibauthorfont}{} +\newcommand{\bibpubfont}{} + +% +% 作者信息的输出格式 +% +% 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen +% 20180603,v1.0l,增加使用nameformat域来选择姓名格式 +\DeclareNameFormat{namefmtselected}{% +\iffieldundef{namefmtid}{}% +{\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}% +\ifcase\value{gbnamefmtcase}% + \ifgiveninits + {\usebibmacro{name:gbuppercase} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:gbuppercase} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% +\or + \ifgiveninits + {\usebibmacro{name:gblowercase} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:gblowercase} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% +\or + \ifgiveninits + {\usebibmacro{name:given-family} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:given-family} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% +\or + \ifgiveninits + {\usebibmacro{name:family-given} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:family-given} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% +\or +\usebibmacro{name:gbpinyin} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}% +\or + \ifnumequal{\value{listcount}}{1} + {\ifgiveninits + {\usebibmacro{name:family-given} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:family-given} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% + \ifboolexpe{% + test {\ifdefvoid\namepartgiven} + and + test {\ifdefvoid\namepartprefix}} + {} + {\usebibmacro{name:revsdelim}}} + {\ifgiveninits + {\usebibmacro{name:given-family} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:given-family} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}}% +\fi + \usebibmacro{name:andothers}} + +\DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式 +\DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family +\DeclareNameAlias{citename}{default}% Default used by \citename + +\DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace} +%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% + +%GB/T 7714-2015 风格,全部大写 +\newbibmacro*{name:gbuppercase}[4]{\bibauthorfont% +\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 +\renewcommand*{\revsdnamepunct}{}% + \ifuseprefix% + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifdefvoid{#3}{}{% + \ifcapital% + {\mkbibnameprefix{\MakeCapital{#3}}\isdot}% + {\mkbibnameprefix{#3}\isdot}% + \ifprefchar{}{\bibnamedelimc}}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% + \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital + \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号 + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% + \ifboolexpe{% + test {\ifdefvoid{#2}} + and + test {\ifdefvoid{#3}}} + {}{\revsdnamepunct}% + \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital + \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% + \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号 +} + +%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 +\newbibmacro*{name:gblowercase}[4]{\bibauthorfont% + \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 + \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def + \ifuseprefix + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifdefvoid{#3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{#3}}\isdot} + {\mkbibnameprefix{#3}\isdot}% + \ifprefchar{}{\bibnamedelimc}}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% + \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital + \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号 + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% + \ifboolexpe{% + test {\ifdefvoid{#2}} + and + test {\ifdefvoid{#3}}} + {}{\revsdnamepunct}% + \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital + \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} + \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号 +} + +%中文常见风格,汉语拼音全拼模式 +\newbibmacro*{name:gbpinyin}[4]{\bibauthorfont% +\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY +\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def +\renewrobustcmd*{\bibnamedelima}{\mbox{-}}% + \ifuseprefix + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifdefvoid{#3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{#3}}\isdot} + {\mkbibnameprefix{#3}\isdot}% + \ifprefchar{}{\bibnamedelimc}}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% + \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamegiven{#2}}\isdot}%\MakeCapital + \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}} + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% + \ifboolexpe{% + test {\ifdefvoid{#2}} + and + test {\ifdefvoid{#3}}} + {} + {\revsdnamepunct}% + \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital + \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} + \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% +} + + +\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily +%\urlstyle{rm} %使用这句也一样 +\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行 +\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行 +\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行 +\DeclareFieldFormat{doi}{% + \rmfamily{DOI}\addcolon\space + \ifhyperref + {\href{https://doi.org/#1}{\nolinkurl{#1}}} + {\nolinkurl{#1}}} + +\DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线 + +% +% beamer中文献标题后的标点问题 +% v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen +% +% 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况: +% texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于 +% 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响 +% 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct +\@ifclassloaded{beamer}{ + \DeclareFieldFormat{title}{#1}% + \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1} + \AtBeginDocument{% + \patchcmd{\abx@macro@title}{\newunitpunct}{}{}{}}}{} + + + % + % 专利的公告日期、或报纸的日期的输出宏 + % 20160701,v1.0,新增加 + % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen + % + % 原理方法:加上printtext避免破坏异步标点机制 + % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份 + % 所以无法再用选项设置的方法,印象需要用底层的命令 + % 这里可以用\blx@isodate,但用自定义的\blx@gbdate,以避免版本判断 + \newbibmacro*{newsdate}{%% + \printtext{\blx@gbdate{}{}}%%\blx@isodate{}{}% + } + + \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 + \ifboolexpr{% + test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% + }% + {}%更新或修改日期通常有day信息 + {\iffieldundef{year}{% + \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% + {\printtext{(}\printenddate\printtext{)}}% + }{\iffieldequalstr{year}{}{%因为year存在,但为空 + }{\printtext{(}\blx@gbdate{}{}\printtext{)}}% + }% + }}% + + + % + % biblatex>v3.8版利用related实现双语文献的处理 + % + %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了, + %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息 + %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中 + \newcommand{\defdoublelangentry}[2]{% + \edef\entrykeya{#1} + \edef\entrykeyb{#2} + \DeclareStyleSourcemap{ + \maps[datatype=bibtex]{ + \map{ + \step[fieldsource=entrykey, match=\entrykeya, final] + \step[fieldset=related, fieldvalue=\entrykeyb] + } + } + } + } + + % 关联文献的输出格式 + % + % 关联文献间的分隔符 + % + \renewcommand{\relateddelim}{\adddot\newline\nobreak}%\par,而作者年样式不需要修改,因为没有项对齐的标签问题 + % + % 关联文献块前的分隔符,针对biblatex>3.11 + % + % 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏 + \ifdef{\begrelateddelim}{\renewcommand{\begrelateddelim}{\adddot\newline\nobreak}}{} + + + +% +% 新增一个样式用于调整期刊年份的格式,只打印年份 +% +\newbibmacro*{periodical+issue}{% + \printtext{%去掉了[parens] + \iffieldundef{issue} + {%\usebibmacro{date}%修改为下一句 + }% + {\printfield{issue}% + \setunit*{\addspace}% + %\usebibmacro{date}%修改为下一句 + }% + }% + %\newunit +} + +% +% 重设专利title的输出,将文献类型标识符输出出去 +% +\renewbibmacro*{patenttitle}{%原输出来自biblatex.def文件 + \ifboolexpr{% + test{\iffieldundef{title}}% + and% + test{\iffieldundef{subtitle}}% + }% + {}% + {\printtext[title]{\bibtitlefont% + \printfield[titlecase]{title}% + \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 + {}{\setunit{\subtitlepunct}% + \printfield[titlecase]{subtitle}}% + \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 + {\setunit{\subtitlepunct}\printfield{titleaddon}}% + \setunit{\subtitlepunct}\printfield{number}%写专利号 + \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}% + %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 + %\newunit + }% +}% +} + +% +% 编者类型的本地化字符串输出 +% v1.0q 2019-03-01 hzz +% 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符 +% 能对不同文境作设置的包括排序,标签等 +% 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串 +% +\DeclareDelimFormat{streditortypes}{% + \edef\userfieldabcde{userd}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% + \or% + \bibstring{\thefield{editortype}scn}% + \or% + \addcomma\addthinspace\bibstring{\thefield{editortype}s}% + \fi}% +% +\DeclareDelimFormat{streditortype}{% + \edef\userfieldabcde{userd}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% + \or% + \bibstring{\thefield{editortype}cn}% + \or% + \addcomma\addthinspace\bibstring{\thefield{editortype}}% + \fi}% + + +% +% 修改series域的输出格式 +% 2019.05.01,v1.0r,byhzz +\renewbibmacro*{series+number}{% + \printfield{series}% + %\setunit*{\addspace}% + %\printfield{number}% + %\newunit + } + +%===================================================================== +%设置驱动格式 +%===================================================================== + +%中文环境的局部化代码 +\def\localsetchinesecode{% +\ifboolexpr{% +togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}% +}% +{% +\iftoggle{bbx:gbfieldstd}{}{% +\DeclareFieldFormat{title}{##1\adddot\addthinspace}% +\DeclareFieldFormat{journaltitle}{##1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪 +\DeclareFieldFormat{issuetitle}{##1}% +\DeclareFieldFormat{maintitle}{##1}% +\DeclareFieldFormat{booktitle}{##1}% +\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 + [article,patent,thesis,unpublished]% + {title}{##1\adddot\addthinspace}%\mkbibquote{##1\isdot} +\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 + [inbook,incollection,inproceedings]% + {title}{##1}%\nopunct\unspace +\DeclareFieldFormat{url}{\url{##1}}%%url相关输出,url域修改如本行,源来自biblatex.def +% +% 标题的字母大小写格式修改 +% +% 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase +% 因为titlecase is applied to the contents of the field directly,title is not +%\DeclareFieldFormat{titlecase}{\MakeCapital##1}%重设标题格式,将其修改为首字母大写 +\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{% +\iffieldundef{url}{\MakeCapital##1}{% +\href{\thefield{url}}{##1}}}{\MakeCapital##1}}%重设标题格式,将其修改为首字母大写 +\DeclareFieldFormat{pages}{##1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{##1} +}% +% +% 修改译者位置格式 +% +% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式 +\renewbibmacro*{bytranslator+others}{% + \ifnameundef{translator}% + {}% + {%\usebibmacro{bytranslator+othersstrg} + %\setunit{\addspace}% + \printnames[bytranslator]{translator}% + \clearname{translator}% + %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理 + %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串 + \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。 + %\setunit{\addspace}% + \newunit}% + \usebibmacro{withothers}}% +% +% 修改作者数量超过限定值,做省略时的处理格式 +% v1.0,20160701,hzz +% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim +% +% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。 +\renewbibmacro*{name:andothers}{% + \ifboolexpr{% + test {\ifnumequal{\value{listcount}}{\value{liststop}}}% + and + test \ifmorenames + }{\ifnumgreater{\value{liststop}}{1}% + {\finalandcomma}% + {}% +\printdelim{andothersdelim}\printdelim{strandothersdelim}% +}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如: +%袁训来, 陈哲, 肖书海, 等. +%胡泳, 范海燕, 译. +%潘惠霞, 魏婧, 杨艳, 等译. +\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理 +}}% +% +% 修改省略作者后的本地化字符串,比如et al. +% v1.0o,20190103,hzz +% +% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。 +% 非默认情况,根据选项信息,选择选择强制中文或英文 +% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 +% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 +\DeclareDelimFormat{strandothersdelim}{% + \edef\userfieldabcde{userd}% + \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}% + \or% + \bibstring{andotherscn}% + \or% + \bibstring{andothers}% + \fi}% +% +% 修改最后一个作者前的字符串,比如 and +% v1.0o,20190103,hzz +% +% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。 +% 非默认情况,根据选项信息,选择选择强制中文或英文 +% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 +% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 +\DeclareDelimFormat{finalnamedelim}{% + \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% + \addspace% + \edef\userfieldabcde{userd}% + \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% +\space% + \or% + \bibstring{andcn}\space% + \or% + \bibstring{and}\space% + \fi}% +% +% url和url日期格式 +% + \renewbibmacro*{url+urldate}{% + %\usebibmacro{url}%%更换url的位置,放到下面 + \iffieldundef{urlyear}% + {}{%\setunit*{\addspace}% + \usebibmacro{urldate}}% + \setunit{\addperiod\addspace}% + \usebibmacro{url}}% + \renewbibmacro*{url}{\printfield{url}}% +% +% 重设title的输出 +% +% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen +% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件 +% 利用toggle做标识符是否输出的判断 +\renewbibmacro*{title}{% + \ifboolexpr{% + test{\iffieldundef{title}}% + and + test{\iffieldundef{subtitle}}% + }% + {}% + {\printtext[title]{\bibtitlefont%增加字体控制命令 + \printfield[titlecase]{title}% + \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 + {}{\setunit{\subtitlepunct}% + \printfield[titlecase]{subtitle}}% + \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 + {\setunit{\subtitlepunct}\printfield{titleaddon}}% + \iftoggle{bbx:gbtype}{% + \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 + {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 + {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 + {\printfield[gbtypeflag]{usera}}}%其它 + }}{}% + %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 + %\newunit +}% +}}% +% +% 日期信息的输出格式,针对biblatex<3.7版本 +% +\DeclareFieldFormat{urldate}{##1}% +\renewbibmacro*{urldate}{% +\addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 +% +% 调整doi+eprint+url格式 +% +% 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。 +\renewbibmacro*{doi+eprint+url}{% +% \iftoggle{bbx:doi}%把doi的位置放到url后面 +% {\printfield{doi}} +% {}% + %\newunit\newblock + \iftoggle{bbx:eprint} + {\iffieldundef{eprint}{}{\newunit\usebibmacro{eprint}}} + {}% + %\newunit\newblock + \iftoggle{bbx:url} + {\usebibmacro{url+urldate}} + {} + \newunit\newblock + \iftoggle{bbx:doi} + {\printfield{doi}} + {}}% +% +% 调整页码的格式,即chapter+pages格式 +% +\renewbibmacro*{chapter+pages}{% +\iftoggle{bbx:gbstrict}{}{% + \printfield{chapter}}% + \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出 + \setunit{\bibpagespunct}% + \printfield{pages}}% + %\newunit %这里的标点去掉 +}% +% +% 当location等出版项超过maxitem缩减后不再输出etal +% +\DeclareListFormat{location}{% + \usebibmacro{list:delim}{##1}% + ##1\isdot}% +\DeclareListAlias{institution}{location}% +\DeclareListAlias{publisher}{location}% +% 新增一个样式用于输出连续出版物的地址,单位,时间, +% 用于periodical连续出版物的出版社和地址的处理 +% +% v1.0k,20180425,为出版信息增加字体控制命令,hzz +% %类似\newbibmacro*{publisher+location+date} +\newbibmacro*{location+institution+date}{\bibpubfont% +\iftoggle{bbx:gbpub}% +{\testCJKfirst{userd}% +\ifboolexpr{% +test {\iflistundef{location}} and test {\iflistundef{institution}}% +}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}% +{\printtext{[S.l.\space :\space s.n.\adddot]}}% +}{% +\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}% + {\printlist{location}}% +\addcolon\addspace% +\iflistundef{institution}{% +\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}% \bibstring{nopublisher}%[s.n.\adddot] +{\printlist{institution}}}% +\setunit{\addcomma\addspace}% + %\usebibmacro{date}% + \printfield{year}% + \bibrangedash% + \iffieldundef{endyear}{}{\printfield{endyear}}% + \newunit}% +{\printlist{location}% + \iflistundef{institution}% + {\setunit*{\addcomma\space}} + {\setunit*{\addcolon\space}}% + \printlist{institution}% + \setunit*{\addcomma\space}% + \usebibmacro{date}% + \newunit}% +}% +% +% 通用的出版社和地址的处理 +% +% 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。 +% 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。 +% 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理 +\renewbibmacro*{publisher+location+date}{\bibpubfont% +\iftoggle{bbx:gbpub}% +{\testCJKfirst{userd}% + \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }% + {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}% + {\iflistundef{location}{%\adddot + \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 + {\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress} + {\printlist{location}\addcolon\addspace}%%\addcolon\addspace% + \iflistundef{publisher}{% + \iffieldequalstr{note}{standard}{}% + {\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}% + {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}% + {\printlist{publisher}}}% +\setunit*{\addcomma\addspace}%\addcomma\addspace% +\usebibmacro{date}%%\newunit %去掉这个标点 +}% +{\printlist{location}% + \iflistundef{publisher} + {\setunit*{\addcomma\space}} + {\setunit*{\addcolon\space}}% + \printlist{publisher}% + \setunit*{\addcomma\space}% + \usebibmacro{date}%%\newunit + }% +}% +% +% 修改了一个institution+location+date用于manual、report、thesis等类型 +% +% 20180425,v1.0k,增加了字体控制命令,hzz +% 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉 +\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。 +{\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉 + \iflistundef{institution} + {\setunit*{\addcomma\space}} + {\setunit*{\addcolon\space}}% + \printlist{institution}% + \setunit*{\addcomma\space}% + \usebibmacro{date}% + %\newunit + }}% +% +% 对volume卷信息格式做出修改 +% v1.0o,20190105,hzz +% +\DeclareFieldFormat{volume}{% +\testCJKfirst{userd}% +\iftoggle{ifCJKforgbt}% +{\bibstring{serialcn}##1\bibstring{volumecn}}% +{\bibstring{volume}~##1}% +}% volume of a book +\DeclareFieldFormat[article,periodical]{volume}{##1}% volume of a journal +% +% 对number册信息格式做出修改 +% v1.0o,20190105,hzz +% +\DeclareFieldFormat{number}{##1}% +\DeclareFieldFormat[book,collection,inbook,% +incollection,proceedings,inproceedings]{number}{% +\testCJKfirst{userd}% +\iftoggle{ifCJKforgbt}% +{\bibstring{serialcn}##1\bibstring{numbercn}}% +{##1}% +}% +% +% 对edition版本信息格式做出修改 +% +\DeclareFieldFormat{edition}{%源来自biblatex.DEF +\testCJKfirst{userd}% +\iftoggle{ifCJKforgbt}% +{\ifinteger{##1}% +{\printtext{##1\str@edition}}% +{##1\isdot}}% +{\ifinteger{##1}% +{\mkbibordedition{##1}~\bibstring{edition}}% +{##1\isdot}}}% +% +% 对version的版本信息做出修改 +% +\DeclareFieldFormat{version}{%源来自biblatex.DEF +\testCJKfirst{userd}% +\ifinteger{##1}% +{\iftoggle{ifCJKforgbt}{\printtext{##1\str@edition}}% +{\mkbibordedition{##1}~\bibstring{version}}}% +{##1\isdot}}% +% +% 修改析出文献的文集的标题与附加标题间的符号 +% +\renewbibmacro*{booktitle}{% + \ifboolexpr{% + test {\iffieldundef{booktitle}} + and + test {\iffieldundef{booksubtitle}} + }% + {}% + {\printtext[booktitle]{\bibtitlefont% + \printfield[titlecase]{booktitle}% + \setunit{\subtitlepunct}% + \printfield[titlecase]{booksubtitle}}% + \newunit%标点换成下一句 + \setunit{\subtitlepunct}}% + \printfield{booktitleaddon}}% +% +% 调整期刊名的格式 +% +% v1.0k,20180425,增加了字体控制命令,hzz +\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx + \usebibmacro{journal}% + %\setunit*{\addspace}% + \setunit*{\addcomma\addspace}%修改为增加一个逗号 + \iffieldundef{series} + {} + {\newunit + \printfield{series}% + \setunit{\addspace}}% + %\usebibmacro{volume+number+eid}% + %\setunit{\addspace}% + \usebibmacro{issue+date}% + %\setunit{\addcolon\space}% + \iffieldundef{volume}{}{\setunit{\addcomma\space}}% + %换成逗号和空格 + \usebibmacro{issue}% + \usebibmacro{volume+number+eid}%把卷期放到年份后面 + %\newunit + }% +% +% 调整期刊卷和期的格式 +% +\renewbibmacro*{volume+number+eid}{%源来自standard.bbx +\iftoggle{bbx:gbfieldstd}{% + \printfield{volume}% + \setunit*{\adddot}% + \printfield{number}% + \setunit{\addcomma\space}% + \printfield{eid}}{% + \printfield{volume}% + %\setunit*{\adddot}%去掉点号 + %\printfield{number}% + \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号 + \iffieldundef{eid}{}{% + \setunit{\addcomma\space}% + \printfield{eid}}}}% +% +% 调整期刊年份的格式 +% +\renewbibmacro*{issue+date}{%去掉括号 + \printtext{%去掉了[parens] + \iffieldundef{issue} + {%\usebibmacro{date} + \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 + {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 + {\usebibmacro{date}}% + }}% + {\iftoggle{bbx:gbstrict}{}{\printfield{issue}% + \setunit*{\addspace}}% + %\usebibmacro{date} + \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 + {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 + {\usebibmacro{date}}% + }}}% + %\newunit + }% +% +% 调整页码前的标点和去掉期刊文章等页码后面的标点 +% +\renewbibmacro*{note+pages}{%源来自standard.bbx + %\printfield{note}%不要note,note用来判断是否是报纸newspaper + \iffieldundef{pages}{}{% + \setunit{\bibpagespunct}% + \printfield{pages}}% + %\newunit + }% +% +% 编者的符号修改一下 +% v1.0 2016-07-01 +% v1.0q 2019-03-01 hzz 修改editortype前的标点 +% +\renewbibmacro*{editor}{%源来自biblatex.DEF + \ifboolexpr{% + test \ifuseeditor + and + not test {\ifnameundef{editor}}% + }% + {\printnames{editor}% + \iffieldundef{editortype}%增加一个类型判断,用于存在editortype的情况 + {\setunit\addspace}%当没有editortype时,直接用句点 + {%\setunit{\addcomma\space}% + \usebibmacro{editorstrg}}% + %\clearname{editor} + }% + {}}% +% +% 编者类型做一修改 +% v1.0 2016-07-01 +% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串 +% +\renewbibmacro*{editorstrg}{%源来自biblatex.DEF + \printtext[editortype]{% + \iffieldundef{editortype}% + {% +% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理 +% test {\ifnumgreater{\value{editor}}{1}} +% or +% test {\ifandothers{editor}} +% } +% {\bibstring{editors}} +% {\bibstring{editor}} + }% + {\ifbibxstring{\thefield{editortype}}%定义编者类型情况下处理,以后根据需要修改 + {\ifboolexpr{% + test {\ifnumgreater{\value{editor}}{1}}% + or + test {\ifandothers{editor}}% + }% + {\printdelim{streditortypes}}% + {\printdelim{streditortype}}}% + {\thefield{editortype}}}% + }}% +% +% bookauthor域的输出, +% v1.0q 2019-03-01 hzz +% 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替, +% 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype +\renewbibmacro*{bybookauthor}{% + \ifnameundef{bookauthor}% + {\ifnameundef{editor}% + {}% + {\ifnamesequal{author}{editor}% + {}{\usebibmacro{editor}}}% + }% + {\ifnamesequal{author}{bookauthor}% + {}{\printnames{bookauthor}}% + }% +}% +% +% 修改期刊的标题 +% +\renewbibmacro*{periodical}{%源来自biblatex.DEF + \iffieldundef{title} + {}% + {\printtext[title]{\bibtitlefont% + \printfield[titlecase]{title}% + %\setunit{\subtitlepunct}% + \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 + {}{\setunit{\subtitlepunct} + \printfield[titlecase]{subtitle}}% + %}%把编组结束移到后面去 + \iftoggle{bbx:gbtype}{% + \iffieldundef{usera}{}{%在标题后直接给出文献标识字母 + \printfield[gbtypeflag]{usera}}}{}% + }}% + }% +% +% 期刊的标题做修改 +% +\renewbibmacro*{title+issuetitle}{%源来自standard.BBX + \usebibmacro{periodical}% + %\setunit*{\addspace}% + \setunit*{\adddot\addspace}%标点修改为句点 + \iffieldundef{series} + {}% + {\newunit + \printfield{series}% + \setunit{\addspace}}% + \usebibmacro{periodical+issue}%将issue调整到上面来,并修改 +\iffieldundef{number}{}{%%进一步处理有范围的数字 + \multinumberparser{\thefield{number}}}% + \iffieldundef{volume}% + {\printfield{year}% + \printtext{\mkbibparens{\multinumberfirst}}% + \bibrangedash% + \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}% + }% + {\multivolparser{\thefield{volume}}% + \printfield{year}% + \setunit{\addcomma\space}%将冒号修改为逗号 + \printtext{\multivolfirst}% + \printtext{\mkbibparens{\multinumberfirst}}% + \bibrangedash% + \iffieldundef{endyear}{}{% + \printfield{endyear}% + \setunit{\addcomma\space}%将冒号修改为逗号 + \printtext{\multivolsecond}% + \printtext{\mkbibparens{\multinumbersecond}}}% + }% + \setunit{\addcomma\space}% + \printfield{eid}% + \setunit{\addspace}% + %\usebibmacro{issue+date}% + %\setunit{\addcolon\space}% + \usebibmacro{issue}% + \newunit}% +% +% 修改in:用于inbook、incollection、inproceedings等类型 +% 2018.04.20,v1.0k,renewed marco,by hzz +% 20190212,v1.0q,增加中英文区分,by hzz +% +% 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。 +\renewbibmacro*{in:}{% + \iftoggle{bbx:gbpunctin}{\printtext{\allowbreak\texttt{//}\allowbreak}}%\addthinspace + {\setunit{\adddot\addspace}% + \iffieldequalstr{userd}{chinese}% + {\printtext{\bibstring{incn}}}% + {\printtext{\bibstring{in}}}% + }}%\newunit\newblock\intitlepunct +% +% 修改type域的输出格式 +% 2019.02.12,v1.0q,byhzz +% 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文 +\DeclareFieldFormat{type}% +{\iffieldequalstr{userd}{chinese}% + {\ifbibxstring{##1cn}{\bibxstring{##1cn}}{##1}}% + {\ifbibstring{##1}{\bibstring{##1}}{##1}}% +}% +% +% book条目类的驱动 +% +\csdef{blx@bbx@book}{%%源来自standard.bbx文件 + \usebibmacro{bibindex}% + \usebibmacro{begentry}% +\usebibmacro{author/editor+others/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 +\usebibmacro{maintitle+title}% +\iftoggle{bbx:gbstrict}{}{% +\newunit +\printlist{language}% +\newunit\newblock% +\usebibmacro{byauthor}% +\newunit\newblock}% +\usebibmacro{byeditor+others}% +\newunit +\printfield{edition}% +\newunit\newblock%% +\iftoggle{bbx:gbstrict}{}{% +\iffieldundef{maintitle}% +{\printfield{volume}% +\printfield{part}}% +{}% +\newunit% +\printfield{volumes}% +\newunit\newblock% +\usebibmacro{series+number}}% +\newunit\newblock% +%\printfield{note}% +%\newunit\newblock% +\usebibmacro{publisher+location+date}% +%\newunit\newblock %这里标点去掉 +\usebibmacro{chapter+pages}% + \iffieldundef{url}{}{%当没有网址时也不输出 + \usebibmacro{modifydate}}%带括号的修改或更新日期, +\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 + \newunit\newblock% + \printfield{pagetotal}% + \newunit\newblock% + \iftoggle{bbx:isbn} + {\printfield{isbn}} + {}% + \newunit\newblock + %\usebibmacro{doi+eprint+url}% + %\newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}}% +% +% 期刊文章,连续出版物中的析出文献的格式 +% +\csdef{blx@bbx@article}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}% + \newunit\newblock + \usebibmacro{bytranslator+others}% + \newunit\newblock + \printfield{version}}% + \newunit\newblock + %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物 + \usebibmacro{journal+issuetitle}% + %\newunit +% \usebibmacro{byeditor+others}% +% \newunit + \usebibmacro{note+pages}% + \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期 + \iffieldundef{url}{}{%当没有网址时也不输出 + \iftoggle{bbx:url}{%当url选项为false时,也不输出 + \usebibmacro{modifydate}}{}}}%带括号的修改或更新日期, + \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置 + \newunit\newblock + \iftoggle{bbx:isbn} + {\printfield{issn}} + {}% + \newunit\newblock + %\usebibmacro{doi+eprint+url}% + %\newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}}% +% +% 连续出版物的驱动 +% +\csdef{blx@bbx@periodical}{%源来自standard.BBX + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{editor}% + %\setunit{\labelnamepunct}\newblock + \newunit\newblock %删除上面一行,添加这一行 + \usebibmacro{title+issuetitle}% + \newunit\newblock% + \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间 + \newunit\newblock%添加这一行 + \iftoggle{bbx:gbstrict}{}{% + \printlist{language}% + \newunit\newblock + \usebibmacro{byeditor}% + \newunit\newblock + \printfield{note}% + \newunit\newblock} + \iftoggle{bbx:isbn} + {\printfield{issn}} + {}% + \newunit\newblock + \usebibmacro{doi+eprint+url}% + \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}}% +% +% 专利文献驱动 +% +\csdef{blx@bbx@patent}{%源来自standard.BBX + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + %\usebibmacro{title}% + \usebibmacro{patenttitle}%给出专利专用的标题输出 + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}}% + \newunit\newblock + \printfield{type}% + \setunit*{\addspace}% + %\printfield{number}%已放到patenttitle中处理 + \iflistundef{location} + {} + {\setunit*{\addspace}% + \printtext{%[parens] + \printlist[][-\value{listtotal}]{location}}}% + \newunit\newblock + \usebibmacro{byholder}% + \newunit\newblock + \printfield{note}% + \newunit\newblock + \usebibmacro{newsdate}% + %\newunit\newblock + \usebibmacro{doi+eprint+url}% + \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}}% +% +% 在线文献驱动 +% +\csdef{blx@bbx@online}{%源来自standard.BBX + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/editor+others/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}% + \newunit\newblock + \usebibmacro{byeditor+others}% + \newunit\newblock + \printfield{note}}% + \newunit + \printfield{version}% + \newunit\newblock +%\printlist{organization}% + \printlist{institution}% + \newunit\newblock +\ifboolexpr{% +test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% +}{\usebibmacro{date}}% +{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间 + \usebibmacro{url+urldate}%从下面移上来 + \newunit\newblock + \iftoggle{bbx:eprint} + {\usebibmacro{eprint}} + {}% + \newunit\newblock + %\usebibmacro{url+urldate}% + %\newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}}% +% +% 报告类型驱动 +% 2016-11-11,增加了译者信息 +% +\csdef{blx@bbx@report}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}}% + \newunit\newblock + \usebibmacro{byeditor+others}%增加的译者信息 + \newunit\newblock + \printfield{type}% + \setunit*{\addspace}% + \printfield{number}% + \newunit\newblock + \printfield{version}% + \newunit + \printfield{note}% + \newunit\newblock + \usebibmacro{publisher+location+date}% + %\newunit\newblock + \usebibmacro{chapter+pages}% + \usebibmacro{doi+eprint+url}% + \newunit + \printfield{pagetotal}% + \newunit\newblock + \iftoggle{bbx:isbn} + {\printfield{isrn}} + {}% + \newunit\newblock +% \usebibmacro{doi+eprint+url}% +% \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}}% +% +% 手册类型驱动 +% 2016-11-11,增加了译者信息 +% +% +\csdef{blx@bbx@manual}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}}% + \newunit\newblock + \usebibmacro{byeditor+others}%增加的译者信息 + \newunit\newblock + \iftoggle{bbx:gbfieldtype}{% + \printfield{type}% + \setunit*{\addspace}}{}% + \printfield{number}% + \newunit\newblock + \printfield{version}% + \newunit + \printfield{note}% + \newunit\newblock + \usebibmacro{institution+location+date}% + %\newunit\newblock + \usebibmacro{chapter+pages}% + \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期 + \usebibmacro{modifydate}}%修改或更新日期为带括号的时间 + \usebibmacro{doi+eprint+url}% + \newunit + \printfield{pagetotal}% + \newunit\newblock + \iftoggle{bbx:isbn} + {\printfield{isrn}} + {}% + \newunit\newblock +% \usebibmacro{doi+eprint+url}% +% \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}}% +% +% 备选类型驱动 +% +% 利用biblatex的misc驱动 +\csdef{blx@bbx@misc}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/editor+others/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% +\iftoggle{bbx:gbstrict}{}{% + \newunit + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}% + \newunit\newblock + \usebibmacro{byeditor+others}}% + \newunit\newblock + \printfield{howpublished}% + \newunit\newblock + \printfield{type}% + \newunit + \printfield{version}% + \newunit + \printfield{note}% + \newunit\newblock + \usebibmacro{institution+location+date}% + %\usebibmacro{organization+location+date}% + %\newunit\newblock + \usebibmacro{doi+eprint+url}% + \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}}% +% +% 专著中的析出文献的格式修改 +% +\csdef{blx@bbx@inbook}{%源来自standard.bbx + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 +\usebibmacro{title}% +\usebibmacro{in:}% +%\printtext{\texttt{//}\addthinspace}% + \usebibmacro{bybookauthor}% + \ifnameundef{bookauthor}{% + \ifnameundef{editor}{}{\newunit}% + }{\newunit}%替换下一句 + %\newunit\newblock +\iffieldundef{series}{}{\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加 + \usebibmacro{maintitle+booktitle}% +\iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}% +\iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息 + \newunit\newblock% +% \usebibmacro{byeditor+others}% +% \newunit\newblock + \printfield{edition}% + \newunit + \iftoggle{bbx:gbstrict}{}{% +% \iffieldundef{maintitle} +% {\printfield{volume}% +% \printfield{part}} +% {}% +% \newunit +% \printfield{volumes}% +% \newunit\newblock +% \usebibmacro{series+number} + }% + \newunit\newblock + %\printfield{note}% + %\newunit\newblock + \usebibmacro{publisher+location+date}% +%\newunit\newblock + \usebibmacro{chapter+pages}% + %\newunit\newblock + \usebibmacro{doi+eprint+url}%移到上面来 + \newunit\newblock + \iftoggle{bbx:isbn} + {\printfield{isbn}} + {}% + \newunit\newblock + %\usebibmacro{doi+eprint+url}% +% \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}}% +}{}% +} + +\AtEveryBibitem{\localsetchinesecode}% +\AtEveryCite{\localsetchinesecode}% +\AtEveryLositem{\localsetchinesecode}% diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.cbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.cbx index e339e22c5c..3679a03ae9 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.cbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.cbx @@ -1,190 +1,190 @@ -%% -%% --------------------------------------------------------------- -%% biblatex-gb7714-2015 --- A biblatex implementation of the -%% GBT7714-2015 citation style,numerical sequence -%% Maintained by huzhenzhen -%% E-mail: hzzmail@163.com -%% Released under the LaTeX Project Public License v1.3c or later -%% --------------------------------------------------------------- -%% -\def\versionofgbtstyle{2020/07/21 v1.0v} -\ProvidesFile{gb7714-2015ms.cbx}[\versionofgbtstyle biblatex citation style] - -% -% 加载标准样式 -% -\RequireCitationStyle{numeric-comp} %numeric - - -% -% 选项设置 -% -\ExecuteBibliographyOptions{ - autocite = superscript , - autopunct = true , - %sorting = none , - maxcitenames=1, - mincitenames=1, -} - -%textcite标注命令中的标点设置 -%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% - -% -% 定义一个上标方括号wrapper -% -\newcommand*\mkbibsuperbracket[1]{% - \mkbibsuperscript{\mkbibbrackets{#1}}% -} - -% 修改postnote的输出格式 -\DeclareFieldFormat{postnote}{#1} - -% -% 重定义cite命令 -% -% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode} -% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式 -\DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 - {[\usebibmacro{cite:init}% - \usebibmacro{prenote}} - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {\usebibmacro{cite:dump}]% - \printfield{postnote}} -% v1.0p 以前用的方式 -%\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号 -% {\usebibmacro{cite:init}% -% \usebibmacro{prenote}} -% {\usebibmacro{citeindex}% -% \usebibmacro{cite:comp}} -% {} -% {\usebibmacro{cite:dump}% -% \usebibmacro{postnote}} - -% -% 定义upcite命令 -% 20180604,v1.0l,hzz -% 20190409,v1.0r,hzz -% 方法:对supercite增加[] -\newrobustcmd*{\upcite}{% - \cite} - -% -% 重定义parencite命令,以满足标签带页码的国标要求 -% -\DeclareCiteCommand{\parencite}%[\mkbibbrackets] - {[\usebibmacro{cite:init}%] - \usebibmacro{prenote}}% - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {%[ - \usebibmacro{cite:dump}]% - \mkbibsuperscript{\printfield{postnote}}} - -% -% 新定义pagescite命令,以满足标签带页码的国标要求 -% -% 原理方法: -% 1.新增页码输出宏 -\newbibmacro*{postpages}{% - \iffieldundef{postnote} - {\printfield[postnote]{pages}} - {\printfield{postnote}}} -% 2.新增\pagescite引用命令 -\DeclareCiteCommand{\pagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 - {[\usebibmacro{cite:init}%]直接添加方括号 - \usebibmacro{prenote}% - } - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {\usebibmacro{cite:dump}]% - \usebibmacro{postpages}} - -% -% 定义yearpagescite,为与ay样式兼容,等同于\pagescite -% -\DeclareCiteCommand{\yearpagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 - {[\usebibmacro{cite:init}%]直接添加方括号 - \usebibmacro{prenote}% - } - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {\usebibmacro{cite:dump}]% - \usebibmacro{postpages}} - - - -% -% 定义\yearcite命令,为与ay样式兼容,且提供不输出页码的标签格式, -% -% 原理方法:等同于\pagescite,但不要页码 -\DeclareCiteCommand{\yearcite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 - {[\usebibmacro{cite:init}%]直接添加方括号 - \usebibmacro{prenote}% - } - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {\usebibmacro{cite:dump}]} - -% -% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码 -% 20180427,v1.0k,增加,hzz -% gb7714样式新定义的命令都把cite放到最后,比如前面的pagescite,yearcite,这里的\authornumcite -% 区别于biblatex定义的命令都把cite放到前面,比如citeauthor等。 -%见numeric.CBX -\newbibmacro*{cite}{% - \printtext[bibhyperref]{% - \printfield{labelprefix}% - \printfield{labelnumber}% - \ifbool{bbx:subentry} - {\printfield{entrysetcount}} - {}}} -%见numeric.CBX,\DeclareCiteCommand{\cite}, -\DeclareCiteCommand{\authornumcite}%[\mkbibsuperscript] - {\usebibmacro{prenote}} - {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace - {\renewcommand*{\andothersdelim}{\addspace}}% - \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}% - \usebibmacro{cite}}}} - {\multicitedelim} - {\mkbibsuperscript{\printfield{postnote}}} - - -% -% 增加如下多个命令 -% 20190409,v1.0r,hzz -% 方法:利用newcommand或newrobustcmd命令进行定义 -% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突 -\DeclareCiteCommand{\citet}% - {\usebibmacro{prenote}} - {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace - {\renewcommand*{\andothersdelim}{\addspace}}% - \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}% - \usebibmacro{cite}}}} - {\multicitedelim} - {\mkbibsuperscript{\printfield{postnote}}} - - -\DeclareCiteCommand{\citep}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 - {[\usebibmacro{cite:init}% - \usebibmacro{prenote}} - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {\usebibmacro{cite:dump}]% - \printfield{postnote}} - -\newrobustcmd*{\citetns}% - {\textcite} - -\newrobustcmd*{\citepns}% - {\parencite} - -\newrobustcmd*{\inlinecite}% - {\parencite} +%% +%% --------------------------------------------------------------- +%% biblatex-gb7714-2015 --- A biblatex implementation of the +%% GBT7714-2015 citation style,numerical sequence +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% +\def\versionofgbtstyle{2021/01/19 v1.0w} +\ProvidesFile{gb7714-2015ms.cbx}[\versionofgbtstyle biblatex citation style] + +% +% 加载标准样式 +% +\RequireCitationStyle{numeric-comp} %numeric + + +% +% 选项设置 +% +\ExecuteBibliographyOptions{ + autocite = superscript , + autopunct = true , + %sorting = none , + maxcitenames=1, + mincitenames=1, +} + +%textcite标注命令中的标点设置 +%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% + +% +% 定义一个上标方括号wrapper +% +\newcommand*\mkbibsuperbracket[1]{% + \mkbibsuperscript{\mkbibbrackets{#1}}% +} + +% 修改postnote的输出格式 +\DeclareFieldFormat{postnote}{#1} + +% +% 重定义cite命令 +% +% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode} +% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式 +\DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 + {[\usebibmacro{cite:init}% + \usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {\usebibmacro{cite:dump}]% + \printfield{postnote}} +% v1.0p 以前用的方式 +%\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号 +% {\usebibmacro{cite:init}% +% \usebibmacro{prenote}} +% {\usebibmacro{citeindex}% +% \usebibmacro{cite:comp}} +% {} +% {\usebibmacro{cite:dump}% +% \usebibmacro{postnote}} + +% +% 定义upcite命令 +% 20180604,v1.0l,hzz +% 20190409,v1.0r,hzz +% 方法:对supercite增加[] +\newrobustcmd*{\upcite}{% + \cite} + +% +% 重定义parencite命令,以满足标签带页码的国标要求 +% +\DeclareCiteCommand{\parencite}%[\mkbibbrackets] + {[\usebibmacro{cite:init}%] + \usebibmacro{prenote}}% + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {%[ + \usebibmacro{cite:dump}]% + \mkbibsuperscript{\printfield{postnote}}} + +% +% 新定义pagescite命令,以满足标签带页码的国标要求 +% +% 原理方法: +% 1.新增页码输出宏 +\newbibmacro*{postpages}{% + \iffieldundef{postnote} + {\printfield[postnote]{pages}} + {\printfield{postnote}}} +% 2.新增\pagescite引用命令 +\DeclareCiteCommand{\pagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 + {[\usebibmacro{cite:init}%]直接添加方括号 + \usebibmacro{prenote}% + } + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {\usebibmacro{cite:dump}]% + \usebibmacro{postpages}} + +% +% 定义yearpagescite,为与ay样式兼容,等同于\pagescite +% +\DeclareCiteCommand{\yearpagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 + {[\usebibmacro{cite:init}%]直接添加方括号 + \usebibmacro{prenote}% + } + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {\usebibmacro{cite:dump}]% + \usebibmacro{postpages}} + + + +% +% 定义\yearcite命令,为与ay样式兼容,且提供不输出页码的标签格式, +% +% 原理方法:等同于\pagescite,但不要页码 +\DeclareCiteCommand{\yearcite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 + {[\usebibmacro{cite:init}%]直接添加方括号 + \usebibmacro{prenote}% + } + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {\usebibmacro{cite:dump}]} + +% +% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码 +% 20180427,v1.0k,增加,hzz +% gb7714样式新定义的命令都把cite放到最后,比如前面的pagescite,yearcite,这里的\authornumcite +% 区别于biblatex定义的命令都把cite放到前面,比如citeauthor等。 +%见numeric.CBX +\newbibmacro*{cite}{% + \printtext[bibhyperref]{% + \printfield{labelprefix}% + \printfield{labelnumber}% + \ifbool{bbx:subentry} + {\printfield{entrysetcount}} + {}}} +%见numeric.CBX,\DeclareCiteCommand{\cite}, +\DeclareCiteCommand{\authornumcite}%[\mkbibsuperscript] + {\usebibmacro{prenote}} + {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace + {\renewcommand*{\andothersdelim}{\addspace}}% + \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}% + \usebibmacro{cite}}}} + {\multicitedelim} + {\mkbibsuperscript{\printfield{postnote}}} + + +% +% 增加如下多个命令 +% 20190409,v1.0r,hzz +% 方法:利用newcommand或newrobustcmd命令进行定义 +% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突 +\DeclareCiteCommand{\citet}% + {\usebibmacro{prenote}} + {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace + {\renewcommand*{\andothersdelim}{\addspace}}% + \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}% + \usebibmacro{cite}}}} + {\multicitedelim} + {\mkbibsuperscript{\printfield{postnote}}} + + +\DeclareCiteCommand{\citep}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 + {[\usebibmacro{cite:init}% + \usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {\usebibmacro{cite:dump}]% + \printfield{postnote}} + +\newrobustcmd*{\citetns}% + {\textcite} + +\newrobustcmd*{\citepns}% + {\parencite} + +\newrobustcmd*{\inlinecite}% + {\parencite} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx index 2efd24b091..6ff1d8af16 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx @@ -1,3339 +1,3340 @@ -%% -%% --------------------------------------------------------------- -%% biblatex-gb7714-2015 --- A biblatex implementation of the -%% GBT7714-2015 bibliography style,numerical sequence and authoryear mixed style -%% Maintained by huzhenzhen -%% E-mail: hzzmail@163.com -%% Released under the LaTeX Project Public License v1.3c or later -%% --------------------------------------------------------------- -%% - -% -% 版本和时间信息 -% -\def\versionofgbtstyle{2020/07/21 v1.0v} -\def\versionofbiblatex{\abx@version} -\ProvidesFile{gb7714-2015mx.bbx}[\versionofgbtstyle biblatex bibliography style] -%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求 - -%===================================================================== -% 加载标准样式 -%===================================================================== -\RequireBibliographyStyle{numeric-comp} -\RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题 - - -%===================================================================== -% 功能函数 -%===================================================================== - % - % 增加一个控制是否输出文献载体的选项 - % 20191125,v1,0s,hzz - \newtoggle{bbx:gbmedium} - \DeclareBibliographyOption{gbmedium}[true]{%biblatex低版本 - \settoggle{bbx:gbmedium}{#1}} - \ExecuteBibliographyOptions{gbmedium} - % - % 增加一个控制是否输出annotation域的选项,该域可以用于在文献条目后面输出一些注释信息 - % 20190509,v1,0s,hzz - \newtoggle{bbx:gbannote} - \DeclareBibliographyOption{gbannote}[false]{%biblatex低版本 - \settoggle{bbx:gbannote}{#1}} - \ExecuteBibliographyOptions{gbannote} - % - %用于在文献条目后面输出注释信息的宏 - %FieldFormat{annotation}用于设置注释信息的格式 - \DeclareFieldFormat{annotation}{% - \printtext{\addspace(#1)}% - } - \renewbibmacro*{annotation}{% - \iftoggle{bbx:gbannote}% - {\iffieldundef{annotation}% - {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}% - {\printfield{annotation}}}% - {}% - } - - - % - % biblatex版本判断 - % 20180629,v1.0k,hzz - % - % 原理方法:适用于3.10以上版本的biblatex,否则给出警告 - \@ifpackagelater{biblatex}{2017/12/28}{}{ - \blx@warning@noline{% - biblatex version is too old for this style\MessageBreak - if errors raised,Please update biblatex to the latest version.} - } - - % - % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成 - % v1.0k,20180509,hzz - % - % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏 - % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8 - % 编码用xelatex编译的问题。 - % - % 原理是:利用perl正则将中文标识记录到域中, - % 然后利用\iffieldundef和\iffieldequalstr进行判断 - \providetoggle{ifCJKforgbt} - \def\testCJKfirst#1{% - \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{% - \iffieldequalstr{#1}{chinese}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}} - - % - % 2个卷的解析函数,用于连续出版物 - % - % 原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号 - \newcommand{\multivolparser}[1]{% - \IfSubStr{#1}{-}% - {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}% - {\def\multivolfirst{#1}\def\multivolsecond{}}% - } - - - % - % 2个期的解析函数,用于连续出版物 - % - \newcommand{\multinumberparser}[1]{% - \IfSubStr{#1}{-}% - {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}% - {\def\multinumberfirst{#1}\def\multinumbersecond{}}% - } - -%===================================================================== -% 数据模型定义 -%===================================================================== - %定义类型和载体标识,从gb内容看载体基本属于介质。 - %为与lee zeping的bst的样式统一,使用mark和medium这两域名 - %为单个条目的姓名格式控制增加nameformat和namefmtid两个域 - %为缩略信息文献表增加了shortbooktitle域 - %为多语言排序增加了lansortorder域 - \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat} - \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid} - \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle} - \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder} - %为多样式文献表增加的stylesections、styleaysection域: - \DeclareDatamodelFields[type=field,datatype=integer]{aysections} - \DeclareDatamodelFields[type=field,datatype=literal]{styleaysection} - - %因为biblatex更新3.14版本以后,biber对于为声明数据模型的条目类型 - %不再默认读取,而是以空字符串作为条目类型名,自然在条目定义alias时 - %就会出现问题,因此显式的声明一下newspaper,然后保留后面采用alias的方式 - %而standard类型则是采用另一种方式直接在sourcemap中转换为其它类型。 - \@ifpackagelater{biblatex}{2019/11/30}{%2019/12/01 v3.14 - \DeclareDatamodelEntrytypes{newspaper}% - }{} - - - -%===================================================================== -% 设置宏包选项 -%===================================================================== - % - % 增加一个控制是否输出type域的选项 - % 20190212,v1,0q,hzz - \newtoggle{bbx:gbfieldtype} - \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本 - \settoggle{bbx:gbfieldtype}{#1}} - \ExecuteBibliographyOptions{gbfieldtype} - - % - % 增加一个控制是否根据页码重设脚注数字标号的选项 - % 20190422,v1,0r,hzz - \newtoggle{bbx:gbfnperpage} - \DeclareBibliographyOption{gbfnperpage}[false]{% - \settoggle{bbx:gbfnperpage}{#1}} - \ExecuteBibliographyOptions{gbfnperpage} - - % - % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表 - % 20190203,v1.0p,hzz - % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签 - % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式 - % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题 - \DeclareBibliographyOption{gbfootbib}[false]{% - \ifstrequal{#1}{false}{}{\execgbfootbib}} - \ExecuteBibliographyOptions{gbfootbib} - - %% - \newlength{\footbibmargin} - \newlength{\footbiblabelsep} - \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离 - \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距 - \def\execgbfootbib% - {% - %开启引用跟踪计数器,为使用\ifciteseen等测试命令 - \ExecuteBibliographyOptions{citetracker=true} - % - %利用footmisc宏包来实现脚注文献的悬挂对齐 - \AtEndPreamble{ - \@ifclassloaded{beamer}{}{ - %beamer类因为其特殊性,为避免冲突不调footmisc。 - %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接 - %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。 - %\PassOptionsToPackage{perpage,hang}{footmisc}% - %\RequirePackage{footmisc}% - - %重新实现脚注的根据单页重设脚注号码 - %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改 - %v1.0q 20190317 hzz - %v1.0r 20190422 hzz 根据gbfnperpage选项设置 - \iftoggle{bbx:gbfnperpage}% - {\@addtoreset{footnote}{page}}{}%重设计数器 - - \@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义 - \long\def\H@@footnotetext##1{\insert\footins{% - \reset@font\footnotesize - \interlinepenalty\interfootnotelinepenalty - \splittopskip\footnotesep - \splitmaxdepth \dp\strutbox \floatingpenalty \@MM - \hsize\columnwidth \@parboxrestore - \protected@edef\@currentlabel{% - \csname p@footnote\endcsname\@thefnmark - }% - \color@begingroup - \leftskip \footbibmargin%增加的左侧缩进 - \@makefntext{% - \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% - }% - \color@endgroup}}% - - \long\def\H@@mpfootnotetext##1{% - \global\setbox\@mpfootins\vbox{% - \unvbox\@mpfootins - \reset@font\footnotesize - \hsize\columnwidth - \@parboxrestore - \protected@edef\@currentlabel - {\csname p@mpfootnote\endcsname\@thefnmark}% - \leftskip \footbibmargin%增加的左侧缩进 - \color@begingroup - \@makefntext{% - \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% - \color@endgroup}} - }{%否则对latex核心代码中的\@footnotetext做重定义 - \long\def\@footnotetext##1{\insert\footins{% - \reset@font\footnotesize - \interlinepenalty\interfootnotelinepenalty - \splittopskip\footnotesep - \splitmaxdepth \dp\strutbox \floatingpenalty \@MM - \hsize\columnwidth \@parboxrestore - \protected@edef\@currentlabel{% - \csname p@footnote\endcsname\@thefnmark - }% - \color@begingroup - \leftskip \footbibmargin%增加的左侧缩进 - \@makefntext{% - \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% - }% - \color@endgroup}}% - - \long\def\@mpfootnotetext##1{% - \global\setbox\@mpfootins\vbox{% - \unvbox\@mpfootins - \reset@font\footnotesize - \hsize\columnwidth - \@parboxrestore - \protected@edef\@currentlabel - {\csname p@mpfootnote\endcsname\@thefnmark}% - \leftskip \footbibmargin%增加的左侧缩进 - \color@begingroup - \@makefntext{% - \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% - \color@endgroup}} - } - - \long\def\@makefntext##1{%增加了脚注标记与正文的间隔 - \parindent 1em\noindent \hb@xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1} - - } - - % - %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式 - \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}} - %做patch使得脚注内容中的脚注数字标签不上标 - \pretocmd{\@makefntext}{% - \def\@makefnmark{% - \hbox{\textcircled{\tiny\@thefnmark}}% - }% - }{}{} - } - - % - %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容) - %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。 - %v1.0q 20190309 区分使脚注标注适应minipage中的情况 - \newbibmacro*{citesavefn}{% - \ifciteseen%当被引用过为true - {\ifcsdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%当已经定义过脚注序号信息 - {\csgdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% - \str@sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}% - \@makefnmark% - }}% - {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% - \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% - }}% - }% - {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% - \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% - %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断 - }}% - } - - % - %重定义\footfullcite使完成gb7714-2015的脚注文献要求 - \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% - {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 - \defcounter{minnames}{\blx@minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。 - \usebibmacro{prenote}% - \renewbibmacro*{postnote}{% - \iffieldundef{postnote}% - {}{\setunit{\addcolon\addspace}\printtext{\thefield{postnote}}}}%由于ay样式中没有修改postnote域,此处因为格式需要不使用默认域格式 - }% - {\usebibmacro{citesavefn}% - \ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}% - {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%\nopunct - {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}% - }% - {\multicitedelim}% - {\usebibmacro{postnote}} - - } - - % - % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式 - % 20180814,v1.0m,hzz - % 原理方法: - % 只为兼容性考虑不做任何处理 - \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本 - } - - % - % 增加一个控制是否输出文献类型和载体标识的选项 - % - % 原理方法: - % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的 - % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本 - \newtoggle{bbx:gbtype} - %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本 - \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本 - \settoggle{bbx:gbtype}{#1}} - \ExecuteBibliographyOptions{gbtype} - - % - % 增加一个源文件编码选择选项,当true时可以使用GBK编码。 - % v1.0k, 2018.05.08, by hzz - % - % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档 - % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def - % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用 - % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。 - % 另外注意: - % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码 - % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常 - % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。 - \newtoggle{bbx:codegbk} - \DeclareBibliographyOption{gbcodegbk}[false]{% - \settoggle{bbx:codegbk}{#1}} - \ExecuteBibliographyOptions{gbcodegbk} - - \def\str@bibliography{参考文献} - \def\str@references{参考文献} - \def\str@bytranslator{译} - \def\str@andotherscn{等} - \def\str@backrefpage{引用页} - \def\str@backrefpages{引用页} - \def\str@noaddress{出版地不详} - \def\str@nopublisher{出版者不详} - \def\str@edition{版} - \def\str@volumecn{卷} - \def\str@numbercn{册} - \def\str@serialcn{第} - \def\str@sameentry{同} - \def\str@incn{见} - \def\str@mathesiscn{硕士学位论文} - \def\str@phdthesiscn{博士学位论文} - \def\str@editorcn{主编} - - \AtEndOfPackage{% - \iftoggle{bbx:codegbk}{% - \ExecuteBibliographyOptions{texencoding = GBK} - \input{gb7714-2015-gbk.def} - }{}} - - % - % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项 - % v1.0k, 2018.05.08, by hzz - % - % 原理方法: - % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息 - % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式 - % 可能需要用于中英文判断的language域的信息。 - \newtoggle{bbx:gbstrict} - \DeclareBibliographyOption{gbstrict}[true]{% - \settoggle{bbx:gbstrict}{#1}} - \ExecuteBibliographyOptions{gbstrict} - - % - % 增加一个控制标题域超链接设置的选项 - % v1.0k, 2018.05.24, by hzz - % - % 原理方法: - % 利用标题域格式来实现,默认设置该选项为false,不做超链接。 - % 设置为true,则标题设置超链接 - \newtoggle{bbx:titlelink} - \DeclareBibliographyOption{gbtitlelink}[false]{% - \settoggle{bbx:titlelink}{#1}} - \ExecuteBibliographyOptions{gbtitlelink} - - % - % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项 - % v1.0l, 2018.07.02, by hzz - % - % 原理方法: - % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置 - \newtoggle{bbx:ctexset} - \DeclareBibliographyOption{gbctexset}[true]{% - \settoggle{bbx:ctexset}{#1}} - \ExecuteBibliographyOptions{gbctexset} - - \AtEndOfPackage{% - \iftoggle{bbx:ctexset}{% - \def\blx@defbibstrings#1#2{% - \def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}% - \abx@dostrings - \csuse{abx@strings@#1}% - \setkeys{blx@lbx}{#2}% - \let\do\blx@defbibstrings@i - \csxdef{abx@strings@#1}{\abx@dostrings}% - } - }{}} - - - - % - % 增加一个恢复域格式为标准样式的控制选项 - % v1.0k, 2018.05.15, by hzz - % - % 原理方法: - % 默认设置该选项为false,采用国标要求的域格式输出相关域 - % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域 - \newtoggle{bbx:gbfieldstd} - \DeclareBibliographyOption{gbfieldstd}[false]{% - \settoggle{bbx:gbfieldstd}{#1}% - \ifstrequal{#1}{false}{}{\execgbfdfmtstd}% - } - \ExecuteBibliographyOptions{gbfieldstd} - - % - % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。 - % - \newtoggle{bbx:gbpub} - \DeclareBibliographyOption{gbpub}[true]{% - %\settoggle{bbx:gbpub}{#1} %或采用下面这一句 - \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}} - \ExecuteBibliographyOptions{gbpub} - - % - % 增加控制析出文献来源前的标点符号//输出的选项 - % v1.0k, 2018.04.20,added in by hzz - \newtoggle{bbx:gbpunctin} - \DeclareBibliographyOption{gbpunctin}[true]{% - \settoggle{bbx:gbpunctin}{#1}} - \ExecuteBibliographyOptions{gbpunctin} - - - % - % 增加一个处理佚名或noauthor的控制选项 - % - % 原理方法:顺序编码制中与作者年制都使用 - \DeclareBibliographyOption{gbnoauthor}[true]{% - \ifstrequal{#1}{false}{}{\dealnoathor}} - %\ExecuteBibliographyOptions{gbnoauthor=true}%对于需要展开较早(展开层级优先)的选项,这一执行无效,只能用宏包加载时给出的选项。 - - - - - % - % 选项设置 - % - \ExecuteBibliographyOptions{ - sorting=none, - useprefix=true, %名字的信息包括前缀 - date = year, %日期仅写到年 - maxbibnames = 3,%设置名字最大数量 - minbibnames = 3, %设置缩减后的名字最小数量 - maxitems = 1,%设置列表最大数量 - minitems = 1, %设置缩减后的列表最小数量 - isbn=false, - sortlocale=zh__pinyin,%zh__big5han,%zh__stroke,%zh__gb2312han,%zh__pinyin, - } - - % - %为日期相关选项增加选项值gb7714-2015 - % - \csdef{mkdaterangegb7714-2015}#1{% - \begingroup - \blx@metadateinfo{#1}% - \iffieldundef{#1year} - {} - {\printtext[#1date]{% - \blx@gbdate{#1}{}}}% - \endgroup} - - \newrobustcmd*{\blx@gbdate}[3][]{% - \dateeraprintpre{#2#3year}% - \blx@imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}% - \iffieldundef{#2#3month}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3month}}}% - \iffieldundef{#2#3day}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3day}}}} - - - %为姓名格式选择增加的计数器 - \newcounter{gbnamefmtcase} - \def\thegbnamefmtcase{\the\c@gbnamefmtcase} - %为数字标签格式选择增加的计数器/命令 - \newcommand{\mkgbnumlabel}[1]{\mkbibbrackets{#1}} - \def\gbbiblabelopt@bracket{\renewcommand{\mkgbnumlabel}[1]{\mkbibbrackets{##1}}} - \def\gbbiblabelopt@parens{\renewcommand{\mkgbnumlabel}[1]{\mkbibparens{##1}}} - \def\gbbiblabelopt@dot{\renewcommand{\mkgbnumlabel}[1]{##1\adddot}} - \def\gbbiblabelopt@plain{\renewcommand{\mkgbnumlabel}[1]{##1}} - \def\gbbiblabelopt@box{\renewcommand{\mkgbnumlabel}[1]{\framebox{##1}}} - \def\gbbiblabelopt@circle{\renewcommand{\mkgbnumlabel}[1]{\textcircled{##1}}} - %为文献表中数字标签对齐方式选择增加的计数器/命令 - \newcounter{gbalignlabel} - \def\thegbalignlabel{\the\c@gbalignlabel} - %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令 - \newcounter{gbcitelocalcase} - \newcounter{gbbiblocalcase} - \def\thegbcitelocalcase{\the\c@gbcitelocalcase} - \def\thegbbiblocalcase{\the\c@gbbiblocalcase} - - - % - % 增加不同语言排序的切换选项,numeric样式,不使用该选项 - % gblanorder=chineseahead的顺序为cn,jp,kr,en,fr,ru - % gblanorder=englishahead的顺序为en,fr,ru,cn,jp,kr - % gblanorder=cn;en;ru;fr;jp;kr的顺序为指定的cn;en;ru;fr;jp;kr,自定义内容可以随意写以分号分隔 - % v1.0q,20190307,hzz - % - \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{% - \ifstrequal{#1}{chineseahead}%%中文在前的顺序 - {\gdef\lancnorder{1}\gdef\lanjporder{2}\gdef\lankrorder{3}% - \gdef\lanenorder{4}\gdef\lanfrorder{5}\gdef\lanruorder{6}}% - {% - \ifstrequal{#1}{englishahead}% - {\execlanodeah\dealsortlan}% - {\execlanodudf{#1}\dealsortlan}% - }% - } - \ExecuteBibliographyOptions{gblanorder} - - \def\execlanodeah{%中文在后的顺序 - \gdef\lancnorder{4} - \gdef\lanjporder{5} - \gdef\lankrorder{6} - \gdef\lanenorder{1} - \gdef\lanfrorder{2} - \gdef\lanruorder{3}} - - \newcounter{lanordernum} - \newcommand{\execlanodudf}[1]{%like:cn;en;ru;fr;jp;kr - \setcounter{lanordernum}{0} - \DeclareListParser{\parsinglanorder}{;} - \renewcommand*{\do}[1]{\stepcounter{lanordernum}\csxdef{lan##1order}{\thelanordernum}} - \parsinglanorder{#1} - } - - % - % 增加本地化字符串的中英文切换选项 - % gbcitelocal指标注中的本地化字符串 - % gbbiblocal 指文献表中的本地化字符串 - % gblocal 指设置文献表和标注中的本地化字符串 - % v1.0o,20190103,hzz - % - \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{% - \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}% - \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}% - \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}% - } - \ExecuteBibliographyOptions{gbcitelocal} - - \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{% - \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}% - \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}% - \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}% - } - \ExecuteBibliographyOptions{gbbiblocal} - - \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{% - \ExecuteBibliographyOptions{gbbiblocal=#1}% - \ExecuteBibliographyOptions{gbcitelocal=#1}% - } - %\ExecuteBibliographyOptions{gblocal} %默认值已经通过两个相关选项设置 - - % - % 增加序号标签格式处理选项 - % v1.0l,20180623,hzz - % - \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{% - \csuse{gbbiblabelopt@#1} - } - \ExecuteBibliographyOptions{gbbiblabel} - - % - % 增加姓名大小写格式处理选项 - % - \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{% - \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}% - \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}% - \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family - \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{} - \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given - \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family - } - \ExecuteBibliographyOptions{gbnamefmt} - - % - % 增加标签对齐选项 - % - % right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式 - \DeclareBibliographyOption[string]{gbalign}[right]{% - \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{} - \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{} - \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{} - \ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{} - } - - \ExecuteBibliographyOptions{ - giveninits=true, - urldate =gb7714-2015, %iso,iso8601,edtf - eventdate =gb7714-2015, - labeldateparts=true, - } - -% -% 针对3.13<=biblatex版本的选项设置,因为内容有限,所以不做版本区分,而用时间直接判断 -% -% 解决国标中“王临慧, 2010a.”和“王临慧, 等, 2010b.”的问题 -% 在没有这个选项之前无法加上a和b -% v1.0s,20190828 -\@ifpackagelater{biblatex}{2019/08/16}{% - \ExecuteBibliographyOptions{% - nohashothers=true}}{} - -%===================================================================== -% 设置本地化字符串 -%===================================================================== - % - % 新建当地化字符串,用来记录“等”字符、“和”字符 - % - \NewBibliographyString{andotherscn} - \NewBibliographyString{andothersincitecn} - \NewBibliographyString{andothersincite} - \NewBibliographyString{andcn} - \NewBibliographyString{andothersjp} - \NewBibliographyString{andotherskr} - \NewBibliographyString{andjp} - \NewBibliographyString{andkr} - \NewBibliographyString{andincitecn} - \NewBibliographyString{andincite} - \NewBibliographyString{volumecn} - \NewBibliographyString{numbercn} - \NewBibliographyString{serialcn} - \NewBibliographyString{incn} - \NewBibliographyString{mathesiscn} - \NewBibliographyString{phdthesiscn} - \NewBibliographyString{editorcn} - \NewBibliographyString{editorscn} - - - - % - % 修改一些当地化字符串 - % - % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件 - % 当然也可以增加比如上面定义的andotherscn - % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别 - - \DefineBibliographyStrings{english}{ - bibliography = {\str@bibliography}, - references = {\str@references}, - bytranslator= {\str@bytranslator},%\addperiod,%将trans. by 改成 译\addcomma\ - and = {\addcomma},%将第2和3人名间的and符号改成逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 - andcn = {\addcomma},%and本地化字符串的中文对应词 - andincitecn = {\addcomma},%将标注中的分开,便于与文献表中的区分 - andincite = {\addcomma}, - %andothers = {et al.},%将超过3个人名的省略,et al.改成为 等 - andotherscn = {\str@andotherscn},%将超过3个人名的省略,et al.改成为 等 - andothersincitecn={\str@andotherscn},%将标注中的分开,便于与文献表中的区分 - andothersincite={et al\adddot}, - backrefpage = {\str@backrefpage:}, - backrefpages = {\str@backrefpages:}, - in={in\intitlepunct}, - volumecn={\str@volumecn}, - numbercn={\str@numbercn}, - serialcn={\str@serialcn}, - andothersjp={他}, - andotherskr={외}, - andjp={和}, - andkr={和}, - incn={\str@incn\addcolon\addspace}, - mathesiscn={\str@mathesiscn}, - phdthesiscn={\str@phdthesiscn}, - editorscn={\str@editorcn}, - editorcn={\str@editorcn}, -} - - % - % 增加两个命令用于临时的局部的修改本地化字符串 - % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串 - % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内 - % v1.0t,hzz,20190525 - \newcommand{\setlocalbibstring}[2]{% - \csdef{abx@sstr@#1}{#2}} - \newcommand{\setlocalbiblstring}[2]{% - \csdef{abx@lstr@#1}{#2}} - -%===================================================================== -% 动态数据修改 -%===================================================================== -% -% 各层次的数据映射和动态修改 -% -% 原理方法: -% 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中 -% 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性 -% 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个 -% 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次 -% 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。 -% 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符, -% 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息 -% -% 不同的文献类型使用相同的驱动输出可以有5种方法: -% 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型 -% 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型 -% 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型 -% 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名 -% 驱动别名定义本质上是做了驱动层映射 -% 5. 直接定义不同的类型的驱动,但驱动内容相同。 -% -% 关于数据映射和驱动使用的考虑如下: -% 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换 -% 2. 为减少代码量,尽量少做内容相同的不同类型驱动 -% 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名 -% 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type -% 可以在样式层映射做某些需要避免这种默认处置的转换 -% 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射 -% -% 文献类型和驱动考虑如下: -% 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article -% newpaper映射为article,并以note域做区分特殊处理 -% 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook -% standard映射为book或inbook,并以note域做区分特殊处理 -% collection和proceedings基本与book类似,因此做book驱动别名处理 -% incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理 -% 3. 专利类型有其特殊性,考虑patent类型 -% 4. 电子资源类型有其特殊性,考虑online类型 -% 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更新日期 -% 因此考虑用一种类型来输出,使用report类型 -% 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略, -% 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型 -% 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时, -% 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。 -% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述 -% 更多的信息,因此不存在网址时,独立做一个备选格式 -% 9. 出版项主要以如下方式处理: -% (a) location+institution+date 仅用于连续出版物 -% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report -% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型 -% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。 -% (e) 不输出,主要用于连续出版物析出的文献 -% 10. 日期以如下方式处理: -% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year -% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate -% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date -% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate - - -\DeclareSourcemap{ -\maps[datatype=bibtex]{% - \map{%当没有作者时将editor转成author - \pernottype{inbook}%因为in系列中editor可能用来表示bookauthor,所以排除 - \pernottype{inproceedings} - \pernottype{incollection} - \pernottype{periodical}%因为peridical直接使用editor,所以排除 - %注意notfield在低版本biblatex中没有 - %\step[notfield=author,final]%当author不存在,将editor复制给author - \step[fieldsource=editor,fieldtarget=author]%并删除editor - } - \map{%当没有作者时将translator转成author - \pernottype{inbook} - \pernottype{inproceedings} - \pernottype{incollection} - %\step[notfield=author,final]%当author不存在,将translator复制给author - \step[fieldsource=translator,fieldtarget=author]%并删除translator - } - \map{%让address和location同步,biblatex中address是location的别名 - %因此输出的时候只有location信息,但处理过程中是可以存在address的。 - %\step[notfield=address,final] - \step[fieldsource=location,final] - \step[fieldset=address,origfieldval] - } - \map{%让address和location同步 - %\step[notfield=location,final] - \step[fieldsource=address,final] - \step[fieldset=location,origfieldval] - } - \map{%处理在bib文件用mark标记文献类型标识符的情况 - \step[fieldsource=mark,final] - \step[fieldset=usera, origfieldval] - } - \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况 - \step[fieldsource=nameformat,match=lowercase,final] - \step[fieldset=namefmtid,fieldvalue={1}] - } - \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况 - \step[fieldsource=nameformat,match=givenahead,final] - \step[fieldset=namefmtid,fieldvalue={2}] - } - \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况 - \step[fieldsource=nameformat,match=familyahead,final] - \step[fieldset=namefmtid,fieldvalue={3}] - } - \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况 - \step[fieldsource=nameformat,match=pinyin,final] - \step[fieldset=namefmtid,fieldvalue={4}] - } - \map{%根据article确定文献类型标识符 - \pertype{article} - \step[fieldset=usera, fieldvalue={J}] - } - \map{%根据periodical确定文献类型标识符 - \pertype{periodical} - \step[fieldset=usera, fieldvalue={J}] - \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor - \step[fieldset=editor, origfieldval] - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符 - \pertype{newspaper} - \step[fieldset=usera, fieldvalue={N}] - \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断 - } - \map{%对应增加的一个数据库类型database确定文献类型标识符 - \pertype{database} - \step[fieldset=usera, fieldvalue={DB}] - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%对应增加的一个数据集类型dataset确定文献类型标识符 - \pertype{dataset} - \step[fieldset=usera, fieldvalue={DS}]% - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%对应增加的一个软件类型software确定文献类型标识符 - \pertype{software} - \step[fieldset=usera, fieldvalue={CP}] - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%对应增加的一个舆图类型map确定文献类型标识符 - \pertype{map} - \step[fieldset=usera, fieldvalue={CM}]% - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%对应增加的一个档案类型archive确定文献类型标识符 - \pertype{archive} - \step[fieldset=usera, fieldvalue={A}] - \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以 - %当misc类型带有网址时,直接将其转换为online类型 - \pertype{misc} - \step[fieldsource=url,final] - \step[typesource=misc,typetarget=online] - } - \map{%对应增加的一个备选类型misc确定文献类型标识符 - \pertype{misc} - \step[fieldset=usera, fieldvalue={Z}]% - } - \map{ - \pertype{book} - \pertype{inbook} - \step[fieldset=usera, fieldvalue={M}] - \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition - \step[fieldset=edition, origfieldval] - } - \map{%兼容老的standard类型,确定文献类型标识符 - \pertype{standard} - \step[fieldset=usera, fieldvalue={S}] - \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断 - } - \map{ - \pertype{patent} - \step[fieldset=usera, fieldvalue={P}] - } - \map{ - \pertype{inproceedings} - \pertype{conference}%兼容老的conference类型 - \step[fieldset=usera, fieldvalue={C}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{proceedings} - \step[fieldset=usera, fieldvalue={C}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{incollection} - \step[fieldset=usera, fieldvalue={G}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{collection} - \step[fieldset=usera, fieldvalue={G}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{report} - \pertype{techreport}%兼容老的techreport类型 - \step[fieldset=usera, fieldvalue={R}] - \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher - \step[fieldset=publisher, origfieldval] - } - \map{ - \pertype{thesis} - \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型 - \pertype{phdthesis} - \step[fieldset=usera, fieldvalue={D}] - \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - } - \map{ - \pertype{online} - \pertype{electronic}%兼容老的electronic类型 - \pertype{www}%兼容老的www类型 - \step[fieldset=usera, fieldvalue={EB}] - \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册 - \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 - \step[fieldset=institution, origfieldval] - } - \map{ - \pertype{manual} - \step[fieldset=usera, fieldvalue={A}] - \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version - \step[fieldset=version, origfieldval] - \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution - \step[fieldset=institution, origfieldval] - \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 - \step[fieldset=institution, origfieldval] - } - \map{ - \pertype{unpublished} - \step[fieldset=usera, fieldvalue={Z}] - } - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - }% - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={editor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - }% - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={translator}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - }% - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={bookauthor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - }% - \map{%处理一些用year表示date的情况 - %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。 - %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息 - \step[fieldsource=year] - \step[fieldset=date, origfieldval] - } - \map{%将entrykey放入keywords中用于后期使用 - \step[fieldsource=entrykey] - \step[fieldset=keywords, origfieldval] - } - \map{\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=userd,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=userd,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=userd,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=userd,fieldvalue={korean}]%韩语 - } - \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题 - \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]% - \step[fieldset=userd, fieldvalue={chinese}] - } - \map{%将没有设置userd,且存在title域的默认设置为英文 - \step[fieldsource=title,final] - \step[fieldset=userd,fieldvalue={english}] - } - \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=userf,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=author,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=userf,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=author,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=userf,fieldvalue={korean}]%韩语 - } - \map{%作者的中文判断 - \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=userf, fieldvalue={chinese}] - } - \map{%将没有设置userf,且存在author域的默认设置为英文 - \step[fieldsource=author,final] - \step[fieldset=userf,fieldvalue={english}] - } - \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=usere,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=translator,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=usere,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=translator,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=usere,fieldvalue={korean}]%韩语 - } - \map{%译者的中文判断 - \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=usere, fieldvalue={chinese}] - } - \map{%将没有设置usere,且存在translator域的默认设置为英文 - \step[fieldsource=translator,final] - \step[fieldset=usere,fieldvalue={english}] - } - \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=userc,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=userc,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=userc,fieldvalue={korean}]%韩语 - } - \map{%编者的中文判断 - \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 - \step[fieldset=userc, fieldvalue={chinese}] - } - \map{%将没有设置userc,且存在editor域的默认设置为英文 - \step[fieldsource=editor,final] - \step[fieldset=userc,fieldvalue={english}] - } - \map{\step[fieldsource=bookauthor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=userb,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - } - \map{% - \step[fieldsource=bookauthor,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=userb,fieldvalue={russian}]%俄语 - } - \map{% - \step[fieldsource=bookauthor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=userb,fieldvalue={japanese}]%日语 - } %确定形式后可增加类似andotherscn这样的本地化字符串处理 - \map{% - \step[fieldsource=bookauthor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=userb,fieldvalue={korean}]%韩语 - } - \map{%编者的中文判断 - \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 - \step[fieldset=userb, fieldvalue={chinese}] - } - \map{%将没有设置userc,且存在editor域的默认设置为英文 - \step[fieldsource=bookauthor,final] - \step[fieldset=userb,fieldvalue={english}] - } - \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language - \step[fieldset=language,origfieldval]%本身language存在则不设定 - } - \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language - \step[fieldset=language,origfieldval] - }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。 - \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。 - \step[fieldset=language,fieldvalue={english}] - } - \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断, - %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况, - %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd - \step[fieldsource=language] - \step[fieldset=userd,origfieldval] - } - \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言 - %biblatex 3.11及以下版本仅有match是区分大小写的,而3.12版开始用matchi来区分大小,而match不区分 - %这里为兼容3.11及以下版本,所以用一个复杂一点的正则表达式 - \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final] - \step[fieldset=langid,fieldvalue={english}] - \step[fieldset=lansortorder,fieldvalue=\lanenorder] - } - \map{ - \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final] - \step[fieldset=langid,fieldvalue={russian}] - \step[fieldset=lansortorder,fieldvalue=\lanruorder] - } - \map{% - \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final] - \step[fieldset=langid,fieldvalue={french}] - \step[fieldset=lansortorder,fieldvalue=\lanfrorder] - } - \map{% - \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, - \step[fieldset=langid,fieldvalue={english}] - \step[fieldset=lansortorder,fieldvalue=\lancnorder] - } - \map{% - \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, - \step[fieldset=langid,fieldvalue={english}] - \step[fieldset=lansortorder,fieldvalue=\lanjporder] - } - \map{% - \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english, - \step[fieldset=langid,fieldvalue={english}] - \step[fieldset=lansortorder,fieldvalue=\lankrorder] - } -} -} - - -% -% 修改输入的参考文献数据,样式层的操作 -% - \DeclareStyleSourcemap{ - \maps[datatype=bibtex]{ - \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook, - %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 - %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断 - \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook - \step[typesource=standard, typetarget=inbook, final] - } - \map{%剩下的全部映射为book - \step[typesource=standard, typetarget=book, final] - } -% \map{%先于标准样式的driver层映射,以取消type设置 -% \step[typesource=mastersthesis, typetarget=thesis, final] -% %\step[fieldset=type, fieldvalue=mathesis] -% } -% \map{%先于标准样式的driver层映射,以取消type设置 -% \step[typesource=phdthesis, typetarget=thesis, final] -% %\step[fieldset=type, fieldvalue=phdthesis] -% } - \map{%先于标准样式的driver层映射,以取消type设置 - \step[typesource=techreport, typetarget=report, final] - %\step[fieldset=type, fieldvalue=techreport] - } - \map{% - \pertype{report} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=report,typetarget=online] - \step[fieldset=note,fieldvalue={report}] - } - \map{% - \pertype{thesis} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=thesis,typetarget=online] - } - \map{% - \pertype{manual} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=manual,typetarget=online] - } - \map{% - \pertype{unpublished} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=unpublished,typetarget=online] - } - \map{% - \pertype{database} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=databasetypetarget=online] - } - \map{% - \pertype{dataset} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=dataset,typetarget=online] - } - \map{% - \pertype{software} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=software,typetarget=online] - } - \map{% - \pertype{map} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=map,typetarget=online] - } - \map{% - \pertype{archive} - %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 - \step[fieldset=location,fieldvalue={}] - \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online - %3.7以上版本用notfield - %\step[notfield=address,final]%当address不存在则继续 - \step[fieldsource=url,final]%地址不存在且存在url那么转变为online - \step[typesource=archive,typetarget=online] - } - \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确) - \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 - \step[fieldset=keywords, fieldvalue={,}, append] - \step[fieldset=keywords, origfieldval, append] - } - \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ - \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] - } - \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ - \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] - } - \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,% - address,location,institution,organization}]{ - \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] - } - } - } - -% -% 佚名/noauthor的处理 -% -% 原理方法:利用样式层的动态数据修改实现 -\def\dealnoathor{ - \DeclareStyleSourcemap{ - \maps[datatype=bibtex]{ - \map{%默认情况下将空缺作者的中文文献设置为佚名 - \step[fieldsource=language,match={chinese},final] - \step[fieldset=author, fieldvalue={佚名}] - } - \map{%默认情况下将空缺作者的英文文献设置为A{non} - \step[fieldsource=language,match={english},final] - \step[fieldset=author, fieldvalue={A{non}}]%noauthor换成Anon,同时为避免大写还加了{} - } - } - } -} - -% -% 不同语言分集调整的实现方式 -% -% 原理方法:利用样式层的动态数据修改lansortorder域来实现排序 -\def\dealsortlan{ - \DeclareStyleSourcemap{ - \maps[datatype=bibtex]{ - \map[overwrite]{%当文献给出language域时,设置文献要使用的本地化字符串的语言 - \step[fieldsource=language,match=english,final] - \step[fieldset=lansortorder,fieldvalue=\lanenorder] - } - \map[overwrite]{ - \step[fieldsource=language,match=russian,final] - \step[fieldset=lansortorder,fieldvalue=\lanruorder] - } - \map[overwrite]{% - \step[fieldsource=language,match=french,final] - \step[fieldset=lansortorder,fieldvalue=\lanfrorder] - } - \map[overwrite]{% - \step[fieldsource=language,match=chinese,final]%中日韩语目前都用english, - \step[fieldset=lansortorder,fieldvalue=\lancnorder] - } - \map[overwrite]{% - \step[fieldsource=language,match=japanese,final]%中日韩语目前都用english, - \step[fieldset=lansortorder,fieldvalue=\lanjporder] - } - \map[overwrite]{% - \step[fieldsource=language,match=korean,final]%中日韩语目前都用english, - \step[fieldset=lansortorder,fieldvalue=\lankrorder] - } - } - } -} - - - - -% -%驱动别名等价于驱动层映射 -% -\DeclareBibliographyAlias{newspaper}{article}% -\DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动 -\DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动 -\DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动 -\DeclareBibliographyAlias{collection}{book}%%文集类型驱动 -\DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动 -\DeclareBibliographyAlias{thesis}{manual}%学位论文驱动 -\DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动 -\DeclareBibliographyAlias{database}{manual} -\DeclareBibliographyAlias{dataset}{manual} -\DeclareBibliographyAlias{software}{manual} -\DeclareBibliographyAlias{map}{manual} -\DeclareBibliographyAlias{archive}{manual} - - -%===================================================================== -% 设置排序格式 -%===================================================================== -% -% 排序格式,用降序,及userb域,针对biblatex3.8及以上版本 -% -\DeclareSortingTemplate{gb7714-2015}{ - \sort{ - \field{presort} - } - %\sort[final]{ - %\field{sortkey} - %} - \sort{ - \field{lansortorder}%language - } - \sort{ - \field{sortkey} - } - \sort{%[direction=descending] - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sortyear} - \field{year} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field{volume} - \literal{0} - } - } - - %降序的nyt - \DeclareSortingTemplate{gbnytd}{ - \sort{ - \field{presort} - } -% \sort[final]{ -% \field{sortkey} -% } - \sort{ - \field{lansortorder}%language - } - \sort[direction=descending]{ - \field{sortkey} - } - \sort[direction=descending]{% - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sortyear} - \field{year} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field{volume} - \literal{0} - } - } - - %降序的ynt - \DeclareSortingTemplate{gbyntd}{ - \sort{ - \field{presort} - } -% \sort[final]{ -% \field{sortkey} -% } - \sort{ - \field{lansortorder}%language - } - \sort[direction=descending]{ - \field{sortyear} - \field{year} - } - \sort{ - \field{sortkey} - } - \sort{% - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field{volume} - \literal{0} - } - } - - %升序的ynt - \DeclareSortingTemplate{gbynta}{ - \sort{ - \field{presort} - } -% \sort[final]{ -% \field{sortkey} -% } - \sort{ - \field{lansortorder}%language - } - \sort{%[direction=ascending] - \field{sortyear} - \field{year} - } - \sort{ - \field{sortkey} - } - \sort{% - \field{sortname} - \field{author} - \field{editor} - \field{translator} - } - \sort{ - \field{sorttitle} - \field{title} - } - \sort{ - \field{volume} - \literal{0} - } - } - -%===================================================================== -% 参考文献表环境 -%===================================================================== -% -% 列表格式 -% -% 增加一个\bibitemindent尺寸用于控制list环境的itemindent -% v1.0l,20180615,hzz -% v1.0t,20200319,hzz,增加尺寸\biblabelextend使某些字体下标签宽度不足时可增加标签宽度 -\setlength{\bibhang}{\biblabelsep}% -\newlength{\bibitemindent} -\setlength{\bibitemindent}{0pt} -\newlength{\biblabelextend} -\setlength{\biblabelextend}{0pt} - - -\defbibenvironment{bibliography} - {\list - {\printtext[labelnumberwidth]{% - \printfield{labelprefix}% - \printfield{labelnumber}}} - {\addtolength{\labelnumberwidth}{\biblabelextend}% - \setlength{\labelwidth}{\labelnumberwidth}% - \setlength{\labelsep}{\biblabelsep}% - \setlength{\leftmargin}{\bibhang}% - \addtolength{\leftmargin}{\labelnumberwidth}% - \setlength{\itemindent}{\bibitemindent}% - \setlength{\itemsep}{\bibitemsep}% - \setlength{\parsep}{\bibparsep}}% - \renewcommand*{\makelabel}[1]{\hss##1}} - {\endlist} - {\item} - -% -% 顺序编码制-标签对齐方式处理 -% -% 原理方法:利用选项提供的计数器数值做选择 -% 左对齐,右对齐为list环境下的处理,此时list环境的\labelwidth只能设置一个,是最宽标签的宽度 -% 项对齐则是在段落环境下做的处理。 -% 左对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距可变 -% 右对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距相等,标签与页边距离可变 -% 项对齐时,序号标签贴在页边,序号标签与参考文献项内容的间距相等 -% 修改序号标签格式为: -% \DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} %源来自numeric.BBX -% \DeclareFieldFormat{labelnumberwidth}{\ttfamily\mkbibbrackets{#1}\hfill} -\DeclareFieldFormat{labelnumberwidth}{% -\ifcase\value{gbalignlabel}%右对齐,整个标签为右对齐 - \mkgbnumlabel{#1}% -\or%左对齐,整个标签为左对齐 - \mkgbnumlabel{#1}\hfill% -\or%中间对齐,比如:序号数字居于[]中间 - \hfil\mkgbnumlabel{\hfill#1\hfill}\hfil% -\fi} - -% -% 修改序号标签格式为以各条参文献为基础进行对齐的方式,即序号与条目内容间隔相等的方式。 -\def\setaligngbstyle{% -\def\blx@bibitem##1{% - \blx@ifdata{##1} - {\begingroup - \blx@getdata{##1}% - \blx@bibcheck - \iftoggle{blx@skipentry}{}{% - \blx@setdefaultrefcontext{##1}% - \global\let\blx@noitem\@empty - \blx@setoptions@type\abx@field@entrytype - \blx@setoptions@entry - \blx@thelabelnumber - \addtocounter{instcount}\@ne - \blx@initsep - \blx@namesep - \csuse{blx@item@\blx@theenv}\relax -% \blx@initsep %移动到上面去,恢复bibnamesep等的作用机制 -% \blx@namesep - \csuse{blx@hook@bibitem}% - \blx@execute - \blx@initunit - \blx@anchor - \blx@beglangbib - \bibsentence - \blx@pagetracker - \blx@driver\abx@field@entrytype - \blx@postpunct - \blx@endlangbib}% - \par\endgroup}%这里增加了一个\par - {}} -\newlength{\lengthid} -\newlength{\lengthlw} -\newcommand{\itemcmd}{% -\settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}} -\addtolength{\lengthid}{\biblabelsep} -\setlength{\lengthlw}{\textwidth} -\addtolength{\lengthlw}{-\lengthid} -\addvspace{\bibitemsep}%恢复\bibitemsep的作用 -%\parshape 2 0em \textwidth \lengthid \lengthlw -\hangindent\lengthid -\mkgbnumlabel{\printfield{labelnumber}}% -\hspace{\biblabelsep}} -% -% 简单的段落环境 -\defbibenvironment{bibliography} -{\begingroup\setlength{\parindent}{0em}} -{\endgroup} -{\itemcmd}} - - -%===================================================================== -% 设置单元或块等的标点 -%===================================================================== -\renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin -\renewcommand*{\subtitlepunct}{\addcolon\addspace} %修改标题和其它标题信息间的标点,来源biblatex.def, -% -% 利用set实现的多语言文献不同语言间的分隔符 -% 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进 -% -% 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets -% 这里调整一下两种语言参考文献的间隔,源来自biblatex.def -\renewcommand*{\entrysetpunct}{\adddot\newline\nobreak} -\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号 -%\renewcommand{\relateddelim}{}%\par - -%===================================================================== -% 修改域的格式,重定义域的输出宏 -%===================================================================== -% -% 新增文献类型标识符的格式 -% []前的nobreak,从GB4.1节的例子看不应该加,所以去掉 -% 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上 -% 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉 -% -\DeclareFieldFormat{gbtypeflag}{% -\iftoggle{bbx:gbmedium}% -{\iftoggle{bbx:url}% - {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% - }% - {\ifentrytype{online}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% - }}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% -} - -% -% 新增用于报纸的文献类型标识符的格式 -% -\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper -\iftoggle{bbx:gbmedium}% -{\iftoggle{bbx:url}% - {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% - {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% - }% - {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% -}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}% -} - -% -% 新增用于标准的文献类型标识符的格式 -% -\DeclareFieldFormat{gbtypeflags}{%用于标准standard -\iftoggle{bbx:gbmedium}% -{\iftoggle{bbx:url}% - {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% - {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% - }% - {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% -}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}% -} - -% -% 重设title等参考文献信息的输出格式 -% -% 原理方法:修改来自biblatex.def文件的原格式 -\newcommand{\bibtitlefont}{} -\newcommand{\bibauthorfont}{} -\newcommand{\bibpubfont}{} - -\DeclareFieldFormat{title}{#1\adddot\addthinspace} -\DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪 -\DeclareFieldFormat{issuetitle}{#1} -\DeclareFieldFormat{maintitle}{#1} -\DeclareFieldFormat{booktitle}{#1} -\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 - [article,patent,thesis,unpublished] - {title}{#1\adddot\addthinspace}%\mkbibquote{#1\isdot} -\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 - [inbook,incollection,inproceedings] - {title}{#1}%\nopunct\unspace -\DeclareFieldFormat{url}{\url{#1}} %%url相关输出,url域修改如本行,源来自biblatex.def -\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily -%\urlstyle{rm} %使用这句也一样 -\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行 -\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行 -\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行 -\DeclareFieldFormat{doi}{% - \rmfamily{DOI}\addcolon\space - \ifhyperref - {\href{https://doi.org/#1}{\nolinkurl{#1}}} - {\nolinkurl{#1}}} -% -% 标题的字母大小写格式修改 -% -% 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase -% 因为titlecase is applied to the contents of the field directly,title is not -%\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写 -\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{% -\iffieldundef{url}{\MakeCapital#1}{% -\href{\thefield{url}}{#1}}}{\MakeCapital#1}}%重设标题格式,将其修改为首字母大写 -\DeclareFieldFormat{pages}{#1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{#1} -\DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线 - -\def\execgbfdfmtstd{%恢复到标准样式的设置 -\DeclareFieldFormat{title}{\mkbibemph{##1}} -\DeclareFieldFormat - [article,inbook,incollection,inproceedings,patent,thesis,unpublished] - {title}{\mkbibquote{##1\isdot}} -\DeclareFieldFormat - [suppbook,suppcollection,suppperiodical] - {title}{##1} -\DeclareFieldFormat{journaltitle}{\mkbibemph{##1}} -\DeclareFieldFormat{issuetitle}{\mkbibemph{##1}} -\DeclareFieldFormat{maintitle}{\mkbibemph{##1}} -\DeclareFieldFormat{booktitle}{\mkbibemph{##1}} -\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{##1}} -\DeclareFieldFormat{titlecase}{##1} -\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{##1}} -} - -% -% 文献标题后的标点问题 -% v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen -% -% 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况: -% texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于 -% 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响 -% 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct - {%texlive 2017对应iftlseven以上版本 - \@ifclassloaded{beamer}{ - \DeclareFieldFormat{title}{#1}% - \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1} - \AtBeginDocument{% - \patchcmd{\abx@macro@title}{\newunitpunct}{}{}{}}}{} - } - - -% -% 修改译者位置格式 -% -% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式 -\renewbibmacro*{bytranslator+others}{% - \ifnameundef{translator} - {} - {%\usebibmacro{bytranslator+othersstrg} - %\setunit{\addspace}% - \printnames[bytranslator]{translator}% - \clearname{translator}% - %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理 - %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串 - \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。 - %\setunit{\addspace}% - \newunit}% - \usebibmacro{withothers}} - - -% -% 修改作者数量超过限定值,做省略时的处理格式 -% v1.0,20160701,hzz -% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim -% -% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。 -% \printnames由start-stop控制项数,默认是1和maxnames/minnames -\renewbibmacro*{name:andothers}{% - \ifboolexpr{ - test {\ifnumequal{\value{listcount}}{\value{liststop}}} - and - test \ifmorenames - }{\ifnumgreater{\value{liststop}}{1}%注意这里试图去区分姓名总数大于1的情况,当姓名总数大于1时,最后一个姓名后面先加入一个\finalandcomma - {\finalandcomma}%目前国标没有这样的区分要求,如果有需要也是可以这么去做的。 - {}% -\printdelim{andothersdelim}\printdelim{strandothersdelim}% -}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如: -%袁训来, 陈哲, 肖书海, 等. -%胡泳, 范海燕, 译. -%潘惠霞, 魏婧, 杨艳, 等译. -\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理 -}} - - -% -% 修改省略作者后的本地化字符串,比如et al. -% v1.0o,20190103,hzz -% -% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。 -% 非默认情况,根据选项信息,选择选择强制中文或英文 -% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 -% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 -\DeclareDelimFormat{strandothersdelim}{% - \edef\userfieldabcde{userd}%这里使用\iffieldequalstr{labelnamesource}替代ifcurrentname因为标注中使用ifcurrentname无效 - \iffieldequalstr{labelnamesource}{translator}{\edef\userfieldabcde{usere}}{}% - \iffieldequalstr{labelnamesource}{editor}{\edef\userfieldabcde{userc}}{}% - \iffieldequalstr{labelnamesource}{author}{\edef\userfieldabcde{userf}}{}% - \iffieldequalstr{labelnamesource}{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbcitelocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\ifbibstring{andothersincitecn}{\bibstring{andothersincitecn}}{\bibstring{andothers}}}{}%中文已经通过english本地化字符串定义 - \iffieldequalstr{\userfieldabcde}{korean}{\ifbibstring{andotherskr}{\bibstring{andotherskr}}{\bibstring{andothers}}}{}%韩语未定义,所以与bib中一致 - \iffieldequalstr{\userfieldabcde}{japanese}{\ifbibstring{andothersjp}{\bibstring{andothersjp}}{\bibstring{andothers}}}{}%日与同韩语 - \iffieldequalstr{\userfieldabcde}{english}{\ifbibstring{andothersincite}{\bibstring{andothersincite}}{\bibstring{andothers}}}{}%英语已定义 - \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%法语未定义,若要定义需要针对french本地化字符串定义 - \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%俄语未定义,若要定义需要针对russian本地化字符串定义 - \or% - \bibstring{andothersincitecn}% - \or% - \bibstring{andothersincite}% - \fi} - - -\DeclareDelimFormat[bib,biblist]{strandothersdelim}{% - \edef\userfieldabcde{userd}% - \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbbiblocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}% - \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}% - \or% - \bibstring{andotherscn}% - \or% - \bibstring{andothers}% - \fi} - -% -% 修改最后一个作者前的字符串,比如 and -% v1.0o,20190103,hzz -% -% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。 -% 非默认情况,根据选项信息,选择选择强制中文或英文 -% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 -% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 -\DeclareDelimFormat{finalnamedelim}{% - \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% - \addspace% - \edef\userfieldabcde{userd}% - \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbcitelocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andincite}}{}% - \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% -\space% - \or% - \bibstring{andincitecn}\space% - \or% - \bibstring{andincite}\space% - \fi} - -\DeclareDelimFormat[bib,biblist]{finalnamedelim}{% - \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% - \addspace% - \edef\userfieldabcde{userd}% - \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbbiblocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}% - \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% -\space% - \or% - \bibstring{andcn}\space% - \or% - \bibstring{and}\space% - \fi} - - -% -% 重设title的输出 -% -% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen -% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件 -% 利用toggle做标识符是否输出的判断 -\renewbibmacro*{title}{% - \ifboolexpr{% - test{\iffieldundef{title}}% - and - test{\iffieldundef{subtitle}}% - }% - {}% - {\printtext[title]{\bibtitlefont%增加字体控制命令 - \printfield[titlecase]{title}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct}% - \printfield[titlecase]{subtitle}}% - \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 - {\setunit{\subtitlepunct}\printfield{titleaddon}}% - \iftoggle{bbx:gbtype}{% - \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 - {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 - {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 - {\printfield[gbtypeflag]{usera}}}%其它 - }}{}% - %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 - %\newunit -}% -}} - -% -% 作者信息的输出格式 -% -% 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen -% 20180603,v1.0l,增加使用nameformat域来选择姓名格式 -\DeclareNameFormat{namefmtselected}{% -\iffieldundef{namefmtid}{}% -{\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}% -\ifcase\value{gbnamefmtcase}% - \ifgiveninits - {\usebibmacro{name:gbuppercase} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:gbuppercase} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% -\or - \ifgiveninits - {\usebibmacro{name:gblowercase} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:gblowercase} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% -\or - \ifgiveninits - {\usebibmacro{name:given-family} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:given-family} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% -\or - \ifgiveninits - {\usebibmacro{name:family-given} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:family-given} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% -\or -\usebibmacro{name:gbpinyin} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}% -\or - \ifnumequal{\value{listcount}}{1} - {\ifgiveninits - {\usebibmacro{name:family-given} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:family-given} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}% - \ifboolexpe{% - test {\ifdefvoid\namepartgiven} - and - test {\ifdefvoid\namepartprefix}} - {} - {\usebibmacro{name:revsdelim}}} - {\ifgiveninits - {\usebibmacro{name:given-family} - {\namepartfamily} - {\namepartgiveni} - {\namepartprefix} - {\namepartsuffix}} - {\usebibmacro{name:given-family} - {\namepartfamily} - {\namepartgiven} - {\namepartprefix} - {\namepartsuffix}}}% -\fi - \usebibmacro{name:andothers}} - -\DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式 -\DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family -\DeclareNameAlias{citename}{default}% Default used by \citename - -\DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace} -%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% - -%GB/T 7714-2015 风格,全部大写 -\newbibmacro*{name:gbuppercase}[4]{\bibauthorfont% -\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 -\renewcommand*{\revsdnamepunct}{}% - \ifuseprefix% - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifdefvoid{#3}{}{% - \ifcapital% - {\mkbibnameprefix{\MakeCapital{#3}}\isdot}% - {\mkbibnameprefix{#3}\isdot}% - \ifprefchar{}{\bibnamedelimc}}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% - \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital - \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号 - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% - \ifboolexpe{% - test {\ifdefvoid{#2}} - and - test {\ifdefvoid{#3}}} - {}{\revsdnamepunct}% - \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital - \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% - \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号 -} - -%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 -\newbibmacro*{name:gblowercase}[4]{\bibauthorfont% - \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 - \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifdefvoid{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifprefchar{}{\bibnamedelimc}}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% - \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital - \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号 - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% - \ifboolexpe{% - test {\ifdefvoid{#2}} - and - test {\ifdefvoid{#3}}} - {}{\revsdnamepunct}% - \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital - \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} - \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号 -} - -%中文常见风格,汉语拼音全拼模式 -\newbibmacro*{name:gbpinyin}[4]{\bibauthorfont% -\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY -\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def -\renewrobustcmd*{\bibnamedelima}{\mbox{-}}% - \ifuseprefix - {\usebibmacro{name:delim}{#3#1}% - \usebibmacro{name:hook}{#3#1}% - \ifdefvoid{#3}{}{% - \ifcapital - {\mkbibnameprefix{\MakeCapital{#3}}\isdot} - {\mkbibnameprefix{#3}\isdot}% - \ifprefchar{}{\bibnamedelimc}}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% - \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamegiven{#2}}\isdot}%\MakeCapital - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}} - {\usebibmacro{name:delim}{#1}% - \usebibmacro{name:hook}{#1}% - \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% - \ifboolexpe{% - test {\ifdefvoid{#2}} - and - test {\ifdefvoid{#3}}} - {} - {\revsdnamepunct}% - \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital - \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} - \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% -} - - -% -% url和url日期格式 -% -\renewbibmacro*{url+urldate}{% - %\usebibmacro{url}%%更换url的位置,放到下面 - \iffieldundef{urlyear}% - {}{%\setunit*{\addspace}% - \usebibmacro{urldate}}% - \setunit{\addperiod\addspace}% - \usebibmacro{url}} -\renewbibmacro*{url}{\printfield{url}} - - -% -% 日期信息的输出格式,针对biblatex>=3.10版本 -% - \DeclareFieldFormat{urldate}{#1} - \renewbibmacro*{urldate}{% - \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 - - % - % 专利的公告日期、或报纸的日期的输出宏 - % 20160701,v1.0,新增加 - % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen - % - % 原理方法:加上printtext避免破坏异步标点机制 - % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份 - % 所以无法再用选项设置的方法,印象需要用底层的命令 - % 这里可以用\blx@isodate,但用\blx@gbdate试图避免版本判断 - \newbibmacro*{newsdate}{%% - \printtext{\blx@gbdate{}{}}%%\blx@isodate{}{}% - } - - % - \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 - \ifboolexpr{% - test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% - }% - {}%更新或修改日期通常有day信息 - {\iffieldundef{year}{% - \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% - {\printtext{(}\printenddate\printtext{)}}% - }{\iffieldequalstr{year}{}{%因为year存在,但为空 - }{\printtext{(}\blx@gbdate{}{}\printtext{)}}% - }% - }}% - - -% -% biblatex>v3.8版利用related实现双语文献的处理 -% - %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了, - %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息 - %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中 - \newcommand{\defdoublelangentry}[2]{% - \edef\entrykeya{##1} - \edef\entrykeyb{##2} - \DeclareStyleSourcemap{ - \maps[datatype=bibtex]{ - \map{ - \step[fieldsource=entrykey, match=\entrykeya, final] - \step[fieldset=related, fieldvalue=\entrykeyb] - } - } - } - } - -% -% 关联文献间的分隔符 -% -\renewcommand{\relateddelim}{\adddot\newline\nobreak}%\par,而作者年样式不需要修改,因为没有项对齐的标签问题 - -% -% 关联文献块前的分隔符,针对biblatex>=3.11 -% -% 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏 -\renewcommand{\begrelateddelim}{\adddot\newline\nobreak} - - -% -% 调整doi+eprint+url格式 -% -% 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。 -\renewbibmacro*{doi+eprint+url}{% -% \iftoggle{bbx:doi}%把doi的位置放到url后面 -% {\printfield{doi}} -% {}% - %\newunit\newblock - \iftoggle{bbx:eprint} - {\iffieldundef{eprint}{}{\newunit\usebibmacro{eprint}}} - {}% - %\newunit\newblock - \iftoggle{bbx:url} - {\usebibmacro{url+urldate}} - {} - \newunit\newblock - \iftoggle{bbx:doi} - {\printfield{doi}} - {}} - -% -% 调整页码的格式,即chapter+pages格式 -% -\renewbibmacro*{chapter+pages}{% -\iftoggle{bbx:gbstrict}{}{% - \printfield{chapter}}% - \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出 - \setunit{\bibpagespunct}% - \printfield{pages}}% - %\newunit %这里的标点去掉 -} - -% -% 当location等出版项超过maxitem缩减后不再输出etal -% -\DeclareListFormat{location}{% - \usebibmacro{list:delim}{#1}% - #1\isdot} -\DeclareListAlias{institution}{location} -\DeclareListAlias{publisher}{location} - -% 新增一个样式用于输出连续出版物的地址,单位,时间, -% 用于periodical连续出版物的出版社和地址的处理 -% -% v1.0k,20180425,为出版信息增加字体控制命令,hzz -% %类似\newbibmacro*{publisher+location+date} -\newbibmacro*{location+institution+date}{\bibpubfont% -\iftoggle{bbx:gbpub}% -{\testCJKfirst{userd}% -\ifboolexpr{% -test {\iflistundef{location}} and test {\iflistundef{institution}}% -}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}% -{\printtext{[S.l.\space :\space s.n.\adddot]}}% -}{% -\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}% - {\printlist{location}}% -\addcolon\addspace% -\iflistundef{institution}{% -\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}% -{\printlist{institution}}}% -\setunit{\addcomma\addspace}% - %\usebibmacro{date}% - \printfield{year}% - \bibrangedash% - \iffieldundef{endyear}{}{\printfield{endyear}}% - \newunit}% -{\printlist{location}% - \iflistundef{institution}% - {\setunit*{\addcomma\space}} - {\setunit*{\addcolon\space}}% - \printlist{institution}% - \setunit*{\addcomma\space}% - \usebibmacro{date}% - \newunit}% -} -% -% 通用的出版社和地址的处理 -% -% 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。 -% 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。 -% 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理 -\renewbibmacro*{publisher+location+date}{\bibpubfont% -\iftoggle{bbx:gbpub}% -{\testCJKfirst{userd}% - \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }% - {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}% - {\iflistundef{location}{%\adddot - \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 - {\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress} - {\printlist{location}\addcolon\addspace}%%\addcolon\addspace% - \iflistundef{publisher}{% - \iffieldequalstr{note}{standard}{}% - {\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}% - {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}% - {\printlist{publisher}}}% -\setunit*{\addcomma\addspace}%\addcomma\addspace% -\usebibmacro{date}%%\newunit %去掉这个标点 -}% -{\printlist{location}% - \iflistundef{publisher} - {\setunit*{\addcomma\space}} - {\setunit*{\addcolon\space}}% - \printlist{publisher}% - \setunit*{\addcomma\space}% - \usebibmacro{date}%%\newunit - }% -} - -% -% 修改了一个institution+location+date用于manual、report、thesis等类型 -% -% 20180425,v1.0k,增加了字体控制命令,hzz -% 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉 -\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。 -{\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉 - \iflistundef{institution} - {\setunit*{\addcomma\space}} - {\setunit*{\addcolon\space}}% - \printlist{institution}% - \setunit*{\addcomma\space}% - \usebibmacro{date}% - %\newunit - }} - -% -% 对volume卷信息格式做出修改 -% v1.0o,20190105,hzz -% -\DeclareFieldFormat{volume}{% -\testCJKfirst{userd}% -\iftoggle{ifCJKforgbt}% -{\bibstring{serialcn}#1\bibstring{volumecn}}% -{\bibstring{volume}~#1}% -}% volume of a book -\DeclareFieldFormat[article,periodical]{volume}{#1}% volume of a journal - -% -% 对number册信息格式做出修改 -% v1.0o,20190105,hzz -% -\DeclareFieldFormat{number}{#1}% -\DeclareFieldFormat[book,collection,inbook,% -incollection,proceedings,inproceedings]{number}{% -\testCJKfirst{userd}% -\iftoggle{ifCJKforgbt}% -{\bibstring{serialcn}#1\bibstring{numbercn}}% -{#1}% -}% - -% -% 对edition版本信息格式做出修改 -% -\DeclareFieldFormat{edition}{%源来自biblatex.DEF -\testCJKfirst{userd}% -\iftoggle{ifCJKforgbt}% -{\ifinteger{#1}% -{\printtext{#1\str@edition}}% -{#1\isdot}}% -{\ifinteger{#1}% -{\mkbibordedition{#1}~\bibstring{edition}}% -{#1\isdot}}} - -% -% 对version的版本信息做出修改 -% -\DeclareFieldFormat{version}{%源来自biblatex.DEF -\testCJKfirst{userd}% -\ifinteger{#1}% -{\iftoggle{ifCJKforgbt}{\printtext{#1\str@edition}}% -{\mkbibordedition{#1}~\bibstring{version}}}% -{#1\isdot}} - -% -% 修改析出文献的文集的标题与附加标题间的符号 -% -\renewbibmacro*{booktitle}{% - \ifboolexpr{ - test {\iffieldundef{booktitle}} - and - test {\iffieldundef{booksubtitle}} - } - {} - {\printtext[booktitle]{\bibtitlefont% - \printfield[titlecase]{booktitle}% - \setunit{\subtitlepunct}% - \printfield[titlecase]{booksubtitle}}% - \newunit%标点换成下一句 - \setunit{\subtitlepunct}}% - \printfield{booktitleaddon}} - - -% -% 调整期刊名的格式 -% -% v1.0k,20180425,增加了字体控制命令,hzz -\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx - \usebibmacro{journal}% - %\setunit*{\addspace}% - \setunit*{\addcomma\addspace}%修改为增加一个逗号 - \iffieldundef{series} - {} - {\newunit - \printfield{series}% - \setunit{\addspace}}% - %\usebibmacro{volume+number+eid}% - %\setunit{\addspace}% - \usebibmacro{issue+date}% - %\setunit{\addcolon\space}% - \iffieldundef{volume}{}{\setunit{\addcomma\space}}% - %换成逗号和空格 - \usebibmacro{issue}% - \usebibmacro{volume+number+eid}%把卷期放到年份后面 - %\newunit - } - - - -% -% 调整期刊卷和期的格式 -% -\renewbibmacro*{volume+number+eid}{%源来自standard.bbx -\iftoggle{bbx:gbfieldstd}{% - \printfield{volume}% - \setunit*{\adddot}% - \printfield{number}% - \setunit{\addcomma\space}% - \printfield{eid}}{% - \printfield{volume}% - %\setunit*{\adddot}%去掉点号 - %\printfield{number}% - \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号 - \iffieldundef{eid}{}{% - \setunit{\addcomma\space}% - \printfield{eid}}}} - -% -% 调整期刊年份的格式 -% -\renewbibmacro*{issue+date}{%去掉括号 - \printtext{%去掉了[parens] - \iffieldundef{issue} - {%\usebibmacro{date} - \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 - {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 - {\usebibmacro{date}}% - }}% - {\iftoggle{bbx:gbstrict}{}{\printfield{issue}% - \setunit*{\addspace}}% - %\usebibmacro{date} - \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 - {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 - {\usebibmacro{date}}% - }}}% - %\newunit - } - -% -% 调整页码前的标点和去掉期刊文章等页码后面的标点 -% -\renewbibmacro*{note+pages}{%源来自standard.bbx - %\printfield{note}%不要note,note用来判断是否是报纸newspaper - \iffieldundef{pages}{}{ - \setunit{\bibpagespunct}% - \printfield{pages}}% - %\newunit - } - - -% -% 编者的符号修改一下 -% v1.0 2016-07-01 -% v1.0q 2019-03-01 hzz 修改editortype前的标点 -% -\renewbibmacro*{editor}{%源来自biblatex.DEF - \ifboolexpr{ - test \ifuseeditor - and - not test {\ifnameundef{editor}} - } - {\printnames{editor}% - \iffieldundef{editortype}%增加一个类型判断,用于存在editortype的情况 - {\setunit\addspace}%当没有editortype时,直接用句点 - {%\setunit{\addcomma\space}% - \usebibmacro{editorstrg}}% - %\clearname{editor} - }% - {}} - -% -% 编者类型做一修改 -% v1.0 2016-07-01 -% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串 -% -\renewbibmacro*{editorstrg}{%源来自biblatex.DEF - \printtext[editortype]{% - \iffieldundef{editortype} - {% -% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理 -% test {\ifnumgreater{\value{editor}}{1}} -% or -% test {\ifandothers{editor}} -% } -% {\bibstring{editors}} -% {\bibstring{editor}} - } - {\ifbibxstring{\thefield{editortype}} %定义编者类型情况下处理,以后根据需要修改 - {\ifboolexpr{ - test {\ifnumgreater{\value{editor}}{1}} - or - test {\ifandothers{editor}} - } - {\printdelim{streditortypes}} - {\printdelim{streditortype}}} - {\thefield{editortype}}}% - }} - -% -% 编者类型的本地化字符串输出 -% v1.0q 2019-03-01 hzz -% 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符 -% 能对不同文境作设置的包括排序,标签等 -% 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串 -% -\DeclareDelimFormat{streditortypes}{% - \edef\userfieldabcde{userd}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbbiblocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% - \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% - \or% - \bibstring{\thefield{editortype}scn}% - \or% - \addcomma\addthinspace\bibstring{\thefield{editortype}s}% - \fi} -% -\DeclareDelimFormat{streditortype}{% - \edef\userfieldabcde{userd}% - \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% - \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% - \ifcase\value{gbbiblocalcase}% - \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}% - \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}% - \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}% - \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% - \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% - \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% - \or% - \bibstring{\thefield{editortype}cn}% - \or% - \addcomma\addthinspace\bibstring{\thefield{editortype}}% - \fi} - - -% -% bookauthor域的输出, -% v1.0q 2019-03-01 hzz -% 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替, -% 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype -\renewbibmacro*{bybookauthor}{% - \ifnameundef{bookauthor}% - {\ifnameundef{editor}% - {}% - {\ifnamesequal{author}{editor}% - {}{\usebibmacro{editor}}}% - }% - {\ifnamesequal{author}{bookauthor}% - {}{\printnames{bookauthor}}% - }% -} - -% -% 修改期刊的标题 -% -\renewbibmacro*{periodical}{%源来自biblatex.DEF - \iffieldundef{title} - {} - {\printtext[title]{\bibtitlefont% - \printfield[titlecase]{title}% - %\setunit{\subtitlepunct}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct} - \printfield[titlecase]{subtitle}}% - %{}%把编组结束移到后面去 - \iftoggle{bbx:gbtype}{% - \iffieldundef{usera}{}{%在标题后直接给出文献标识字母 - \printfield[gbtypeflag]{usera}}}{} - }} - } - - -% -% 期刊的标题做修改 -% -\renewbibmacro*{title+issuetitle}{%源来自standard.BBX - \usebibmacro{periodical}% - %\setunit*{\addspace}% - \setunit*{\adddot\addspace}%标点修改为句点 - \iffieldundef{series} - {} - {\newunit - \printfield{series}% - \setunit{\addspace}}% - \usebibmacro{periodical+issue}%将issue调整到上面来,并修改 -\iffieldundef{number}{}{%%进一步处理有范围的数字 - \multinumberparser{\thefield{number}}}% - \iffieldundef{volume}% - {\printfield{year}% - \printtext{\mkbibparens{\multinumberfirst}}% - \bibrangedash% - \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}% - }% - {\multivolparser{\thefield{volume}}% - \printfield{year}% - \setunit{\addcomma\space}%将冒号修改为逗号 - \printtext{\multivolfirst}% - \printtext{\mkbibparens{\multinumberfirst}}% - \bibrangedash% - \iffieldundef{endyear}{}{% - \printfield{endyear}% - \setunit{\addcomma\space}%将冒号修改为逗号 - \printtext{\multivolsecond}% - \printtext{\mkbibparens{\multinumbersecond}}}% - }% - \setunit{\addcomma\space}% - \printfield{eid}% - \setunit{\addspace}% - %\usebibmacro{issue+date}% - %\setunit{\addcolon\space}% - \usebibmacro{issue}% - \newunit} - -% -% 新增一个样式用于调整期刊年份的格式,只打印年份 -% -\newbibmacro*{periodical+issue}{% - \printtext{%去掉了[parens] - \iffieldundef{issue} - {%\usebibmacro{date}%修改为下一句 - }% - {\printfield{issue}% - \setunit*{\addspace}% - %\usebibmacro{date}%修改为下一句 - }% - }% - %\newunit -} - -% -% 重设专利title的输出,将文献类型标识符输出出去 -% -\newbibmacro*{patenttitle}{%原输出来自biblatex.def文件 - \ifboolexpr{% - test{\iffieldundef{title}}% - and% - test{\iffieldundef{subtitle}}% - }% - {}% - {\printtext[title]{\bibtitlefont% - \printfield[titlecase]{title}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct}% - \printfield[titlecase]{subtitle}}% - \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 - {\setunit{\subtitlepunct}\printfield{titleaddon}}% - \setunit{\subtitlepunct}\printfield{number}%写专利号 - \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}% - %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 - %\newunit - }% -}% -} - - - -% -% 修改in:用于inbook、incollection、inproceedings等类型 -% 2018.04.20,v1.0k,renewed marco,by hzz -% 20190212,v1.0q,增加中英文区分,by hzz -% -% 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。 -\renewbibmacro*{in:}{% - \iftoggle{bbx:gbpunctin}{\printtext{\texttt{//}\allowbreak}}%\addthinspace - {\setunit{\adddot\addspace}% - \iffieldequalstr{userd}{chinese}% - {\printtext{\bibstring{incn}}}% - {\printtext{\bibstring{in}}}% - }}%\newunit\newblock\intitlepunct - -% -% 修改type域的输出格式 -% 2019.02.12,v1.0q,byhzz -% 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文 -\DeclareFieldFormat{type}% -{\iffieldequalstr{userd}{chinese}% - {\ifbibxstring{#1cn}{\bibxstring{#1cn}}{#1}}% - {\ifbibstring{#1}{\bibstring{#1}}{#1}}% -} - - -% -% 修改series域的输出格式 -% 2019.05.01,v1.0r,byhzz -\renewbibmacro*{series+number}{% - \printfield{series}% - %\setunit*{\addspace}% - %\printfield{number}% - %\newunit - } - -%===================================================================== -%设置驱动格式 -%===================================================================== -% -% book条目类的驱动 -% - \DeclareBibliographyDriver{book}{%源来自standard.bbx文件 - \usebibmacro{bibindex}% - \usebibmacro{begentry}% -\usebibmacro{author/editor+others/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 -\usebibmacro{maintitle+title}% -\iftoggle{bbx:gbstrict}{}{% -\newunit -\printlist{language}% -\newunit\newblock% -\usebibmacro{byauthor}% -\newunit\newblock}% -\usebibmacro{byeditor+others}% -\newunit -\printfield{edition}% -\newunit\newblock%% -\iftoggle{bbx:gbstrict}{}{% -\iffieldundef{maintitle}% -{\printfield{volume}% -\printfield{part}}% -{}% -\newunit% -\printfield{volumes}% -\newunit\newblock% -\usebibmacro{series+number}}% -\newunit\newblock% -%\printfield{note}% -%\newunit\newblock% -\usebibmacro{publisher+location+date}% -%\newunit\newblock %这里标点去掉 -\usebibmacro{chapter+pages}% - \iffieldundef{url}{}{%当没有网址时也不输出 - \usebibmacro{modifydate}}%带括号的修改或更新日期, -\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 - \newunit\newblock% - \printfield{pagetotal}% - \newunit\newblock% - \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% - \newunit\newblock - %\usebibmacro{doi+eprint+url}% - %\newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - - -% -% 期刊文章,连续出版物中的析出文献的格式 -% - \DeclareBibliographyDriver{article}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}% - \newunit\newblock - \usebibmacro{bytranslator+others}% - \newunit\newblock - \printfield{version}}% - \newunit\newblock - %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物 - \usebibmacro{journal+issuetitle}% - %\newunit -% \usebibmacro{byeditor+others}% -% \newunit - \usebibmacro{note+pages}% - \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期 - \iffieldundef{url}{}{%当没有网址时也不输出 - \iftoggle{bbx:url}{%当url选项为false时,也不输出 - \usebibmacro{modifydate}}{}}}%带括号的修改或更新日期, - \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置 - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{issn}} - {}% - \newunit\newblock - %\usebibmacro{doi+eprint+url}% - %\newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - - - -% -% 连续出版物的驱动 -% - \DeclareBibliographyDriver{periodical}{%源来自standard.BBX - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{editor}% - %\setunit{\labelnamepunct}\newblock - \newunit\newblock %删除上面一行,添加这一行 - \usebibmacro{title+issuetitle}% - \newunit\newblock% - \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间 - \newunit\newblock%添加这一行 - \iftoggle{bbx:gbstrict}{}{% - \printlist{language}% - \newunit\newblock - \usebibmacro{byeditor}% - \newunit\newblock - \printfield{note}% - \newunit\newblock} - \iftoggle{bbx:isbn} - {\printfield{issn}} - {}% - \newunit\newblock - \usebibmacro{doi+eprint+url}% - \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - -% -% 专利文献驱动 -% - \DeclareBibliographyDriver{patent}{%源来自standard.BBX - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - %\usebibmacro{title}% - \usebibmacro{patenttitle}%给出专利专用的标题输出 - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}}% - \newunit\newblock - \printfield{type}% - \setunit*{\addspace}% - %\printfield{number}%已放到patenttitle中处理 - \iflistundef{location} - {} - {\setunit*{\addspace}% - \printtext{%[parens] - \printlist[][-\value{listtotal}]{location}}}% - \newunit\newblock - \usebibmacro{byholder}% - \newunit\newblock - \printfield{note}% - \newunit\newblock - \usebibmacro{newsdate}% - %\newunit\newblock - \usebibmacro{doi+eprint+url}% - \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - - -% -% 在线文献驱动 -% -\DeclareBibliographyDriver{online}{%源来自standard.BBX - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/editor+others/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}% - \newunit\newblock - \usebibmacro{byeditor+others}% - \newunit\newblock - \printfield{note}}% - \newunit - \printfield{version}% - \newunit\newblock - %\printlist{organization}% - \printlist{institution}% - \newunit\newblock -\ifboolexpr{% -test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% -}{\usebibmacro{date}}% -{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间 - \usebibmacro{url+urldate}%从下面移上来 - \newunit\newblock - \iftoggle{bbx:eprint} - {\usebibmacro{eprint}} - {}% - \newunit\newblock - %\usebibmacro{url+urldate}% - %\newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - - -% -% 报告类型驱动 -% 当有网址无出版项时,用online输出 -% -\DeclareBibliographyDriver{report}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}}% - \newunit\newblock - \usebibmacro{byeditor+others}%增加的译者信息 - \newunit\newblock - \printfield{type}% - \setunit*{\addspace}% - \printfield{number}% - \newunit\newblock - \printfield{version}% - \newunit - \printfield{note}% - \newunit\newblock - \usebibmacro{publisher+location+date}% - %\newunit\newblock - \usebibmacro{chapter+pages}% - \usebibmacro{doi+eprint+url}% - \newunit - \printfield{pagetotal}% - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{isrn}} - {}% - \newunit\newblock -% \usebibmacro{doi+eprint+url}% -% \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - -% -% 论文、手册类型驱动 -% 2016-11-11,增加了译者信息 -% -\DeclareBibliographyDriver{manual}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% - \iftoggle{bbx:gbstrict}{}{% - \newunit% - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}}% - \newunit\newblock - \usebibmacro{byeditor+others}%增加的译者信息 - \newunit\newblock - \iftoggle{bbx:gbfieldtype}{% - \printfield{type}% - \setunit*{\addspace}}{}% - \printfield{number}% - \newunit\newblock - \printfield{version}% - \newunit - \printfield{note}% - \newunit\newblock - \usebibmacro{institution+location+date}% - %\newunit\newblock - \usebibmacro{chapter+pages}% - \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期 - \usebibmacro{modifydate}}%修改或更新日期为带括号的时间 - \usebibmacro{doi+eprint+url}% - \newunit - \printfield{pagetotal}% - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{isrn}} - {}% - \newunit\newblock -% \usebibmacro{doi+eprint+url}% -% \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - -% -% 备选类型驱动 -% -% 利用biblatex的misc驱动 -\DeclareBibliographyDriver{misc}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/editor+others/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 - \usebibmacro{title}% -\iftoggle{bbx:gbstrict}{}{% - \newunit - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}% - \newunit\newblock - \usebibmacro{byeditor+others}}% - \newunit\newblock - \printfield{howpublished}% - \newunit\newblock - \printfield{type}% - \newunit - \printfield{version}% - \newunit - \printfield{note}% - \newunit\newblock - \usebibmacro{institution+location+date}% - %\usebibmacro{organization+location+date}% - %\newunit\newblock - \usebibmacro{doi+eprint+url}% - \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - - -% -% 专著中的析出文献的格式修改 -% -\DeclareBibliographyDriver{inbook}{%源来自standard.bbx - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/translator+others}% -\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 -\usebibmacro{title}% -\usebibmacro{in:}% -%\printtext{\texttt{//}\addthinspace}% - \usebibmacro{bybookauthor}% - \ifnameundef{bookauthor}{% - \ifnameundef{editor}{}{\newunit}% - }{\newunit}%替换下一句 - %\newunit\newblock -\iffieldundef{series}{}{\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加 - \usebibmacro{maintitle+booktitle}% -\iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}% -\iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息 - \newunit\newblock% -% \usebibmacro{byeditor+others}% -% \newunit\newblock - \printfield{edition}% - \newunit - \iftoggle{bbx:gbstrict}{}{% -% \iffieldundef{maintitle} -% {\printfield{volume}% -% \printfield{part}} -% {}% -% \newunit -% \printfield{volumes}% -% \newunit\newblock -% \usebibmacro{series+number} - }% - \newunit\newblock - %\printfield{note}% - %\newunit\newblock - \usebibmacro{publisher+location+date}% - %\newunit\newblock - \usebibmacro{chapter+pages}% - %\newunit\newblock - \usebibmacro{doi+eprint+url}%移到上面来 - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% - \newunit\newblock -% \usebibmacro{doi+eprint+url}% -% \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \usebibmacro{finentry}\usebibmacro{annotation}} - - -% -%针对不同refsection做不同的格式处理的代码 -% - -% -%默认采用顺序编码制,因此只需增加的是作者年制 -\newrobustcmd{\setaystylesection}[1]{\csxdef{gb@aystyle@section#1}{#1}} - -% -%在AtBeginBibliography处已经无法重定义defbibenvironment{bibliographyay} -%所以输出只能是用另外定义的环境来实现 -%可以在refsection后面做patch -%为排序引入newrefcontext -\apptocmd{\refsection}{ -\edef\gb@refsecnum{\number\c@refsection}% -\ifcsdef{gb@aystyle@section\gb@refsecnum}% -{ -\newrefcontext[sorting=gb7714-2015] - -\setlength{\bibhang}{1em} -\setlength{\bibitemindent}{-\bibhang} -\defbibenvironment{bibliography} - {\list - {} - {\setlength{\leftmargin}{\bibhang}% - \setlength{\itemindent}{\bibitemindent}% - \setlength{\itemsep}{\bibitemsep}% - \setlength{\parsep}{\bibparsep}}} - {\endlist} - {\item} -}{} -}{}{} - -% -%为排序引入endrefcontext -% -\pretocmd{\endrefsection}{ -\edef\gb@refsecnum{\number\c@refsection}% -\ifcsdef{gb@aystyle@section\gb@refsecnum}% -{\endrefcontext}{} -}{}{} - -%因为是整个文献表,在打印文献表的时候,增加钩子代码 -%因为下面的钩子是在defbibenvironment的begincode之后,所以对于defbibenvironment相关的设置都是无效的 -\AtBeginBibliography{ - -\edef\gb@refsecnum{\number\c@refsection}% -\ifcsdef{gb@aystyle@section\gb@refsecnum}% -%\ifboolexpr{ -%not test {\ifcsundef{gb@aystyle@section\gb@refsecnum}} -%and -%test {\ifcsequal{gb@refsecnum}{gb@aystyle@section\gb@refsecnum}} -%} - { - - \DeclareDelimFormat{nameyeardelim}{\addcomma\space} - \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space} - - \renewbibmacro*{date}{% - \iflabeldateisdate - {} - {\printdate}}% - - \renewbibmacro*{date+extradate}{% - \iffieldundef{labelyear} - {} - {\printtext{%[parens]%这里去掉括号 - \iflabeldateisdate - {\printdateextra} - {\printlabeldateextra}}}}% - - \newbibmacro*{bbx:savehash}{% - \savefield{fullhash}{\bbx@lasthash}} - - \newbibmacro*{bbx:dashcheck}[2]{} - - %注意这里当没有作者只有标题时在年份之前的标点是否需要标准并未涉及,所以未做处理。 - \renewbibmacro*{author}{%以前的date+extrayear变为date+extradate,所以对3.8以上版本重定义一下author - \ifboolexpr{ - test \ifuseauthor - and - not test {\ifnameundef{author}} - } - {% - \usebibmacro{bbx:savehash}% - \printnames{author}% - \iffieldundef{authortype} - {\setunit{\printdelim{nameyeardelim}}} - {\setunit{\printdelim{authortypedelim}}}% - \iffieldundef{authortype} - {} - {\usebibmacro{authorstrg}% - \setunit{\printdelim{nameyeardelim}}} - }% - {\global\undef\bbx@lasthash - \usebibmacro{labeltitle}% - \setunit*{\printdelim{nonameyeardelim}}}% - \usebibmacro{date+extradate}} - - \newbibmacro*{labeltitle}{% - \iffieldundef{label} - {\iffieldundef{shorttitle} - {\printfield{title}% - \clearfield{title}} - {\printfield[title]{shorttitle}}} - {\printfield{label}}} - -% -% 增加一个number带括号的格式,避免使用mkbibparens而引入一个不必要的空格 -% -\DeclareFieldFormat{addnumflag}{% -\nobreak\printtext{(}\nobreak #1\nobreak\printtext{)}} - -% -% 调整journal输出 -% -% 原理方法:首先判断子标题,然后再设置标点。 -% 避免直接设置标点后,当volume不存在时需要使用\nopuct去标点进而引入不必要的空格 -\renewbibmacro*{journal}{% - \iffieldundef{journaltitle}% - {}% - {\printtext[journaltitle]{% - \printfield[titlecase]{journaltitle}% - \iffieldundef{journalsubtitle}{}{\setunit{\subtitlepunct}% - \printfield[titlecase]{journalsubtitle}}}}} - - - -% -% 调整期刊卷和期的格式 -% -\renewbibmacro*{volume+number+eid}{%源来自standard.bbx -\iftoggle{bbx:gbfieldstd}{% - \printfield{volume}% - \setunit*{\adddot}% - \printfield{number}% - \setunit{\addcomma\space}% - \printfield{eid}}{% - \printfield{volume}% - %\setunit*{\adddot}%去掉点号 - %\printfield{number}% - \iffieldundef{number}{}{\printfield[addnumflag]{number}}%区别于顺序编码制 - \iffieldundef{eid}{}{% - \setunit{\addcomma\space}% - \printfield{eid}}}} - -% -% 调整期刊年份的格式 -% -% 原理方法:原在authoryear.BBX中\bbx@opt@mergedate@compact中定义 -% 当issue存在时,才设置newunit。避免直接设置标点后,当volume不存在是需要使用\nopuct去标点进而引入不必要的空格 - \renewbibmacro*{issue+date}{% - \iffieldundef{issue}% - {}% - {\iftoggle{bbx:gbstrict}{}{\printtext[parens]{\printfield{issue}}\newunit}}} - -% -% 编者的符号修改一下 -% v1.0 2016-07-01 -% v1.0q 2019-03-01 hzz 修改editortype前的标点 -% -\renewbibmacro*{editor}{% - \ifboolexpr{ - test \ifuseeditor - and - not test {\ifnameundef{editor}} - } - {\usebibmacro{bbx:dashcheck} - {%\bibnamedash - \printnames{editor}% - } - {\printnames{editor}% - %\setunit{\printdelim{editortypedelim}}% - %\usebibmacro{bbx:savehash} - }% - \usebibmacro{editorstrg}% - %\clearname{editor}% - \setunit{\printdelim{nameyeardelim}}}% - {\global\undef\bbx@lasthash - \usebibmacro{labeltitle}% - \setunit*{\printdelim{nonameyeardelim}}}% - \ifboolexpr{% - test {\ifentrytype{inbook}} - or - test {\ifentrytype{incollection}} - or - test {\ifentrytype{inproceedings}} - or - test {\ifentrytype{conference}} - }% - {}% - {\usebibmacro{date+extradate}}} - - - }{} - - - -} - - - -% -%针对具体条目做处理时的特殊处理 -% -%\def\localsetrefsectionstyle{% -%} - -%\AtEveryBibitem{\localsetrefsectionstyle}% -%\AtEveryCite{\localsetchinesecode}% -%\AtEveryLositem{\localsetchinesecode}% +%% +%% --------------------------------------------------------------- +%% biblatex-gb7714-2015 --- A biblatex implementation of the +%% GBT7714-2015 bibliography style,numerical sequence and authoryear mixed style +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% + +% +% 版本和时间信息 +% +\def\versionofgbtstyle{2021/01/19 v1.0w} +\def\versionofbiblatex{\abx@version} +\ProvidesFile{gb7714-2015mx.bbx}[\versionofgbtstyle biblatex bibliography style] +%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求 + +%===================================================================== +% 加载标准样式 +%===================================================================== +\RequireBibliographyStyle{numeric-comp} +\RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题 + + +%===================================================================== +% 功能函数 +%===================================================================== + % + % 增加一个控制是否输出文献载体的选项 + % 20191125,v1,0s,hzz + \newtoggle{bbx:gbmedium} + \DeclareBibliographyOption{gbmedium}[true]{%biblatex低版本 + \settoggle{bbx:gbmedium}{#1}} + \ExecuteBibliographyOptions{gbmedium} + % + % 增加一个控制是否输出annotation域的选项,该域可以用于在文献条目后面输出一些注释信息 + % 20190509,v1,0s,hzz + \newtoggle{bbx:gbannote} + \DeclareBibliographyOption{gbannote}[false]{%biblatex低版本 + \settoggle{bbx:gbannote}{#1}} + \ExecuteBibliographyOptions{gbannote} + % + %用于在文献条目后面输出注释信息的宏 + %FieldFormat{annotation}用于设置注释信息的格式 + \DeclareFieldFormat{annotation}{% + \printtext{\addspace(#1)}% + } + \renewbibmacro*{annotation}{% + \iftoggle{bbx:gbannote}% + {\iffieldundef{annotation}% + {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}% + {\printfield{annotation}}}% + {}% + } + + + % + % biblatex版本判断 + % 20180629,v1.0k,hzz + % + % 原理方法:适用于3.10以上版本的biblatex,否则给出警告 + \@ifpackagelater{biblatex}{2017/12/28}{}{ + \blx@warning@noline{% + biblatex version is too old for this style\MessageBreak + if errors raised,Please update biblatex to the latest version.} + } + + % + % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成 + % v1.0k,20180509,hzz + % + % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏 + % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8 + % 编码用xelatex编译的问题。 + % + % 原理是:利用perl正则将中文标识记录到域中, + % 然后利用\iffieldundef和\iffieldequalstr进行判断 + \providetoggle{ifCJKforgbt} + \def\testCJKfirst#1{% + \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{% + \iffieldequalstr{#1}{chinese}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}} + + % + % 2个卷的解析函数,用于连续出版物 + % + % 原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号 + \newcommand{\multivolparser}[1]{% + \IfSubStr{#1}{-}% + {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}% + {\def\multivolfirst{#1}\def\multivolsecond{}}% + } + + + % + % 2个期的解析函数,用于连续出版物 + % + \newcommand{\multinumberparser}[1]{% + \IfSubStr{#1}{-}% + {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}% + {\def\multinumberfirst{#1}\def\multinumbersecond{}}% + } + +%===================================================================== +% 数据模型定义 +%===================================================================== + %定义类型和载体标识,从gb内容看载体基本属于介质。 + %为与lee zeping的bst的样式统一,使用mark和medium这两域名 + %为单个条目的姓名格式控制增加nameformat和namefmtid两个域 + %为缩略信息文献表增加了shortbooktitle域 + %为多语言排序增加了lansortorder域 + \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat} + \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid} + \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle} + \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder} + %为多样式文献表增加的stylesections、styleaysection域: + \DeclareDatamodelFields[type=field,datatype=integer]{aysections} + \DeclareDatamodelFields[type=field,datatype=literal]{styleaysection} + + %因为biblatex更新3.14版本以后,biber对于为声明数据模型的条目类型 + %不再默认读取,而是以空字符串作为条目类型名,自然在条目定义alias时 + %就会出现问题,因此显式的声明一下newspaper,然后保留后面采用alias的方式 + %而standard类型则是采用另一种方式直接在sourcemap中转换为其它类型。 + \@ifpackagelater{biblatex}{2019/11/30}{%2019/12/01 v3.14 + \DeclareDatamodelEntrytypes{newspaper}% + }{} + + + +%===================================================================== +% 设置宏包选项 +%===================================================================== + % + % 增加一个控制是否输出type域的选项 + % 20190212,v1,0q,hzz + \newtoggle{bbx:gbfieldtype} + \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本 + \settoggle{bbx:gbfieldtype}{#1}} + \ExecuteBibliographyOptions{gbfieldtype} + + % + % 增加一个控制是否根据页码重设脚注数字标号的选项 + % 20190422,v1,0r,hzz + \newtoggle{bbx:gbfnperpage} + \DeclareBibliographyOption{gbfnperpage}[false]{% + \settoggle{bbx:gbfnperpage}{#1}} + \ExecuteBibliographyOptions{gbfnperpage} + + % + % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表 + % 20190203,v1.0p,hzz + % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签 + % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式 + % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题 + \DeclareBibliographyOption{gbfootbib}[false]{% + \ifstrequal{#1}{false}{}{\execgbfootbib}} + \ExecuteBibliographyOptions{gbfootbib} + + %% + \newlength{\footbibmargin} + \newlength{\footbiblabelsep} + \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离 + \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距 + \def\execgbfootbib% + {% + %开启引用跟踪计数器,为使用\ifciteseen等测试命令 + \ExecuteBibliographyOptions{citetracker=true} + % + %利用footmisc宏包来实现脚注文献的悬挂对齐 + \AtEndPreamble{ + \@ifclassloaded{beamer}{}{ + %beamer类因为其特殊性,为避免冲突不调footmisc。 + %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接 + %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。 + %\PassOptionsToPackage{perpage,hang}{footmisc}% + %\RequirePackage{footmisc}% + + %重新实现脚注的根据单页重设脚注号码 + %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改 + %v1.0q 20190317 hzz + %v1.0r 20190422 hzz 根据gbfnperpage选项设置 + \iftoggle{bbx:gbfnperpage}% + {\@addtoreset{footnote}{page}}{}%重设计数器 + + \@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义 + \long\def\H@@footnotetext##1{\insert\footins{% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \leftskip \footbibmargin%增加的左侧缩进 + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% + }% + \color@endgroup}}% + + \long\def\H@@mpfootnotetext##1{% + \global\setbox\@mpfootins\vbox{% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \leftskip \footbibmargin%增加的左侧缩进 + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \color@endgroup}} + }{%否则对latex核心代码中的\@footnotetext做重定义 + \long\def\@footnotetext##1{\insert\footins{% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \leftskip \footbibmargin%增加的左侧缩进 + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% + }% + \color@endgroup}}% + + \long\def\@mpfootnotetext##1{% + \global\setbox\@mpfootins\vbox{% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \leftskip \footbibmargin%增加的左侧缩进 + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \color@endgroup}} + } + + \long\def\@makefntext##1{%增加了脚注标记与正文的间隔 + \parindent 1em\noindent \hb@xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1} + + } + + % + %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式 + \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}} + %做patch使得脚注内容中的脚注数字标签不上标 + \pretocmd{\@makefntext}{% + \def\@makefnmark{% + \hbox{\textcircled{\tiny\@thefnmark}}% + }% + }{}{} + } + + % + %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容) + %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。 + %v1.0q 20190309 区分使脚注标注适应minipage中的情况 + \newbibmacro*{citesavefn}{% + \ifciteseen%当被引用过为true + {\ifcsdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%当已经定义过脚注序号信息 + {\csgdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% + \str@sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}% + \@makefnmark% + }}% + {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% + \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% + }}% + }% + {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% + \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% + %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断 + }}% + } + + % + %重定义\footfullcite使完成gb7714-2015的脚注文献要求 + \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% + {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 + \defcounter{minnames}{\blx@minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。 + \usebibmacro{prenote}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {}{\setunit{\addcolon\addspace}\printtext{\thefield{postnote}}}}%由于ay样式中没有修改postnote域,此处因为格式需要不使用默认域格式 + }% + {\usebibmacro{citesavefn}% + \ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}% + {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%\nopunct + {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}% + }% + {\multicitedelim}% + {\usebibmacro{postnote}} + + } + + % + % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式 + % 20180814,v1.0m,hzz + % 原理方法: + % 只为兼容性考虑不做任何处理 + \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本 + } + + % + % 增加一个控制是否输出文献类型和载体标识的选项 + % + % 原理方法: + % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的 + % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本 + \newtoggle{bbx:gbtype} + %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本 + \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本 + \settoggle{bbx:gbtype}{#1}} + \ExecuteBibliographyOptions{gbtype} + + % + % 增加一个源文件编码选择选项,当true时可以使用GBK编码。 + % v1.0k, 2018.05.08, by hzz + % + % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档 + % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def + % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用 + % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。 + % 另外注意: + % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码 + % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常 + % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。 + \newtoggle{bbx:codegbk} + \DeclareBibliographyOption{gbcodegbk}[false]{% + \settoggle{bbx:codegbk}{#1}} + \ExecuteBibliographyOptions{gbcodegbk} + + \def\str@bibliography{参考文献} + \def\str@references{参考文献} + \def\str@bytranslator{译} + \def\str@andotherscn{等} + \def\str@backrefpage{引用页} + \def\str@backrefpages{引用页} + \def\str@noaddress{出版地不详} + \def\str@nopublisher{出版者不详} + \def\str@edition{版} + \def\str@volumecn{卷} + \def\str@numbercn{册} + \def\str@serialcn{第} + \def\str@sameentry{同} + \def\str@incn{见} + \def\str@mathesiscn{硕士学位论文} + \def\str@phdthesiscn{博士学位论文} + \def\str@editorcn{主编} + + \AtEndOfPackage{% + \iftoggle{bbx:codegbk}{% + \ExecuteBibliographyOptions{texencoding = GBK} + \input{gb7714-2015-gbk.def} + }{}} + + % + % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项 + % v1.0k, 2018.05.08, by hzz + % + % 原理方法: + % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息 + % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式 + % 可能需要用于中英文判断的language域的信息。 + \newtoggle{bbx:gbstrict} + \DeclareBibliographyOption{gbstrict}[true]{% + \settoggle{bbx:gbstrict}{#1}} + \ExecuteBibliographyOptions{gbstrict} + + % + % 增加一个控制标题域超链接设置的选项 + % v1.0k, 2018.05.24, by hzz + % + % 原理方法: + % 利用标题域格式来实现,默认设置该选项为false,不做超链接。 + % 设置为true,则标题设置超链接 + \newtoggle{bbx:titlelink} + \DeclareBibliographyOption{gbtitlelink}[false]{% + \settoggle{bbx:titlelink}{#1}} + \ExecuteBibliographyOptions{gbtitlelink} + + % + % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项 + % v1.0l, 2018.07.02, by hzz + % + % 原理方法: + % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置 + \newtoggle{bbx:ctexset} + \DeclareBibliographyOption{gbctexset}[true]{% + \settoggle{bbx:ctexset}{#1}} + \ExecuteBibliographyOptions{gbctexset} + + \AtEndOfPackage{% + \iftoggle{bbx:ctexset}{% + \def\blx@defbibstrings#1#2{% + \def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}% + \abx@dostrings + \csuse{abx@strings@#1}% + \setkeys{blx@lbx}{#2}% + \let\do\blx@defbibstrings@i + \csxdef{abx@strings@#1}{\abx@dostrings}% + } + }{}} + + + + % + % 增加一个恢复域格式为标准样式的控制选项 + % v1.0k, 2018.05.15, by hzz + % + % 原理方法: + % 默认设置该选项为false,采用国标要求的域格式输出相关域 + % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域 + \newtoggle{bbx:gbfieldstd} + \DeclareBibliographyOption{gbfieldstd}[false]{% + \settoggle{bbx:gbfieldstd}{#1}% + \ifstrequal{#1}{false}{}{\execgbfdfmtstd}% + } + \ExecuteBibliographyOptions{gbfieldstd} + + % + % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。 + % + \newtoggle{bbx:gbpub} + \DeclareBibliographyOption{gbpub}[true]{% + %\settoggle{bbx:gbpub}{#1} %或采用下面这一句 + \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}} + \ExecuteBibliographyOptions{gbpub} + + % + % 增加控制析出文献来源前的标点符号//输出的选项 + % v1.0k, 2018.04.20,added in by hzz + \newtoggle{bbx:gbpunctin} + \DeclareBibliographyOption{gbpunctin}[true]{% + \settoggle{bbx:gbpunctin}{#1}} + \ExecuteBibliographyOptions{gbpunctin} + + + % + % 增加一个处理佚名或noauthor的控制选项 + % + % 原理方法:顺序编码制中与作者年制都使用 + \DeclareBibliographyOption{gbnoauthor}[true]{% + \ifstrequal{#1}{false}{}{\dealnoathor}} + %\ExecuteBibliographyOptions{gbnoauthor=true}%对于需要展开较早(展开层级优先)的选项,这一执行无效,只能用宏包加载时给出的选项。 + + + + + % + % 选项设置 + % + \ExecuteBibliographyOptions{ + sorting=none, + useprefix=true, %名字的信息包括前缀 + date = year, %日期仅写到年 + maxbibnames = 3,%设置名字最大数量 + minbibnames = 3, %设置缩减后的名字最小数量 + maxitems = 1,%设置列表最大数量 + minitems = 1, %设置缩减后的列表最小数量 + isbn=false, + sortlocale=zh__pinyin,%zh__big5han,%zh__stroke,%zh__gb2312han,%zh__pinyin, + } + + % + %为日期相关选项增加选项值gb7714-2015 + % + \csdef{mkdaterangegb7714-2015}#1{% + \begingroup + \blx@metadateinfo{#1}% + \iffieldundef{#1year} + {} + {\printtext[#1date]{% + \blx@gbdate{#1}{}}}% + \endgroup} + + \newrobustcmd*{\blx@gbdate}[3][]{% + \dateeraprintpre{#2#3year}% + \blx@imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}% + \iffieldundef{#2#3month}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3month}}}% + \iffieldundef{#2#3day}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3day}}}} + + + %为姓名格式选择增加的计数器 + \newcounter{gbnamefmtcase} + \def\thegbnamefmtcase{\the\c@gbnamefmtcase} + %为数字标签格式选择增加的计数器/命令 + \newcommand{\mkgbnumlabel}[1]{\mkbibbrackets{#1}} + \def\gbbiblabelopt@bracket{\renewcommand{\mkgbnumlabel}[1]{\mkbibbrackets{##1}}} + \def\gbbiblabelopt@parens{\renewcommand{\mkgbnumlabel}[1]{\mkbibparens{##1}}} + \def\gbbiblabelopt@dot{\renewcommand{\mkgbnumlabel}[1]{##1\adddot}} + \def\gbbiblabelopt@plain{\renewcommand{\mkgbnumlabel}[1]{##1}} + \def\gbbiblabelopt@box{\renewcommand{\mkgbnumlabel}[1]{\framebox{##1}}} + \def\gbbiblabelopt@circle{\renewcommand{\mkgbnumlabel}[1]{\textcircled{##1}}} + %为文献表中数字标签对齐方式选择增加的计数器/命令 + \newcounter{gbalignlabel} + \def\thegbalignlabel{\the\c@gbalignlabel} + %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令 + \newcounter{gbcitelocalcase} + \newcounter{gbbiblocalcase} + \def\thegbcitelocalcase{\the\c@gbcitelocalcase} + \def\thegbbiblocalcase{\the\c@gbbiblocalcase} + + + % + % 增加不同语言排序的切换选项,numeric样式,不使用该选项 + % gblanorder=chineseahead的顺序为cn,jp,kr,en,fr,ru + % gblanorder=englishahead的顺序为en,fr,ru,cn,jp,kr + % gblanorder=cn;en;ru;fr;jp;kr的顺序为指定的cn;en;ru;fr;jp;kr,自定义内容可以随意写以分号分隔 + % v1.0q,20190307,hzz + % + \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{% + \ifstrequal{#1}{chineseahead}%%中文在前的顺序 + {\gdef\lancnorder{1}\gdef\lanjporder{2}\gdef\lankrorder{3}% + \gdef\lanenorder{4}\gdef\lanfrorder{5}\gdef\lanruorder{6}}% + {% + \ifstrequal{#1}{englishahead}% + {\execlanodeah\dealsortlan}% + {\execlanodudf{#1}\dealsortlan}% + }% + } + \ExecuteBibliographyOptions{gblanorder} + + \def\execlanodeah{%中文在后的顺序 + \gdef\lancnorder{4} + \gdef\lanjporder{5} + \gdef\lankrorder{6} + \gdef\lanenorder{1} + \gdef\lanfrorder{2} + \gdef\lanruorder{3}} + + \newcounter{lanordernum} + \newcommand{\execlanodudf}[1]{%like:cn;en;ru;fr;jp;kr + \setcounter{lanordernum}{0} + \DeclareListParser{\parsinglanorder}{;} + \renewcommand*{\do}[1]{\stepcounter{lanordernum}\csxdef{lan##1order}{\thelanordernum}} + \parsinglanorder{#1} + } + + % + % 增加本地化字符串的中英文切换选项 + % gbcitelocal指标注中的本地化字符串 + % gbbiblocal 指文献表中的本地化字符串 + % gblocal 指设置文献表和标注中的本地化字符串 + % v1.0o,20190103,hzz + % + \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{% + \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}% + \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}% + \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}% + } + \ExecuteBibliographyOptions{gbcitelocal} + + \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{% + \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}% + \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}% + \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}% + } + \ExecuteBibliographyOptions{gbbiblocal} + + \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{% + \ExecuteBibliographyOptions{gbbiblocal=#1}% + \ExecuteBibliographyOptions{gbcitelocal=#1}% + } + %\ExecuteBibliographyOptions{gblocal} %默认值已经通过两个相关选项设置 + + % + % 增加序号标签格式处理选项 + % v1.0l,20180623,hzz + % + \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{% + \csuse{gbbiblabelopt@#1} + } + \ExecuteBibliographyOptions{gbbiblabel} + + % + % 增加姓名大小写格式处理选项 + % + \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{% + \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}% + \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}% + \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family + \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{} + \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given + \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family + } + \ExecuteBibliographyOptions{gbnamefmt} + + % + % 增加标签对齐选项 + % + % right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式 + \DeclareBibliographyOption[string]{gbalign}[right]{% + \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{} + \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{} + \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{} + \ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{} + } + + \ExecuteBibliographyOptions{ + giveninits=true, + urldate =gb7714-2015, %iso,iso8601,edtf + eventdate =gb7714-2015, + labeldateparts=true, + } + +% +% 针对3.13<=biblatex版本的选项设置,因为内容有限,所以不做版本区分,而用时间直接判断 +% +% 解决国标中“王临慧, 2010a.”和“王临慧, 等, 2010b.”的问题 +% 在没有这个选项之前无法加上a和b +% v1.0s,20190828 +\@ifpackagelater{biblatex}{2019/08/16}{% + \ExecuteBibliographyOptions{% + nohashothers=true}}{} + +%===================================================================== +% 设置本地化字符串 +%===================================================================== + % + % 新建当地化字符串,用来记录“等”字符、“和”字符 + % + \NewBibliographyString{andotherscn} + \NewBibliographyString{andothersincitecn} + \NewBibliographyString{andothersincite} + \NewBibliographyString{andcn} + \NewBibliographyString{andothersjp} + \NewBibliographyString{andotherskr} + \NewBibliographyString{andjp} + \NewBibliographyString{andkr} + \NewBibliographyString{andincitecn} + \NewBibliographyString{andincite} + \NewBibliographyString{volumecn} + \NewBibliographyString{numbercn} + \NewBibliographyString{serialcn} + \NewBibliographyString{incn} + \NewBibliographyString{mathesiscn} + \NewBibliographyString{phdthesiscn} + \NewBibliographyString{editorcn} + \NewBibliographyString{editorscn} + + + + % + % 修改一些当地化字符串 + % + % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件 + % 当然也可以增加比如上面定义的andotherscn + % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别 + + \DefineBibliographyStrings{english}{ + bibliography = {\str@bibliography}, + references = {\str@references}, + bytranslator= {\str@bytranslator},%\addperiod,%将trans. by 改成 译\addcomma\ + and = {\addcomma},%将第2和3人名间的and符号改成逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 + andcn = {\addcomma},%and本地化字符串的中文对应词 + andincitecn = {\addcomma},%将标注中的分开,便于与文献表中的区分 + andincite = {\addcomma}, + %andothers = {et al.},%将超过3个人名的省略,et al.改成为 等 + andotherscn = {\str@andotherscn},%将超过3个人名的省略,et al.改成为 等 + andothersincitecn={\str@andotherscn},%将标注中的分开,便于与文献表中的区分 + andothersincite={et al\adddot}, + backrefpage = {\str@backrefpage:}, + backrefpages = {\str@backrefpages:}, + in={in\intitlepunct}, + volumecn={\str@volumecn}, + numbercn={\str@numbercn}, + serialcn={\str@serialcn}, + andothersjp={他}, + andotherskr={외}, + andjp={和}, + andkr={和}, + incn={\str@incn\addcolon\addspace}, + mathesiscn={\str@mathesiscn}, + phdthesiscn={\str@phdthesiscn}, + editorscn={\str@editorcn}, + editorcn={\str@editorcn}, +} + + % + % 增加两个命令用于临时的局部的修改本地化字符串 + % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串 + % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内 + % v1.0t,hzz,20190525 + \newcommand{\setlocalbibstring}[2]{% + \csdef{abx@sstr@#1}{#2}} + \newcommand{\setlocalbiblstring}[2]{% + \csdef{abx@lstr@#1}{#2}} + +%===================================================================== +% 动态数据修改 +%===================================================================== +% +% 各层次的数据映射和动态修改 +% +% 原理方法: +% 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中 +% 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性 +% 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个 +% 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次 +% 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。 +% 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符, +% 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息 +% +% 不同的文献类型使用相同的驱动输出可以有5种方法: +% 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型 +% 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型 +% 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型 +% 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名 +% 驱动别名定义本质上是做了驱动层映射 +% 5. 直接定义不同的类型的驱动,但驱动内容相同。 +% +% 关于数据映射和驱动使用的考虑如下: +% 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换 +% 2. 为减少代码量,尽量少做内容相同的不同类型驱动 +% 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名 +% 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type +% 可以在样式层映射做某些需要避免这种默认处置的转换 +% 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射 +% +% 文献类型和驱动考虑如下: +% 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article +% newpaper映射为article,并以note域做区分特殊处理 +% 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook +% standard映射为book或inbook,并以note域做区分特殊处理 +% collection和proceedings基本与book类似,因此做book驱动别名处理 +% incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理 +% 3. 专利类型有其特殊性,考虑patent类型 +% 4. 电子资源类型有其特殊性,考虑online类型 +% 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更新日期 +% 因此考虑用一种类型来输出,使用report类型 +% 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略, +% 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型 +% 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时, +% 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。 +% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述 +% 更多的信息,因此不存在网址时,独立做一个备选格式 +% 9. 出版项主要以如下方式处理: +% (a) location+institution+date 仅用于连续出版物 +% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report +% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型 +% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。 +% (e) 不输出,主要用于连续出版物析出的文献 +% 10. 日期以如下方式处理: +% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year +% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate +% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date +% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate + + +\DeclareSourcemap{ +\maps[datatype=bibtex]{% + \map{%当没有作者时将editor转成author + \pernottype{inbook}%因为in系列中editor可能用来表示bookauthor,所以排除 + \pernottype{inproceedings} + \pernottype{incollection} + \pernottype{periodical}%因为peridical直接使用editor,所以排除 + %注意notfield在低版本biblatex中没有 + %\step[notfield=author,final]%当author不存在,将editor复制给author + \step[fieldsource=editor,fieldtarget=author]%并删除editor + } + \map{%当没有作者时将translator转成author + \pernottype{inbook} + \pernottype{inproceedings} + \pernottype{incollection} + %\step[notfield=author,final]%当author不存在,将translator复制给author + \step[fieldsource=translator,fieldtarget=author]%并删除translator + } + \map{%让address和location同步,biblatex中address是location的别名 + %因此输出的时候只有location信息,但处理过程中是可以存在address的。 + %\step[notfield=address,final] + \step[fieldsource=location,final] + \step[fieldset=address,origfieldval] + } + \map{%让address和location同步 + %\step[notfield=location,final] + \step[fieldsource=address,final] + \step[fieldset=location,origfieldval] + } + \map{%处理在bib文件用mark标记文献类型标识符的情况 + \step[fieldsource=mark,final] + \step[fieldset=usera, origfieldval] + } + \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况 + \step[fieldsource=nameformat,match=lowercase,final] + \step[fieldset=namefmtid,fieldvalue={1}] + } + \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况 + \step[fieldsource=nameformat,match=givenahead,final] + \step[fieldset=namefmtid,fieldvalue={2}] + } + \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况 + \step[fieldsource=nameformat,match=familyahead,final] + \step[fieldset=namefmtid,fieldvalue={3}] + } + \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况 + \step[fieldsource=nameformat,match=pinyin,final] + \step[fieldset=namefmtid,fieldvalue={4}] + } + \map{%根据article确定文献类型标识符 + \pertype{article} + \step[fieldset=usera, fieldvalue={J}] + } + \map{%根据periodical确定文献类型标识符 + \pertype{periodical} + \step[fieldset=usera, fieldvalue={J}] + \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor + \step[fieldset=editor, origfieldval] + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符 + \pertype{newspaper} + \step[fieldset=usera, fieldvalue={N}] + \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断 + } + \map{%对应增加的一个数据库类型database确定文献类型标识符 + \pertype{database} + \step[fieldset=usera, fieldvalue={DB}] + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%对应增加的一个数据集类型dataset确定文献类型标识符 + \pertype{dataset} + \step[fieldset=usera, fieldvalue={DS}]% + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%对应增加的一个软件类型software确定文献类型标识符 + \pertype{software} + \step[fieldset=usera, fieldvalue={CP}] + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%对应增加的一个舆图类型map确定文献类型标识符 + \pertype{map} + \step[fieldset=usera, fieldvalue={CM}]% + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%对应增加的一个档案类型archive确定文献类型标识符 + \pertype{archive} + \step[fieldset=usera, fieldvalue={A}] + \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以 + %当misc类型带有网址时,直接将其转换为online类型 + \pertype{misc} + \step[fieldsource=url,final] + \step[typesource=misc,typetarget=online] + } + \map{%对应增加的一个备选类型misc确定文献类型标识符 + \pertype{misc} + \step[fieldset=usera, fieldvalue={Z}]% + } + \map{ + \pertype{book} + \pertype{inbook} + \step[fieldset=usera, fieldvalue={M}] + \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition + \step[fieldset=edition, origfieldval] + } + \map{%兼容老的standard类型,确定文献类型标识符 + \pertype{standard} + \step[fieldset=usera, fieldvalue={S}] + \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断 + } + \map{ + \pertype{patent} + \step[fieldset=usera, fieldvalue={P}] + } + \map{ + \pertype{inproceedings} + \pertype{conference}%兼容老的conference类型 + \step[fieldset=usera, fieldvalue={C}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{proceedings} + \step[fieldset=usera, fieldvalue={C}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{incollection} + \step[fieldset=usera, fieldvalue={G}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{collection} + \step[fieldset=usera, fieldvalue={G}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{report} + \pertype{techreport}%兼容老的techreport类型 + \step[fieldset=usera, fieldvalue={R}] + \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher + \step[fieldset=publisher, origfieldval] + } + \map{ + \pertype{thesis} + \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型 + \pertype{phdthesis} + \step[fieldset=usera, fieldvalue={D}] + \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + } + \map{ + \pertype{online} + \pertype{electronic}%兼容老的electronic类型 + \pertype{www}%兼容老的www类型 + \step[fieldset=usera, fieldvalue={EB}] + \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册 + \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 + \step[fieldset=institution, origfieldval] + } + \map{ + \pertype{manual} + \step[fieldset=usera, fieldvalue={A}] + \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version + \step[fieldset=version, origfieldval] + \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution + \step[fieldset=institution, origfieldval] + \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 + \step[fieldset=institution, origfieldval] + } + \map{ + \pertype{unpublished} + \step[fieldset=usera, fieldvalue={Z}] + } + \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 + \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] + }% + \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 + \step[fieldsource={editor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] + }% + \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 + \step[fieldsource={translator}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] + }% + \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 + \step[fieldsource={bookauthor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] + }% + \map{%处理一些用year表示date的情况 + %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。 + %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息 + \step[fieldsource=year] + \step[fieldset=date, origfieldval] + } + \map{%将entrykey放入keywords中用于后期使用 + \step[fieldsource=entrykey] + \step[fieldset=keywords, origfieldval] + } + \map{\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userd,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userd,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userd,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userd,fieldvalue={korean}]%韩语 + } + \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题 + \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]% + \step[fieldset=userd, fieldvalue={chinese}] + } + \map{%将没有设置userd,且存在title域的默认设置为英文 + \step[fieldsource=title,final] + \step[fieldset=userd,fieldvalue={english}] + } + \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userf,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=author,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userf,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=author,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userf,fieldvalue={korean}]%韩语 + } + \map{%作者的中文判断 + \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] + \step[fieldset=userf, fieldvalue={chinese}] + } + \map{%将没有设置userf,且存在author域的默认设置为英文 + \step[fieldsource=author,final] + \step[fieldset=userf,fieldvalue={english}] + } + \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=usere,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=translator,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=usere,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=translator,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=usere,fieldvalue={korean}]%韩语 + } + \map{%译者的中文判断 + \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] + \step[fieldset=usere, fieldvalue={chinese}] + } + \map{%将没有设置usere,且存在translator域的默认设置为英文 + \step[fieldsource=translator,final] + \step[fieldset=usere,fieldvalue={english}] + } + \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userc,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userc,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userc,fieldvalue={korean}]%韩语 + } + \map{%编者的中文判断 + \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 + \step[fieldset=userc, fieldvalue={chinese}] + } + \map{%将没有设置userc,且存在editor域的默认设置为英文 + \step[fieldsource=editor,final] + \step[fieldset=userc,fieldvalue={english}] + } + \map{\step[fieldsource=bookauthor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userb,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 + } + \map{% + \step[fieldsource=bookauthor,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userb,fieldvalue={russian}]%俄语 + } + \map{% + \step[fieldsource=bookauthor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userb,fieldvalue={japanese}]%日语 + } %确定形式后可增加类似andotherscn这样的本地化字符串处理 + \map{% + \step[fieldsource=bookauthor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userb,fieldvalue={korean}]%韩语 + } + \map{%编者的中文判断 + \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 + \step[fieldset=userb, fieldvalue={chinese}] + } + \map{%将没有设置userc,且存在editor域的默认设置为英文 + \step[fieldsource=bookauthor,final] + \step[fieldset=userb,fieldvalue={english}] + } + \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language + \step[fieldset=language,origfieldval]%本身language存在则不设定 + } + \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language + \step[fieldset=language,origfieldval] + }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。 + \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。 + \step[fieldset=language,fieldvalue={english}] + } + \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断, + %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况, + %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd + \step[fieldsource=language] + \step[fieldset=userd,origfieldval] + } + \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言 + %biblatex 3.11及以下版本仅有match是区分大小写的,而3.12版开始用matchi来区分大小,而match不区分 + %这里为兼容3.11及以下版本,所以用一个复杂一点的正则表达式 + \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final] + \step[fieldset=langid,fieldvalue={english}] + \step[fieldset=lansortorder,fieldvalue=\lanenorder] + } + \map{ + \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final] + \step[fieldset=langid,fieldvalue={russian}] + \step[fieldset=lansortorder,fieldvalue=\lanruorder] + } + \map{% + \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final] + \step[fieldset=langid,fieldvalue={french}] + \step[fieldset=lansortorder,fieldvalue=\lanfrorder] + } + \map{% + \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + \step[fieldset=lansortorder,fieldvalue=\lancnorder] + } + \map{% + \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + \step[fieldset=lansortorder,fieldvalue=\lanjporder] + } + \map{% + \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + \step[fieldset=lansortorder,fieldvalue=\lankrorder] + } +} +} + + +% +% 修改输入的参考文献数据,样式层的操作 +% + \DeclareStyleSourcemap{ + \maps[datatype=bibtex]{ + \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook, + %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 + %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断 + \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook + \step[typesource=standard, typetarget=inbook, final] + } + \map{%剩下的全部映射为book + \step[typesource=standard, typetarget=book, final] + } +% \map{%先于标准样式的driver层映射,以取消type设置 +% \step[typesource=mastersthesis, typetarget=thesis, final] +% %\step[fieldset=type, fieldvalue=mathesis] +% } +% \map{%先于标准样式的driver层映射,以取消type设置 +% \step[typesource=phdthesis, typetarget=thesis, final] +% %\step[fieldset=type, fieldvalue=phdthesis] +% } + \map{%先于标准样式的driver层映射,以取消type设置 + \step[typesource=techreport, typetarget=report, final] + %\step[fieldset=type, fieldvalue=techreport] + } + \map{% + \pertype{report} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=report,typetarget=online] + \step[fieldset=note,fieldvalue={report}] + } + \map{% + \pertype{thesis} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=thesis,typetarget=online] + } + \map{% + \pertype{manual} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=manual,typetarget=online] + } + \map{% + \pertype{unpublished} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=unpublished,typetarget=online] + } + \map{% + \pertype{database} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=databasetypetarget=online] + } + \map{% + \pertype{dataset} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=dataset,typetarget=online] + } + \map{% + \pertype{software} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=software,typetarget=online] + } + \map{% + \pertype{map} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=map,typetarget=online] + } + \map{% + \pertype{archive} + %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 + \step[fieldset=location,fieldvalue={}] + \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online + %3.7以上版本用notfield + %\step[notfield=address,final]%当address不存在则继续 + \step[fieldsource=url,final]%地址不存在且存在url那么转变为online + \step[typesource=archive,typetarget=online] + } + \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确) + \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 + \step[fieldset=keywords, fieldvalue={,}, append] + \step[fieldset=keywords, origfieldval, append] + } + \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ + \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] + } + \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ + \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] + } + \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,% + address,location,institution,organization}]{ + \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] + } + } + } + +% +% 佚名/noauthor的处理 +% +% 原理方法:利用样式层的动态数据修改实现 +\def\dealnoathor{ + \DeclareStyleSourcemap{ + \maps[datatype=bibtex]{ + \map{%默认情况下将空缺作者的中文文献设置为佚名 + \step[fieldsource=language,match={chinese},final] + \step[fieldset=author, fieldvalue={佚名}] + } + \map{%默认情况下将空缺作者的英文文献设置为A{non} + \step[fieldsource=language,match={english},final] + \step[fieldset=author, fieldvalue={A{non}}]%noauthor换成Anon,同时为避免大写还加了{} + } + } + } +} + +% +% 不同语言分集调整的实现方式 +% +% 原理方法:利用样式层的动态数据修改lansortorder域来实现排序 +\def\dealsortlan{ + \DeclareStyleSourcemap{ + \maps[datatype=bibtex]{ + \map[overwrite]{%当文献给出language域时,设置文献要使用的本地化字符串的语言 + \step[fieldsource=language,match=english,final] + \step[fieldset=lansortorder,fieldvalue=\lanenorder] + } + \map[overwrite]{ + \step[fieldsource=language,match=russian,final] + \step[fieldset=lansortorder,fieldvalue=\lanruorder] + } + \map[overwrite]{% + \step[fieldsource=language,match=french,final] + \step[fieldset=lansortorder,fieldvalue=\lanfrorder] + } + \map[overwrite]{% + \step[fieldsource=language,match=chinese,final]%中日韩语目前都用english, + \step[fieldset=lansortorder,fieldvalue=\lancnorder] + } + \map[overwrite]{% + \step[fieldsource=language,match=japanese,final]%中日韩语目前都用english, + \step[fieldset=lansortorder,fieldvalue=\lanjporder] + } + \map[overwrite]{% + \step[fieldsource=language,match=korean,final]%中日韩语目前都用english, + \step[fieldset=lansortorder,fieldvalue=\lankrorder] + } + } + } +} + + + + +% +%驱动别名等价于驱动层映射 +% +\DeclareBibliographyAlias{newspaper}{article}% +\DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动 +\DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动 +\DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动 +\DeclareBibliographyAlias{collection}{book}%%文集类型驱动 +\DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动 +\DeclareBibliographyAlias{thesis}{manual}%学位论文驱动 +\DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动 +\DeclareBibliographyAlias{database}{manual} +\DeclareBibliographyAlias{dataset}{manual} +\DeclareBibliographyAlias{software}{manual} +\DeclareBibliographyAlias{map}{manual} +\DeclareBibliographyAlias{archive}{manual} + + +%===================================================================== +% 设置排序格式 +%===================================================================== +% +% 排序格式,用降序,及userb域,针对biblatex3.8及以上版本 +% +\DeclareSortingTemplate{gb7714-2015}{ + \sort{ + \field{presort} + } + %\sort[final]{ + %\field{sortkey} + %} + \sort{ + \field{lansortorder}%language + } + \sort{ + \field{sortkey} + } + \sort{%[direction=descending] + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sortyear} + \field{year} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field{volume} + \literal{0} + } + } + + %降序的nyt + \DeclareSortingTemplate{gbnytd}{ + \sort{ + \field{presort} + } +% \sort[final]{ +% \field{sortkey} +% } + \sort{ + \field{lansortorder}%language + } + \sort[direction=descending]{ + \field{sortkey} + } + \sort[direction=descending]{% + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sortyear} + \field{year} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field{volume} + \literal{0} + } + } + + %降序的ynt + \DeclareSortingTemplate{gbyntd}{ + \sort{ + \field{presort} + } +% \sort[final]{ +% \field{sortkey} +% } + \sort{ + \field{lansortorder}%language + } + \sort[direction=descending]{ + \field{sortyear} + \field{year} + } + \sort{ + \field{sortkey} + } + \sort{% + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field{volume} + \literal{0} + } + } + + %升序的ynt + \DeclareSortingTemplate{gbynta}{ + \sort{ + \field{presort} + } +% \sort[final]{ +% \field{sortkey} +% } + \sort{ + \field{lansortorder}%language + } + \sort{%[direction=ascending] + \field{sortyear} + \field{year} + } + \sort{ + \field{sortkey} + } + \sort{% + \field{sortname} + \field{author} + \field{editor} + \field{translator} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field{volume} + \literal{0} + } + } + +%===================================================================== +% 参考文献表环境 +%===================================================================== +% +% 列表格式 +% +% 增加一个\bibitemindent尺寸用于控制list环境的itemindent +% v1.0l,20180615,hzz +% v1.0t,20200319,hzz,增加尺寸\biblabelextend使某些字体下标签宽度不足时可增加标签宽度 +\setlength{\bibhang}{\biblabelsep}% +\newlength{\bibitemindent} +\setlength{\bibitemindent}{0pt} +\newlength{\biblabelextend} +\setlength{\biblabelextend}{0pt} + + +\defbibenvironment{bibliography} + {\list + {\printtext[labelnumberwidth]{% + \printfield{labelprefix}% + \printfield{labelnumber}}} + {\addtolength{\labelnumberwidth}{\biblabelextend}% + \setlength{\labelwidth}{\labelnumberwidth}% + \setlength{\labelsep}{\biblabelsep}% + \setlength{\leftmargin}{\bibhang}% + \addtolength{\leftmargin}{\labelnumberwidth}% + \setlength{\itemindent}{\bibitemindent}% + \setlength{\itemsep}{\bibitemsep}% + \setlength{\parsep}{\bibparsep}}% + \renewcommand*{\makelabel}[1]{\hss##1}} + {\endlist} + {\item} + +% +% 顺序编码制-标签对齐方式处理 +% +% 原理方法:利用选项提供的计数器数值做选择 +% 左对齐,右对齐为list环境下的处理,此时list环境的\labelwidth只能设置一个,是最宽标签的宽度 +% 项对齐则是在段落环境下做的处理。 +% 左对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距可变 +% 右对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距相等,标签与页边距离可变 +% 项对齐时,序号标签贴在页边,序号标签与参考文献项内容的间距相等 +% 修改序号标签格式为: +% \DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} %源来自numeric.BBX +% \DeclareFieldFormat{labelnumberwidth}{\ttfamily\mkbibbrackets{#1}\hfill} +\DeclareFieldFormat{labelnumberwidth}{% +\ifcase\value{gbalignlabel}%右对齐,整个标签为右对齐 + \mkgbnumlabel{#1}% +\or%左对齐,整个标签为左对齐 + \mkgbnumlabel{#1}\hfill% +\or%中间对齐,比如:序号数字居于[]中间 + \hfil\mkgbnumlabel{\hfill#1\hfill}\hfil% +\fi} + +% +% 修改序号标签格式为以各条参文献为基础进行对齐的方式,即序号与条目内容间隔相等的方式。 +\def\setaligngbstyle{% +\def\blx@bibitem##1{% + \blx@ifdata{##1} + {\begingroup + \blx@getdata{##1}% + \blx@bibcheck + \iftoggle{blx@skipentry}{}{% + \blx@setdefaultrefcontext{##1}% + \global\let\blx@noitem\@empty + \blx@setoptions@type\abx@field@entrytype + \blx@setoptions@entry + \blx@thelabelnumber + \addtocounter{instcount}\@ne + \blx@initsep + \blx@namesep + \csuse{blx@item@\blx@theenv}\relax +% \blx@initsep %移动到上面去,恢复bibnamesep等的作用机制 +% \blx@namesep + \csuse{blx@hook@bibitem}% + \blx@execute + \blx@initunit + \blx@anchor + \blx@beglangbib + \bibsentence + \blx@pagetracker + \blx@driver\abx@field@entrytype + \blx@postpunct + \blx@endlangbib}% + \par\endgroup}%这里增加了一个\par + {}} +\newlength{\lengthid} +\newlength{\lengthlw} +\newcommand{\itemcmd}{% +\settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}} +\addtolength{\lengthid}{\biblabelsep} +\setlength{\lengthlw}{\textwidth} +\addtolength{\lengthlw}{-\lengthid} +\addvspace{\bibitemsep}%恢复\bibitemsep的作用 +%\parshape 2 0em \textwidth \lengthid \lengthlw +\hangindent\lengthid +\mkgbnumlabel{\printfield{labelnumber}}% +\hspace{\biblabelsep}} +% +% 简单的段落环境 +\defbibenvironment{bibliography} +{\begingroup\setlength{\parindent}{0em}} +{\endgroup} +{\itemcmd}} + + +%===================================================================== +% 设置单元或块等的标点 +%===================================================================== +\renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin +\renewcommand*{\subtitlepunct}{\addcolon\addspace} %修改标题和其它标题信息间的标点,来源biblatex.def, +% +% 利用set实现的多语言文献不同语言间的分隔符 +% 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进 +% +% 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets +% 这里调整一下两种语言参考文献的间隔,源来自biblatex.def +\renewcommand*{\entrysetpunct}{\adddot\newline\nobreak} +\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号 +%\renewcommand{\relateddelim}{}%\par + +%===================================================================== +% 修改域的格式,重定义域的输出宏 +%===================================================================== +% +% 新增文献类型标识符的格式 +% []前的nobreak,从GB4.1节的例子看不应该加,所以去掉 +% 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上 +% 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉 +% +\DeclareFieldFormat{gbtypeflag}{% +\iftoggle{bbx:gbmedium}% +{\iftoggle{bbx:url}% + {\iffieldundef{url}%当存在url时,增加一个OL标识符 + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% + }% + {\ifentrytype{online}% + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% + }}% + {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% +} + +% +% 新增用于报纸的文献类型标识符的格式 +% +\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper +\iftoggle{bbx:gbmedium}% +{\iftoggle{bbx:url}% + {\iffieldundef{url}%当存在url时,增加一个OL标识符 + {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% + {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% + }% + {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% +}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}% +} + +% +% 新增用于标准的文献类型标识符的格式 +% +\DeclareFieldFormat{gbtypeflags}{%用于标准standard +\iftoggle{bbx:gbmedium}% +{\iftoggle{bbx:url}% + {\iffieldundef{url}%当存在url时,增加一个OL标识符 + {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% + {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% + }% + {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% +}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}% +} + +% +% 重设title等参考文献信息的输出格式 +% +% 原理方法:修改来自biblatex.def文件的原格式 +\newcommand{\bibtitlefont}{} +\newcommand{\bibauthorfont}{} +\newcommand{\bibpubfont}{} + +\DeclareFieldFormat{title}{#1\adddot\addthinspace} +\DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪 +\DeclareFieldFormat{issuetitle}{#1} +\DeclareFieldFormat{maintitle}{#1} +\DeclareFieldFormat{booktitle}{#1} +\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 + [article,patent,thesis,unpublished] + {title}{#1\adddot\addthinspace}%\mkbibquote{#1\isdot} +\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 + [inbook,incollection,inproceedings] + {title}{#1}%\nopunct\unspace +\DeclareFieldFormat{url}{\url{#1}} %%url相关输出,url域修改如本行,源来自biblatex.def +\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily +%\urlstyle{rm} %使用这句也一样 +\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行 +\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行 +\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行 +\DeclareFieldFormat{doi}{% + \rmfamily{DOI}\addcolon\space + \ifhyperref + {\href{https://doi.org/#1}{\nolinkurl{#1}}} + {\nolinkurl{#1}}} +% +% 标题的字母大小写格式修改 +% +% 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase +% 因为titlecase is applied to the contents of the field directly,title is not +%\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写 +\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{% +\iffieldundef{url}{\MakeCapital#1}{% +\href{\thefield{url}}{#1}}}{\MakeCapital#1}}%重设标题格式,将其修改为首字母大写 +\DeclareFieldFormat{pages}{#1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{#1} +\DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线 +\DefineBibliographyExtras{russian}{\renewcommand*{\bibrangedash}{-}} + +\def\execgbfdfmtstd{%恢复到标准样式的设置 +\DeclareFieldFormat{title}{\mkbibemph{##1}} +\DeclareFieldFormat + [article,inbook,incollection,inproceedings,patent,thesis,unpublished] + {title}{\mkbibquote{##1\isdot}} +\DeclareFieldFormat + [suppbook,suppcollection,suppperiodical] + {title}{##1} +\DeclareFieldFormat{journaltitle}{\mkbibemph{##1}} +\DeclareFieldFormat{issuetitle}{\mkbibemph{##1}} +\DeclareFieldFormat{maintitle}{\mkbibemph{##1}} +\DeclareFieldFormat{booktitle}{\mkbibemph{##1}} +\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{##1}} +\DeclareFieldFormat{titlecase}{##1} +\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{##1}} +} + +% +% 文献标题后的标点问题 +% v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen +% +% 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况: +% texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于 +% 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响 +% 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct + {%texlive 2017对应iftlseven以上版本 + \@ifclassloaded{beamer}{ + \DeclareFieldFormat{title}{#1}% + \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1} + \AtBeginDocument{% + \patchcmd{\abx@macro@title}{\newunitpunct}{}{}{}}}{} + } + + +% +% 修改译者位置格式 +% +% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式 +\renewbibmacro*{bytranslator+others}{% + \ifnameundef{translator} + {} + {%\usebibmacro{bytranslator+othersstrg} + %\setunit{\addspace}% + \printnames[bytranslator]{translator}% + \clearname{translator}% + %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理 + %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串 + \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。 + %\setunit{\addspace}% + \newunit}% + \usebibmacro{withothers}} + + +% +% 修改作者数量超过限定值,做省略时的处理格式 +% v1.0,20160701,hzz +% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim +% +% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。 +% \printnames由start-stop控制项数,默认是1和maxnames/minnames +\renewbibmacro*{name:andothers}{% + \ifboolexpr{ + test {\ifnumequal{\value{listcount}}{\value{liststop}}} + and + test \ifmorenames + }{\ifnumgreater{\value{liststop}}{1}%注意这里试图去区分姓名总数大于1的情况,当姓名总数大于1时,最后一个姓名后面先加入一个\finalandcomma + {\finalandcomma}%目前国标没有这样的区分要求,如果有需要也是可以这么去做的。 + {}% +\printdelim{andothersdelim}\printdelim{strandothersdelim}% +}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如: +%袁训来, 陈哲, 肖书海, 等. +%胡泳, 范海燕, 译. +%潘惠霞, 魏婧, 杨艳, 等译. +\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理 +}} + + +% +% 修改省略作者后的本地化字符串,比如et al. +% v1.0o,20190103,hzz +% +% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。 +% 非默认情况,根据选项信息,选择选择强制中文或英文 +% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 +% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 +\DeclareDelimFormat{strandothersdelim}{% + \edef\userfieldabcde{userd}%这里使用\iffieldequalstr{labelnamesource}替代ifcurrentname因为标注中使用ifcurrentname无效 + \iffieldequalstr{labelnamesource}{translator}{\edef\userfieldabcde{usere}}{}% + \iffieldequalstr{labelnamesource}{editor}{\edef\userfieldabcde{userc}}{}% + \iffieldequalstr{labelnamesource}{author}{\edef\userfieldabcde{userf}}{}% + \iffieldequalstr{labelnamesource}{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbcitelocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\ifbibstring{andothersincitecn}{\bibstring{andothersincitecn}}{\bibstring{andothers}}}{}%中文已经通过english本地化字符串定义 + \iffieldequalstr{\userfieldabcde}{korean}{\ifbibstring{andotherskr}{\bibstring{andotherskr}}{\bibstring{andothers}}}{}%韩语未定义,所以与bib中一致 + \iffieldequalstr{\userfieldabcde}{japanese}{\ifbibstring{andothersjp}{\bibstring{andothersjp}}{\bibstring{andothers}}}{}%日与同韩语 + \iffieldequalstr{\userfieldabcde}{english}{\ifbibstring{andothersincite}{\bibstring{andothersincite}}{\bibstring{andothers}}}{}%英语已定义 + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%法语未定义,若要定义需要针对french本地化字符串定义 + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%俄语未定义,若要定义需要针对russian本地化字符串定义 + \or% + \bibstring{andothersincitecn}% + \or% + \bibstring{andothersincite}% + \fi} + + +\DeclareDelimFormat[bib,biblist]{strandothersdelim}{% + \edef\userfieldabcde{userd}% + \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}% + \or% + \bibstring{andotherscn}% + \or% + \bibstring{andothers}% + \fi} + +% +% 修改最后一个作者前的字符串,比如 and +% v1.0o,20190103,hzz +% +% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。 +% 非默认情况,根据选项信息,选择选择强制中文或英文 +% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 +% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 +\DeclareDelimFormat{finalnamedelim}{% + \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% + \addspace% + \edef\userfieldabcde{userd}% + \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbcitelocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andincite}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% +\space% + \or% + \bibstring{andincitecn}\space% + \or% + \bibstring{andincite}\space% + \fi} + +\DeclareDelimFormat[bib,biblist]{finalnamedelim}{% + \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% + \addspace% + \edef\userfieldabcde{userd}% + \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% +\space% + \or% + \bibstring{andcn}\space% + \or% + \bibstring{and}\space% + \fi} + + +% +% 重设title的输出 +% +% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen +% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件 +% 利用toggle做标识符是否输出的判断 +\renewbibmacro*{title}{% + \ifboolexpr{% + test{\iffieldundef{title}}% + and + test{\iffieldundef{subtitle}}% + }% + {}% + {\printtext[title]{\bibtitlefont%增加字体控制命令 + \printfield[titlecase]{title}% + \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 + {}{\setunit{\subtitlepunct}% + \printfield[titlecase]{subtitle}}% + \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 + {\setunit{\subtitlepunct}\printfield{titleaddon}}% + \iftoggle{bbx:gbtype}{% + \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 + {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 + {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 + {\printfield[gbtypeflag]{usera}}}%其它 + }}{}% + %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 + %\newunit +}% +}} + +% +% 作者信息的输出格式 +% +% 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen +% 20180603,v1.0l,增加使用nameformat域来选择姓名格式 +\DeclareNameFormat{namefmtselected}{% +\iffieldundef{namefmtid}{}% +{\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}% +\ifcase\value{gbnamefmtcase}% + \ifgiveninits + {\usebibmacro{name:gbuppercase} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:gbuppercase} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% +\or + \ifgiveninits + {\usebibmacro{name:gblowercase} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:gblowercase} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% +\or + \ifgiveninits + {\usebibmacro{name:given-family} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:given-family} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% +\or + \ifgiveninits + {\usebibmacro{name:family-given} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:family-given} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% +\or +\usebibmacro{name:gbpinyin} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}% +\or + \ifnumequal{\value{listcount}}{1} + {\ifgiveninits + {\usebibmacro{name:family-given} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:family-given} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}% + \ifboolexpe{% + test {\ifdefvoid\namepartgiven} + and + test {\ifdefvoid\namepartprefix}} + {} + {\usebibmacro{name:revsdelim}}} + {\ifgiveninits + {\usebibmacro{name:given-family} + {\namepartfamily} + {\namepartgiveni} + {\namepartprefix} + {\namepartsuffix}} + {\usebibmacro{name:given-family} + {\namepartfamily} + {\namepartgiven} + {\namepartprefix} + {\namepartsuffix}}}% +\fi + \usebibmacro{name:andothers}} + +\DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式 +\DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family +\DeclareNameAlias{citename}{default}% Default used by \citename + +\DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace} +%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% + +%GB/T 7714-2015 风格,全部大写 +\newbibmacro*{name:gbuppercase}[4]{\bibauthorfont% +\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 +\renewcommand*{\revsdnamepunct}{}% + \ifuseprefix% + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifdefvoid{#3}{}{% + \ifcapital% + {\mkbibnameprefix{\MakeCapital{#3}}\isdot}% + {\mkbibnameprefix{#3}\isdot}% + \ifprefchar{}{\bibnamedelimc}}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% + \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital + \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号 + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% + \ifboolexpe{% + test {\ifdefvoid{#2}} + and + test {\ifdefvoid{#3}}} + {}{\revsdnamepunct}% + \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital + \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% + \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号 +} + +%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 +\newbibmacro*{name:gblowercase}[4]{\bibauthorfont% + \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 + \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def + \ifuseprefix + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifdefvoid{#3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{#3}}\isdot} + {\mkbibnameprefix{#3}\isdot}% + \ifprefchar{}{\bibnamedelimc}}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% + \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital + \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号 + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% + \ifboolexpe{% + test {\ifdefvoid{#2}} + and + test {\ifdefvoid{#3}}} + {}{\revsdnamepunct}% + \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital + \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} + \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号 +} + +%中文常见风格,汉语拼音全拼模式 +\newbibmacro*{name:gbpinyin}[4]{\bibauthorfont% +\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY +\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def +\renewrobustcmd*{\bibnamedelima}{\mbox{-}}% + \ifuseprefix + {\usebibmacro{name:delim}{#3#1}% + \usebibmacro{name:hook}{#3#1}% + \ifdefvoid{#3}{}{% + \ifcapital + {\mkbibnameprefix{\MakeCapital{#3}}\isdot} + {\mkbibnameprefix{#3}\isdot}% + \ifprefchar{}{\bibnamedelimc}}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% + \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamegiven{#2}}\isdot}%\MakeCapital + \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}} + {\usebibmacro{name:delim}{#1}% + \usebibmacro{name:hook}{#1}% + \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% + \ifboolexpe{% + test {\ifdefvoid{#2}} + and + test {\ifdefvoid{#3}}} + {} + {\revsdnamepunct}% + \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital + \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} + \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% +} + + +% +% url和url日期格式 +% +\renewbibmacro*{url+urldate}{% + %\usebibmacro{url}%%更换url的位置,放到下面 + \iffieldundef{urlyear}% + {}{%\setunit*{\addspace}% + \usebibmacro{urldate}}% + \setunit{\addperiod\addspace}% + \usebibmacro{url}} +\renewbibmacro*{url}{\printfield{url}} + + +% +% 日期信息的输出格式,针对biblatex>=3.10版本 +% + \DeclareFieldFormat{urldate}{#1} + \renewbibmacro*{urldate}{% + \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 + + % + % 专利的公告日期、或报纸的日期的输出宏 + % 20160701,v1.0,新增加 + % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen + % + % 原理方法:加上printtext避免破坏异步标点机制 + % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份 + % 所以无法再用选项设置的方法,印象需要用底层的命令 + % 这里可以用\blx@isodate,但用\blx@gbdate试图避免版本判断 + \newbibmacro*{newsdate}{%% + \printtext{\blx@gbdate{}{}}%%\blx@isodate{}{}% + } + + % + \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 + \ifboolexpr{% + test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% + }% + {}%更新或修改日期通常有day信息 + {\iffieldundef{year}{% + \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% + {\printtext{(}\printenddate\printtext{)}}% + }{\iffieldequalstr{year}{}{%因为year存在,但为空 + }{\printtext{(}\blx@gbdate{}{}\printtext{)}}% + }% + }}% + + +% +% biblatex>v3.8版利用related实现双语文献的处理 +% + %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了, + %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息 + %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中 + \newcommand{\defdoublelangentry}[2]{% + \edef\entrykeya{##1} + \edef\entrykeyb{##2} + \DeclareStyleSourcemap{ + \maps[datatype=bibtex]{ + \map{ + \step[fieldsource=entrykey, match=\entrykeya, final] + \step[fieldset=related, fieldvalue=\entrykeyb] + } + } + } + } + +% +% 关联文献间的分隔符 +% +\renewcommand{\relateddelim}{\adddot\newline\nobreak}%\par,而作者年样式不需要修改,因为没有项对齐的标签问题 + +% +% 关联文献块前的分隔符,针对biblatex>=3.11 +% +% 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏 +\renewcommand{\begrelateddelim}{\adddot\newline\nobreak} + + +% +% 调整doi+eprint+url格式 +% +% 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。 +\renewbibmacro*{doi+eprint+url}{% +% \iftoggle{bbx:doi}%把doi的位置放到url后面 +% {\printfield{doi}} +% {}% + %\newunit\newblock + \iftoggle{bbx:eprint} + {\iffieldundef{eprint}{}{\newunit\usebibmacro{eprint}}} + {}% + %\newunit\newblock + \iftoggle{bbx:url} + {\usebibmacro{url+urldate}} + {} + \newunit\newblock + \iftoggle{bbx:doi} + {\printfield{doi}} + {}} + +% +% 调整页码的格式,即chapter+pages格式 +% +\renewbibmacro*{chapter+pages}{% +\iftoggle{bbx:gbstrict}{}{% + \printfield{chapter}}% + \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出 + \setunit{\bibpagespunct}% + \printfield{pages}}% + %\newunit %这里的标点去掉 +} + +% +% 当location等出版项超过maxitem缩减后不再输出etal +% +\DeclareListFormat{location}{% + \usebibmacro{list:delim}{#1}% + #1\isdot} +\DeclareListAlias{institution}{location} +\DeclareListAlias{publisher}{location} + +% 新增一个样式用于输出连续出版物的地址,单位,时间, +% 用于periodical连续出版物的出版社和地址的处理 +% +% v1.0k,20180425,为出版信息增加字体控制命令,hzz +% %类似\newbibmacro*{publisher+location+date} +\newbibmacro*{location+institution+date}{\bibpubfont% +\iftoggle{bbx:gbpub}% +{\testCJKfirst{userd}% +\ifboolexpr{% +test {\iflistundef{location}} and test {\iflistundef{institution}}% +}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}% +{\printtext{[S.l.\space :\space s.n.\adddot]}}% +}{% +\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}% + {\printlist{location}}% +\addcolon\addspace% +\iflistundef{institution}{% +\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}% +{\printlist{institution}}}% +\setunit{\addcomma\addspace}% + %\usebibmacro{date}% + \printfield{year}% + \bibrangedash% + \iffieldundef{endyear}{}{\printfield{endyear}}% + \newunit}% +{\printlist{location}% + \iflistundef{institution}% + {\setunit*{\addcomma\space}} + {\setunit*{\addcolon\space}}% + \printlist{institution}% + \setunit*{\addcomma\space}% + \usebibmacro{date}% + \newunit}% +} +% +% 通用的出版社和地址的处理 +% +% 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。 +% 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。 +% 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理 +\renewbibmacro*{publisher+location+date}{\bibpubfont% +\iftoggle{bbx:gbpub}% +{\testCJKfirst{userd}% + \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }% + {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}% + {\iflistundef{location}{%\adddot + \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 + {\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress} + {\printlist{location}\addcolon\addspace}%%\addcolon\addspace% + \iflistundef{publisher}{% + \iffieldequalstr{note}{standard}{}% + {\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}% + {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}% + {\printlist{publisher}}}% +\setunit*{\addcomma\addspace}%\addcomma\addspace% +\usebibmacro{date}%%\newunit %去掉这个标点 +}% +{\printlist{location}% + \iflistundef{publisher} + {\setunit*{\addcomma\space}} + {\setunit*{\addcolon\space}}% + \printlist{publisher}% + \setunit*{\addcomma\space}% + \usebibmacro{date}%%\newunit + }% +} + +% +% 修改了一个institution+location+date用于manual、report、thesis等类型 +% +% 20180425,v1.0k,增加了字体控制命令,hzz +% 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉 +\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。 +{\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉 + \iflistundef{institution} + {\setunit*{\addcomma\space}} + {\setunit*{\addcolon\space}}% + \printlist{institution}% + \setunit*{\addcomma\space}% + \usebibmacro{date}% + %\newunit + }} + +% +% 对volume卷信息格式做出修改 +% v1.0o,20190105,hzz +% +\DeclareFieldFormat{volume}{% +\testCJKfirst{userd}% +\iftoggle{ifCJKforgbt}% +{\bibstring{serialcn}#1\bibstring{volumecn}}% +{\bibstring{volume}~#1}% +}% volume of a book +\DeclareFieldFormat[article,periodical]{volume}{#1}% volume of a journal + +% +% 对number册信息格式做出修改 +% v1.0o,20190105,hzz +% +\DeclareFieldFormat{number}{#1}% +\DeclareFieldFormat[book,collection,inbook,% +incollection,proceedings,inproceedings]{number}{% +\testCJKfirst{userd}% +\iftoggle{ifCJKforgbt}% +{\bibstring{serialcn}#1\bibstring{numbercn}}% +{#1}% +}% + +% +% 对edition版本信息格式做出修改 +% +\DeclareFieldFormat{edition}{%源来自biblatex.DEF +\testCJKfirst{userd}% +\iftoggle{ifCJKforgbt}% +{\ifinteger{#1}% +{\printtext{#1\str@edition}}% +{#1\isdot}}% +{\ifinteger{#1}% +{\mkbibordedition{#1}~\bibstring{edition}}% +{#1\isdot}}} + +% +% 对version的版本信息做出修改 +% +\DeclareFieldFormat{version}{%源来自biblatex.DEF +\testCJKfirst{userd}% +\ifinteger{#1}% +{\iftoggle{ifCJKforgbt}{\printtext{#1\str@edition}}% +{\mkbibordedition{#1}~\bibstring{version}}}% +{#1\isdot}} + +% +% 修改析出文献的文集的标题与附加标题间的符号 +% +\renewbibmacro*{booktitle}{% + \ifboolexpr{ + test {\iffieldundef{booktitle}} + and + test {\iffieldundef{booksubtitle}} + } + {} + {\printtext[booktitle]{\bibtitlefont% + \printfield[titlecase]{booktitle}% + \setunit{\subtitlepunct}% + \printfield[titlecase]{booksubtitle}}% + \newunit%标点换成下一句 + \setunit{\subtitlepunct}}% + \printfield{booktitleaddon}} + + +% +% 调整期刊名的格式 +% +% v1.0k,20180425,增加了字体控制命令,hzz +\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx + \usebibmacro{journal}% + %\setunit*{\addspace}% + \setunit*{\addcomma\addspace}%修改为增加一个逗号 + \iffieldundef{series} + {} + {\newunit + \printfield{series}% + \setunit{\addspace}}% + %\usebibmacro{volume+number+eid}% + %\setunit{\addspace}% + \usebibmacro{issue+date}% + %\setunit{\addcolon\space}% + \iffieldundef{volume}{}{\setunit{\addcomma\space}}% + %换成逗号和空格 + \usebibmacro{issue}% + \usebibmacro{volume+number+eid}%把卷期放到年份后面 + %\newunit + } + + + +% +% 调整期刊卷和期的格式 +% +\renewbibmacro*{volume+number+eid}{%源来自standard.bbx +\iftoggle{bbx:gbfieldstd}{% + \printfield{volume}% + \setunit*{\adddot}% + \printfield{number}% + \setunit{\addcomma\space}% + \printfield{eid}}{% + \printfield{volume}% + %\setunit*{\adddot}%去掉点号 + %\printfield{number}% + \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号 + \iffieldundef{eid}{}{% + \setunit{\addcomma\space}% + \printfield{eid}}}} + +% +% 调整期刊年份的格式 +% +\renewbibmacro*{issue+date}{%去掉括号 + \printtext{%去掉了[parens] + \iffieldundef{issue} + {%\usebibmacro{date} + \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 + {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 + {\usebibmacro{date}}% + }}% + {\iftoggle{bbx:gbstrict}{}{\printfield{issue}% + \setunit*{\addspace}}% + %\usebibmacro{date} + \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 + {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 + {\usebibmacro{date}}% + }}}% + %\newunit + } + +% +% 调整页码前的标点和去掉期刊文章等页码后面的标点 +% +\renewbibmacro*{note+pages}{%源来自standard.bbx + %\printfield{note}%不要note,note用来判断是否是报纸newspaper + \iffieldundef{pages}{}{ + \setunit{\bibpagespunct}% + \printfield{pages}}% + %\newunit + } + + +% +% 编者的符号修改一下 +% v1.0 2016-07-01 +% v1.0q 2019-03-01 hzz 修改editortype前的标点 +% +\renewbibmacro*{editor}{%源来自biblatex.DEF + \ifboolexpr{ + test \ifuseeditor + and + not test {\ifnameundef{editor}} + } + {\printnames{editor}% + \iffieldundef{editortype}%增加一个类型判断,用于存在editortype的情况 + {\setunit\addspace}%当没有editortype时,直接用句点 + {%\setunit{\addcomma\space}% + \usebibmacro{editorstrg}}% + %\clearname{editor} + }% + {}} + +% +% 编者类型做一修改 +% v1.0 2016-07-01 +% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串 +% +\renewbibmacro*{editorstrg}{%源来自biblatex.DEF + \printtext[editortype]{% + \iffieldundef{editortype} + {% +% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理 +% test {\ifnumgreater{\value{editor}}{1}} +% or +% test {\ifandothers{editor}} +% } +% {\bibstring{editors}} +% {\bibstring{editor}} + } + {\ifbibxstring{\thefield{editortype}} %定义编者类型情况下处理,以后根据需要修改 + {\ifboolexpr{ + test {\ifnumgreater{\value{editor}}{1}} + or + test {\ifandothers{editor}} + } + {\printdelim{streditortypes}} + {\printdelim{streditortype}}} + {\thefield{editortype}}}% + }} + +% +% 编者类型的本地化字符串输出 +% v1.0q 2019-03-01 hzz +% 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符 +% 能对不同文境作设置的包括排序,标签等 +% 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串 +% +\DeclareDelimFormat{streditortypes}{% + \edef\userfieldabcde{userd}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% + \or% + \bibstring{\thefield{editortype}scn}% + \or% + \addcomma\addthinspace\bibstring{\thefield{editortype}s}% + \fi} +% +\DeclareDelimFormat{streditortype}{% + \edef\userfieldabcde{userd}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbbiblocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}% + \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% + \or% + \bibstring{\thefield{editortype}cn}% + \or% + \addcomma\addthinspace\bibstring{\thefield{editortype}}% + \fi} + + +% +% bookauthor域的输出, +% v1.0q 2019-03-01 hzz +% 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替, +% 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype +\renewbibmacro*{bybookauthor}{% + \ifnameundef{bookauthor}% + {\ifnameundef{editor}% + {}% + {\ifnamesequal{author}{editor}% + {}{\usebibmacro{editor}}}% + }% + {\ifnamesequal{author}{bookauthor}% + {}{\printnames{bookauthor}}% + }% +} + +% +% 修改期刊的标题 +% +\renewbibmacro*{periodical}{%源来自biblatex.DEF + \iffieldundef{title} + {} + {\printtext[title]{\bibtitlefont% + \printfield[titlecase]{title}% + %\setunit{\subtitlepunct}% + \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 + {}{\setunit{\subtitlepunct} + \printfield[titlecase]{subtitle}}% + %{}%把编组结束移到后面去 + \iftoggle{bbx:gbtype}{% + \iffieldundef{usera}{}{%在标题后直接给出文献标识字母 + \printfield[gbtypeflag]{usera}}}{} + }} + } + + +% +% 期刊的标题做修改 +% +\renewbibmacro*{title+issuetitle}{%源来自standard.BBX + \usebibmacro{periodical}% + %\setunit*{\addspace}% + \setunit*{\adddot\addspace}%标点修改为句点 + \iffieldundef{series} + {} + {\newunit + \printfield{series}% + \setunit{\addspace}}% + \usebibmacro{periodical+issue}%将issue调整到上面来,并修改 +\iffieldundef{number}{}{%%进一步处理有范围的数字 + \multinumberparser{\thefield{number}}}% + \iffieldundef{volume}% + {\printfield{year}% + \printtext{\mkbibparens{\multinumberfirst}}% + \bibrangedash% + \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}% + }% + {\multivolparser{\thefield{volume}}% + \printfield{year}% + \setunit{\addcomma\space}%将冒号修改为逗号 + \printtext{\multivolfirst}% + \printtext{\mkbibparens{\multinumberfirst}}% + \bibrangedash% + \iffieldundef{endyear}{}{% + \printfield{endyear}% + \setunit{\addcomma\space}%将冒号修改为逗号 + \printtext{\multivolsecond}% + \printtext{\mkbibparens{\multinumbersecond}}}% + }% + \setunit{\addcomma\space}% + \printfield{eid}% + \setunit{\addspace}% + %\usebibmacro{issue+date}% + %\setunit{\addcolon\space}% + \usebibmacro{issue}% + \newunit} + +% +% 新增一个样式用于调整期刊年份的格式,只打印年份 +% +\newbibmacro*{periodical+issue}{% + \printtext{%去掉了[parens] + \iffieldundef{issue} + {%\usebibmacro{date}%修改为下一句 + }% + {\printfield{issue}% + \setunit*{\addspace}% + %\usebibmacro{date}%修改为下一句 + }% + }% + %\newunit +} + +% +% 重设专利title的输出,将文献类型标识符输出出去 +% +\newbibmacro*{patenttitle}{%原输出来自biblatex.def文件 + \ifboolexpr{% + test{\iffieldundef{title}}% + and% + test{\iffieldundef{subtitle}}% + }% + {}% + {\printtext[title]{\bibtitlefont% + \printfield[titlecase]{title}% + \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 + {}{\setunit{\subtitlepunct}% + \printfield[titlecase]{subtitle}}% + \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 + {\setunit{\subtitlepunct}\printfield{titleaddon}}% + \setunit{\subtitlepunct}\printfield{number}%写专利号 + \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}% + %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 + %\newunit + }% +}% +} + + + +% +% 修改in:用于inbook、incollection、inproceedings等类型 +% 2018.04.20,v1.0k,renewed marco,by hzz +% 20190212,v1.0q,增加中英文区分,by hzz +% +% 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。 +\renewbibmacro*{in:}{% + \iftoggle{bbx:gbpunctin}{\printtext{\allowbreak\texttt{//}\allowbreak}}%\addthinspace + {\setunit{\adddot\addspace}% + \iffieldequalstr{userd}{chinese}% + {\printtext{\bibstring{incn}}}% + {\printtext{\bibstring{in}}}% + }}%\newunit\newblock\intitlepunct + +% +% 修改type域的输出格式 +% 2019.02.12,v1.0q,byhzz +% 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文 +\DeclareFieldFormat{type}% +{\iffieldequalstr{userd}{chinese}% + {\ifbibxstring{#1cn}{\bibxstring{#1cn}}{#1}}% + {\ifbibstring{#1}{\bibstring{#1}}{#1}}% +} + + +% +% 修改series域的输出格式 +% 2019.05.01,v1.0r,byhzz +\renewbibmacro*{series+number}{% + \printfield{series}% + %\setunit*{\addspace}% + %\printfield{number}% + %\newunit + } + +%===================================================================== +%设置驱动格式 +%===================================================================== +% +% book条目类的驱动 +% + \DeclareBibliographyDriver{book}{%源来自standard.bbx文件 + \usebibmacro{bibindex}% + \usebibmacro{begentry}% +\usebibmacro{author/editor+others/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 +\usebibmacro{maintitle+title}% +\iftoggle{bbx:gbstrict}{}{% +\newunit +\printlist{language}% +\newunit\newblock% +\usebibmacro{byauthor}% +\newunit\newblock}% +\usebibmacro{byeditor+others}% +\newunit +\printfield{edition}% +\newunit\newblock%% +\iftoggle{bbx:gbstrict}{}{% +\iffieldundef{maintitle}% +{\printfield{volume}% +\printfield{part}}% +{}% +\newunit% +\printfield{volumes}% +\newunit\newblock% +\usebibmacro{series+number}}% +\newunit\newblock% +%\printfield{note}% +%\newunit\newblock% +\usebibmacro{publisher+location+date}% +%\newunit\newblock %这里标点去掉 +\usebibmacro{chapter+pages}% + \iffieldundef{url}{}{%当没有网址时也不输出 + \usebibmacro{modifydate}}%带括号的修改或更新日期, +\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 + \newunit\newblock% + \printfield{pagetotal}% + \newunit\newblock% + \iftoggle{bbx:isbn} + {\printfield{isbn}} + {}% + \newunit\newblock + %\usebibmacro{doi+eprint+url}% + %\newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + + +% +% 期刊文章,连续出版物中的析出文献的格式 +% + \DeclareBibliographyDriver{article}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}% + \newunit\newblock + \usebibmacro{bytranslator+others}% + \newunit\newblock + \printfield{version}}% + \newunit\newblock + %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物 + \usebibmacro{journal+issuetitle}% + %\newunit +% \usebibmacro{byeditor+others}% +% \newunit + \usebibmacro{note+pages}% + \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期 + \iffieldundef{url}{}{%当没有网址时也不输出 + \iftoggle{bbx:url}{%当url选项为false时,也不输出 + \usebibmacro{modifydate}}{}}}%带括号的修改或更新日期, + \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置 + \newunit\newblock + \iftoggle{bbx:isbn} + {\printfield{issn}} + {}% + \newunit\newblock + %\usebibmacro{doi+eprint+url}% + %\newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + + + +% +% 连续出版物的驱动 +% + \DeclareBibliographyDriver{periodical}{%源来自standard.BBX + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{editor}% + %\setunit{\labelnamepunct}\newblock + \newunit\newblock %删除上面一行,添加这一行 + \usebibmacro{title+issuetitle}% + \newunit\newblock% + \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间 + \newunit\newblock%添加这一行 + \iftoggle{bbx:gbstrict}{}{% + \printlist{language}% + \newunit\newblock + \usebibmacro{byeditor}% + \newunit\newblock + \printfield{note}% + \newunit\newblock} + \iftoggle{bbx:isbn} + {\printfield{issn}} + {}% + \newunit\newblock + \usebibmacro{doi+eprint+url}% + \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + +% +% 专利文献驱动 +% + \DeclareBibliographyDriver{patent}{%源来自standard.BBX + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + %\usebibmacro{title}% + \usebibmacro{patenttitle}%给出专利专用的标题输出 + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}}% + \newunit\newblock + \printfield{type}% + \setunit*{\addspace}% + %\printfield{number}%已放到patenttitle中处理 + \iflistundef{location} + {} + {\setunit*{\addspace}% + \printtext{%[parens] + \printlist[][-\value{listtotal}]{location}}}% + \newunit\newblock + \usebibmacro{byholder}% + \newunit\newblock + \printfield{note}% + \newunit\newblock + \usebibmacro{newsdate}% + %\newunit\newblock + \usebibmacro{doi+eprint+url}% + \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + + +% +% 在线文献驱动 +% +\DeclareBibliographyDriver{online}{%源来自standard.BBX + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/editor+others/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}% + \newunit\newblock + \usebibmacro{byeditor+others}% + \newunit\newblock + \printfield{note}}% + \newunit + \printfield{version}% + \newunit\newblock + %\printlist{organization}% + \printlist{institution}% + \newunit\newblock +\ifboolexpr{% +test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% +}{\usebibmacro{date}}% +{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间 + \usebibmacro{url+urldate}%从下面移上来 + \newunit\newblock + \iftoggle{bbx:eprint} + {\usebibmacro{eprint}} + {}% + \newunit\newblock + %\usebibmacro{url+urldate}% + %\newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + + +% +% 报告类型驱动 +% 当有网址无出版项时,用online输出 +% +\DeclareBibliographyDriver{report}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}}% + \newunit\newblock + \usebibmacro{byeditor+others}%增加的译者信息 + \newunit\newblock + \printfield{type}% + \setunit*{\addspace}% + \printfield{number}% + \newunit\newblock + \printfield{version}% + \newunit + \printfield{note}% + \newunit\newblock + \usebibmacro{publisher+location+date}% + %\newunit\newblock + \usebibmacro{chapter+pages}% + \usebibmacro{doi+eprint+url}% + \newunit + \printfield{pagetotal}% + \newunit\newblock + \iftoggle{bbx:isbn} + {\printfield{isrn}} + {}% + \newunit\newblock +% \usebibmacro{doi+eprint+url}% +% \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + +% +% 论文、手册类型驱动 +% 2016-11-11,增加了译者信息 +% +\DeclareBibliographyDriver{manual}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}}% + \newunit\newblock + \usebibmacro{byeditor+others}%增加的译者信息 + \newunit\newblock + \iftoggle{bbx:gbfieldtype}{% + \printfield{type}% + \setunit*{\addspace}}{}% + \printfield{number}% + \newunit\newblock + \printfield{version}% + \newunit + \printfield{note}% + \newunit\newblock + \usebibmacro{institution+location+date}% + %\newunit\newblock + \usebibmacro{chapter+pages}% + \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期 + \usebibmacro{modifydate}}%修改或更新日期为带括号的时间 + \usebibmacro{doi+eprint+url}% + \newunit + \printfield{pagetotal}% + \newunit\newblock + \iftoggle{bbx:isbn} + {\printfield{isrn}} + {}% + \newunit\newblock +% \usebibmacro{doi+eprint+url}% +% \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + +% +% 备选类型驱动 +% +% 利用biblatex的misc驱动 +\DeclareBibliographyDriver{misc}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/editor+others/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% +\iftoggle{bbx:gbstrict}{}{% + \newunit + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}% + \newunit\newblock + \usebibmacro{byeditor+others}}% + \newunit\newblock + \printfield{howpublished}% + \newunit\newblock + \printfield{type}% + \newunit + \printfield{version}% + \newunit + \printfield{note}% + \newunit\newblock + \usebibmacro{institution+location+date}% + %\usebibmacro{organization+location+date}% + %\newunit\newblock + \usebibmacro{doi+eprint+url}% + \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + + +% +% 专著中的析出文献的格式修改 +% +\DeclareBibliographyDriver{inbook}{%源来自standard.bbx + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/translator+others}% +\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 +\usebibmacro{title}% +\usebibmacro{in:}% +%\printtext{\texttt{//}\addthinspace}% + \usebibmacro{bybookauthor}% + \ifnameundef{bookauthor}{% + \ifnameundef{editor}{}{\newunit}% + }{\newunit}%替换下一句 + %\newunit\newblock +\iffieldundef{series}{}{\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加 + \usebibmacro{maintitle+booktitle}% +\iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}% +\iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息 + \newunit\newblock% +% \usebibmacro{byeditor+others}% +% \newunit\newblock + \printfield{edition}% + \newunit + \iftoggle{bbx:gbstrict}{}{% +% \iffieldundef{maintitle} +% {\printfield{volume}% +% \printfield{part}} +% {}% +% \newunit +% \printfield{volumes}% +% \newunit\newblock +% \usebibmacro{series+number} + }% + \newunit\newblock + %\printfield{note}% + %\newunit\newblock + \usebibmacro{publisher+location+date}% + %\newunit\newblock + \usebibmacro{chapter+pages}% + %\newunit\newblock + \usebibmacro{doi+eprint+url}%移到上面来 + \newunit\newblock + \iftoggle{bbx:isbn} + {\printfield{isbn}} + {}% + \newunit\newblock +% \usebibmacro{doi+eprint+url}% +% \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry}\usebibmacro{annotation}} + + +% +%针对不同refsection做不同的格式处理的代码 +% + +% +%默认采用顺序编码制,因此只需增加的是作者年制 +\newrobustcmd{\setaystylesection}[1]{\csxdef{gb@aystyle@section#1}{#1}} + +% +%在AtBeginBibliography处已经无法重定义defbibenvironment{bibliographyay} +%所以输出只能是用另外定义的环境来实现 +%可以在refsection后面做patch +%为排序引入newrefcontext +\apptocmd{\refsection}{ +\edef\gb@refsecnum{\number\c@refsection}% +\ifcsdef{gb@aystyle@section\gb@refsecnum}% +{ +\newrefcontext[sorting=gb7714-2015] + +\setlength{\bibhang}{1em} +\setlength{\bibitemindent}{-\bibhang} +\defbibenvironment{bibliography} + {\list + {} + {\setlength{\leftmargin}{\bibhang}% + \setlength{\itemindent}{\bibitemindent}% + \setlength{\itemsep}{\bibitemsep}% + \setlength{\parsep}{\bibparsep}}} + {\endlist} + {\item} +}{} +}{}{} + +% +%为排序引入endrefcontext +% +\pretocmd{\endrefsection}{ +\edef\gb@refsecnum{\number\c@refsection}% +\ifcsdef{gb@aystyle@section\gb@refsecnum}% +{\endrefcontext}{} +}{}{} + +%因为是整个文献表,在打印文献表的时候,增加钩子代码 +%因为下面的钩子是在defbibenvironment的begincode之后,所以对于defbibenvironment相关的设置都是无效的 +\AtBeginBibliography{ + +\edef\gb@refsecnum{\number\c@refsection}% +\ifcsdef{gb@aystyle@section\gb@refsecnum}% +%\ifboolexpr{ +%not test {\ifcsundef{gb@aystyle@section\gb@refsecnum}} +%and +%test {\ifcsequal{gb@refsecnum}{gb@aystyle@section\gb@refsecnum}} +%} + { + + \DeclareDelimFormat{nameyeardelim}{\addcomma\space} + \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space} + + \renewbibmacro*{date}{% + \iflabeldateisdate + {} + {\printdate}}% + + \renewbibmacro*{date+extradate}{% + \iffieldundef{labelyear} + {} + {\printtext{%[parens]%这里去掉括号 + \iflabeldateisdate + {\printdateextra} + {\printlabeldateextra}}}}% + + \newbibmacro*{bbx:savehash}{% + \savefield{fullhash}{\bbx@lasthash}} + + \newbibmacro*{bbx:dashcheck}[2]{} + + %注意这里当没有作者只有标题时在年份之前的标点是否需要标准并未涉及,所以未做处理。 + \renewbibmacro*{author}{%以前的date+extrayear变为date+extradate,所以对3.8以上版本重定义一下author + \ifboolexpr{ + test \ifuseauthor + and + not test {\ifnameundef{author}} + } + {% + \usebibmacro{bbx:savehash}% + \printnames{author}% + \iffieldundef{authortype} + {\setunit{\printdelim{nameyeardelim}}} + {\setunit{\printdelim{authortypedelim}}}% + \iffieldundef{authortype} + {} + {\usebibmacro{authorstrg}% + \setunit{\printdelim{nameyeardelim}}} + }% + {\global\undef\bbx@lasthash + \usebibmacro{labeltitle}% + \setunit*{\printdelim{nonameyeardelim}}}% + \usebibmacro{date+extradate}} + + \newbibmacro*{labeltitle}{% + \iffieldundef{label} + {\iffieldundef{shorttitle} + {\printfield{title}% + \clearfield{title}} + {\printfield[title]{shorttitle}}} + {\printfield{label}}} + +% +% 增加一个number带括号的格式,避免使用mkbibparens而引入一个不必要的空格 +% +\DeclareFieldFormat{addnumflag}{% +\nobreak\printtext{(}\nobreak #1\nobreak\printtext{)}} + +% +% 调整journal输出 +% +% 原理方法:首先判断子标题,然后再设置标点。 +% 避免直接设置标点后,当volume不存在时需要使用\nopuct去标点进而引入不必要的空格 +\renewbibmacro*{journal}{% + \iffieldundef{journaltitle}% + {}% + {\printtext[journaltitle]{% + \printfield[titlecase]{journaltitle}% + \iffieldundef{journalsubtitle}{}{\setunit{\subtitlepunct}% + \printfield[titlecase]{journalsubtitle}}}}} + + + +% +% 调整期刊卷和期的格式 +% +\renewbibmacro*{volume+number+eid}{%源来自standard.bbx +\iftoggle{bbx:gbfieldstd}{% + \printfield{volume}% + \setunit*{\adddot}% + \printfield{number}% + \setunit{\addcomma\space}% + \printfield{eid}}{% + \printfield{volume}% + %\setunit*{\adddot}%去掉点号 + %\printfield{number}% + \iffieldundef{number}{}{\printfield[addnumflag]{number}}%区别于顺序编码制 + \iffieldundef{eid}{}{% + \setunit{\addcomma\space}% + \printfield{eid}}}} + +% +% 调整期刊年份的格式 +% +% 原理方法:原在authoryear.BBX中\bbx@opt@mergedate@compact中定义 +% 当issue存在时,才设置newunit。避免直接设置标点后,当volume不存在是需要使用\nopuct去标点进而引入不必要的空格 + \renewbibmacro*{issue+date}{% + \iffieldundef{issue}% + {}% + {\iftoggle{bbx:gbstrict}{}{\printtext[parens]{\printfield{issue}}\newunit}}} + +% +% 编者的符号修改一下 +% v1.0 2016-07-01 +% v1.0q 2019-03-01 hzz 修改editortype前的标点 +% +\renewbibmacro*{editor}{% + \ifboolexpr{ + test \ifuseeditor + and + not test {\ifnameundef{editor}} + } + {\usebibmacro{bbx:dashcheck} + {%\bibnamedash + \printnames{editor}% + } + {\printnames{editor}% + %\setunit{\printdelim{editortypedelim}}% + %\usebibmacro{bbx:savehash} + }% + \usebibmacro{editorstrg}% + %\clearname{editor}% + \setunit{\printdelim{nameyeardelim}}}% + {\global\undef\bbx@lasthash + \usebibmacro{labeltitle}% + \setunit*{\printdelim{nonameyeardelim}}}% + \ifboolexpr{% + test {\ifentrytype{inbook}} + or + test {\ifentrytype{incollection}} + or + test {\ifentrytype{inproceedings}} + or + test {\ifentrytype{conference}} + }% + {}% + {\usebibmacro{date+extradate}}} + + + }{} + + + +} + + + +% +%针对具体条目做处理时的特殊处理 +% +%\def\localsetrefsectionstyle{% +%} + +%\AtEveryBibitem{\localsetrefsectionstyle}% +%\AtEveryCite{\localsetchinesecode}% +%\AtEveryLositem{\localsetchinesecode}% diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.cbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.cbx index d1d882e4df..52ea63a1d3 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.cbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.cbx @@ -1,466 +1,466 @@ -%% -%% --------------------------------------------------------------- -%% biblatex-gb7714-2015 --- A biblatex implementation of the -%% GBT7714-2015 citation style,numerical sequence -%% Maintained by huzhenzhen -%% E-mail: hzzmail@163.com -%% Released under the LaTeX Project Public License v1.3c or later -%% --------------------------------------------------------------- -%% -\def\versionofgbtstyle{2020/07/21 v1.0v} -\ProvidesFile{gb7714-2015mx.cbx}[\versionofgbtstyle biblatex citation style] - -% -% 加载标准样式 -% -\RequireCitationStyle{numeric-comp} %numeric - - -% -% 选项设置 -% -\ExecuteBibliographyOptions{ - %autocite = superscript , - %autopunct = true , - %sorting = none , - maxcitenames=1, - mincitenames=1, - uniquename=init,%因为使用了名字缩写选项,所以需要设置uniquename=init而不是full避免冲突 - uniquelist=minyear, - labeldateparts, - sortcites, -} - - - -% -% 定义一个上标方括号wrapper -% -\newcommand*\mkbibsuperbracket[1]{% - \mkbibsuperscript{\mkbibbrackets{#1}}% -} - -% 修改postnote的输出格式 -\DeclareFieldFormat{postnote}{#1} - -% -% 重定义cite命令 -% -% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode} -% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式 -\DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 - {[\usebibmacro{cite:init}% - \usebibmacro{prenote}} - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {\usebibmacro{cite:dump}]% - \printfield{postnote}} -% v1.0p 以前用的方式 -%\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号 -% {\usebibmacro{cite:init}% -% \usebibmacro{prenote}} -% {\usebibmacro{citeindex}% -% \usebibmacro{cite:comp}} -% {} -% {\usebibmacro{cite:dump}% -% \usebibmacro{postnote}} - -% -% 定义upcite命令 -% 20180604,v1.0l,hzz -% 20190409,v1.0r,hzz -% 方法:对supercite增加[] -\newrobustcmd*{\upcite}{% - \cite} - -% -% 重定义parencite命令,以满足标签带页码的国标要求 -% -\DeclareCiteCommand{\parencite}%[\mkbibbrackets] - {[\usebibmacro{cite:init}%] - \usebibmacro{prenote}}% - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {%[ - \usebibmacro{cite:dump}]% - \mkbibsuperscript{\printfield{postnote}}} - -% -% 新定义pagescite命令,以满足标签带页码的国标要求 -% -% 原理方法: -% 1.新增页码输出宏 -\newbibmacro*{postpages}{% - \iffieldundef{postnote} - {\printfield[postnote]{pages}} - {\printfield{postnote}}} -% 2.新增\pagescite引用命令 -\DeclareCiteCommand{\pagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 - {[\usebibmacro{cite:init}%]直接添加方括号 - \usebibmacro{prenote}% - } - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {\usebibmacro{cite:dump}]% - \usebibmacro{postpages}} - -% -% 定义yearpagescite,为与ay样式兼容,等同于\pagescite -% -\DeclareCiteCommand{\yearpagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 - {[\usebibmacro{cite:init}%]直接添加方括号 - \usebibmacro{prenote}% - } - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {\usebibmacro{cite:dump}]% - \usebibmacro{postpages}} - -% -% 定义\yearcite命令,为与ay样式兼容,且提供不输出页码的标签格式, -% -% 原理方法:等同于\pagescite,但不要页码 -\DeclareCiteCommand{\yearcite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 - {[\usebibmacro{cite:init}%]直接添加方括号 - \usebibmacro{prenote}% - } - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {\usebibmacro{cite:dump}]} - -% -% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码 -% 20180427,v1.0k,增加,hzz -% gb7714样式新定义的命令都把cite放到最后,比如前面的pagescite,yearcite,这里的\authornumcite -% 区别于biblatex定义的命令都把cite放到前面,比如citeauthor等。 -%见numeric.CBX -\newbibmacro*{cite}{% - \printtext[bibhyperref]{% - \printfield{labelprefix}% - \printfield{labelnumber}% - \ifbool{bbx:subentry} - {\printfield{entrysetcount}} - {}}} -%见numeric.CBX,\DeclareCiteCommand{\cite}, -\DeclareCiteCommand{\authornumcite}%[\mkbibsuperscript] - {\usebibmacro{prenote}} - {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace - {\renewcommand*{\andothersdelim}{\addspace}}% - \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}% - \usebibmacro{cite}}}} - {\multicitedelim} - {\mkbibsuperscript{\printfield{postnote}}} - - -% -% 增加如下多个命令 -% 20190409,v1.0r,hzz -% 方法:利用newcommand或newrobustcmd命令进行定义 -% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突 -\DeclareCiteCommand{\citet}% - {\usebibmacro{prenote}} - {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace - {\renewcommand*{\andothersdelim}{\addspace}}% - \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}% - \usebibmacro{cite}}}} - {\multicitedelim} - {\mkbibsuperscript{\printfield{postnote}}} - - -\DeclareCiteCommand{\citep}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 - {[\usebibmacro{cite:init}% - \usebibmacro{prenote}} - {\usebibmacro{citeindex}% - \usebibmacro{cite:comp}} - {} - {\usebibmacro{cite:dump}]% - \printfield{postnote}} - -\newrobustcmd*{\citetns}% - {\textcite} - -\newrobustcmd*{\citepns}% - {\parencite} - -\newrobustcmd*{\inlinecite}% - {\parencite} - - -%textcite标注命令中的标点设置 -%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% - -%textcite标注命令中的标点设置,注意只针对textcite命令。 -\DeclareDelimFormat[textcite]{nameyeardelim}{}%\addcomma\space -\DeclareDelimFormat[textcite]{andothersdelim}{\iffieldequalstr{userf}{chinese}{\addthinspace}{\addspace}}% -\AtEveryCitekey{% -\iffieldequalstr{userf}{chinese}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace - {\renewcommand*{\andothersdelim}{\addspace}}% -} - -% -% -% -\apptocmd{\refsection}{ - -%\edef\gb@refsecnum{\number\c@refsection} -\edef\gb@refsecnum{\number\c@refsection}% -\ifcsundef{gb@aystyle@section\gb@refsecnum}% -{}% -{ - -\renewcommand*{\iffinalcitedelim}{% - \ifnumequal{\value{textcitecount}}{\value{textcitetotal}-1}} - -\newbibmacro*{cite:init}{% - \ifnumless{\value{multicitecount}}{2} - {\global\boolfalse{cbx:parens}% - \global\undef\cbx@lasthash - \global\undef\cbx@lastyear} - {\iffieldundef{prenote} - {} - {\global\undef\cbx@lasthash - \global\undef\cbx@lastyear}}} - -\newbibmacro*{cite:reinit}{% - \global\undef\cbx@lasthash - \global\undef\cbx@lastyear} - -\newbibmacro*{cite}{% - \iffieldundef{shorthand} - {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}} - {\usebibmacro{cite:label}% - \setunit{\printdelim{nonameyeardelim}}% - \usebibmacro{cite:labeldate+extradate}% - \usebibmacro{cite:reinit}} - {\iffieldequals{namehash}{\cbx@lasthash} - {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND - \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} - {\setunit{\addcomma}% - \usebibmacro{cite:extradate}} - {\setunit{\compcitedelim}% - \usebibmacro{cite:labeldate+extradate}% - \savefield{labelyear}{\cbx@lastyear}}} - {\printnames{labelname}% - \setunit{\printdelim{nameyeardelim}}% - \usebibmacro{cite:labeldate+extradate}% - \savefield{namehash}{\cbx@lasthash}% - \savefield{labelyear}{\cbx@lastyear}}}} - {\usebibmacro{cite:shorthand}% - \usebibmacro{cite:reinit}}% - \setunit{\multicitedelim}} - -\newbibmacro*{citeyear}{% - \iffieldundef{shorthand} - {\iffieldundef{labelyear} - {\usebibmacro{cite:label}% - \usebibmacro{cite:reinit}} - {\iffieldequals{namehash}{\cbx@lasthash} - {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND - \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} - {\setunit{\addcomma}% - \usebibmacro{cite:extradate}} - {\setunit{\compcitedelim}% - \usebibmacro{cite:labeldate+extradate}% - \savefield{labelyear}{\cbx@lastyear}}} - {\usebibmacro{cite:labeldate+extradate}% - \savefield{namehash}{\cbx@lasthash}% - \savefield{labelyear}{\cbx@lastyear}}}} - {\usebibmacro{cite:shorthand}% - \usebibmacro{cite:reinit}}% - \setunit{\multicitedelim}} - -\newbibmacro*{textcite}{% - \iffieldequals{namehash}{\cbx@lasthash} - {\iffieldundef{shorthand} - {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND - \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} - {\setunit{\addcomma}% - \usebibmacro{cite:extradate}} - {\setunit{\compcitedelim}% - \usebibmacro{cite:labeldate+extradate}% - \savefield{labelyear}{\cbx@lastyear}}} - {\setunit{\compcitedelim}% - \usebibmacro{cite:shorthand}% - \global\undef\cbx@lastyear}} - {\ifnameundef{labelname} - {\iffieldundef{shorthand} - {\usebibmacro{cite:label}% - \setunit{% - \global\booltrue{cbx:parens}% - \printdelim{nonameyeardelim}\bibopenparen}% - \ifnumequal{\value{citecount}}{1} - {\usebibmacro{prenote}} - {}% - \usebibmacro{cite:labeldate+extradate}} - {\usebibmacro{cite:shorthand}}} - {\printnames{labelname}% - \setunit{% - \global\booltrue{cbx:parens}% - \printdelim{nameyeardelim}\bibopenparen}% - \ifnumequal{\value{citecount}}{1} - {\usebibmacro{prenote}} - {}% - \iffieldundef{shorthand} - {\iffieldundef{labelyear} - {\usebibmacro{cite:label}} - {\usebibmacro{cite:labeldate+extradate}}% - \savefield{labelyear}{\cbx@lastyear}} - {\usebibmacro{cite:shorthand}% - \global\undef\cbx@lastyear}}% - \stepcounter{textcitecount}% - \savefield{namehash}{\cbx@lasthash}}% - \setunit{% - \ifbool{cbx:parens} - {\bibcloseparen\global\boolfalse{cbx:parens}} - {}% - \textcitedelim}} - -\newbibmacro*{cite:shorthand}{% - \printtext[bibhyperref]{\printfield{shorthand}}} - -% -% 重定义cite:label,针对biblatex3.8以上版本set条目集的标注(引用)标签 -% -% 原理方法:当条目是set时,v3.8以上版本,都没有有用的信息(区别于3.7以下版本set复制第一个成员的信息), -% 于是利用entrykey来给出标签,那么就要set的条目关键字是需要的字符串,注意字符串中间不能有空格 -\renewbibmacro*{cite:label}{% - \iffieldundef{label}% - {\iffieldundef{labeltitle}{\printtext[bibhyperref]{\printfield{entrykey}}}%entrykey - {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}}% - {\printtext[bibhyperref]{\printfield{label}}}} - -\newbibmacro*{cite:labeldate+extradate}{% - \iffieldundef{labelyear} - {} - {\printtext[bibhyperref]{\printlabeldateextra}}} - -\newbibmacro*{cite:extradate}{% - \iffieldundef{extradate} - {} - {\printtext[bibhyperref]{\printfield{extradate}}}} - - - -% -% 重定义cite:label,针对biblatex3.8以上版本set条目集的标注(引用)标签 -% -% 原理方法:当条目是set时,v3.8以上版本,都没有有用的信息(区别于3.7以下版本set复制第一个成员的信息), -% 于是利用entrykey来给出标签,那么就要set的条目关键字是需要的字符串,注意字符串中间不能有空格 -\renewbibmacro*{cite:label}{% - \iffieldundef{label}% - {\iffieldundef{labeltitle}{\printtext[bibhyperref]{\printfield{entrykey}}}%entrykey - {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}}% - {\printtext[bibhyperref]{\printfield{label}}}} - -% -% 重定义cite命令 -% -% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode} -% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式 -\DeclareCiteCommand{\cite} - {\usebibmacro{cite:init}% - \renewbibmacro*{postnote}{% - \iffieldundef{postnote}% - {}% - {\thefield{postnote}}}% - (\usebibmacro{prenote}}%) - {\usebibmacro{citeindex}% - \usebibmacro{cite}} - {} - {%( - )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote} - } - -\DeclareCiteCommand{\parencite}[\mkbibparens] - {\usebibmacro{cite:init}% - \usebibmacro{prenote}} - {\usebibmacro{citeindex}% - \usebibmacro{cite}} - {} - {\usebibmacro{postnote}} - -% -% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码 -% 20180427,v1.0k,增加,hzz -% 20190409,v1.0r,hzz -% 为与顺序编码制兼容,增加了命令,定义与citet相同 -\newbibmacro*{citet}{% - \iffieldundef{shorthand} - {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}} - {\usebibmacro{cite:label}% - \setunit{\printdelim{nonameyeardelim}}% - \usebibmacro{cite:labeldate+extradate}% - \usebibmacro{cite:reinit}} - {\iffieldequals{namehash}{\cbx@lasthash} - {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND - \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} - {\setunit{\addcomma}% - \usebibmacro{cite:extradate}} - {\setunit{\compcitedelim}% - \usebibmacro{cite:labeldate+extradate}% - \savefield{labelyear}{\cbx@lastyear}}} - {\printnames{labelname}% - %\setunit{\printdelim{nameyeardelim}}% - (\usebibmacro{cite:labeldate+extradate})% - \savefield{namehash}{\cbx@lasthash}% - \savefield{labelyear}{\cbx@lastyear}}}} - {\usebibmacro{cite:shorthand}% - \usebibmacro{cite:reinit}}% - \setunit{\multicitedelim}} - -\DeclareCiteCommand{\authornumcite}% - {\usebibmacro{cite:init}% - \renewbibmacro*{postnote}{% - \iffieldundef{postnote}% - {}% - {\thefield{postnote}}}% - \usebibmacro{prenote}}% - {\usebibmacro{citeindex}% - \usebibmacro{citet}} - {} - {\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote} - } - -% -% 增加如下多个命令 -% 20190409,v1.0r,hzz -% 方法:利用newcommand或newrobustcmd命令进行定义 -% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突 - -%同\authornumcite -\DeclareCiteCommand{\citet}% - {\usebibmacro{cite:init}% - \renewbibmacro*{postnote}{% - \iffieldundef{postnote}% - {}% - {\thefield{postnote}}}% - \usebibmacro{prenote}}% - {\usebibmacro{citeindex}% - \usebibmacro{citet}} - {} - {\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote} - } - -%同cite -\DeclareCiteCommand{\citep} - {\usebibmacro{cite:init}% - \renewbibmacro*{postnote}{% - \iffieldundef{postnote}% - {}% - {\thefield{postnote}}}% - (\usebibmacro{prenote}}%) - {\usebibmacro{citeindex}% - \usebibmacro{cite}} - {} - {%( - )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote} - } - - -} -}{}{} +%% +%% --------------------------------------------------------------- +%% biblatex-gb7714-2015 --- A biblatex implementation of the +%% GBT7714-2015 citation style,numerical sequence +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% +\def\versionofgbtstyle{2021/01/19 v1.0w} +\ProvidesFile{gb7714-2015mx.cbx}[\versionofgbtstyle biblatex citation style] + +% +% 加载标准样式 +% +\RequireCitationStyle{numeric-comp} %numeric + + +% +% 选项设置 +% +\ExecuteBibliographyOptions{ + %autocite = superscript , + %autopunct = true , + %sorting = none , + maxcitenames=1, + mincitenames=1, + uniquename=init,%因为使用了名字缩写选项,所以需要设置uniquename=init而不是full避免冲突 + uniquelist=minyear, + labeldateparts, + sortcites, +} + + + +% +% 定义一个上标方括号wrapper +% +\newcommand*\mkbibsuperbracket[1]{% + \mkbibsuperscript{\mkbibbrackets{#1}}% +} + +% 修改postnote的输出格式 +\DeclareFieldFormat{postnote}{#1} + +% +% 重定义cite命令 +% +% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode} +% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式 +\DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 + {[\usebibmacro{cite:init}% + \usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {\usebibmacro{cite:dump}]% + \printfield{postnote}} +% v1.0p 以前用的方式 +%\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号 +% {\usebibmacro{cite:init}% +% \usebibmacro{prenote}} +% {\usebibmacro{citeindex}% +% \usebibmacro{cite:comp}} +% {} +% {\usebibmacro{cite:dump}% +% \usebibmacro{postnote}} + +% +% 定义upcite命令 +% 20180604,v1.0l,hzz +% 20190409,v1.0r,hzz +% 方法:对supercite增加[] +\newrobustcmd*{\upcite}{% + \cite} + +% +% 重定义parencite命令,以满足标签带页码的国标要求 +% +\DeclareCiteCommand{\parencite}%[\mkbibbrackets] + {[\usebibmacro{cite:init}%] + \usebibmacro{prenote}}% + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {%[ + \usebibmacro{cite:dump}]% + \mkbibsuperscript{\printfield{postnote}}} + +% +% 新定义pagescite命令,以满足标签带页码的国标要求 +% +% 原理方法: +% 1.新增页码输出宏 +\newbibmacro*{postpages}{% + \iffieldundef{postnote} + {\printfield[postnote]{pages}} + {\printfield{postnote}}} +% 2.新增\pagescite引用命令 +\DeclareCiteCommand{\pagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 + {[\usebibmacro{cite:init}%]直接添加方括号 + \usebibmacro{prenote}% + } + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {\usebibmacro{cite:dump}]% + \usebibmacro{postpages}} + +% +% 定义yearpagescite,为与ay样式兼容,等同于\pagescite +% +\DeclareCiteCommand{\yearpagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 + {[\usebibmacro{cite:init}%]直接添加方括号 + \usebibmacro{prenote}% + } + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {\usebibmacro{cite:dump}]% + \usebibmacro{postpages}} + +% +% 定义\yearcite命令,为与ay样式兼容,且提供不输出页码的标签格式, +% +% 原理方法:等同于\pagescite,但不要页码 +\DeclareCiteCommand{\yearcite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 + {[\usebibmacro{cite:init}%]直接添加方括号 + \usebibmacro{prenote}% + } + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {\usebibmacro{cite:dump}]} + +% +% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码 +% 20180427,v1.0k,增加,hzz +% gb7714样式新定义的命令都把cite放到最后,比如前面的pagescite,yearcite,这里的\authornumcite +% 区别于biblatex定义的命令都把cite放到前面,比如citeauthor等。 +%见numeric.CBX +\newbibmacro*{cite}{% + \printtext[bibhyperref]{% + \printfield{labelprefix}% + \printfield{labelnumber}% + \ifbool{bbx:subentry} + {\printfield{entrysetcount}} + {}}} +%见numeric.CBX,\DeclareCiteCommand{\cite}, +\DeclareCiteCommand{\authornumcite}%[\mkbibsuperscript] + {\usebibmacro{prenote}} + {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace + {\renewcommand*{\andothersdelim}{\addspace}}% + \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}% + \usebibmacro{cite}}}} + {\multicitedelim} + {\mkbibsuperscript{\printfield{postnote}}} + + +% +% 增加如下多个命令 +% 20190409,v1.0r,hzz +% 方法:利用newcommand或newrobustcmd命令进行定义 +% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突 +\DeclareCiteCommand{\citet}% + {\usebibmacro{prenote}} + {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace + {\renewcommand*{\andothersdelim}{\addspace}}% + \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}% + \usebibmacro{cite}}}} + {\multicitedelim} + {\mkbibsuperscript{\printfield{postnote}}} + + +\DeclareCiteCommand{\citep}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 + {[\usebibmacro{cite:init}% + \usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \usebibmacro{cite:comp}} + {} + {\usebibmacro{cite:dump}]% + \printfield{postnote}} + +\newrobustcmd*{\citetns}% + {\textcite} + +\newrobustcmd*{\citepns}% + {\parencite} + +\newrobustcmd*{\inlinecite}% + {\parencite} + + +%textcite标注命令中的标点设置 +%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% + +%textcite标注命令中的标点设置,注意只针对textcite命令。 +\DeclareDelimFormat[textcite]{nameyeardelim}{}%\addcomma\space +\DeclareDelimFormat[textcite]{andothersdelim}{\iffieldequalstr{userf}{chinese}{\addthinspace}{\addspace}}% +\AtEveryCitekey{% +\iffieldequalstr{userf}{chinese}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace + {\renewcommand*{\andothersdelim}{\addspace}}% +} + +% +% +% +\apptocmd{\refsection}{ + +%\edef\gb@refsecnum{\number\c@refsection} +\edef\gb@refsecnum{\number\c@refsection}% +\ifcsundef{gb@aystyle@section\gb@refsecnum}% +{}% +{ + +\renewcommand*{\iffinalcitedelim}{% + \ifnumequal{\value{textcitecount}}{\value{textcitetotal}-1}} + +\newbibmacro*{cite:init}{% + \ifnumless{\value{multicitecount}}{2} + {\global\boolfalse{cbx:parens}% + \global\undef\cbx@lasthash + \global\undef\cbx@lastyear} + {\iffieldundef{prenote} + {} + {\global\undef\cbx@lasthash + \global\undef\cbx@lastyear}}} + +\newbibmacro*{cite:reinit}{% + \global\undef\cbx@lasthash + \global\undef\cbx@lastyear} + +\newbibmacro*{cite}{% + \iffieldundef{shorthand} + {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}} + {\usebibmacro{cite:label}% + \setunit{\printdelim{nonameyeardelim}}% + \usebibmacro{cite:labeldate+extradate}% + \usebibmacro{cite:reinit}} + {\iffieldequals{namehash}{\cbx@lasthash} + {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND + \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} + {\setunit{\addcomma}% + \usebibmacro{cite:extradate}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:labeldate+extradate}% + \savefield{labelyear}{\cbx@lastyear}}} + {\printnames{labelname}% + \setunit{\printdelim{nameyeardelim}}% + \usebibmacro{cite:labeldate+extradate}% + \savefield{namehash}{\cbx@lasthash}% + \savefield{labelyear}{\cbx@lastyear}}}} + {\usebibmacro{cite:shorthand}% + \usebibmacro{cite:reinit}}% + \setunit{\multicitedelim}} + +\newbibmacro*{citeyear}{% + \iffieldundef{shorthand} + {\iffieldundef{labelyear} + {\usebibmacro{cite:label}% + \usebibmacro{cite:reinit}} + {\iffieldequals{namehash}{\cbx@lasthash} + {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND + \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} + {\setunit{\addcomma}% + \usebibmacro{cite:extradate}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:labeldate+extradate}% + \savefield{labelyear}{\cbx@lastyear}}} + {\usebibmacro{cite:labeldate+extradate}% + \savefield{namehash}{\cbx@lasthash}% + \savefield{labelyear}{\cbx@lastyear}}}} + {\usebibmacro{cite:shorthand}% + \usebibmacro{cite:reinit}}% + \setunit{\multicitedelim}} + +\newbibmacro*{textcite}{% + \iffieldequals{namehash}{\cbx@lasthash} + {\iffieldundef{shorthand} + {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND + \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} + {\setunit{\addcomma}% + \usebibmacro{cite:extradate}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:labeldate+extradate}% + \savefield{labelyear}{\cbx@lastyear}}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:shorthand}% + \global\undef\cbx@lastyear}} + {\ifnameundef{labelname} + {\iffieldundef{shorthand} + {\usebibmacro{cite:label}% + \setunit{% + \global\booltrue{cbx:parens}% + \printdelim{nonameyeardelim}\bibopenparen}% + \ifnumequal{\value{citecount}}{1} + {\usebibmacro{prenote}} + {}% + \usebibmacro{cite:labeldate+extradate}} + {\usebibmacro{cite:shorthand}}} + {\printnames{labelname}% + \setunit{% + \global\booltrue{cbx:parens}% + \printdelim{nameyeardelim}\bibopenparen}% + \ifnumequal{\value{citecount}}{1} + {\usebibmacro{prenote}} + {}% + \iffieldundef{shorthand} + {\iffieldundef{labelyear} + {\usebibmacro{cite:label}} + {\usebibmacro{cite:labeldate+extradate}}% + \savefield{labelyear}{\cbx@lastyear}} + {\usebibmacro{cite:shorthand}% + \global\undef\cbx@lastyear}}% + \stepcounter{textcitecount}% + \savefield{namehash}{\cbx@lasthash}}% + \setunit{% + \ifbool{cbx:parens} + {\bibcloseparen\global\boolfalse{cbx:parens}} + {}% + \textcitedelim}} + +\newbibmacro*{cite:shorthand}{% + \printtext[bibhyperref]{\printfield{shorthand}}} + +% +% 重定义cite:label,针对biblatex3.8以上版本set条目集的标注(引用)标签 +% +% 原理方法:当条目是set时,v3.8以上版本,都没有有用的信息(区别于3.7以下版本set复制第一个成员的信息), +% 于是利用entrykey来给出标签,那么就要set的条目关键字是需要的字符串,注意字符串中间不能有空格 +\renewbibmacro*{cite:label}{% + \iffieldundef{label}% + {\iffieldundef{labeltitle}{\printtext[bibhyperref]{\printfield{entrykey}}}%entrykey + {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}}% + {\printtext[bibhyperref]{\printfield{label}}}} + +\newbibmacro*{cite:labeldate+extradate}{% + \iffieldundef{labelyear} + {} + {\printtext[bibhyperref]{\printlabeldateextra}}} + +\newbibmacro*{cite:extradate}{% + \iffieldundef{extradate} + {} + {\printtext[bibhyperref]{\printfield{extradate}}}} + + + +% +% 重定义cite:label,针对biblatex3.8以上版本set条目集的标注(引用)标签 +% +% 原理方法:当条目是set时,v3.8以上版本,都没有有用的信息(区别于3.7以下版本set复制第一个成员的信息), +% 于是利用entrykey来给出标签,那么就要set的条目关键字是需要的字符串,注意字符串中间不能有空格 +\renewbibmacro*{cite:label}{% + \iffieldundef{label}% + {\iffieldundef{labeltitle}{\printtext[bibhyperref]{\printfield{entrykey}}}%entrykey + {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}}% + {\printtext[bibhyperref]{\printfield{label}}}} + +% +% 重定义cite命令 +% +% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode} +% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式 +\DeclareCiteCommand{\cite} + {\usebibmacro{cite:init}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {}% + {\thefield{postnote}}}% + (\usebibmacro{prenote}}%) + {\usebibmacro{citeindex}% + \usebibmacro{cite}} + {} + {%( + )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote} + } + +\DeclareCiteCommand{\parencite}[\mkbibparens] + {\usebibmacro{cite:init}% + \usebibmacro{prenote}} + {\usebibmacro{citeindex}% + \usebibmacro{cite}} + {} + {\usebibmacro{postnote}} + +% +% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码 +% 20180427,v1.0k,增加,hzz +% 20190409,v1.0r,hzz +% 为与顺序编码制兼容,增加了命令,定义与citet相同 +\newbibmacro*{citet}{% + \iffieldundef{shorthand} + {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}} + {\usebibmacro{cite:label}% + \setunit{\printdelim{nonameyeardelim}}% + \usebibmacro{cite:labeldate+extradate}% + \usebibmacro{cite:reinit}} + {\iffieldequals{namehash}{\cbx@lasthash} + {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND + \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} + {\setunit{\addcomma}% + \usebibmacro{cite:extradate}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:labeldate+extradate}% + \savefield{labelyear}{\cbx@lastyear}}} + {\printnames{labelname}% + %\setunit{\printdelim{nameyeardelim}}% + (\usebibmacro{cite:labeldate+extradate})% + \savefield{namehash}{\cbx@lasthash}% + \savefield{labelyear}{\cbx@lastyear}}}} + {\usebibmacro{cite:shorthand}% + \usebibmacro{cite:reinit}}% + \setunit{\multicitedelim}} + +\DeclareCiteCommand{\authornumcite}% + {\usebibmacro{cite:init}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {}% + {\thefield{postnote}}}% + \usebibmacro{prenote}}% + {\usebibmacro{citeindex}% + \usebibmacro{citet}} + {} + {\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote} + } + +% +% 增加如下多个命令 +% 20190409,v1.0r,hzz +% 方法:利用newcommand或newrobustcmd命令进行定义 +% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突 + +%同\authornumcite +\DeclareCiteCommand{\citet}% + {\usebibmacro{cite:init}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {}% + {\thefield{postnote}}}% + \usebibmacro{prenote}}% + {\usebibmacro{citeindex}% + \usebibmacro{citet}} + {} + {\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote} + } + +%同cite +\DeclareCiteCommand{\citep} + {\usebibmacro{cite:init}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {}% + {\thefield{postnote}}}% + (\usebibmacro{prenote}}%) + {\usebibmacro{citeindex}% + \usebibmacro{cite}} + {} + {%( + )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote} + } + + +} +}{}{} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714texteg.dat b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714texteg.dat deleted file mode 100644 index 6fb3ef1a4a..0000000000 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714texteg.dat +++ /dev/null @@ -1,214 +0,0 @@ -[14] ANDERSEN J B, RAPPAPORT T S, YOSHIDA S. Propagation measurements and models for wireless communications channels[J]. IEEE Commun. Mag., 1995, 33(1): 42–49. -[49] 陈高峰. 基于开放式框架的交叉开发环境设计与实现[J]. 煤炭技术, 2011, 30(6): 230–232. -[51] 陈金成, 杨海威, 钟廷修. 一种开放式体系结构经济型数控装置的研制[J]. 上海交通大学学报, 2001, 35(12): 1861–1864. -[52] 高光明. 信号情报接收机的发展现状及趋势[J]. 电讯技术, 1998, 38(2): 60–65. -[53] 高翔, 李辰. 复杂航电架构的开放式系统标准研究[J]. 航空电子技术, 2015, 46(2): 26–31. -[55] 李炳穆. 理想的图书管理员和信息专家的素养与形象[J]. 图书情报工作, 2000(2): 5–8. -[48] ZHAO L, HAIMOVICH A M. Performance of ultra-wideband communications in the presence of interference[J]. IEEE J. Sel. Areas Commun., 2002, 20(9): 1684–1691. -[8] 张敏莉, 易仕和, 赵玉新. 超声速短化喷管的设计和试验研究[J]. 空气动力学报, 2007, 25(4): 500–503. - -[47] WALLS S C, BARICHIVICH W J, BROWN M E. Drought, deluge and declines: the impact of precipition extremes on amphibians in a changing climate[J/OL]. Biology, 2013, 2(1): 399–418[2013–11–04]. http://www.mdpi.com. -[50] 陈建军. 从数字地球到智慧地球[J/OL]. 国图资源导刊, 2010, 7(10): 93 [2013–03–20]. http://d.g.wanfangdata.com.cn. doi: 10.3969/j.issn.1672-5603.2010.10.038. -[54] 江向东. 互联网环境下的信息处理与图书管理系统解决方案[J/OL]. 情报学报, 1999, 18(2): 4[2000–01–18]. http://www.chinainfo.gov.cn/periodical/qbxb/qbxb99/qbxb990203. -[7] 储大同. 恶性肿瘤个体化治疗靶向药物的临床表现[J/OL]. 中华肿瘤杂志, 2010, 32(10): 721–724[2014–06–25]. http://www.sohu.com. doi: 10.7666/d.y351065. -[9] 储大同. 恶性肿瘤个体化治疗靶向药物的临床表现[J/OL]. 中华肿瘤杂志, 2010, 32(9/10): 721–724 [2014–06–25]. http://www.sohu.com. doi: 10.7666/d.y351065. - -[10] 丁文祥. 数字革命与竞争国际化[N]. 中国青年报, 2000–11–20(15). -[11] 傅刚, 赵承, 李佳路. 大风沙过后的思考[N/OL]. 北京青年报, 2000–04–12(14) [2005–07–12]. http://www.bjyouth.com.cn/Bqb/20000412/GB/4216%5ED0412B1401.htm. -[12] 刘裕国, 杨柳, 张洋, 等. 雾霾来袭,如何突围[N/OL]. 人民日报, 2013–01–12 [2013–11–06]. http://paper.people.com.cn. -[13] 张田勤. 犯罪 DNA 库与生命伦理学计划[N]. 大众科技报, 2000–11–12(7). - - - - -[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 2004, 50(6): 1312–1318. -[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 2004, 50(6). -[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 2004, 50: 1312–1318. -[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 2004(6): 1312–1318. -[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 50(6): 1312–1318. -[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 2004, 50. -[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 2004(6). -[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 50(6). -[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 2004: 1312–1318. -[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 50: 1312–1318. - -[1] 中国地质学会. 地质评论[J]. 1936, 1(1)–. 北京: [出版者不详], 1936–. -[2] 中国图书馆学会. 图书馆学通信[J]. 1957(1)–1990(4). 北京: 北京图书馆, 1957–1990. -[3] American Association for the Advancement of Science. Science[J]. 1883, 1(1)–. Washington, D.C.: [s.n.], 1883–. -[4] 中华医学会湖北分会. 临床内科杂志[J]. 1984, 1(1)–. 武汉: 中华医学会湖北分会, 1984–. -[8] 张敏莉, 易仕和, 赵玉新. 超声速短化喷管的设计和试验研究[J]. 空气动力学报, 2007, 25(4): 500–503. -[8] ZHANG M L, YI S H, ZHAO Y X. The design and experimental investigations of supersonic length shorted nozzle[J]. ACTA AERODYNAMICA SINICA, 2007, 25(4): 500–503. -[14] ANDERSEN J B, RAPPAPORT T S, YOSHIDA S. Propagation measurements and models for wireless communications channels[J]. IEEE Commun. Mag., 1995, 33(1): 42–49. -[15] ANDRISANO O, TRALLI V, VERDONE R. Millimeter waves for short-range multimedia communication systems[J]. Proc. IEEE, 1998, 86(7): 1383–1401. -[16] CAPLAN P. Cataloging internet resources[J]. The public Access Computer Systems Review, 1993, 4(2): 61–66. -[7] 储大同. 恶性肿瘤个体化治疗靶向药物的临床表现[J/OL]. 中华肿瘤杂志, 2010, 32(10): 721–724[2014–06–25]. http://www.sohu.com. doi: 10.7666/d.y351065. - - -[1] 韩吉人. 论职工教育的特点[G]//中国职工教育研究会. 职工教育研究论文集. 北京: 人民教育出版社, 1985: 90–99. -[2] FOURNEY M E. Advances in holographic photoelasticity[C]//Symposium on Applications of Holography in Mechanics, August 23-25, 1971, University of Southern California, Los Angeles, California. New York: ASME, 1971: 17–38. -[3] FOURNEY M E. Advances in holographic photoelasticity[C]//American Society of Mechanical Engineers.Applied Mechanics Division. Symposium on Applications of Holography in Mechanics, August 23-25, 1971. University of Southern California, Los Angeles, California. New York: ASME, 1971: 17–38. -[4] NEMEC B. Force control of redundant robots[C]//Processings of Symposium on Robot Control. [S.l.]: [s.n.], 1997: 209–214. -[5] 贾东琴, 柯平. 面向数字素养的高校图书馆数字服务体系研究[C]//中国图书馆学会. 中国图书馆学会年会论文集:2011 年卷. 北京: 国家图书馆出版社, 2011: 45–52. -[6] 裴丽生. 在中国科协技术期刊编辑工作经验交流会上的讲话[C]//中国科学技术协会学会工作部. 中国科协学术期刊编辑工作经验交流会资料选. 北京: 中国科学技术协会学会工作部, 1981: 2–10. -[7] 汪学军. 中国农业转基因生物研发进展与安全管理[C]//国家环境保护总局生物安全管理办公室. 中国国家生物安全框架实施国际合作项目研讨会论文集. 北京: 中国环境科学出版社, 2002: 22–25. -[8] 张忠智. 科技书刊的总编 (主编) 的角色要求[C]//中国科学技术期刊编辑学会学术委员会. 中国科学技术期刊编辑学会建会十周年学术研讨会论文汇编. 北京: 中国科学技术期刊编辑学会学术委员会, 1997: 33–34. -[9] CHOI J D, STARK W E. Performance analysis of ultra-wideband spread-spectrum communications in narrowband interference[C]//Proc. IEEE Military Commun. Conf. (MILCOM). Vol. 2. Anaheim, CA: [s.n.], 2002: 1075–1080. -[10] DARDARI D, PASOLINI G. Simple and accurate models for error probability evaluation of IEEE802.11 DS-SS physical interface in the presence of Bluetooth interference[C]//Proc. IEEE Global Telecommun. Conf. (GLOBECOM). Vol. 1. Taipei: [s.n.], 2002: 201–206. -[11] FIROOZBAKHSH B, PRATT T G, JAYANT N. Analysis of IEEE 802.11a interference on UWB systems[C]//Proc. of IEEE Conference on Ultrawideband Systems and Technologies (UWBST). Oulu, Finland: [s.n.], 2003: 473–477. -[12] FOERSTER J R. Interference modeling of pulse-based UWB waveforms on narrowband systems[C]//Proc. IEEE Veh. Technol. Conf. Vol. 4. Birmingham, AL: [s.n.], 2002: 1931–1935. -[13] FONTANA R J. An insight into UWB interference from a shot noise perspective[C]//Proc. of IEEE Conference on Ultrawideband Systems and Technologies (UWBST). Baltimore, MD: [s.n.], 2002: 309–313. -[14] GIORGETTI A. Coexistence of UWB and narrowband systems in Nakagami/Rice channels[C]//Proc. Int. Symp. on Wireless Personal Multimedia Commun. (WPMC). Aalborg, Denmark: [s.n.], 2005: 794–798. -[15] GIORGETTI A, CHIANI M, DARDARI D. Coexistence issues in cognitive radios based on ultra-wide bandwidth systems[C]//Proc. IEEE Int. Conf. on Cognitive Radio Oriented Wireless Net. and Comm. (CROWNCOM). Mykonos, Greece: [s.n.], 2006. -[16] LI Y, MOLISCH A F, ZHANG J. Practical approaches to channel estimation and interference suppression for OFDM based UWB communications[C]//Proc. of the IEEE 6th Circ. and Syst., Symp. on Emerging Technologies: Frontiers of Mobile and Wireless Communication. Vol. 1. [S.l.]: [s.n.], 2004: 21–24. -[17] NASRI A, SCHOBER R, LAMPE L. Performance Evaluation of BICM-OFDM Systems Impaired by UWB Interference[C]//Proc. IEEE Int. Conf. on Commun. Beijing, China: [s.n.], 2008: 3616–3621. -[18] PIAZZO L. UWB EM compatibility and coexistence issues[C]//Proc. 1st Int. Workshop on Networking with UWB. Rome, Italy: [s.n.], 2001. -[19] 陈志勇. 中国财税文化价值研究:“中国财税文化国际学术研讨会”论文集[C/OL]. 北京: 经济科学出版社, 2011 [2013–10–14]. http://apabi.lib.pku.edu.cn. -[20] 雷光春. 综合湿地管理: 综合湿地管理国际研讨会论文集[C]. 北京: 海洋出版社, 2012. -[21] ROSENTHALL E M. Proceedings of the Fifth Canadian Mathematical Congress, University of Montreal, 1961[C]. Toronto: University of Toronto Press, 1963. -[22] GANZHA V G, MAYR E W, VOROZHTSOV E V. Computer algebra in scientific computing:CASC 2000:proceedings of the Third Workshop on Computer Algebra in Scientific Computing, Samarkand, October 5-9, 2000[C]. Berlin: Springer, 2000. -[23] BABU B V, NAGAR A K, DEEP K, et al. Proceedings of the second international conference on soft computing for problem solving, December 28-30[C]. New Delhi: Springer, 2014. -[24] 中国力学学会. 第 3 届全国实验流体力学学术会议论文集[C]. 天津: [出版者不详], 1999. -[25] 中国社会科学院台湾史研究中心. 台湾光复六十五周年暨抗战史实学术研讨会论文集[C]. 北京: 九州出版社, 2012. - - -[8] LEHMAN P, KIME P, BORUVKA A, et al. The biblatex Package: Programmable Bibliographies and Citations[A]. version 2.8a. 2013. -[9] LEHMAN P, KIME P, BORUVKA A, et al. The Biblatex Package: Programmable Bibliographies and Citations[A]. 3.0. 2015. -[10] MITTELBACH F. An environment for multicolumn output[A]. 2015. -[11] OETIKER T, PARTL H, HYNA I, et al. The Not So Short Introduction to L ATEX 2ε[A]. 2011. -[12] ROBERTSON W, WILSON P, PRESS H. The ccaption package[A]. v3.2c. 2011. -[13] SOMMERFELDT A. Customizing captions of floating environments[A/OL]. 2011. http://sourceforge.net/projects/latex-caption/. -[14] UMEKI H. The geometry package[A]. v5.6. 2010. -[15] 胡振震. 符合 GB7714-2015 标准的 biblatex 参考文献样式文件[A]. 2016. -[16] 吴凌云. CTEX FAQ: 常见问题集[A]. version 0.4. 2007. -[17] 中国第一历史档案馆, 辽宁省档案馆. 中国明朝档案总汇[A]. 桂林: 广西师范大学出版社, 2001. -[18] 包太雷. LaTeX Notes: 雷太赫排版系统简介[Z]. 2013. -[1] CALKIN D, AGER A, THOMPSON M. A comparative risk assessment framework for wildland fire management: the 2010 cohesive strategy Science report:RMRS-GTR-262[R]. 2011: 8–9. -[2] EGGRERS A J. One-dimensional flows of an imperfect diatomic gas[R]. NACA report 959. -[3] HUMPHREY R L, WAGNER J L. The sonic throat method and real gas one-dimensional flow: an application to air and nitrogen[R]. AD 730029. 1971. -[4] U.S. Department of Transportation Federal Highway Administration. Guidelines for handling excavated acid-producing materials, PB 91-194001[R]. Springfield: U.S. Department of Commerce National Information Service, 1990. -[5] World Health Organization. Factors regulating the immune response: report of WHO Scientific Group[R]. Geneva: WHO, 1970. -[6] 汤万金, 杨跃翔, 刘文, 等. 人体安全重要技术标准研制最终报告:7178999X[R/OL]. 2013 [2014–06–24]. http://www.nstrs.org.cn. -[7] 中华人民共和国国务院新闻办公室. 国防白皮书: 中国武装力量的多样化运用[R/OL]. 2013 [2014–06–11]. http://www.mod.gov.cn. - -[1] Commonwealth libraries bureau of library development.Pennsylvania department of education office. Pennsylvania library laws[EB/OL]. [2013–03–24]. http://www.racc.edu. -[3] Omg Inc. Unified Modeling Language: Superstructure[EB/OL]. (2003). http://www.omg.org. -[4] Online Computer Library Center, Inc. History of OCLC[EB/OL]. [2000–01–08]. http://www.oclc.org/about/history/default.htm. -[2] HOPKINSON A. UNIMARC and metadata: Dublin Core[EB/OL]. [1999–12–08]. http://www.rfla.org/IV/rfla64/13801613.htm. -[5] 李强. 化解医患矛盾需釜底抽薪[EB/OL]. (2012–05–03) [2013–03–25]. http://wenku.baidu.com. -[6] 萧钰. 出版业信息化迈入快车道[EB/OL]. (2001–12–19) [2002–04–15]. http://www.creader.com/news/20011219/200112190019.html. -[7] WiMedia Alliance[EB/OL]. www.wimedia.org. -[8] Dublin Core metadata element set: version 1.1[EB/OL]. (2012–06–14) [2014–06–11]. http://dublincore.org. -[9] JabRef 中文手册[EB/OL]. http://blog.csdn.net/zd0303/article/details/7676807. -[10] PACS-L:the public-access computer systems forum[EB/OL]. (1989) [1995–05–17]. http://info.lib.uh.edu/pacsl.html. - -[33] 全国信息文献标准化技术委员会. 文献著录: 第 4 部分 非书资料:GB/T3792.4-2009[S]. 北京: 中国标准出版社, 2010: 3. -[34] 全国广播电视标准化技术委员会. 广播电视音像资料编目规范: 第 2 部分 广播资料:GY/T202.2-2007[S]. 北京: 国家广播电影电视局广播电视规划院, 2007: 1. -[35] 国家环境保护局科技标准司. 土壤环境质量标准:GB 15616-1995[S/OL]. 北京: 中国标准出版社, 1996: 2–3 [2013–10–14]. http://wenku.baidu.com. -[36] Information and documdocument-the Dublin core metadata element set:ISO 15836:2009[S/OL].[2013–03–24]. http://www.iso.org. -[40] 国家标准局信息分类编码研究所. 世界各国和地区名称代码 GB/T 2659-1986[S]//全国文献工作标准化技术委员会. 文献工作国家标准汇编: 3. 北京: 中国标准出版社, 1988: 59–92. -[41] 宋史卷三: 本纪第三[M/OL]//李承森. 宋史: 第 1 册. 北京: 中华书局, 2011: 11–12 [2013–05–09]. http://apabi.lib.pku.edu.cn. - -[1] CALMS R B. Infrared spectroscopic studies on solid oxygen[D]. Berkeley: Univ. of California, 1965. -[4] 张若凌. 高超声速非平衡流动的计算和实验研究[D]. 绵阳: 中国空气动力研究与发展中心, 2004. -[5] 张志祥. 间断动力系统的随机扰动及其在守恒律方程中的应用[D]. 北京: 北京大学数学学院, 1998. -[2] 马欢. 人类活动影响下海河流域典型区水循环变化分析[D/OL]. 北京: 清华大学, 2011: 27 [2013–10–14]. http://www.cnki.net. -[3] 吴云芳. 面向中文信息处理的现代汉语并列结构研究[D/OL]. 北京: 北京大学, 2003 [2013–10–14]. http://thesis.lib.pku.edu.cn. - -[2] 中国职工教育研究会. 职工教育研究论文集[G]. 北京: 人民教育出版社, 1985. -[1] 韩吉人. 论职工教育的特点[G]//中国职工教育研究会. 职工教育研究论文集. 北京: 人民教育出版社, 1985: 90–99. -[1] KOSEKI A, MOMOSE H, KAWAHITO M, et al. Compiler: US828402[P/OL]. 2002–05–25[2002–05–28]. http://FF&p=1&u=netahtml/PTO/search-bool.html&r=5&f=G&l=50&col=AND&d=PG01&sl=IBM.AS.&0S=AN/IBM&RS=AN/IBM. -[2] TACHIBANA R, SHIMIZU S, KOBAYSHI S, et al. Electronic watermarking method and system: US6915001[P/OL]. 2002–04–25 [2002–05–28]. http://patftuspto.gov/netacgi/nphParser?%20Seetl=PTO2&Sect2=HITOFF&=1&u=/netahhml/search-bool.html%20&r=1&f=G&1=50&col=AND&d=ptxt&sl=%60Electronic+watermarking+method+system'.TTL.&OS=TTL/. -[3] 河北绿洲生态环境科技有限公司. 一种荒漠化地区生态植被综合培育种植方法: 01129210.5[P/OL]. 2001–10–24 [2002–05–28]. http://211.152.9.47/sipoasp/zlijs/hyjs-yx-new.asp?recid=01129210.5&leixin.27 -[4] 姜锡洲. 一种温热外敷药制备方案: 中国: 88105607.3[P]. 1989–07–26. -[5] 刘加林. 多功能一次性压舌板: 92214985.2[P]. 1993–04–14. -[6] 西安电子科技大学. 光折变自适应光外差探测方法: 01128777.2[P/OL]. 2002–03–06 [2002–05–28]. http://211.152.9.47/sipoasp/zljs/hyjs-yx-new.asp?recid=01128777.2&leixin=0. -[7] 张凯军. 轨道火车及高速轨道火车紧急安全制动辅助装置: 201220158825.2[P]. 2012–04–05. - -[1] Commonwealth libraries bureau of library development.Pennsylvania department of education office. Pennsylvania library laws[EB/OL]. [2013–03–24]. http://www.racc.edu. -[2] HOPKINSON A. UNIMARC and metadata: Dublin Core[EB/OL]. [1999–12–08]. http://www.rfla.org/IV/rfla64/13801613.htm. -[3] Omg Inc. Unified Modeling Language: Superstructure[EB/OL]. (2003). http://www.omg.org. -[4] Online Computer Library Center, Inc. History of OCLC[EB/OL]. [2000–01–08]. http://www.oclc.org/about/history/default.htm. -[5] 李强. 化解医患矛盾需釜底抽薪[EB/OL]. (2012–05–03) [2013–03–25]. http://wenku.baidu.com. -[6] 萧钰. 出版业信息化迈入快车道[EB/OL]. (2001–12–19) [2002–04–15]. http://www.creader.com/news/20011219/200112190019.html. -[7] WiMedia Alliance[EB/OL]. www.wimedia.org. -[8] Dublin Core metadata element set: version 1.1[EB/OL]. (2012–06–14) [2014–06–11]. http://dublincore.org. -[9] JabRef 中文手册[EB/OL]. http://blog.csdn.net/zd0303/article/details/7676807. -[10] PACS-L:the public-access computer systems forum[EB/OL]. (1989) [1995–05–17]. http://info.lib.uh.edu/pacsl.html. - -[38] 白书农. 植物开花研究[M]//李承森. 植物科学进展. 北京: 高等教育出版社, 1998: 146–163. -[42] 楼梦麟, 杨燕. 汶川地震基岩地震动特征分析[M/OL]//同济大学土木工程防灾国家重点实验室. 汶川地震震害研究. 上海: 同济大学出版社, 2011: 11–12 [2013–05–09]. http://apabi.lib.pku.edu.cn. DOI: AFAC1212121. -[42] 楼梦麟, 杨燕. 汶川地震基岩地震动特征分析[M/OL]//同济大学土木工程防灾国家重点实验室. 汶川地震震害研究. 上海: 同济大学出版社: 11–12 [2013–05–09]. http://apabi.lib.pku.edu.cn. DOI: AFAC1212121. -[42] 楼梦麟, 杨燕. 汶川地震基岩地震动特征分析[M/OL]//同济大学土木工程防灾国家重点实验室. 汶川地震震害研究. 上海: 同济大学出版社, 2011[2013–05–09]. http://apabi.lib.pku.edu.cn. DOI: AFAC1212121. -[42] 楼梦麟, 杨燕. 汶川地震基岩地震动特征分析[M/OL]//同济大学土木工程防灾国家重点实验室. 汶川地震震害研究. 上海: 同济大学出版社[2013–05–09]. http://apabi.lib.pku.edu.cn. DOI: AFAC1212121. -[41] 宋史卷三: 本纪第三[M/OL]//李承森. 宋史colon第 1 册. 北京: 中华书局, 2011: 11–12 [2013–05–09]. http://apabi.lib.pku.edu.cn. -[41] 宋史卷三: 本纪第三[M]//李承森. 宋史colon第 1 册. 北京: 中华书局. -[41] 宋史卷三: 本纪第三[M]//宋史: 第 1 册. 北京: 中华书局. -[41] 宋史卷三: 本纪第三[M]//宋史. 北京: 中华书局. -[37] 卷 39 乞致任第一[M]//苏魏公文集: 下册. 北京: 中华书局, 1988: 590. -[41] 宋史卷三: 本纪第三[M]//宋史: 第 1 册. 北京: 中华书局, 1977: 49. -[43] BUSECK P R, NORD G L Jr., VEBLEN D R. Subsolidus phenomena in pyroxenes[M]//PREWITT C. Pyroxense. Washington, D.C.: Mineralogical Society of America, 1980: 117–211. -[42] 楼梦麟, 杨燕. 汶川地震基岩地震动特征分析[M]//同济大学土木工程防灾国家重点实验室. 汶川地震震害研究. 上海: 同济大学出版社, 2011: 11–12. -[33] POISEL R A. 通信电子战原理[M/OL]. 聂皞, 王振华, 陈少昌, 等, 译. 2 版. 北京: 电子工业出版社[2013–08–01]. http://www.baidu.com. DOI: AFAC1212121. -[33] POISEL R A. 通信电子战原理[M/OL]. 聂皞, 王振华, 陈少昌, 等, 译. 2 版. 北京: 电子工业出版社: 23–26 [2013–08–01]. http://www.baidu.com. DOI: AFAC1212121. -[33] POISEL R A. 通信电子战原理[M/OL]. 聂皞, 王振华, 陈少昌, 等, 译. 2 版. 北京: 电子工业出版社, 2013: 23–26 [2013–08–01]. http://www.baidu.com. DOI: AFAC1212121. -[33] 赵学功. 当代美国外交[M/OL]. [出版地不详]: 社会科学文献出版社, 2001 [2014–06–11]. http://www.baidu.com. -[3] 余敏. 出版集团研究[M/OL]. 北京: 中国书籍出版社, 2001. www.bla~bla.org. -[10] 余敏. 出版集团研究[M/OL]. 北京: 中国书籍出版社, 2001: 179–193 [2001–08–04]. http://www.baidu.com. -[11] 候文顺. 高分子物理: 高分子材料分析、选择与改性[M/OL]. 北京: 化学工业出版社, 2010: 119[2012–11–27]. http://apabi.lib.pku.edu.cn. -[15] KINCHY A. Seeds, Sciences, and struggle : the global politics of transgenic crops[M/OL]. Cambridge,Mass.: MIT Press, 2012: 50 [2013–07–14]. http://lib.myilibary.com. -[16] PRAETZELLIS A. Death by theory: a tale of mystery and archaeological theory[M/OL]. Rev.ed. [S.l.]: Rowman & Littlefield Publishing Group, Inc., 2011: 13 [2012–07–26]. http://lib.myilibrary.com. -[15] KINCHY A. Seeds, Sciences, and struggle : the global politics of transgenic crops[M]. Cambridge,Mass.: MIT Press, 2012: 50. -[22] 易仕和, 赵玉新, 何霖, 等. 超声速和高超声速喷管设计[M]. 北京: 国防工业出版社, 2013. -[24] MIROSLAV D L, DEJAN V T, BRIAN L E. 信号处理滤波器设计-基于 matlab 和 mathematica 的设计方法[M]. 朱义胜, 董辉, 译. 北京: 电子工业出版社, 2004. -[25] 蔡敏, 徐慧慧, 黄柄强. UML 基础和 Rose 建模教程[M]. 北京: 人民邮电出版社, 2006. -[33] POISEL R A. 通信电子战原理[M]. 聂皞, 王振华, 陈少昌, 等, 译. 2 版. 北京: 电子工业出版社, 2013: 23–26. -[27] SIMON M K, OMURA J K, SCHOLTZ R A, et al. Spread Spectrum Communications Handbook[M]. New York City: McGraw-Hill, Inc., 2001. -[23] Von PEEBLES P Z Jr, LIN S, DANIEL COSTELLO J. Probability, random variable, and random signal Principles[M]. 4th ed. New York: McGraw-Hill, 2001: 100. -[22] YI S H, ZHAO Y X, HE L, et al. Supersonic and hypersonic nozzle design[M]. BeiJing: National Defense Industry Press, 2013. -[41] LIN S, DANIEL COSTELLO J. Error Control Coding[M]. Second Edition. Englewood Cliffs: NJ:Prentice Hall, 2004. -[45] PROAKIS J G, MANOLAKIS D G. Digital signal processing: Principles,algorithms, and applications[M]. 第 4 版. 北京: 电子工业出版社, 2007. -[46] REED J H. An Introduction to Ultrawideband Communication Systems[M]. Upper Saddle River: NJ: Prentice Hall, 2005. -[47] ROOD H J. Logic and structured design for computer programmers[M]. 3rd ed. [S.l.]: Brooks/ColeThomson Learning, 2001. -[48] ROSS S M. 概率论基础教程[M]. 郑忠国, 詹从赞, 译. 第 8 版. 北京: 人民邮电出版社, 2010. -[49] SIMON M K, ALOUINI M S. Digital Communication over Fading Channels[M]. Hoboken: NJ: Wiley-IEEE Press, 2004. -[50] STUBER G L. Principles of Mobile Communication[M]. Second Edition. Norwell: MA: Kluwer Academic Publishers, 2001. -[51] YUFIN S A. Geoecology and computers: proceedings of the Third International Conference on Advances of Computer Methods in Geotechnical and Geoenvironmental Engineering, Moscow, Russia, February 1-4, 2000[M]. Rotterdam: A. A. Balkema, 2000. -[52] 埃伯哈德 蔡德勒, 等. 数学指南-实用数学手册[M]. 李文林等, 译. 北京: 科学出版社, 2012. -[53] 陈希孺. 概率论与数理统计[M]. 合肥: 中国科学技术大学出版社, 2009. -[54] 陈志杰, 赵书钦, 李树钧, 等. LaTeX 入门与提高[M]. 第二版. 北京: 高等教育出版社, 2010. -[1] 张伯伟. 全唐五代诗格会考[M]. 南京: 江苏古籍出版社, 2002: 288. -[2] 师伏堂日记: 第 4 册[M]. 北京: 北京图书馆出版社, 2009: 155. -[3] 胡承正, 周详, 缪灵. 理论物理概论: 上[M]. 武汉: 武汉大学出版社, 2010: 112. -[4] 美国妇产科医师学会. 新生儿脑病和脑性瘫痪发病机制与病理生理[M]. 段涛, 杨慧霞, 译. 北京: 人民卫生出版社, 2010: 38–39. -[5] 康熙字典: 已集上: 水部[M]. 同文书局影印本. 北京: 中华书局, 1962: 50. -[6] 汪昂. 增订本草备要: 四卷[M]. 刻本. 上海: 老二酉堂. -[7] 蒋有绪, 郭泉水, 马娟, 等. 中国森林群落分类及其群落学特征[M]. 北京: 科学出版社, 1998. -[8] 中国企业投资协会, 台湾并购与私募股权协会, 汇盈国际投资集团. 投资台湾: 大陆企业赴台投资指南[M]. 北京: 九州出版社, 2013. -[9] 罗斯基. 战前中国经济的增长[M]. 唐巧天, 毛立坤, 姜修宪, 译. 杭州: 浙江大学出版社, 2009. -[10] 库恩. 科学革命的结构: 第 4 版[M]. 金吾伦, 胡新和, 译. 2 版. 北京: 北京大学出版社, 2012. -[12] CRAWFPRD W, GORMAN M. Future libraries:dreams, maddness, & reality[M]. Chicago: American Library Association, 1995. -[13] International Federation of Library Association and Institutions. Names of persons: national usages for entry in catalogues[M]. 3rd ed. London: IFLA International Office for UBC, 1977. -[14] O’BRIEN J A. Introduction to information systems[M]. 7th ed. Burr Ridge, III.: Irwin, 1994. -[10] 库恩, 余敏, 阿飞, 等. 科学革命的结构: 第 4 版[M]. 金吾伦, 胡新和, 译. 北京: 北京大学出版社, 2012. -[10] 库恩. 科学革命的结构: 第 4 版[M]. 北京: 北京大学出版社, 2012. -[10] 库恩. 科学革命的结构: 第 4 版[M]. 金吾伦, 胡新和, 译. 2 版. 北京: 北京大学出版社, 2012. -[8] 余敏. 出版集团研究[M]. 3 版. 北京: 中国书籍出版社, 2001. DOI: AFAC1212121. -[1] 余敏. 出版集团研究[M]. 北京: 中国书籍出版社. DOI: AFAC1212121. -[1] 余敏. 出版集团研究[M]. 北京: 中国书籍出版社: 179–193. DOI: AFAC1212121. -[11] 出版集团研究[M]. 北京: 中国书籍出版社, 2001: 179–193. -[8] 余敏. 出版集团研究[M]. 北京: 中国书籍出版社, 2001: 179–193.DOI:AFAC1212121. -[7] 余敏. 出版集团研究[M]. 北京: 中国书籍出版社, 2001: 179–193. -[2] 余敏. 出版集团研究[M]. [出版地不详]: 中国书籍出版社, 2001: 179–193. -[4] 余敏. 出版集团研究[M]. 北京: [出版者不详], 2001. -[5] 余敏. 出版集团研究[M]. 北京: [出版者不详]. -[6] 余敏. 出版集团研究[M]. 北京: [出版者不详], 2001: 20–30. -[9] 余敏. 出版集团研究[M]. 2 版. 北京: 中国书籍出版社, 2001: 179–193. -[11] 出版集团研究[M]. 北京: 中国书籍出版社, 2001: 179–193. -[12] PARSONS. The Mobile Radio Propagation Channel[M]. 2nd ed. Hoboken: John Wiley, Sons,2000. -[13] Parsons. The Mobile Radio Propagation Channel[M]. 2nd ed. Hoboken: John Wiley, Sons, 2000. -[14] PARSONS J D. The Mobile Radio Propagation Channel[M]. 2nd ed. Hoboken: John Wiley,Sons, 2000. -[15] PARSONS J D. The Mobile Radio Propagation Channel[M]. 2nd ed. Hoboken: John Wiley,Sons. -[16] PARSONS J D. The Mobile Radio Propagation Channel[M]. 2nd ed. [S.l.]: John Wiley, Sons,2000. -[17] PARSONS J D. The Mobile Radio Propagation Channel[M]. 2nd ed. Hoboken: [s.n.], 2000. -[18] PARSONS J D. The Mobile Radio Propagation Channel[M]. 2nd ed. Hoboken: [s.n.]. -[19] PARSONS J D. The Mobile Radio Propagation Channel[M]. 2nd ed. Hoboken: [s.n.], 2000: 15–20. \ No newline at end of file diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714texttobib.pl b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714texttobib.pl deleted file mode 100644 index 1b8dc7be36..0000000000 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714texttobib.pl +++ /dev/null @@ -1,1670 +0,0 @@ -##% -##% --------------------------------------------------------------- -##% gb7714texttobib--- A transformation tool for GB/T 7714-2015 style -##% bibliography text to bib source file -##% -##% Maintained by huzhenzhen -##% Homepage: -##% history: -##% 2017/02/26 v1.0g -##% E-mail: -##% hzzmail@163.com -##% Released under the LaTeX Project Public License v1.3c or later -##% usage: -##% perl gb7714texttobib.pl in=textfilename out=bibfilename -##% options(need to do): -##% style=ay or default -##% key=ay or default -##% -##% --------------------------------------------------------------- -#%Target:: 将pdf文档中拷出的参考文献文本转换成bib文件,文本文件中的一条参考文献为一行 -#%Method:: 利用perl进行文本处理,处理和判断的两个重要方面是: -# 分析分割后的文本的位置和内容,使用的是正则表达式匹配,主要两种方式 -# 1.根据标点和本文特征一部分一部分的解析,比如book条目处理 -# 2.直接列出所有可能的正则表达式一个个匹配,比如article条目处理 -#%Date :: 2017-02-22 -#%Note :: 1.网址之类如果解析出错,应确认其前导词http://之前没有空格 -# 2.有些以.连接有从属关系的机构作者,可以把.后的空格去掉便于正确解析 -# 3.有些尽管解析到的域不是真实的域,但不影响著录格式(显示效果),相应条目的域 -# 可以在bib文件中完善,尽管从实用角度并不需要这么做。 -# -##% --------------------------------------------------------------- -##% todo: 1. pdf 的比较? -##% obsolete intro: -##% 1.源文件文档如果个别地方不符合规范,可以修改一下 -##% (a):inbook/standard类中,当出现//后面第二项是booktitle且其中存在:时,先把父标题的冒号改成colon,比如 -##% [M]//李承森. 宋史: 第 1 册. 北京: 中华书局. 应把宋史后的冒号改掉 -##% [S]//全国文献工作标准化技术委员会. 文献工作国家标准汇编: 3. 北京: 中国标准出版社, 1988: 59–92. -##% --------------------------------------------------------------- - - -foreach $file(@ARGV){ - print 'file:',$file,"\n"; - if($file=~m/in=/){ - ($infile)=($file=~m/in=(.*)/) - } - if($file=~m/out=/){ - ($outfile)=($file=~m/out=(.*)/) - } -} - -open (FHR,"<$infile"); -open (FHW,">$outfile"); -print FHW '% Encoding: UTF-8',"\n"; - -@references=;#将所有的文献存为@references数组,各文献以<行>为单位进行区分 - -$ns=1; -$ne=@references; -$nline=0; -foreach $reference(@references){ - - $nline=$nline+1; - if($nline<$ns){next;} #先跳过几行进行,配合后面的last进行当行测试 - - while($reference=~m/–/){ - $reference=~s/–/-/;#直接利用正则表达式更正页码/日期/网址中的连字符 - } - print "$reference ";#打印各文献的内容 - - undef $entrytype; - undef $author; - undef $title; - undef $journal; - undef $translator; - undef $bookauthor; - undef $booktitle; - undef $version; - undef $address; - undef $publisher; - undef $institution; - undef $year; - undef $type; - undef $date; - undef $volume; - undef $number; - undef $pages; - undef $eventdate; - undef $urldate; - undef $url; - undef $doi; - undef $note; - undef $eventyvn; - undef $endeventyvn; - undef $eventdate; - undef $eventvol; - undef $eventnum; - undef $endeventdate; - undef $endeventvol; - undef $endeventnum; - - #--------------------------------------------------------------- - #条目类型:期刊和期刊中析出的文献/periodical、article - #--------------------------------------------------------------- - if(1){ - if($reference=~m/\[J\]/){ - if($reference=~m/:\s/ and $reference=~m/:\s\D/){#根据存在出版社前的冒号加空格区分 - print 'this entry is periodical',"\n"; - $entrytype='periodical'; - }else{ - print 'this entry is article',"\n"; - $entrytype='article'; - } - } - - if($entrytype eq 'periodical'){#字符串比较用eq而数字比较用==,如果用==那么两边都是1,则是真 - $regexformach='\[J\]\.'; - &bfidentifier; - - ($preadderess, $pospublisher)=($reference=~m/\[J\]\.(.*):\s(.*)/); - print 'preadderess =',$preadderess,"\n"; - print 'pospublisher=',$pospublisher,"\n"; - ($eventyear, $address)=($preadderess=~m/(.*)\.\s(.*)/); - print 'eventyear =',$eventyear,"\n"; - print 'address =',$address,"\n"; - ($eventyvn, $endeventyvn)=($eventyear=~m/(.*)\-(.*)/);#yvn表示year,volume,number - print 'eventyvn =',$eventyvn,"\n"; - print 'endeventyvn =',$endeventyvn,"\n"; - if($eventyvn=~m/.*,.*/){#存在逗号表明有卷信息 - ($eventdate, $eventvol, $eventnum)=($eventyvn=~m/\s*(.*),\s(.*)\((.*)\)/);#yvn表示year,volume,number - print 'eventdate =',$eventdate,"\n"; - print 'eventvol =',$eventvol,"\n"; - print 'eventnum =',$eventnum,"\n"; - if($endeventyvn){ - ($endeventdate, $endeventvol, $endeventnum)=($endeventyvn=~m/\s*(.*),\s(.*)\((.*)\)/);#yvn表示year,volume,number - print 'endeventdate =',$endeventdate,"\n"; - print 'endeventvol =',$endeventvol,"\n"; - print 'endeventnum =',$endeventnum,"\n"; - } - }else{ - ($eventdate, $eventnum)=($eventyvn=~m/\s*(.*)\((.*)\)/);#yvn表示year,volume,number - print 'eventdate =',$eventdate,"\n"; - print 'eventvol =',$eventvol,"\n"; - print 'eventnum =',$eventnum,"\n"; - if($endeventyvn){ - ($endeventdate, $endeventnum)=($endeventyvn=~m/\s*(.*)\((.*)\)/);#yvn表示year,volume,number - print 'endeventdate =',$endeventdate,"\n"; - print 'endeventvol =',$endeventvol,"\n"; - print 'endeventnum =',$endeventnum,"\n"; - } - } - if($endeventdate){ - $date=$eventdate.'-'.$endeventdate; - }else{ - $date=$eventdate - } - if($endeventvol){ - $volume=$eventvol.'-'.$endeventvol; - }else{ - $volume=$eventvol - } - if($endeventnum){ - $number=$eventnum.'-'.$endeventnum; - }else{ - $number=$eventnum - } - print 'date =',$date,"\n"; - print 'volume =',$volume,"\n"; - print 'number =',$number,"\n"; - ($publisher)=($pospublisher=~m/(.*),/); - print 'publisher =',$publisher,"\n"; - } - - if($entrytype eq 'article'){ - $regexformach='\[J\]\.'; - &bfidentifier; - - $flagmatched=0; - $regexbfjournal='\]\.\s(.*),\s(.*),\s(.*)\((.*)\):\s(.*)\.';#包括全部信息 - if($reference=~m/$regexbfjournal/){ - ($journal,$date,$volume,$number,$pages)=($reference=~m/$regexbfjournal/); - $flagmatched=1; - print '包括全部信息',"\n"; - } - $regexbfjournal='\]\.\s(.*),\s(.*),\s(.*)\((.*)\)\.';#没有页码 - if($reference=~m/$regexbfjournal/ and $flagmatched==0){ - ($journal,$date,$volume,$number)=($reference=~m/$regexbfjournal/); - $flagmatched=1; - print '没有页码',"\n"; - } - $regexbfjournal='\]\.\s(.*),\s(.*),\s(.*):\s(.*)\.';#没有期 - if($reference=~m/$regexbfjournal/ and $flagmatched==0){ - ($journal,$date,$volume,$pages)=($reference=~m/$regexbfjournal/); - $flagmatched=1; - print '没有期',"\n"; - } - $regexbfjournal='\]\.\s(.*),\s(.*)\((.*)\):\s(.*)\.';#没有卷/年 - if($reference=~m/$regexbfjournal/ and $flagmatched==0){ - ($journal,$date,$number,$pages)=($reference=~m/$regexbfjournal/); - $flagmatched=1; - if($date!~m/\d{4}/){ - $volume=$date; - $date=''; - } - print '没有卷/年',"\n"; - } - $regexbfjournal='\]\.\s(.*),\s(.*),\s(.*)\.';#没有页码,期 - if($reference=~m/$regexbfjournal/ and $flagmatched==0){ - ($journal,$date,$volume)=($reference=~m/$regexbfjournal/); - $flagmatched=1; - print '没有页码,期',"\n"; - } - $regexbfjournal='\]\.\s(.*),\s(.*)\((.*)\)\.';#没有页码,卷/年 - if($reference=~m/$regexbfjournal/ and $flagmatched==0){ - ($journal,$date,$number)=($reference=~m/$regexbfjournal/); - $flagmatched=1; - if($date!~m/\d{4}/){ - $volume=$date; - $date=''; - } - print '没有页码,卷/年',"\n"; - } - $regexbfjournal='\]\.\s(.*),\s(.*):\s(.*)\.';#没有卷/年,期 - if($reference=~m/$regexbfjournal/ and $flagmatched==0){ - ($journal,$date,$pages)=($reference=~m/$regexbfjournal/); - $flagmatched=1; - if($date!~m/\d{4}/){ - $volume=$date; - $date=''; - } - print '没有卷/年,期',"\n"; - } - - if($flagmatched==0){ - print 'the text after title was not matched, please add a regex for the current entry in the perl source code!',"\n"; - print '当前条目标题之后的内容没有匹配的正则表达式,请在perl代码中增加适合该条目正则表达式!',"\n"; - } - - print 'journal =',$journal,"\n"; - print 'date =',$date,"\n"; - print 'volume =',$volume,"\n"; - print 'number =',$number,"\n"; - print 'pages =',$pages,"\n"; - - } - - #判断期刊中析出的文献,带url - if($reference=~m/\[J\/OL\]/){ - print 'this entry is article with url',"\n"; - $entrytype='article'; - - $regexformach='\[J\/OL\]\.'; - &bfidentifier; - - ($postitle)=($reference=~m/\[J\/OL\]\.\s(.*)/); - if($postitle=~m/\[.*\]/){#存在urldate - ($preurldate,$urldate,$posurl)=($postitle=~m/(.*)\[(.*)\]\.\s(.*)/); - }else{#不存在urldate - ($preurldate,$posurl)=($postitle=~m/(.*)(http:.*)/); - } - unless($preurldate=~m/\.$/){$preurldate=$preurldate.'.';}#加个点统一上面两种方式 - - #处理url和doi - $regexposurl='(.*)doi:\s(.*)';#处理url和doi - if($posurl=~m/$regexposurl/i){ - ($url,$doi)=($posurl=~m/$regexposurl/i); - }else{ - $url=$posurl; - } - - #处理urldate前的内容,基本article不带url的情况相同 - $flagmatched=0; - $regexbfjournal='(.*),\s(.*),\s(.*)\((.*)\):\s(.*)\.';#包括全部信息 - if($preurldate=~m/$regexbfjournal/ and $flagmatched==0){ - ($journal,$date,$volume,$number,$pages)=($preurldate=~m/$regexbfjournal/); - $flagmatched=1; - } - $regexbfjournal='(.*),\s(.*),\s(.*)\((.*)\)\.';#没有页码 - if($preurldate=~m/$regexbfjournal/ and $flagmatched==0){ - ($journal,$date,$volume,$number)=($preurldate=~m/$regexbfjournal/); - $flagmatched=1; - } - $regexbfjournal='(.*),\s(.*),\s(.*):\s(.*)\.';#没有期 - if($preurldate=~m/$regexbfjournal/ and $flagmatched==0){ - ($journal,$date,$volume,$pages)=($preurldate=~m/$regexbfjournal/); - $flagmatched=1; - } - $regexbfjournal='(.*),\s(.*)\((.*)\):\s(.*)\.';#没有卷/年 - if($preurldate=~m/$regexbfjournal/ and $flagmatched==0){ - ($journal,$date,$number,$pages)=($preurldate=~m/$regexbfjournal/); - $flagmatched=1; - if($date!~m/\d{4}/){ - $volume=$date; - $date=''; - } - } - $regexbfjournal='(.*),\s(.*),\s(.*)\.';#没有页码,期 - if($preurldate=~m/$regexbfjournal/ and $flagmatched==0){ - ($journal,$date,$volume)=($preurldate=~m/$regexbfjournal/); - $flagmatched=1; - } - $regexbfjournal='(.*),\s(.*)\((.*)\)\.';#没有页码,卷/年 - if($preurldate=~m/$regexbfjournal/ and $flagmatched==0){ - ($journal,$date,$number)=($preurldate=~m/$regexbfjournal/); - $flagmatched=1; - if($date!~m/\d{4}/){ - $volume=$date; - $date=''; - } - } - $regexbfjournal='(.*),\s(.*):\s(.*)\.';#没有卷/年,期 - if($preurldate=~m/$regexbfjournal/ and $flagmatched==0){ - ($journal,$date,$pages)=($preurldate=~m/$regexbfjournal/); - $flagmatched=1; - if($date!~m/\d{4}/){ - $volume=$date; - $date=''; - } - } - - if($flagmatched==0){ - print 'the text after title was not matched, please add a regex for the current entry in the perl source code!',"\n"; - print '当前条目标题之后的内容没有匹配的正则表达式,请在perl代码中增加适合该条目正则表达式!',"\n"; - } - - print 'journal =',$journal,"\n"; - print 'date =',$date,"\n"; - print 'volume =',$volume,"\n"; - print 'number =',$number,"\n"; - print 'pages =',$pages,"\n"; - print 'urldate =',$urldate,"\n"; - print 'url =',$url,"\n"; - print 'doi =',$doi,"\n"; - - - } - } - - #--------------------------------------------------------------- - #条目类型:判断报纸中析出的文献/newspaper - #--------------------------------------------------------------- - if(1){ - if($reference=~m/\[N\]/){ - print 'this entry is newspaper',"\n"; - $entrytype='newspaper'; - $note='news'; - $regexnewsflag='\[N\]'; - $onlineflag=0; - } - if($reference=~m/\[N\/OL\]/){ - print 'this entry is newspaper with url',"\n"; - $entrytype='newspaper'; - $note='news'; - $regexnewsflag='\[N\/OL\]'; - $onlineflag=1; - } - if($entrytype eq 'newspaper'){ - if($onlineflag==1){ - $regexformach='\[N\/OL\]'; - &bfidentifier; - - print 'has url',"\n"; - $flagmatched=0; - $regexnewspostitle='\.\s(.*),\s(.*)\((.*)\)\s*\[(.*)\]\.\s(.*)'; - if($reference=~m/$regexnewsflag$regexnewspostitle/ and $flagmatched==0){ - $flagmatched=1; - ($journal,$date,$number,$urldate,$posurl)=($reference=~m/$regexnewsflag$regexnewspostitle/);} - $regexnewspostitle='\.\s(.*),\s(.*)\s*\[(.*)\]\.\s(.*)'; - if($reference=~m/$regexnewsflag$regexnewspostitle/ and $flagmatched==0){ - $flagmatched=1; - ($journal,$date,$urldate,$posurl)=($reference=~m/$regexnewsflag$regexnewspostitle/);} - if($flagmatched==0){ - print 'the text after title was not matched, please add a regex for the current entry in the perl source code!',"\n"; - print '当前条目标题之后的内容没有匹配的正则表达式,请在perl代码中增加适合该条目正则表达式!',"\n"; - } - }else{ - $regexformach='\[N\]'; - &bfidentifier; - - print 'no url',"\n"; - $regexnewspostitle='\.\s(.*),\s(.*)\((.*)\)'; - ($journal,$date,$number)=($reference=~m/$regexnewsflag$regexnewspostitle/); - } - #处理url和doi - $regexposurl='(.*)doi:\s(.*)';#处理url和doi - if($posurl=~m/$regexposurl/i){ - ($url,$doi)=($posurl=~m/$regexposurl/i); - }else{ - $url=$posurl; - } - - # print 'journal =',$journal,"\n"; - # print 'date =',$date,"\n"; - # print 'volume =',$volume,"\n"; - # print 'number =',$number,"\n"; - # print 'pages =',$pages,"\n"; - # print 'urldate =',$urldate,"\n"; - # print 'url =',$url,"\n"; - # print 'doi =',$doi,"\n"; - } - } - - - #--------------------------------------------------------------- - #条目类型:论文集中析出的文献/inproceedings - #--------------------------------------------------------------- - if(1){#\/\/ - if ($reference=~m/\[C\/OL\]\/\//){ - $entrytype='inproceedings'; - print "this entry's type is: $entrytype with url\n"; - $regexformach='\[C\/OL\]\/\/'; - &bfidentifier; - - $regexformach='C\/OL\]\/\/'; - &bfaddressinbook; - - &afpublisherbookurl; - }elsif($reference=~m/\[C\]\/\//){ - $entrytype='inproceedings'; - print "this entry's type is: $entrytype \n"; - $regexformach='\[C\]\/\/'; - &bfidentifier; - - $regexformach='C\]\/\/'; - &bfaddressinbook; - - &afpublisherbook; - } - - if ($entrytype eq 'inproceedings'){ - if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.] - $address=""; - } - if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.] - $publisher=""; - } - $date=$year; - } - - } - - - #--------------------------------------------------------------- - #条目类型:论文集/proceedings - #--------------------------------------------------------------- - if(1){ - if ($reference=~m/\[C\/OL\]\./){ - $entrytype='proceedings'; - print "this entry's type is: $entrytype with url\n"; - $regexformach='\[C\/OL\]\.'; - &bfidentifier; - - $regexformach='C\/OL\]\.'; - &bfaddressbook; - - &afpublisherbookurl; - }elsif($reference=~m/\[C\]\./){ - $entrytype='proceedings'; - print "this entry's type is: $entrytype \n"; - $regexformach='\[C\]\.'; - &bfidentifier; - - $regexformach='C\]\.'; - &bfaddressbook; - - &afpublisherbook; - } - - if ($entrytype eq 'proceedings'){ - if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.] - $address=""; - } - if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.] - $publisher=""; - } - $date=$year; - print 'date=',"$date"; - } - } - - - - - #--------------------------------------------------------------- - #条目类型:未出版物/unpublished - #--------------------------------------------------------------- - if(1){ - if ($reference=~m/\[Z\/OL\]\./){ - $entrytype='unpublished'; - print "this entry's type is: $entrytype with url\n"; - $regexformach='\[Z\/OL\]\.'; - &bfidentifier; - - $regexformach='Z\/OL\]\.'; - &bfaddressbook; - - &afpublisherbookurlb; - }elsif($reference=~m/\[Z\]\./){ - $entrytype='unpublished'; - print "this entry's type is: $entrytype \n"; - $regexformach='\[Z\]\.'; - &bfidentifier; - - $regexformach='Z\]\.'; - &bfaddressbook; - - &afpublisherbookb; - } - - if ($entrytype eq 'unpublished'){ - $date=$year; - print 'date=',"$date"; - } - } - - - #--------------------------------------------------------------- - #条目类型:手册、档案/manual - #--------------------------------------------------------------- - if(1){ - if ($reference=~m/\[A\/OL\]\./){ - $entrytype='manual'; - print "this entry's type is: $entrytype with url\n"; - $regexformach='\[A\/OL\]\.'; - &bfidentifier; - - $regexformach='A\/OL\]\.'; - &bfaddressbook; - - &afpublisherbookurlb; - }elsif($reference=~m/\[A\]\./){ - $entrytype='manual'; - print "this entry's type is: $entrytype \n"; - $regexformach='\[A\]\.'; - &bfidentifier; - - $regexformach='A\]\.'; - &bfaddressbook; - - &afpublisherbookb; - } - - if ($entrytype eq 'manual'){ - $date=$year; - print 'date=',"$date"; - } - } - - - - #--------------------------------------------------------------- - #条目类型:报告/report - #--------------------------------------------------------------- - if(1){ - if ($reference=~m/\[R\/OL\]\./){ - $entrytype='report'; - print "this entry's type is: $entrytype with url\n"; - $regexformach='\[R\/OL\]\.'; - &bfidentifier; - - $regexformach='R\/OL\]\.'; - &bfaddressbook; - - &afpublisherbookurlb; - }elsif($reference=~m/\[R\]\./){ - $entrytype='report'; - print "this entry's type is: $entrytype \n"; - $regexformach='\[R\]\.'; - &bfidentifier; - - $regexformach='R\]\.'; - &bfaddressbook; - - &afpublisherbookb; - } - - if ($entrytype eq 'report'){ - $date=$year; - print 'date=',"$date"; - } - - } - - #--------------------------------------------------------------- - #条目类型:标准/standard - #--------------------------------------------------------------- - if(1){ - if ($reference=~m/\[S\/OL\]\./){ - $entrytype='standard'; - print "this entry's type is: $entrytype with url\n"; - $regexformach='\[S\/OL\]\.'; - &bfidentifier; - - $regexformach='S\/OL\]\.'; - &bfaddressbook; - &afpublisherbookurl; - }elsif($reference=~m/\[S\]\./){ - $entrytype='standard'; - print "this entry's type is: $entrytype \n"; - $regexformach='\[S\]\.'; - &bfidentifier; - - $regexformach='S\]\.'; - &bfaddressbook; - - &afpublisherbook; - }elsif ($reference=~m/\[S\/OL\]\/\//){ - $entrytype='standard'; - print "this entry's type is: $entrytype with url\n"; - $regexformach='\[S\/OL\]\/\/'; - &bfidentifier; - - $regexformach='S\/OL\]\/\/'; - &bfaddressinbook; - - &afpublisherbookurl; - }elsif($reference=~m/\[S\]\/\//){ - $entrytype='standard'; - print "this entry's type is: $entrytype \n"; - $regexformach='\[S\]\/\/'; - &bfidentifier; - - $regexformach='S\]\/\/'; - &bfaddressinbook; - - &afpublisherbook; - } - if ($entrytype eq 'standard'){ - if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.] - $address=""; - } - if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.] - $publisher=""; - } - $date=$year; - $note='standard'; - print 'date=',"$date"; - print 'note=',"$note"; - } - - } - - #--------------------------------------------------------------- - #条目类型:学位论文/thesis - #--------------------------------------------------------------- - if(1){ - if ($reference=~m/\[D\/OL\]\./){ - $entrytype='thesis'; - print "this entry's type is: $entrytype with url\n"; - $regexformach='\[D\/OL\]\.'; - &bfidentifier; - - $regexformach='D\/OL\]\.'; - &bfaddressbook; - - &afpublisherbookurl; - }elsif($reference=~m/\[D\]\./){ - $entrytype='thesis'; - print "this entry's type is: $entrytype \n"; - $regexformach='\[D\]\.'; - &bfidentifier; - - $regexformach='D\]\.'; - &bfaddressbook; - - &afpublisherbook; - } - - if ($entrytype eq 'thesis'){ - if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.] - $address=""; - } - if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.] - $publisher=""; - } - $date=$year; - print 'date=',"$date"; - } - - } - - - #--------------------------------------------------------------- - #条目类型:汇编中析出的文献/incollection - #--------------------------------------------------------------- - if(1){#\/\/ - if ($reference=~m/\[G\/OL\]\/\//){ - $entrytype='incollection'; - print "this entry's type is: $entrytype with url\n"; - $regexformach='\[G\/OL\]\/\/'; - &bfidentifier; - - $regexformach='G\/OL\]\/\/'; - &bfaddressinbook; - - &afpublisherbookurl; - }elsif($reference=~m/\[G\]\/\//){ - $entrytype='incollection'; - print "this entry's type is: $entrytype \n"; - $regexformach='\[G\]\/\/'; - &bfidentifier; - - $regexformach='G\]\/\/'; - &bfaddressinbook; - - &afpublisherbook; - } - - if ($entrytype eq 'incollection'){ - if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.] - $address=""; - } - if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.] - $publisher=""; - } - $date=$year; - } - - } - - - #--------------------------------------------------------------- - #条目类型:汇编/collection - #--------------------------------------------------------------- - if(1){ - if ($reference=~m/\[G\/OL\]\./){ - $entrytype='collection'; - print "this entry's type is: $entrytype with url\n"; - $regexformach='\[G\/OL\]\.'; - &bfidentifier; - - $regexformach='G\/OL\]\.'; - &bfaddressbook; - - &afpublisherbookurl; - }elsif($reference=~m/\[G\]\./){ - $entrytype='collection'; - print "this entry's type is: $entrytype \n"; - $regexformach='\[G\]\.'; - &bfidentifier; - - $regexformach='G\]\.'; - &bfaddressbook; - - &afpublisherbook; - } - - if ($entrytype eq 'collection'){ - if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.] - $address=""; - } - if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.] - $publisher=""; - } - $date=$year; - print 'date=',"$date"; - } - } - - - #--------------------------------------------------------------- - #条目类型:专利/patent - #--------------------------------------------------------------- - if(1){ - if ($reference=~m/\[P\/OL\]\./){ - $entrytype='patent'; - print "this entry's type is: $entrytype with url\n"; - $regexformach='\[P\/OL\]\.'; - &bfidentifier; - }elsif($reference=~m/\[P\]\./){ - $entrytype='patent'; - print "this entry's type is: $entrytype \n"; - $regexformach='\[P\]\.'; - &bfidentifier; - } - - if($entrytype eq 'patent'){ - ($postitle)=($reference=~m/$regexformach\s*(.*)/); - print 'postitle=',$postitle,"\n"; - $titlenumber=$title; - if($titlenumber=~m/:\s*\d.*/){ - ($title,$number)=($titlenumber=~m/(.*):\s*(\d.*)/); - print 'title =',$title,"\n"; - print 'number =',$number,"\n"; - } - - if($postitle=~m/\[.*\]/ and $reference=~m/\[P\/OL\]\./){ - ($date,$urldate,$posurl)=($postitle=~/(.*)\s*\[(.*)\]\.\s*(.*)/); - print 'date=',$date,"\n"; - print 'urldate =',$urldate,"\n"; - print 'posurl =',$posurl,"\n"; - if($posurl=~m/DOI/i){#匹配存在doi的话 - ($url,$doi)=($posurl=~m/(.*)DOI:(.*)\./i); - print 'url=',"$url \n"; - print 'doi=',"$doi \n"; - }else{ - $url=$posurl; - print 'url =',"$url \n"; - } - }else{ - $posurl=$postitle; - if($posurl=~m/DOI/i){#匹配存在doi的话 - ($date,$doi)=($posurl=~m/(.*)DOI:(.*)\./i); - print 'date=',"$date \n"; - print 'doi =',"$doi \n"; - }else{ - $date=$posurl; - print 'date =',"$date \n"; - } - } - } - } - - - #--------------------------------------------------------------- - #条目类型:电子资源/online - #--------------------------------------------------------------- - if(1){ - if ($reference=~m/\[EB\/OL\]\./){#匹配[EB/OL]判断为online类型 - $entrytype='online'; - print "this entry's type is: $entrytype \n"; - - $regexformach='\[EB\/OL\]\.'; - &bfidentifier; - - ($postitle)=($reference=~m/$regexformach\s*(.*)/); - print 'postitle=',$postitle,"\n"; - - if($postitle=~m/\(.*\)/ and $postitle=~m/\[.*\]/){#存在更新日期和引用日期 - ($eventdate,$urldate,$posurl)=($postitle=~/\s*\((.*)\)\s*\[(.*)\]\.\s*(.*)/); - }elsif($postitle=~m/\(.*\)/ and $postitle!~m/\[.*\]/){#存在更新日期但无引用日期 - ($eventdate,$posurl)=($postitle=~/\s*\((.*)\)\.\s*(.*)/); - }elsif($postitle!~m/\(.*\)/ and $postitle=~m/\[.*\]/){#存在引用日期但无更新日期 - ($urldate,$posurl)=($postitle=~/\s*\[(.*)\]\.\s*(.*)/); - }else{ - ($posurl)=($postitle=~/\s*(.*)/); - } - print 'eventdate=',$eventdate,"\n"; - print 'urldate =',$urldate,"\n"; - print 'posurl =',$posurl,"\n"; - - if($posurl=~m/DOI/i){#匹配存在doi的话 - ($url,$doi)=($posurl=~m/(.*)DOI:(.*)\./i); - print 'url=',"$url \n"; - print 'doi=',"$doi \n"; - }else{ - $url=$posurl; - print 'url =',"$url \n"; - } - } - } - - #--------------------------------------------------------------- - #条目类型:专著/book - #--------------------------------------------------------------- - if(1){ - if ($reference=~m/\[M\]\./){#匹配[M]判断为book类型 - print "this entry's type is: book \n"; - $entrytype='book'; - - $regexformach='\[M\]\.'; - &bfidentifier; - - $regexformach='M\]\.'; - &bfaddressbook; - - &afpublisherbook; - - if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.] - $address=""; - } - if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.] - $publisher=""; - } - $date=$year; - } - } - - #--------------------------------------------------------------- - #条目类型:专著但存在网址/book with url - #--------------------------------------------------------------- - if(1){ - if ($reference=~m/\[M\/OL\]\./){ - print "this entry's type is: book with url\n"; - $entrytype='book'; - - $regexformach='\[M\/OL\]\.'; - &bfidentifier; - - $regexformach='M\/OL\]\.'; - &bfaddressbook; - - &afpublisherbookurl; - - - if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.] - $address=""; - } - if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.] - $publisher=""; - } - $date=$year; - } - } - - - #--------------------------------------------------------------- - #条目类型:专著中析出文献/inbook - #--------------------------------------------------------------- - if(1){ - if ($reference=~m/\[M\]\/\//){#匹配[M]//判断为inbook类型 - print "this entry's type is: inbook \n"; - $entrytype='inbook'; - - $regexformach='\[M\]\/\/'; - &bfidentifier; - - $regexformach='M\]\/\/'; - &bfaddressinbook; - - &afpublisherbook;#出版社及之后的信息inbook/book一样的 - - - if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.] - $address=""; - } - if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.] - $publisher=""; - } - $date=$year; - } - } - - - #--------------------------------------------------------------- - #条目类型:专著中析出文献但存在网址/inbook with url - #--------------------------------------------------------------- - if(1){ - if ($reference=~m/\[M\/OL\]\/\//){#匹配[M]//判断为inbook类型 - print "this entry's type is: inbook \n"; - $entrytype='inbook'; - - - $regexformach='\[M\/OL\]\/\/'; - &bfidentifier; - - $regexformach='M\/OL\]\/\/'; - &bfaddressinbook; - - &afpublisherbookurl;#出版社及之后的信息inbook/book一样的 - - - if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.] - $address=""; - } - if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.] - $publisher=""; - } - $date=$year; - } - } - - - #--------------------------------------------------------------- - #输出到bib文件中 - #--------------------------------------------------------------- - if(1){ - if($date=~m/-\d{4}/){#存在enddate的情况下,将中间的连字符转化成斜杠 - print 'date=',$date,"\n"; - ($datetempa,$datetempb)=($date=~m/(.*)-(\d{4}.*)/); - $date=$datetempa.'/'.$datetempb; - print 'date=',$date,"\n"; - } - - if($url=~m/.*\.$/){ - $urlplusdot=$url; - ($url)=($urlplusdot=~m/(.*)\.$/);#去掉处于条目末尾的url地址后的点 - } - #最后输出 - print "\n"; - print '@',"$entrytype",'{',"ref-$nline-$sn",',',"\n"; - $author&& print 'author = {',$author,'},',"\n"; - $title&& print 'title = {',$title,'},',"\n"; - $journal&& print 'journal = {',$journal,'},',"\n"; - $translator&& print 'translator= {',$translator,'},',"\n"; - $bookauthor&& print 'bookauthor= {',$bookauthor,'},',"\n"; - $booktitle&& print 'booktitle = {',$booktitle,'},',"\n"; - $version&& print 'version = {',$version,'},',"\n"; - $address&& print 'address = {',$address,'},',"\n"; - $publisher&& print 'publisher = {',$publisher,'},',"\n"; - $type&& print 'type = {',$type,'},',"\n"; - $date&& print 'date = {',$date,'},',"\n"; - $volume&& print 'volume = {',$volume,'},',"\n"; - $number&& print 'number = {',$number,'},',"\n"; - $pages&& print 'pages = {',$pages,'},',"\n"; - $eventdate&& print 'eventdate = {',$eventdate,'},',"\n"; - $urldate&& print 'urldate = {',$urldate,'},',"\n"; - $url&& print 'url = {',$url,'},',"\n"; - $doi&& print 'doi = {',$doi,'},',"\n"; - $note&& print 'note = {',$note,'},',"\n"; - print '}',"\n"; - print 'authorlabel=',$authorlabel,"\n"; - - - print FHW '@',"$entrytype",'{',"ref-$nline-$sn-$authorlabel",',',"\n"; - $author&& print FHW 'author = {',$author,'},',"\n"; - $title&& print FHW 'title = {',$title,'},',"\n"; - $journal&& print FHW 'journal = {',$journal,'},',"\n"; - $translator&& print FHW 'translator= {',$translator,'},',"\n"; - $bookauthor&& print FHW 'bookauthor= {',$bookauthor,'},',"\n"; - $booktitle&& print FHW 'booktitle = {',$booktitle,'},',"\n"; - $version&& print FHW 'version = {',$version,'},',"\n"; - $address&& print FHW 'address = {',$address,'},',"\n"; - $publisher&& print FHW 'publisher = {',$publisher,'},',"\n"; - $type&& print FHW 'type = {',$type,'},',"\n"; - $date&& print FHW 'date = {',$date,'},',"\n"; - $volume&& print FHW 'volume = {',$volume,'},',"\n"; - $number&& print FHW 'number = {',$number,'},',"\n"; - $pages&& print FHW 'pages = {',$pages,'},',"\n"; - $eventdate&& print FHW 'eventdate = {',$eventdate,'},',"\n"; - $urldate&& print FHW 'urldate = {',$urldate,'},',"\n"; - $url&& print FHW 'url = {',$url,'},',"\n"; - $doi&& print FHW 'doi = {',$doi,'},',"\n"; - $note&& print FHW 'note = {',$note,'},',"\n"; - print FHW '}',"\n"; - } - - - print "\n"; - if($nline>=$ne){last;} #先跳过几行进行,配合后面的last进行当行测试 -} - - sub bfidentifier{#bf表示before,标识符前所有的类型都一样 - #$regexpformach=@_; - #print '@_=',@_,"\n"; - #print 'regexpformach=',"$regexpformach \n"; - #标识符之前很容易匹配三个内容,序号,作者和标题 - if($reference=~m/.*\D\.\s\D.*$regexformach/){#匹配存在作者后的点的话,同时点号周围不是数字,有时标题中可能出现1.1这样的信息 - ($sn , $author , $title)=($reference=~m/\[(\d+)\]\s*(.*)\.\s(.*)$regexformach/); - print 'sn =',"$sn \n"; - print 'author=',"$author \n";#作者多个姓名还需要处理,还要注意有前后缀的情况 - print 'title =',"$title \n"; - if($author=~m/等/){ - $author=~s/等/others/;#将等换成others - }else{ - $author=~s/,\s*$//;#将最后一个逗号去掉 - } - if($author=~m/et\sal/){ - $author=~s/et\sal/others/;#将et al.换成others - }else{ - $author=~s/,\s*$//;#将最后一个逗号去掉 - } - while($author=~m/,/){ - $author=~s/,/ and /;#将逗号换成and - } - print 'author=',"$author \n"; - }else{#不存在作者的话\[M\]\/\/ - ($sn , $title)=($reference=~m/\[(\d+)\]\s*(.*)$regexformach/);#标识符之前很容易匹配三个内容,序号,作者和标题 - print 'sn =',"$sn \n"; - print 'title =',"$title \n"; - } - - #进一步处理责任者的姓名,主要针对英文名需要有一些符号进行区分姓,名,前缀和后缀。 - @names=split('and',$author); - print 'names=',@names,"\n"; - $author=""; - $j=0; - foreach $name(@names){#一个姓名一个姓名处理 - - $j=$j+1; - #print $name,"\n"; - @nameparts=split(' ',$name); - #print 'nameparts=',@nameparts,"\n"; - - $org=0; - for($k=0;$k<@nameparts;$k++){ - if(@nameparts[$k]=~m/.{2,}/ and @nameparts[$k]!~m/\s*von\s*/i and @nameparts[$k]!~m/\s*jr\s*/i){ - #当分解的单作者的各个部分,存在两个以上为2个字符以上的情况,说明不是一般的姓名而是机构作者 - $org=$org+1; - print 'org=',"$org\n"; - } - } - - if(@nameparts>1){ - if(@nameparts[0]=~m/\s*von\s*/i){#确定姓的位置 - $family=1; - @nameparts[1]=@nameparts[1].','; - }else{ - $family=0; - @nameparts[0]=@nameparts[0].','; - } - if(@nameparts[-1]=~m/\s*jr\s*/i){#确定后缀的位置 - @nameparts[-1]=@nameparts[-1].'.,'; - $given=@nameparts-2; - $suffix=1; - }else{ - $suffix=0; - $given=@nameparts-1; - } - print 'family=',$family,"\n"; - print 'given=',$given,"\n"; - print 'suffix=',$suffix,"\n"; - print 'familyname=',@nameparts[$family],"\n"; - - $namefmt=""; - for($i=0;$i<=$family;$i++){ - $namefmt=$namefmt.@nameparts[$i].' '; - print $i,$family,$namefmt,"\n"; - } - if($suffix){ - $namefmt=$namefmt.@nameparts[-1].' '; - } - for($i=$family+1;$i<=$given;$i++){ - $namefmt=$namefmt.@nameparts[$i].' '; - print $i,$family,$namefmt,"\n"; - } - }else{ - $namefmt=$name; - } - if($org > 1){#当是机构作者时 - $namefmt='{'.$name.'}'; - } - print 'namefmt=',"$namefmt \n"; - - if($j==1){#把姓名用and连接起来 - $author=$namefmt; - }else{ - $author=$author.' and '.$namefmt; - } - - if($j==1){#根据第一个作者构建authorlabel - if($org > 1){#机构作者取各单词的首字母 - $authorlabel=''; - for($k=0;$k<@nameparts;$k++){ - ($strtmp)=($nameparts[$k]=~/^(.)/); - $authorlabel=$authorlabel.$strtmp; - } - }else{#姓名则仅取作者姓 - ($authorlabel)=$nameparts[$family]; - if($authorlabel=~m/,$/){$authorlabel=~s/,$//;}#去掉最后的逗号 - } - } - } - while($author=~m/\s{2,}/){ - $author=~s/\s{2,}/ /;#将多余的空格去掉 - } - while($author=~m/\.{2,}/){ - $author=~s/\.{2,}/\./;#将多余的点去掉 - } - print 'author=',"$author\n"; - } - - - sub bfaddressbook{#bf表示before,出版者前book和inbook不一样 - #对于book类型,必然存在出版地和出版者信息,以此为根据展开 - print 'sub:bfaddressbook ',"\n"; - if($reference!~m/$regexformach\s*[^:]+:\s\D{1,}.*/){#如果不存在出版地和出版者信息 - ($pospublisher)=($reference=~m/$regexformach\s*(.*)/); - print 'pospublisher=',"$pospublisher \n"; - }else{ - ($preaddress, $pospublisher)=($reference=~m/$regexformach\s*([^:]+):\s(\D{1,}.*)/);#标识符之后根据第一个冒号分为包括地址的信息和包括出版者的信息两部分 - print 'preaddress =',"$preaddress \n"; - print 'pospublisher=',"$pospublisher \n"; - - #处理出版地及其前面的信息 - if ($preaddress=~m/.*\[S\.l\.\].*/) {#当存在英文的[S.l.],英文的一般不存在译者,所以下面处理比较简单 - $preaddress=~s/\[S\.l\.\]/\[S-l-\]/; #先将[S.l.]换成[S-l-]然后换回来 - } - if ($preaddress=~m/.*\d.*\.\s*.*/){#匹配存在数字版本的话 - ($preversion, $version, $address)=($preaddress=~m/(.*)(\d)[^\.]*\.\s*(.*)/); - print 'preversion =',"$preversion \n"; - print 'version =',"$version \n"; - print 'address =',"$address \n"; - if($preversion=~m/.*\..*/){#如果存在译者等信息 - ($translator)=($preversion=~m/(.*)\..*/); - print 'translator =',"$translator \n";#作者多个姓名还需要处理,还有译这个标识 - } - }else {#不存在数字版本的话 - if($preaddress=~m/.*\.\s+.*/){#存在点加空格,表示存在其他作者信息,区别点在末尾但无空格 - ($preversion,$address)=($preaddress=~m/(.*)\.\s*(.*)/); - print 'preversion =',"$preversion \n"; - print 'address =',"$address \n"; - $translator=$preversion; - print 'translator =',"$translator \n"; - }else{ - $address=$preaddress; - print 'address =',"$address \n"; - } - } - - if($translator=~m/译/){#当译者真实存在 - $translator=~s/,\s*译//;#将译去掉 - if($translator=~m/等/){ - $translator=~s/等/others/;#将等换成others - }else{ - $translator=~s/,\s*$//;#将最后一个逗号去掉 - } - while($translator=~m/,/){ - $translator=~s/,/ and /;#将逗号换成and - } - print 'translator =',"$translator \n"; - }else {#当译者不存在,那么translator中信息可能是非数字的版本信息 - unless($version) {#除非version没有信息 - $version=$translator; - $translator=""; - }else{ - print "version is already exisit!\n"; - print 'version=',$version,"\n"; - print 'translator=',$translator,"\n"; - } - } - - if ($address=~m/.*\[S-l-\].*/) {#当存在英文的[S-l-][S.l.] - $address=~s/\[S-l-\]/\[S\.l\.\]/; #将[S-l-]换回[S.l.] - } - } - } - - - sub bfaddressinbook{#bf表示before,出版者前book和inbook不一样 - ($postitle)=($reference=~m/$regexformach\s*(.*)/); - print 'postitle=',$postitle,"\n"; - if($postitle=~m/^[^:\.]+:[^:\.]+\./){#当存在析出源第一项中出现:时 - $postitle=~s/:/colon/;#先将该冒号换成colon - print 'postitle=',$postitle,"\n"; - } - #对于inbook类型,必然存在出版地和出版者信息,以此为根据展开 - ($preaddress, $pospublisher)=($postitle=~m/\s*(.*):\s(\D.*)/); - #($preaddress, $pospublisher)=($postitle=~m/\s*([^:]+):\s(\D.*)/); - #标识符之后根据第一个冒号分为包括地址的信息和包括出版者的信息两部分 - print 'preaddress =',"$preaddress \n"; - print 'pospublisher=',"$pospublisher \n"; - - #处理出版地及其前面的信息 - if ($preaddress=~m/.*\[S\.l\.\].*/) {#当存在英文的[S.l.],英文的一般不存在译者,所以下面处理比较简单 - $preaddress=~s/\[S\.l\.\]/\[S-l-\]/; #先将[S.l.]换成[S-l-]然后换回来 - } - if ($preaddress=~m/.*\d.*\.\s+.*/ and ($preaddress=~m/.*th\sed.*/ or $preaddress=~m/.*版.*/)){#匹配存在数字版本的话 - ($preversion, $version, $address)=($preaddress=~m/(.*)(\d)[^\.]*\.\s+(.*)/); - print 'preversion =',"$preversion \n"; - print 'version =',"$version \n"; - print 'address =',"$address \n"; - if($preversion=~m/.*\.\s+.*/){#如果存在译者等信息 - ($translator)=($preversion=~m/(.*)\.\s+.*/); - print 'translator =',"$translator \n";#作者多个姓名还需要处理,还有译这个标识 - } - }else {#不存在数字版本的话 - if($preaddress=~m/.*\.\s+.*/){#存在点加空格,表示存在其他作者信息,区别点在末尾但无空格 - ($preversion,$address)=($preaddress=~m/(.*)\.\s+(.*)/); - print 'preversion =',"$preversion \n"; - print 'address =',"$address \n"; - if($preversion=~m/.*\.\s+.*/){#中间还存在点加空格 - ($bookauthor,$booktitle)=($preversion=~m/(.*)\.\s+(.*)/); - - if($bookauthor=~m/等/){ - $bookauthor=~s/等/others/;#将等换成others - }else{ - $bookauthor=~s/,\s*$//;#将最后一个逗号去掉 - } - if($bookauthor=~m/et\sal/){ - $bookauthor=~s/et\sal/others/;#将et al.换成others - }else{ - $bookauthor=~s/,\s*$//;#将最后一个逗号去掉 - } - while($bookauthor=~m/,/){ - $bookauthor=~s/,/ and /;#将逗号换成and - } - print 'bookauthor=',"$bookauthor \n"; - }else{ - $booktitle=$preversion; - } - }else{ - $address=$preaddress; - print 'address =',"$address \n"; - } - } - - if ($address=~m/.*\[S-l-\].*/) {#当存在英文的[S-l-][S.l.] - $address=~s/\[S-l-\]/\[S\.l\.\]/; #将[S-l-]换回[S.l.] - } - if ($booktitle=~m/.*colon.*/) {#当存在colon - $booktitle=~s/colon/:/; #将colon换回: - } - - #进一步处理责任者的姓名,主要针对英文名需要有一些符号进行区分姓,名,前缀和后缀。 - @names=split('and',$bookauthor); - print 'names=',@names,"\n"; - $bookauthor=""; - $j=0; - foreach $name(@names){ - $j=$j+1; - #print $name,"\n"; - @nameparts=split(' ',$name); - #print 'nameparts=',@nameparts,"\n"; - - $org=0; - for($k=0;$k<@nameparts;$k++){ - if(@nameparts[$k]=~m/.{2,}/ and @nameparts[$k]!~m/\s*von\s*/i and @nameparts[$k]!~m/\s*jr\s*/i){ - #当分解的单作者的各个部分,存在两个以上为2个字符以上的情况,说明不是一般的姓名而是机构作者 - $org=$org+1; - print 'org=',"$org\n"; - } - } - - if(@nameparts>1){ - if(@nameparts[0]=~m/\s*von\s*/i){#确定姓的位置 - $family=1; - @nameparts[1]=@nameparts[1].','; - }else{ - $family=0; - @nameparts[0]=@nameparts[0].','; - } - if(@nameparts[-1]=~m/\s*jr\s*/i){#确定后缀的位置 - @nameparts[-1]=@nameparts[-1].'.,'; - $given=@nameparts-2; - $suffix=1; - }else{ - $suffix=0; - $given=@nameparts-1; - } - #print 'family=',$family,"\n"; - #print 'given=',$given,"\n"; - #print 'suffix=',$suffix,"\n"; - - $namefmt=""; - for($i=0;$i<=$family;$i++){ - $namefmt=$namefmt.@nameparts[$i].' '; - #print $i,$family,$namefmt,"\n"; - } - if($suffix){ - $namefmt=$namefmt.@nameparts[-1].' '; - } - for($i=$family+1;$i<=$given;$i++){ - $namefmt=$namefmt.@nameparts[$i].' '; - } - }else{ - $namefmt=$name; - } - if($org > 1){#当是机构作者时 - $namefmt='{'.$name.'}'; - } - #print 'namefmt=',"$namefmt \n"; - - if($j==1){ - $bookauthor=$namefmt; - }else{ - $bookauthor=$bookauthor.' and '.$namefmt; - } - } - while($bookauthor=~m/\s{2,}/){ - $bookauthor=~s/\s{2,}/ /;#将多余的空格去掉 - } - while($bookauthor=~m/\.{2,}/){ - $bookauthor=~s/\.{2,}/\./;#将多余的点去掉 - } - print 'bookauthor=',"$bookauthor\n"; - } - - - sub afpublisherbook{#af表示after,出版者后book和inbook一样,但如果存在url则不同 - #处理出版者及其后面的信息 - if ($pospublisher=~m/.*\[s\.n\.\].*/) {#当存在英文的[s.n.] - $pospublisher=~s/\[s\.n\.\]/\[s-n-\]/; #先将[s.n.]换成[s-n-]然后换回来 - } - if ($pospublisher=~m/.*,\s*\d{4}\S+/){#匹配存在年份的话 - ($publisher, $year, $posyear)=($pospublisher=~m/(.*),\s*(\d{4})(.*)/); - print 'publisher=',"$publisher \n"; - print 'year =',"$year \n"; - print 'posyear =',"$posyear \n"; - if($posyear=~m/^:/){#匹配存在页码前面的冒号的话 - ($pages, $pospages)=($posyear=~m/^:([^\.]+)\.(.*)/); - print 'pages =',"$pages \n"; - print 'pospages=',"$pospages \n"; - if($pospages=~m/DOI/i){#匹配存在doi的话 - ($doi)=($pospages=~m/DOI:(.*)\./i); - print 'doi=',"$doi \n"; - } - }else{#不存在页码的话 - if($posyear=~m/DOI/i){#匹配存在doi的话 - ($doi)=($posyear=~m/DOI:(.*)\./i); - print 'doi=',"$doi \n"; - } - } - }else{#不存在年份,匹配一下是否存在冒号和页码 - if($pospublisher=~m/.*[^DOI]:.*/i){#当存在不是doi后面的冒号时,说明有页码 - ($publisher, $pages, $pospages)=($pospublisher=~m/([^:]*):([^\.]*)\.(.*)/); - print 'publisher=',"$publisher \n"; - print 'pages =',"$pages \n"; - print 'pospages =',"$pospages \n"; - if($pospages=~m/DOI/i){#匹配存在doi的话 - ($doi)=($pospages=~m/DOI:(.*)\./i); - print 'doi=',"$doi \n"; - } - }else{#没有页码冒号以点作为出版者后的分隔点 - ($publisher, $pospages)=($pospublisher=~m/([^\.]*)\.(.*)/); - print 'publisher=',"$publisher \n"; - print 'pospages =',"$pospages \n"; - if($pospages=~m/DOI/i){#匹配存在doi的话 - ($doi)=($pospages=~m/DOI:(.*)\./i); - print 'doi=',"$doi \n"; - } - } - } - if ($publisher=~m/.*\[s-n-\].*/) {#当存在英文的[s-n-] - $publisher=~s/\[s-n-\]/\[s\.n\.\]/; #将[s-n-]换回[s.n.] - } - } - - - sub afpublisherbookurl{#af表示after,出版者后book和inbook一样,但如果存在url则不同 - #处理出版者及其后面的信息 - if ($pospublisher=~m/.*\[s\.n\.\].*/) {#当存在英文的[s.n.] - $pospublisher=~s/\[s\.n\.\]/\[s-n-\]/; #先将[s.n.]换成[s-n-]然后换回来 - } - if ($pospublisher=~m/.*,\s*\d{4}[^\d-]/){#匹配存在年份的话,4个数字后面跟着不能是数字和连字符- - ($publisher, $year, $posyear)=($pospublisher=~m/(.*),\s*(\d{4})(.*)/); - print 'publisher=',"$publisher \n"; - print 'year =',"$year \n"; - print 'posyear =',"$posyear \n"; - if($posyear=~m/^:/){#匹配存在页码前面的冒号的话 - ($pages, $pospages)=($posyear=~m/^:([^\.]+)\.(.*)/); - print 'pages =',"$pages \n"; - print 'pospages=',"$pospages \n"; - if($pages=~m/\[.*\]/){ - ($pagesa, $urldate)=($pages=~m/(.*)\[(.*)\]/); - $pages=$pagesa; - print 'urldate=',"$urldate \n"; - print 'pages=',"$pages \n"; - } - if($pospages=~m/DOI/i){#匹配存在doi的话 - ($url, $doi)=($pospages=~m/(.*)\.\s*DOI:(.*)\./i); - print 'url=',"$url \n"; - print 'doi=',"$doi \n"; - }else{ - ($url)=($pospages=~m/(.*)\./i); - print 'url=',"$url \n"; - } - } - else{#不存在页码的话 - if($posyear=~m/\[.*\]/){ - ($urldate,$pospages)=($posyear=~m/.*\[(.*)\]\.(.*)/); - print 'urldate=',"$urldate \n"; - print 'pospages=',"$pospages \n"; - } - else{#不存在页码,又不存在引用日期的话,那么会有一个点和空格 - ($pospages)=($posyear=~m/.*\s(.*)/); - print 'pospages=',"$pospages \n"; - } - if($pospages=~m/DOI/i){#匹配存在doi的话 - ($url, $doi)=($pospages=~m/(.*)\.\s*DOI:(.*)\./i); - print 'url=',"$url \n"; - print 'doi=',"$doi \n"; - }else{ - ($url)=($pospages=~m/(.*)\./i); - print 'url=',"$url \n"; - } - } - }else{#不存在年份,匹配一下是否存在冒号和页码 - if($pospublisher=~m/.*[^DOIhttp]:.*/i){#当存在不是doi或http后面的冒号时,说明有页码 - ($publisher, $pages, $pospages)=($pospublisher=~m/([^:]*):([^\.]*)\.(.*)/); - print 'publisher=',"$publisher \n"; - print 'pages =',"$pages \n"; - print 'pospages =',"$pospages \n"; - if($pages=~m/\[.*\]/){ - ($pagesa, $urldate)=($pages=~m/(.*)\[(.*)\]/); - $pages=$pagesa; - print 'urldate=',"$urldate \n"; - print 'pages=',"$pages \n"; - } - if($pospages=~m/DOI/i){#匹配存在doi的话 - ($url, $doi)=($pospages=~m/(.*)\.\s*DOI:(.*)\./i); - print 'url=',"$url \n"; - print 'doi=',"$doi \n"; - }else{ - ($url)=($pospages=~m/(.*)\./i); - print 'url=',"$url \n"; - } - }else{#没有页码冒号以点作为出版者后的分隔点 - ($publisher, $pospages)=($pospublisher=~m/([^\.]*)\.(.*)/); - print 'publisher=',"$publisher \n"; - print 'pospages =',"$pospages \n"; - if($publisher=~m/\[.*\]/){ - ($publishera, $urldate)=($publisher=~m/(.*)\[(.*)\]/); - $publisher=$publishera; - print 'urldate=',"$urldate \n"; - print 'publisher=',"$publisher \n"; - } - if($pospages=~m/DOI/i){#匹配存在doi的话 - ($url, $doi)=($pospages=~m/(.*)\.\s*DOI:(.*)\./i); - print 'url=',"$url \n"; - print 'doi=',"$doi \n"; - }else{ - ($url)=($pospages=~m/(.*)\./i); - print 'url=',"$url \n"; - } - } - } - if ($publisher=~m/.*\[s-n-\].*/) {#当存在英文的[s-n-] - $publisher=~s/\[s-n-\]/\[s\.n\.\]/; #将[s-n-]换回[s.n.] - } - } - - - sub afpublisherbookb{#af表示after,出版者后book和inbook一样,但如果存在url则不同 - #处理出版者及其后面的信息 - if ($pospublisher=~m/.*\[s\.n\.\].*/) {#当存在英文的[s.n.] - $pospublisher=~s/\[s\.n\.\]/\[s-n-\]/; #先将[s.n.]换成[s-n-]然后换回来 - } - if ($pospublisher=~m/.*[\.\s,]*\d{4}[\D\S]+/){#匹配存在年份的话,年份前面没有逗号+空格 - ($publisher, $year, $posyear)=($pospublisher=~m/(.*)[\.\s,]*(\d{4})([\D\S].*)/); - print 'publisher=',"$publisher \n"; - if($publisher=~m/[,\s]+$/){$publisher=~s/[,\s]+$//;}#去掉最后的逗号 - unless($address){#当没有出版地时,也没有必要存在 - $version=$publisher; - $publisher=''; - } - print 'year =',"$year \n"; - print 'posyear =',"$posyear \n"; - if($posyear=~m/^:/){#匹配存在页码前面的冒号的话 - ($pages, $pospages)=($posyear=~m/^:([^\.]+)\.(.*)/); - print 'pages =',"$pages \n"; - print 'pospages=',"$pospages \n"; - if($pospages=~m/DOI/i){#匹配存在doi的话 - ($doi)=($pospages=~m/DOI:(.*)\./i); - print 'doi=',"$doi \n"; - } - }else{#不存在页码的话 - if($posyear=~m/DOI/i){#匹配存在doi的话 - ($doi)=($posyear=~m/DOI:(.*)\./i); - print 'doi=',"$doi \n"; - } - } - }else{#不存在年份,匹配一下是否存在冒号和页码 - if($pospublisher=~m/.*[^DOI]:.*/i){#当存在不是doi后面的冒号时,说明有页码 - ($publisher, $pages, $pospages)=($pospublisher=~m/([^:]*):([^\.]*)\.(.*)/); - print 'publisher=',"$publisher \n"; - print 'pages =',"$pages \n"; - print 'pospages =',"$pospages \n"; - if($pospages=~m/DOI/i){#匹配存在doi的话 - ($doi)=($pospages=~m/DOI:(.*)\./i); - print 'doi=',"$doi \n"; - } - }else{#没有页码冒号以点作为出版者后的分隔点 - ($publisher, $pospages)=($pospublisher=~m/([^\.]*)\.(.*)/); - print 'publisher=',"$publisher \n"; - print 'pospages =',"$pospages \n"; - if($pospages=~m/DOI/i){#匹配存在doi的话 - ($doi)=($pospages=~m/DOI:(.*)\./i); - print 'doi=',"$doi \n"; - } - } - if($publisher=~m/,$/){$publisher=~s/,$//;}#去掉最后的逗号 - unless($address){#当没有出版地时,也没有必要存在 - $type=$publisher; - $publisher=''; - } - } - if ($publisher=~m/.*\[s-n-\].*/) {#当存在英文的[s-n-] - $publisher=~s/\[s-n-\]/\[s\.n\.\]/; #将[s-n-]换回[s.n.] - } - } - - - - sub afpublisherbookurlb{#af表示after,出版者后book和inbook一样,但如果存在url则不同 - #处理出版者及其后面的信息 - if ($pospublisher=~m/.*\[s\.n\.\].*/) {#当存在英文的[s.n.] - $pospublisher=~s/\[s\.n\.\]/\[s-n-\]/; #先将[s.n.]换成[s-n-]然后换回来 - } - if ($pospublisher=~m/.*[\.\s,]*\d{4}[^\d-]/){#匹配存在年份的话,4个数字后面跟着不能是数字和连字符- - ($publisher, $year, $posyear)=($pospublisher=~m/(.*)[\.\s,]*(\d{4})([^\d-].*)/); - print 'publisher=',"$publisher \n"; - print 'year =',"$year \n"; - print 'posyear =',"$posyear \n"; - if($publisher=~m/,$/){$publisher=~s/,$//;}#去掉最后的逗号 - unless($address){#当没有出版地时,也没有必要存在 - $version=$publisher; - $publisher=''; - } - if($posyear=~m/^:/){#匹配存在页码前面的冒号的话 - ($pages, $pospages)=($posyear=~m/^:([^\.]+)\.(.*)/); - print 'pages =',"$pages \n"; - print 'pospages=',"$pospages \n"; - if($pages=~m/\[.*\]/){ - ($pagesa, $urldate)=($pages=~m/(.*)\[(.*)\]/); - $pages=$pagesa; - print 'urldate=',"$urldate \n"; - print 'pages=',"$pages \n"; - } - if($pospages=~m/DOI/i){#匹配存在doi的话 - ($url, $doi)=($pospages=~m/(.*)\.\s*DOI:(.*)\./i); - print 'url=',"$url \n"; - print 'doi=',"$doi \n"; - }else{ - ($url)=($pospages=~m/(.*)\./i); - print 'url=',"$url \n"; - } - } - else{#不存在页码的话 - if($posyear=~m/\[.*\]/){ - ($urldate,$pospages)=($posyear=~m/.*\[(.*)\]\.(.*)/); - print 'urldate=',"$urldate \n"; - print 'pospages=',"$pospages \n"; - } - else{#不存在页码,又不存在引用日期的话,那么会有一个点和空格 - ($pospages)=($posyear=~m/.*\s(.*)/); - print 'pospages=',"$pospages \n"; - } - if($pospages=~m/DOI/i){#匹配存在doi的话 - ($url, $doi)=($pospages=~m/(.*)\.\s*DOI:(.*)\./i); - print 'url=',"$url \n"; - print 'doi=',"$doi \n"; - }else{ - ($url)=($pospages=~m/(.*)\./i); - print 'url=',"$url \n"; - } - } - }else{#不存在年份,匹配一下是否存在冒号和页码 - if($pospublisher=~m/.*[^DOIhttp]:.*/i){#当存在不是doi或http后面的冒号时,说明有页码 - ($publisher, $pages, $pospages)=($pospublisher=~m/([^:]*):([^\.]*)\.(.*)/); - print 'publisher=',"$publisher \n"; - print 'pages =',"$pages \n"; - print 'pospages =',"$pospages \n"; - if($pages=~m/\[.*\]/){ - ($pagesa, $urldate)=($pages=~m/(.*)\[(.*)\]/); - $pages=$pagesa; - print 'urldate=',"$urldate \n"; - print 'pages=',"$pages \n"; - } - if($pospages=~m/DOI/i){#匹配存在doi的话 - ($url, $doi)=($pospages=~m/(.*)\.\s*DOI:(.*)\./i); - print 'url=',"$url \n"; - print 'doi=',"$doi \n"; - }else{ - ($url)=($pospages=~m/(.*)\./i); - print 'url=',"$url \n"; - } - }else{#没有页码冒号以点作为出版者后的分隔点 - ($publisher, $pospages)=($pospublisher=~m/([^\.]*)\.(.*)/); - print 'publisher=',"$publisher \n"; - print 'pospages =',"$pospages \n"; - if($publisher=~m/\[.*\]/){ - ($publishera, $urldate)=($publisher=~m/(.*)\[(.*)\]/); - $publisher=$publishera; - print 'urldate=',"$urldate \n"; - print 'publisher=',"$publisher \n"; - } - if($pospages=~m/DOI/i){#匹配存在doi的话 - ($url, $doi)=($pospages=~m/(.*)\.\s*DOI:(.*)\./i); - print 'url=',"$url \n"; - print 'doi=',"$doi \n"; - }else{ - ($url)=($pospages=~m/(.*)\./i); - print 'url=',"$url \n"; - } - } - if($publisher=~m/,$/){$publisher=~s/,$//;}#去掉最后的逗号 - unless($address){#当没有出版地时,也没有必要存在 - $type=$publisher; - $publisher=''; - } - } - if ($publisher=~m/.*\[s-n-\].*/) {#当存在英文的[s-n-] - $publisher=~s/\[s-n-\]/\[s\.n\.\]/; #将[s-n-]换回[s.n.] - } - } - - - -close (FHR); -close (FHW); \ No newline at end of file diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015.tex b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015.tex deleted file mode 100644 index b495abd4d8..0000000000 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015.tex +++ /dev/null @@ -1,15 +0,0 @@ -\documentclass{article} -\usepackage{pdfpages}%直接插入pdf文件页 -\graphicspath{{egfigure/}{example/}} - -\begin{document} - -\includepdf[pages=-]{egfigure/tgbcitation.pdf} - -\IfFileExists{egfigure/tngbcitationay.pdf} -{\includepdf[pages=-]{egfigure/tngbcitationay.pdf}} -{\includepdf[pages=-]{egfigure/tngbcitationaynew.pdf}} - -\includepdf[pages=-]{egfigure/tgbbiblio.pdf} - -\end{document} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015eg.tex b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015eg.tex deleted file mode 100644 index f64360b40f..0000000000 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015eg.tex +++ /dev/null @@ -1,114 +0,0 @@ -\documentclass{article} -\usepackage[colorlinks=true]{hyperref} -\usepackage{pdfpages}%直接插入pdf文件页 -\graphicspath{{egfigure/}{example/}} - -\begin{document} - -\phantomsection -%\addcontentsline{toc}{section}{cls-beamer} -\includepdf[pages=-,addtotoc={1,section,1,cls-beamer,eg:beamer}]{example/cls-beamer.pdf} - - -\phantomsection -%\addcontentsline{toc}{section}{cls-beameray} -\includepdf[pages=-,addtotoc={1,section,1,cls-beameray,eg:beameray}]{example/cls-beameray.pdf} - - -\phantomsection -%\addcontentsline{toc}{section}{codeopt-gbcodegbk} -\includepdf[pages=-,addtotoc={1,section,1,codeopt-gbcodegbk,eg:gbk}]{example/codeopt-gbcodegbk.pdf} - - -\phantomsection -%\addcontentsline{toc}{section}{eg-opt-gbstyle} -\includepdf[pages=-,addtotoc={1,section,1,eg-opt-gbstyle,eg:multistyle}]{example/eg-opt-gbstyle.pdf} - - -\phantomsection -%\addcontentsline{toc}{section}{opt-gbalign-center} -\includepdf[pages=-,addtotoc={1,section,1,opt-gbalign-center,eg:aligncenter}]{example/opt-gbalign-center.pdf} - - -\phantomsection -%\addcontentsline{toc}{section}{opt-gbalign-gb} -\includepdf[pages=-,addtotoc={1,section,1,opt-gbalign-gb,eg:aligngb}]{example/opt-gbalign-gb.pdf} - - -\phantomsection -%\addcontentsline{toc}{section}{opt-gbalign-left} -\includepdf[pages=-,addtotoc={1,section,1,opt-gbalign-left,eg:alignleft}]{example/opt-gbalign-left.pdf} - - -\phantomsection -%\addcontentsline{toc}{section}{opt-gbbiblabel} -\includepdf[pages=-,addtotoc={1,section,1,opt-gbbiblabel,eg:biblabel}]{example/opt-gbbiblabel.pdf} - - - - - -\phantomsection -%\addcontentsline{toc}{section}{opt-gbfieldstd} -\includepdf[pages=-,addtotoc={1,section,1,opt-gbfieldstd,eg:fieldstd}]{example/opt-gbfieldstd.pdf} - - -\phantomsection -%\addcontentsline{toc}{section}{opt-gbnamefmt} -\includepdf[pages=-,addtotoc={1,section,1,opt-gbnamefmt,eg:namefmt}]{example/opt-gbnamefmt.pdf} - - -\phantomsection -%\addcontentsline{toc}{section}{opt-gbnamefmt-default} -\includepdf[pages=-,addtotoc={1,section,1,opt-gbnamefmt-default,eg:namefmta}]{example/opt-gbnamefmt-default.pdf} - - - -\phantomsection -%\addcontentsline{toc}{section}{opt-gbpub-true} -\includepdf[pages=-,addtotoc={1,section,1,opt-gbpub-true,eg:pub}]{example/opt-gbpub-true.pdf} - - -\phantomsection -%\addcontentsline{toc}{section}{opt-gbpunctin} -\includepdf[pages=-,addtotoc={1,section,1,opt-gbpunctin,eg:in}]{example/opt-gbpunctin.pdf} - - -\phantomsection -%\addcontentsline{toc}{section}{opt-gbtitlelink} -\includepdf[pages=-,addtotoc={1,section,1,opt-gbtitlelink,eg:titlelink}]{example/opt-gbtitlelink.pdf} - - - -\phantomsection -%\addcontentsline{toc}{section}{opt-footbib} -\includepdf[pages=-,addtotoc={1,section,1,opt-gbfootbib,eg:footbib}]{example/opt-gbfootbib.pdf} - - -\phantomsection -%\addcontentsline{toc}{section}{opt-gbtype} -\includepdf[pages=-,addtotoc={1,section,1,opt-gbtype,eg:entrytype}]{example/opt-gbtype.pdf} - -\phantomsection -%\addcontentsline{toc}{section}{opt-gbctexset} -\includepdf[pages=-,addtotoc={1,section,1,opt-gbctexset,eg:ctexset}]{example/opt-gbctexset.pdf} - -\phantomsection -%\addcontentsline{toc}{section}{opt-gbnoauthor-false} -\includepdf[pages=-,addtotoc={1,section,1,opt-gbnoauthor-false,eg:noauthor}]{example/opt-gbnoauthor-false.pdf} - - -\phantomsection -%\addcontentsline{toc}{section}{opt-gbnoauthor-true} -\includepdf[pages=-,addtotoc={1,section,1,opt-gbnoauthor-true,eg:noauthora}]{example/opt-gbnoauthor-true.pdf} - - -\phantomsection -%\addcontentsline{toc}{section}{opt-gblocal} -\includepdf[pages=-,addtotoc={1,section,1,opt-gblocal,eg:local}]{example/opt-gblocal.pdf} - - - - - -\end{document} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015fmt.tex b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015fmt.tex deleted file mode 100644 index e3cd6eaa29..0000000000 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015fmt.tex +++ /dev/null @@ -1,13 +0,0 @@ -\documentclass{article} -\usepackage[colorlinks=true]{hyperref} -\usepackage{pdfpages}%直接插入pdf文件页 -\graphicspath{{egfigure/}{example/}} - -\begin{document} - - -\phantomsection -%\addcontentsline{toc}{section}{testallformat} -\includepdf[pages=-,addtotoc={1,section,1,allfmt,eg:allfmt}]{example/testallformat.pdf} - -\end{document} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015lan.tex b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015lan.tex deleted file mode 100644 index 637fc0c293..0000000000 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015lan.tex +++ /dev/null @@ -1,45 +0,0 @@ -\documentclass{article} -\usepackage[colorlinks=true]{hyperref} -\usepackage{pdfpages}%直接插入pdf文件页 -\graphicspath{{egfigure/}{example/}} - -\begin{document} - -\phantomsection -%\addcontentsline{toc}{section}{opt-eg-authoryear} -\includepdf[pages=-,addtotoc={1,section,1,opt-eg-dblang,eg:doublelang}]{example/opt-eg-dblang.pdf} - - -\phantomsection -%\addcontentsline{toc}{section}{opt-eg-authoryear} -\includepdf[pages=-,addtotoc={1,section,1,opt-eg-authoryear,eg:ay}]{example/opt-eg-authoryear.pdf} - -\phantomsection -%\addcontentsline{toc}{section}{opt-autolang-multilan} -\includepdf[pages=-,addtotoc={1,section,1,opt-autolang-multilan,eg:multilang}]{example/opt-autolang-multilan.pdf} - - -\phantomsection -%\addcontentsline{toc}{section}{opt-eg-multilan} -\includepdf[pages=-,addtotoc={1,section,1,opt-eg-multilan,eg:multilanga}]{example/opt-eg-multilan.pdf} - - -\phantomsection -\includepdf[pages=-,addtotoc={1,section,1,opt-gblanorder-chineseahead,eg:lanordercnah}]{example/opt-gblanorder-chineseahead.pdf} - -\phantomsection -\includepdf[pages=-,addtotoc={1,section,1,opt-gblanorder-englishahead,eg:lanorderenah}]{example/opt-gblanorder-englishahead.pdf} - -\phantomsection -\includepdf[pages=-,addtotoc={1,section,1,opt-gblanorder-udforder,eg:lanorderudf}]{example/opt-gblanorder-udforder.pdf} - -\phantomsection -\includepdf[pages=-,addtotoc={1,section,1,test-setlocal,eg:setlocalstring}] -{example/test-setlocal.pdf} - -\phantomsection -\includepdf[pages=-,addtotoc={1,section,1,test-setlocal-multilan,eg:setlocalstringmutillan}] -{example/test-setlocal-multilan.pdf} - - -\end{document} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015ms.tex b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015ms.tex deleted file mode 100644 index ffc76f6e26..0000000000 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015ms.tex +++ /dev/null @@ -1,15 +0,0 @@ -\documentclass{article} -\usepackage{pdfpages}%直接插入pdf文件页 -\graphicspath{{egfigure/}{example/}} - -\begin{document} - -\includepdf[pages=-]{egfigure/tgbcitationms.pdf} - -\IfFileExists{egfigure/tngbcitationay.pdf} -{\includepdf[pages=-]{egfigure/tngbcitationay.pdf}} -{\includepdf[pages=-]{egfigure/tngbcitationaynew.pdf}} - -\includepdf[pages=-]{egfigure/tgbbiblioms.pdf} - -\end{document} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015thesis.tex b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015thesis.tex deleted file mode 100644 index 80ede4a301..0000000000 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015thesis.tex +++ /dev/null @@ -1,68 +0,0 @@ -\documentclass{article} -\usepackage[colorlinks]{hyperref} -\usepackage{pdfpages}%直接插入pdf文件页 -\graphicspath{{egfigure/}{example/}} - -\begin{document} - -\tableofcontents - -\newpage -%\addcontentsline{toc}{section}{BUPT} -\includepdf[pages=-,addtotoc={1,section,1,BUPT,eg:BUPT}]{egthesis/thesis-bupt-numeric.pdf} - - -%\addcontentsline{toc}{section}{CAU} -\includepdf[pages=-,addtotoc={1,section,1,CAU,eg:CAU}]{egthesis/thesis-cau-numeric.pdf} - - -%\addcontentsline{toc}{section}{ECNU} -\includepdf[pages=-,addtotoc={1,section,1,ECNU,eg:ECNU}]{egthesis/thesis-ecnu-numeric.pdf} - - -%\addcontentsline{toc}{section}{FDU} -\includepdf[pages=-,addtotoc={1,section,1,FDU,eg:FDU}]{egthesis/thesis-fdu-numeric.pdf} - - -%\addcontentsline{toc}{section}{NWAFU} -\includepdf[pages=-,addtotoc={1,section,1,NWAFU,eg:nwafu}]{egthesis/thesis-nwafu-ay.pdf} - -%\addcontentsline{toc}{section}{SEU} -\includepdf[pages=-,addtotoc={1,section,1,SEU,eg:seu}]{egthesis/thesis-seu-numeric.pdf} - -%\addcontentsline{toc}{section}{SJTU} -\includepdf[pages=-,addtotoc={1,section,1,SJTU,eg:SJTU}]{egthesis/thesis-sjtu-numeric.pdf} - - -%\addcontentsline{toc}{section}{THU} -\includepdf[pages=-,addtotoc={1,section,1,THU,eg:THU}]{egthesis/thesis-thu-numeric.pdf} - -%\addcontentsline{toc}{section}{THU} -\includepdf[pages=-,addtotoc={1,section,1,THU,eg:TongJi}]{egthesis/thesis-tongji.pdf} - -%\addcontentsline{toc}{section}{UCAS} -\includepdf[pages=-,addtotoc={1,section,1,UCAS-m,eg:UCASm}]{egthesis/thesis-ucas-m.pdf} - - -%\addcontentsline{toc}{section}{UIBE} -\includepdf[pages=-,addtotoc={1,section,1,UIBE,eg:UIBE}]{egthesis/thesis-uibe-numeric.pdf} - - -%\addcontentsline{toc}{section}{USTC} -\includepdf[pages=-,addtotoc={1,section,1,USTC-ay,eg:USTCay}]{egthesis/thesis-ustc-authoryear.pdf} - - -%\addcontentsline{toc}{section}{USTC} -\includepdf[pages=-,addtotoc={1,section,1,USTC-num,eg:USTCnum}]{egthesis/thesis-ustc-numeric.pdf} - - -%\addcontentsline{toc}{section}{XJTU} -\includepdf[pages=-,addtotoc={1,section,1,XJTU,eg:XJTU}]{egthesis/thesis-xjtu-numeric.pdf} - - -%\addcontentsline{toc}{section}{ZJU} -\includepdf[pages=-,addtotoc={1,section,1,ZJU,eg:ZJU}]{egthesis/thesis-zju-numeric.pdf} - - - -\end{document} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/readme-BibLatex-Check.md b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/readme-BibLatex-Check.md deleted file mode 100644 index d441c64790..0000000000 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/readme-BibLatex-Check.md +++ /dev/null @@ -1,27 +0,0 @@ -BibLatex-Check - -是Pezmc开发检查bib文件中参考文献条目和域是否符合biblatex设定的python脚本。 -输入为bib文件,输出为bib文件正确与否的信息,会包括域的欠缺信息等,为一个html文件,该用firefox打开会比较快。 - -仓库见:https://github.com/Pezmc/BibLatex-Check - -用法: - -`./biblatex_check.py <-b input.bib> [-a input.aux] [-o output.html]` - -注意:aux和html文件是可选的。 - -帮助命令: - -`./biblatex_check.py -h` - -选项: - -- -b (--bib=file.bib) Set the input Bib File -- -a (--aux=file.aux) Set the input Aux File -- -o (--output=file.html) Write results to the HTML Output File. -- -v (--view) Open in Browser. Use together with -o. -- -N (--no-console) Do not print problems to console. An exit code is always returned. - - - diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/readme-BibLatex-map.md b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/readme-BibLatex-map.md deleted file mode 100644 index 9209550fc7..0000000000 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/readme-BibLatex-map.md +++ /dev/null @@ -1,152 +0,0 @@ -# biblatex-map.py - -是一个用于处理、修改和规范化bib文件的python脚本。 - -主要功能包括: -1. 基于biblatex的source map的逻辑修改bib文件中的参考文献信息 -2. 输入bib文件的解析,输出修改后的bib文件,以及json格式的参考文献文件 -3. 输出定制著录格式比如GB/T 7714-2015标准的参考文献表,输出文本或者thebibliography环境。简化格式定制方式 -4. 进一步可以实现一个宏包,实现一个简化功能的低配版biblatex - -处理的逻辑遵循biblatex的动态数据修改的规范,修改参数设置基本相同,只是把biblatex用tex命令表示的`\maps`、`\map`和`\step`转换为用json格式表示。 - -等价于用python重新实现了biber的动态数据修改功能。 - -------------------------------- - -本来想将这一内容放到Pezmc开发的biblatex_check脚本中,但想想还是纯粹点好了。 - -------------------------------- - -Maintainer: huzhenzhen - -Homepage: - -License:MIT license - - --------------------------------------- - -## 用法: - -直接在python命令行中运行 - -`./biblatex-map.py` - -需要修改的bib文件在`biblatex-map.py`修改: - -``` -if __name__=="__main__": - - #设置输入的bib文件 - inputbibfile='biblatex-map-test.bib' - - #set the aux file - #this is not necessary - #auxfile='tex-source-code.aux' -``` - -输出的bib/json文件自动生成,当设置了aux文件后,那么输出的bib文件中条目将限制为aux中引用的文献条目。 - -修改bib文件内容的配置用json格式表示,直接在`biblatex-map.py`修改sourcemaps参数: - -``` -#maps所有的修改用map构成一个maps -sourcemaps=[ - [#map1:将ELECTRONIC类型转换为online类型 - [{"typesource":"ELECTRONIC","typetarget":"online"}]#step1 - ], - [#map2:将source域转换为url域 - [{"fieldsource":"source","fieldtarget":"url"}]#step1 - ], - [#map3:将urldate域的信息“yyyy-m-d”转换为“yyyy-mm-dd”,注意正则表达式直接写不用在外面套"" - [{"fieldsource":"urldate","match":r'(\d\d\d\d)\-(\d)\-(\d)',"replace":r'\1-0\2-0\3'}]#step1 - ], - [#map4:将urldate域的信息“yyyy-m-d”转换为“yyyy-mm-dd”,注意正则表达式直接写不用在外面套"" - [{"fieldsource":"date","match":r'(\d\d\d\d)\-(\d)\-(\d)',"replace":r'\1-0\2-0\3',"overwrite":True}]#step1 - ], - [#map5:将refdate域转换为urldate域 - [{"fieldsource":"refdate","fieldtarget":"urldate"}]#step1 - ], - [#map6:对于newspaper类型,设置note为news - [{"pertype":"newspaper"}],#step1 - [{"fieldset":"note","fieldvalue":"news","overwrite":True}]#step2 - ], - [#map7:设置edition域等于version - [{"fieldsource":"version","final":True}],#step1 - [{"fieldset":"edition","origfieldval":True}]#step2 - ], - [#map8:设置entrykey域设置给keywords - [{"fieldsource":"entrykey"}],#step1 - [{"fieldset":"keywords","origfieldval":True}]#step2 - ], - [#map9:对于存在note域的情况,将其值添加到keywords - [{"fieldsource":"note","final":True}],#step1 - [{"fieldset":"keywords","origfieldval":True,"overwrite":True,"append":True}]#step2 - ], - [#map10:根据标题的字符编码范围确定标题的语言类型 - [{"fieldsource":"title","match":r'[\u2FF0-\u9FA5]',"final":True}],#step1 - [{"fieldset":"userd","fieldvalue":"chinese"}]#step2 - ], -] -``` - -sourcemaps参数其实是json格式的。 -sourcemaps是一个列表,记录所有的修改,一个修改是一个map,也是一个列表。 -一个map列表中有任意数量的step(步骤),一个step内由一个key-val参数构成字典(dict)数据结构。 - -处理逻辑是这样: -``` - for map in maps #遍历maps中的所有map - for entry in entries #对所有的条目均执行该map - for step in map #遍历map中的所有step - code for the step to modify the bib entry -``` - -需要注意:python中正则和perl中的略有不同,比如python用\xHH,\uHHHH,\UHHHHHHHH表示unicode字符,而perl直接用\x{HHHH}表示。 - -## need to do: - -已实现的选项: -typesource=?entrytype? -typetarget=?entrytype? -fieldsource=?entryfield? -fieldtarget=?entryfield? -match=?regexp? -matchi=?regexp? -notmatch=?regexp? -notmatchi=?regexp? -replace=?regexp? - -notfield=?entryfield? -final=true, false default: false -origfieldval=true, false default: false -append=true, false default: false -pertype -pernottype - -fieldset=?entryfield? -fieldvalue=?string? -null=true, false default: false -origfield=true, false default: false -origentrytype=true, false default: false -origfieldval=true, false default: false - - - -未实现的选项 - -entryclone=?clonekey? -entrynew=?entrynewkey? -entrynewtype=?string? -entrytarget=?string? -entrynocite=true, false default: false -entrynull=true, false default: false - -1. match 大小写区分的match - - - - - - diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-oxref/Makefile b/macros/latex/contrib/biblatex-contrib/biblatex-oxref/Makefile index 527f4146c6..e58dba0ac6 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-oxref/Makefile +++ b/macros/latex/contrib/biblatex-contrib/biblatex-oxref/Makefile @@ -26,7 +26,7 @@ $(STYS:%=%-doc.pdf): %-doc.pdf : %-doc.tex $(NAME).bbx %.bbx %.cbx british-$(NAM latexmk -silent -lualatex -shell-escape -interaction=nonstopmode $< >/dev/null clean: - for log in *.log; do [ -e "$$log" ] || continue; grep "WARNING: biblatex-oxref" $$log; test $$? -eq 1; done + @for log in *.log; do [ -e "$$log" ] || continue; grep "WARNING: biblatex-oxref" $$log; test $$? -eq 1; done rm -f $(NAME).{$(AUX)} $(STYS:%=%-doc.{$(AUX)}) rm -f $(STYS:%=%.doc) {american,british,english}-$(NAME).doc rm -rf _minted-* diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-oxref/README.md b/macros/latex/contrib/biblatex-contrib/biblatex-oxref/README.md index ed2a550642..070e51eb27 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-oxref/README.md +++ b/macros/latex/contrib/biblatex-contrib/biblatex-oxref/README.md @@ -140,7 +140,7 @@ first two steps. ## Licence -Copyright 2016–2020 Alex Ball. +Copyright 2016–2021 Alex Ball. This work consists of the documented LaTeX file oxref.dtx and a Makefile. diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxalph-doc.pdf b/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxalph-doc.pdf index ce452f4772..d298a7d4f2 100644 Binary files a/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxalph-doc.pdf and b/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxalph-doc.pdf differ diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxnotes-doc.pdf b/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxnotes-doc.pdf index d31e38c0b2..032b19373f 100644 Binary files a/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxnotes-doc.pdf and b/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxnotes-doc.pdf differ diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxnum-doc.pdf b/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxnum-doc.pdf index 96f409d6d6..8851a9b454 100644 Binary files a/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxnum-doc.pdf and b/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxnum-doc.pdf differ diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxref.dtx b/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxref.dtx index 32c12f7cb7..66eeb6bee5 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxref.dtx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxref.dtx @@ -1,6 +1,6 @@ % \iffalse %<*internal|bbx|cbx|dbx|lbx|doc> -\def\Version{2020/10/19 v2.1} +\def\Version{2021/01/18 v2.2} % %<*internal> \iffalse @@ -166,7 +166,7 @@ See: http://www.latex-project.org/lppl.txt \endpreamble \postamble -Copyright (C) 2016–2020 Alex Ball +Copyright (C) 2016–2021 Alex Ball \endpostamble \usedir{tex/latex/\jobname} @@ -229,7 +229,7 @@ Copyright (C) 2016–2020 Alex Ball \PassOptionsToPackage{style=oxnotes}{biblatex} % %\PassOptionsToPackage{style=oxnotes,scnames,varissuedate,anon}{biblatex} -%\PassOptionsToPackage{style=oxnum,scnames,varissuedate,anon}{biblatex} +%\PassOptionsToPackage{style=oxnum,scnames,varissuedate,anon,backref=true}{biblatex} %\PassOptionsToPackage{style=oxalph,varissuedate,anon}{biblatex} %\PassOptionsToPackage{style=oxyear,varissuedate,anon}{biblatex} %<*driver|doc> @@ -380,7 +380,7 @@ Copyright (C) 2016–2020 Alex Ball } % -\hypersetup{pdfborder={0 0 0},pdfencoding=auto} +\hypersetup{pdfborder={0 0 0},pdfencoding=unicode} \usepackage[noabbrev,capitalize,nameinlink]{cleveref} \crefname{page}{page}{pages} @@ -842,7 +842,7 @@ first two steps. ## Licence -Copyright 2016–2020 Alex Ball. +Copyright 2016–2021 Alex Ball. This work consists of the documented LaTeX file oxref.dtx and a Makefile. @@ -971,6 +971,10 @@ The style has some options additional to the regular \pkg{biblatex} ones: Removes publisher name from all entries. Once set, this option cannot be overridden. \end{docKey} +\begin{docKey}{norelatedin}{=\val{true}|\val{false}}{default \val{true}, initially \val{false}} + Suppresses the printing of the \code{in} localization string in circumstances where it would appear directly following a related string such as \enquote{originally published as}. It can also be set on a per-type and per-entry basis. The effects of this key are not well tested, so do please get in touch (see below) if you encounter problems with it. +\end{docKey} + \begin{docKey}{relationpunct}{=\val{period}|\val{comma}|\val{semicolon}|\val{colon}|\val{space}}{default \val{semicolon}, initially \val{semicolon}} Sets the punctuation that precedes the \code{relatedtype} localization string. An additional space is assumed unless the value is \val{space}. @@ -6918,8 +6922,13 @@ will trigger the use of parentheses. \end{Verbatim} \end{bibexbox} +\defbibnote{preface}{This document uses the \pkg{biblatex} option \key{backref} +to demonstrate how entries can be marked with the page(s) on which they were +cited. The format of the back references comes from \pkg{biblatex} itself +rather than \pkg[biblatex]{oxref}.} -\printbibliography[notcategory=hidden] +%\printbibliography[notcategory=hidden] +%\printbibliography[notcategory=hidden,prenote=preface] % % %<*driver> @@ -7120,11 +7129,7 @@ will trigger the use of parentheses. % % \begin{macrocode} \newtoggle{blx@ox@nametitle}\toggletrue{blx@ox@nametitle}% -\DeclareBibliographyOption{usenametitles}[true]{% - \settoggle{blx@ox@nametitle}{#1}} -\DeclareTypeOption{usenametitles}[true]{% - \settoggle{blx@ox@nametitle}{#1}} -\DeclareEntryOption{usenametitles}[true]{% +\DeclareBiblatexOption{global,type,entry}{usenametitles}[true]{% \settoggle{blx@ox@nametitle}{#1}} % \end{macrocode} % @@ -7903,11 +7908,7 @@ will trigger the use of parentheses. \ifbibstring{#1}{\bibstring{#1}}{#1\isdot}% } \newtoggle{blx@ox@timefirst} -\DeclareBibliographyOption{timefirst}[true]{% - \settoggle{blx@ox@timefirst}{#1}} -\DeclareTypeOption{timefirst}[true]{% - \settoggle{blx@ox@timefirst}{#1}} -\DeclareEntryOption{timefirst}[true]{% +\DeclareBiblatexOption{global,type,entry}{timefirst}[true]{% \settoggle{blx@ox@timefirst}{#1}} \newbibmacro*{date+time}{% \ifboolexpr{ @@ -8213,7 +8214,7 @@ will trigger the use of parentheses. } \newcommand*{\ifabbrev}[3]{% \StrRight{#1}{1}[\blx@ox@lastchar]% - \IfSubStr{\blx@ox@abbrevstring}{\blx@ox@lastchar}{#2}{#3} + \expandafter\IfSubStr*{\blx@ox@abbrevstring}{\blx@ox@lastchar}{#2}{#3}% } % \end{macrocode} % @@ -8245,9 +8246,9 @@ will trigger the use of parentheses. }{}}% \usebibmacro{journal}% \iffieldundef{journalsubtitle}{% - \ifabbrev{\thefield{journaltitle}}{\setunit{\addspace}}{\newunit}% + \ifabbrev{\strfield{journaltitle}}{\setunit{\addspace}}{\newunit}% }{% - \ifabbrev{\thefield{journalsubtitle}}{\setunit{\addspace}}{\newunit}}% + \ifabbrev{\strfield{journalsubtitle}}{\setunit{\addspace}}{\newunit}}% \iffieldundef{series}{}{% \newunit\newblock \printfield{series}% @@ -8270,9 +8271,9 @@ will trigger the use of parentheses. \renewbibmacro*{title+issuetitle}{% \usebibmacro{periodical}% \iffieldundef{subtitle}{% - \ifabbrev{\thefield{title}}{\setunit{\addspace}}{\newunit}% + \ifabbrev{\strfield{title}}{\setunit{\addspace}}{\newunit}% }{% - \ifabbrev{\thefield{subtitle}}{\setunit{\addspace}}{\newunit}}% + \ifabbrev{\strfield{subtitle}}{\setunit{\addspace}}{\newunit}}% \iffieldundef{series}{}{% \newunit\newblock \printfield{series}% @@ -8345,17 +8346,9 @@ will trigger the use of parentheses. % % \begin{macrocode} \newtoggle{blx@ox@varissuedate} -\DeclareBibliographyOption{varissuedate}[true]{% - \settoggle{blx@ox@varissuedate}{#1}} -\DeclareTypeOption{varissuedate}[true]{% - \settoggle{blx@ox@varissuedate}{#1}} -\DeclareEntryOption{varissuedate}[true]{% +\DeclareBiblatexOption{global,type,entry}{varissuedate}[true]{% \settoggle{blx@ox@varissuedate}{#1}} -\DeclareBibliographyOption{issuedate-plain}[true]{% - \settoggle{blx@ox@varissuedate}{#1}} -\DeclareTypeOption{issuedate-plain}[true]{% - \settoggle{blx@ox@varissuedate}{#1}} -\DeclareEntryOption{issuedate-plain}[true]{% +\DeclareBiblatexOption{global,type,entry}{issuedate-plain}[true]{% \settoggle{blx@ox@varissuedate}{#1}} \renewbibmacro*{issue+date}{% \ifboolexpr{ @@ -8438,13 +8431,12 @@ will trigger the use of parentheses. \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% \usebibmacro{finentry}} % \end{macrocode} % @@ -8469,13 +8461,12 @@ will trigger the use of parentheses. \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% \usebibmacro{finentry}} % \end{macrocode} % @@ -8531,13 +8522,12 @@ will trigger the use of parentheses. \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% \usebibmacro{finentry}} % \end{macrocode} % @@ -8889,13 +8879,12 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% \usebibmacro{finentry}} % \end{macrocode} % @@ -8953,19 +8942,18 @@ reference,mvreference,inreference]{volume}{% \printfield{pagetotal}% \newunit\newblock \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% + {\printfield{isbn}} + {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} % \end{macrocode} % @@ -8988,9 +8976,9 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{maintitle+booktitle}% \newunit \iffieldundef{maintitle} - {\printfield{volume}% - \printfield{part}} - {}% + {\printfield{volume}% + \printfield{part}} + {}% \newunit\newblock \usebibmacro{byeditor+others}% \newunit\newblock @@ -9003,19 +8991,18 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{chapter+pages}% \newunit\newblock \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% + {\printfield{isbn}} + {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} % \end{macrocode} % @@ -9044,9 +9031,9 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{maintitle+booktitle}% \newunit \iffieldundef{maintitle} - {\printfield{volume}% - \printfield{part}} - {}% + {\printfield{volume}% + \printfield{part}} + {}% \newunit\newblock \usebibmacro{byeditor+others}% \newunit\newblock @@ -9057,19 +9044,18 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{chapter+pages}% \newunit\newblock \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% + {\printfield{isbn}} + {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} % \end{macrocode} % @@ -9092,9 +9078,9 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{maintitle+booktitle}% \newunit \iffieldundef{maintitle} - {\printfield{volume}% - \printfield{part}} - {}% + {\printfield{volume}% + \printfield{part}} + {}% \newunit\newblock \usebibmacro{byeditor+others}% \newunit\newblock @@ -9107,19 +9093,18 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{chapter+pages}% \newunit\newblock \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% + {\printfield{isbn}} + {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} % \end{macrocode} % @@ -9147,19 +9132,18 @@ reference,mvreference,inreference]{volume}{% \printfield{pagetotal}% \newunit\newblock \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% + {\printfield{isbn}} + {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} % \end{macrocode} % @@ -9205,19 +9189,18 @@ reference,mvreference,inreference]{volume}{% \printfield{pagetotal}% \newunit\newblock \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% + {\printfield{isbn}} + {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} % \end{macrocode} % @@ -9242,9 +9225,9 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{maintitle+booktitle}% \newunit \iffieldundef{maintitle} - {\printfield{volume}% - \printfield{part}} - {}% + {\printfield{volume}% + \printfield{part}} + {}% \newunit\newblock \printfield{volumes}% \newunit\newblock @@ -9255,19 +9238,18 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{chapter+pages}% \newunit\newblock \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% + {\printfield{isbn}} + {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} % \end{macrocode} % @@ -9296,9 +9278,9 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{maintitle+booktitle}% \newunit \iffieldundef{maintitle} - {\printfield{volume}% - \printfield{part}} - {}% + {\printfield{volume}% + \printfield{part}} + {}% \newunit\newblock \printfield{volumes}% \newunit\newblock% @@ -9307,19 +9289,18 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{chapter+pages}% \newunit\newblock \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% + {\printfield{isbn}} + {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} % \end{macrocode} % @@ -9352,19 +9333,18 @@ reference,mvreference,inreference]{volume}{% \printfield{pagetotal}% \newunit\newblock \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% + {\printfield{isbn}} + {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} % \end{macrocode} % @@ -9413,19 +9393,18 @@ reference,mvreference,inreference]{volume}{% \printfield{pagetotal}% \newunit\newblock \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% + {\printfield{isbn}} + {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} % \end{macrocode} % @@ -9450,9 +9429,9 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{maintitle+booktitle}% \newunit \iffieldundef{maintitle} - {\printfield{volume}% - \printfield{part}} - {}% + {\printfield{volume}% + \printfield{part}} + {}% \newunit\newblock \printfield{edition}% \newunit @@ -9469,19 +9448,18 @@ reference,mvreference,inreference]{volume}{% \printfield{pagetotal}% \newunit\newblock \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% + {\printfield{isbn}} + {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} % \end{macrocode} % @@ -9539,9 +9517,9 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{maintitle+title}% \newunit \iffieldundef{maintitle} - {\printfield{volume}% - \printfield{part}} - {}% + {\printfield{volume}% + \printfield{part}} + {}% \newunit\newblock \usebibmacro{event+venue+date}% \newunit\newblock @@ -9560,19 +9538,18 @@ reference,mvreference,inreference]{volume}{% \printfield{pagetotal}% \newunit\newblock \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% + {\printfield{isbn}} + {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} % \end{macrocode} % @@ -9593,9 +9570,9 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{maintitle+booktitle}% \newunit \iffieldundef{maintitle} - {\printfield{volume}% - \printfield{part}} - {}% + {\printfield{volume}% + \printfield{part}} + {}% \newunit\newblock \usebibmacro{event+venue+date}% \newunit\newblock @@ -9612,19 +9589,18 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{chapter+pages}% \newunit\newblock \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% + {\printfield{isbn}} + {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} % \end{macrocode} % @@ -9835,9 +9811,9 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{maintitle+title}% \newunit \iffieldundef{maintitle} - {\printfield{volume}% - \printfield{part}} - {}% + {\printfield{volume}% + \printfield{part}} + {}% \setunit{\titlebyauthordelim}\newblock \usebibmacro{byauthor}% \newunit\newblock @@ -9848,28 +9824,26 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{series+type+number}% \setunit{\addspace}% \usebibmacro{institution+location+date}% - \iffieldequals{entrysubtype}{\legreport}{% - \setunit{\addspace}\nopunct - }{% - \newunit\newblock}% + \iffieldequals{entrysubtype}{\legreport} + {\setunit{\addspace}\nopunct} + {\newunit\newblock}% \usebibmacro{chapter+pages}% \newunit \printfield{pagetotal}% \newunit\newblock \iftoggle{bbx:isbn} - {\printfield{isrn}} - {}% + {\printfield{isrn}} + {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} % \end{macrocode} % @@ -9982,13 +9956,12 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% \usebibmacro{finentry}} % \end{macrocode} % @@ -10018,17 +9991,17 @@ reference,mvreference,inreference]{volume}{% }{}% \usebibmacro{author/editor}% \setunit{\printdelim{nametitledelim}}\newblock - \ifentrytype{software}{% - \usebibmacro{title+version}% - }{% - \usebibmacro{title}}% + \ifentrytype{software} + {\usebibmacro{title+version}} + {\usebibmacro{title}}% \setunit{\titlebyauthordelim}\newblock \usebibmacro{byauthor}% \newunit\newblock \usebibmacro{byeditor}% \newunit - \ifentrytype{software}{}{% - \newunit\printfield{version}}% + \ifentrytype{software} + {} + {\newunit\printfield{version}}% \newunit \printfield{note}% \newunit\newblock @@ -10039,19 +10012,18 @@ reference,mvreference,inreference]{volume}{% \printfield{pagetotal}% \newunit\newblock \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% + {\printfield{isbn}} + {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} \DeclareBibliographyAlias{standard}{manual} \ExecuteBibliographyOptions[standard]{useeditor=false} @@ -10183,19 +10155,18 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{post-byeditor+others}% \newunit\newblock \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% + {\printfield{isbn}} + {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} % \end{macrocode} % @@ -10250,19 +10221,18 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{post-byeditor+others}% \newunit\newblock \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% + {\printfield{isbn}} + {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} % \end{macrocode} % @@ -10397,19 +10367,18 @@ reference,mvreference,inreference]{volume}{% \printlist{organization}% \newunit\newblock \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% + {\printfield{isbn}} + {}% \newunit\newblock \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} \DeclareBibliographyAlias{image}{performance} \DeclareBibliographyAlias{artwork}{performance} @@ -10512,19 +10481,18 @@ reference,mvreference,inreference]{volume}{% \printlist{publisher}% \newunit\newblock \iftoggle{bbx:eprint} - {\usebibmacro{eprint}} - {}% + {\usebibmacro{eprint}} + {}% \newunit\newblock \usebibmacro{url+urldate}% \newunit\newblock \usebibmacro{addendum+pubstate}% + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% \usebibmacro{finentry}} % \end{macrocode} % @@ -10596,13 +10564,12 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{doi+eprint+url}% \newunit\newblock \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% \usebibmacro{finentry}} % \end{macrocode} % @@ -10626,9 +10593,7 @@ reference,mvreference,inreference]{volume}{% \setboolean{bbx@paryear-essential}{#1}} \newtoggle{blx@ox@nopostnotedelim} \newtoggle{bbx:altcourt} -\DeclareBibliographyOption{court-plain}[true]{% - \settoggle{bbx:altcourt}{#1}} -\DeclareEntryOption{court-plain}[true]{% +\DeclareBiblatexOption{global,type,entry}{court-plain}[true]{% \settoggle{bbx:altcourt}{#1}} \newtoggle{bbx@ecliuse} \newtoggle{bbx@eclionly} @@ -10962,13 +10927,13 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{doi+eprint+url}% \setunit{\addspace}%\newblock \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% \setunit{\addspace}%\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% \usebibmacro{finentry}} \newtoggle{bbx@juriscitedone} \newbibmacro{juriscitation}{% @@ -11387,7 +11352,8 @@ reference,mvreference,inreference]{volume}{% \usebibmacro{legsupp}}}}% \setunit{\addcomma\space}% \printfield{note}% - \setunit{\addspace}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% \usebibmacro{finentry}} \newbibmacro*{courtrules}{% \restorefield{prenote}{\postnotesecond}% @@ -11757,11 +11723,12 @@ reference,mvreference,inreference]{volume}{% \iftoggle{bbx:url}{% \usebibmacro{url+urldate}% }{}% - \setunit{\relatedtypepunct}\newblock \iftoggle{bbx:related}{% \usebibmacro{related:init}% \usebibmacro{related}% }{}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% \usebibmacro{finentry}} % \end{macrocode} % @@ -11824,13 +11791,12 @@ reference,mvreference,inreference]{volume}{% {}% \newunit\newblock \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \setunit{\relatedtypepunct}\newblock \iftoggle{bbx:related} {\usebibmacro{related:init}% \usebibmacro{related}} {}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% \usebibmacro{finentry}} % \end{macrocode} % @@ -11851,81 +11817,128 @@ reference,mvreference,inreference]{volume}{% % \subsection{Related entries} % % We make the punctuation before related items configurable in remaining drivers -% inherited from the standard style. +% inherited from the standard style, and move the |pageref| macro to the end. % % \begin{macrocode} \xpatchbibdriver{booklet}{% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% \newunit\newblock \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% }{% - \setunit{\relatedtypepunct}\newblock \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% }{}{\wlog{WARNING: biblatex-oxref failed to patch booklet}} +% \end{macrocode} +% \begin{macrocode} \xpatchbibdriver{misc}{% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% \newunit\newblock \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% }{% - \setunit{\relatedtypepunct}\newblock \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% }{}{\wlog{WARNING: biblatex-oxref failed to patch misc}} % \end{macrocode} % % We provide an option for setting the relatedtype punctuation. % % \begin{macrocode} -\DeclareBibliographyOption[string]{relationpunct}[semicolon]{% - \ifcsdef{add#1}{% - \ifstrequal{#1}{space}{% - \renewcommand*{\relatedtypepunct}{\addspace}% - }{% - \renewcommand*{\relatedtypepunct}{\csuse{add#1}\space}}% - }{% +\DeclareDelimFormat{begrelateddelimequals}{\addspace} +\DeclareDelimFormat{begrelateddelimin}{\addcomma\space} +\DeclareDelimFormat{begrelateddelimincludes}{\addcomma\space} +\DeclareDelimFormat{begrelateddelimreprintfrom}{\addperiod\space} +\DeclareDelimFormat{begrelateddelimreviewof}{\newunitpunct} +\DeclareDelimFormat{begrelateddelimtranslationof}{\addspace} +\DeclareDelimFormat{begrelateddelimmultivolume}{\newunitpunct} +\DeclareDelimFormat{relateddelimmultivolume}{\newunitpunct} +\newtoggle{blx@ox@success} +\DeclareBiblatexOption{global,type}[string]{relationpunct}[semicolon]{% + \bgroup\blx@blxinit + \ifcsdef{add#1}{\global\toggletrue{blx@ox@success}}{% + \global\togglefalse{blx@ox@success}% \PackageError{biblatex-oxref}{% Invalid option 'relationpunct=#1'% }{% Valid values are 'dot', 'comma', 'semicolon', 'colon',\MessageBreak - 'period', 'exclam', 'question', and 'space'.}}} -\DeclareTypeOption[string]{relationpunct}[semicolon]{% - \ifcsdef{add#1}{% - \ifstrequal{#1}{space}{% - \renewcommand*{\relatedtypepunct}{\addspace}% - }{% - \renewcommand*{\relatedtypepunct}{\csuse{add#1}\space}}% + 'period', 'exclam', 'question', and 'space'.}}% + \egroup + \iftoggle{blx@ox@success}{\ifstrequal{#1}{space}{% + \DeclareDelimFormat{begrelateddelim}{\addspace}% }{% - \PackageError{biblatex-oxref}{% - Invalid option 'relationpunct=#1'% - }{% - Valid values are 'dot', 'comma', 'semicolon', 'colon',\MessageBreak - 'period', 'exclam', 'question', and 'space'.}}} -\newtoggle{blx@ox@relpunctset} + \DeclareDelimFormat{begrelateddelim}{\csuse{add#1}\space}}% + }{}} \DeclareEntryOption[string]{relationpunct}[semicolon]{% - \ifcsdef{add#1}{% - \ifstrequal{#1}{space}{% - \renewcommand*{\relatedtypepunct}{\addspace}% - }{% - \renewcommand*{\relatedtypepunct}{\csuse{add#1}\space}}% - \toggletrue{blx@ox@relpunctset} - }{% + \bgroup\blx@blxinit + \ifcsdef{add#1}{\global\toggletrue{blx@ox@success}}{% + \global\togglefalse{blx@ox@success}% \PackageError{biblatex-oxref}{% Invalid option 'relationpunct=#1'% }{% Valid values are 'dot', 'comma', 'semicolon', 'colon',\MessageBreak - 'period', 'exclam', 'question', and 'space'.}}} + 'period', 'exclam', 'question', and 'space'.}}% + \egroup + \iftoggle{blx@ox@success}{\ifstrequal{#1}{space}{% + \DeclareDelimFormat{begrelateddelim}{\addspace}% + \DeclareDelimFormat{begrelateddelimequals}{\addspace}% + \DeclareDelimFormat{begrelateddelimin}{\addspace}% + \DeclareDelimFormat{begrelateddelimincludes}{\addspace}% + \DeclareDelimFormat{begrelateddelimreprintfrom}{\addspace}% + \DeclareDelimFormat{begrelateddelimreviewof}{\addspace}% + \DeclareDelimFormat{begrelateddelimtranslationof}{\addspace}% + \DeclareDelimFormat{begrelateddelimmultivolume}{\addspace}% + }{% + \DeclareDelimFormat{begrelateddelim}{\csuse{add#1}\space}% + \DeclareDelimFormat{begrelateddelimequals}{\csuse{add#1}\space}% + \DeclareDelimFormat{begrelateddelimin}{\csuse{add#1}\space}% + \DeclareDelimFormat{begrelateddelimincludes}{\csuse{add#1}\space}% + \DeclareDelimFormat{begrelateddelimreprintfrom}{\csuse{add#1}\space}% + \DeclareDelimFormat{begrelateddelimreviewof}{\csuse{add#1}\space}% + \DeclareDelimFormat{begrelateddelimtranslationof}{\csuse{add#1}\space}% + \DeclareDelimFormat{begrelateddelimmultivolume}{\csuse{add#1}\space}}% + }{}} +\ExecuteBibliographyOptions{relationpunct} \newcounter{blx@ox@relitem} \xapptobibmacro{begrelated}{% \setcounter{blx@ox@relitem}{0}% - \iftoggle{blx@ox@relpunctset}{}{% - \iffieldequalstr{relatedtype}{in}{% - \setunit{\addcomma\space}}{}% - \iffieldequalstr{relatedtype}{reprintfrom}{% - \setunit{\addperiod\space}}{}% - \iffieldequalstr{relatedtype}{translationof}{% - \setunit{\addspace}}{}% - \iffieldequalstr{relatedtype}{multivolume}{% - \setunit{\addcomma\space}}{}% -}}{}{\wlog{WARNING: biblatex-oxref failed to append to begrelated}} -\DeclareDelimFormat{relateddelimmultivolume}{\newunitpunct} -\DeclareDelimFormat{begrelateddelimmultivolume}{\newunitpunct} +}{}{\wlog{WARNING: biblatex-oxref failed to append to begrelated}} +% \end{macrocode} +% +% We provide an option to prevent a related item beginning with "in". +% +% \begin{macrocode} +\newtoggle{blx@ox@norelin} +\DeclareBiblatexOption{global,type,entry}{norelatedin}[true]{% + \settoggle{blx@ox@norelin}{#1}} +\xapptobibmacro{begrelatedloop}{% + \iftoggle{blx@ox@norelin}{% + \renewbibmacro*{in:}{% + \ifboolexpr{ + test {\ifnameundef{author}} + and + test {\ifnameundef{translator}} + and + test {\iffieldundef{title}} + }{}{% + \bibstring{in}% + \printunit{\intitlepunct}% + }}}{}% +}{}{\wlog{WARNING: biblatex-oxref failed to append to begrelatedloop}} % \end{macrocode} % @@ -12843,8 +12856,8 @@ reference,mvreference,inreference]{volume}{% \defbibenvironment{bibliography} {\list {\printtext[labelnumberwidth]{% - \printfield{labelprefix}% - \printfield{labelnumber}}} + \printfield{labelprefix}% + \printfield{labelnumber}}} {\setlength{\labelwidth}{\labelnumberwidth}% \setlength{\leftmargin}{\labelwidth}% \setlength{\labelsep}{\biblabelsep}% @@ -12872,7 +12885,7 @@ reference,mvreference,inreference]{volume}{% \entryset {\ifbool{bbx:subentry} {\printfield[bibentrysetcount]{entrysetcount}% - \printunit*{\addnbspace}} + \printunit*{\addnbspace}} {}} {}% \newunit\newblock @@ -12996,11 +13009,7 @@ reference,mvreference,inreference]{volume}{% % % \begin{macrocode} \newtoggle{blx@ox@nonodate} -\DeclareBibliographyOption{nonodate}[true]{% - \settoggle{blx@ox@nonodate}{#1}} -\DeclareTypeOption{nonodate}[true]{% - \settoggle{blx@ox@nonodate}{#1}} -\DeclareEntryOption{nonodate}[true]{% +\DeclareBiblatexOption{global,type,entry}{nonodate}[true]{% \settoggle{blx@ox@nonodate}{#1}} \newbibmacro*{labeldate}{% \ifboolexpr{ diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxref.pdf b/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxref.pdf index f2e38b76aa..3daf20e3ce 100644 Binary files a/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxref.pdf and b/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxref.pdf differ diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxyear-doc.pdf b/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxyear-doc.pdf index f9a115aab7..7492f2c4b1 100644 Binary files a/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxyear-doc.pdf and b/macros/latex/contrib/biblatex-contrib/biblatex-oxref/oxyear-doc.pdf differ diff --git a/macros/latex/contrib/easybook/doc/easybook-demo.pdf b/macros/latex/contrib/easybook/doc/easybook-demo.pdf index 71496575c9..18c3384f52 100644 Binary files a/macros/latex/contrib/easybook/doc/easybook-demo.pdf and b/macros/latex/contrib/easybook/doc/easybook-demo.pdf differ diff --git a/macros/latex/contrib/easybook/doc/easybook-demo.tex b/macros/latex/contrib/easybook/doc/easybook-demo.tex index 2c9a7ae899..e96e315e25 100644 --- a/macros/latex/contrib/easybook/doc/easybook-demo.tex +++ b/macros/latex/contrib/easybook/doc/easybook-demo.tex @@ -95,7 +95,7 @@ \edge~\url{https://latexstudio.net} \\ \url{https://ctan.org/pkg/easybook} } - \date{2021/01/18\hskip\ccwd\relax v1.21f} + \date{2021/01/19\hskip\ccwd\relax v1.21h} } \begin{document} diff --git a/macros/latex/contrib/easybook/doc/easybook.pdf b/macros/latex/contrib/easybook/doc/easybook.pdf index 8cdd54c31a..f3f39b11b1 100644 Binary files a/macros/latex/contrib/easybook/doc/easybook.pdf and b/macros/latex/contrib/easybook/doc/easybook.pdf differ diff --git a/macros/latex/contrib/easybook/doc/easybook.tex b/macros/latex/contrib/easybook/doc/easybook.tex index aa6248434b..3f465f79df 100644 --- a/macros/latex/contrib/easybook/doc/easybook.tex +++ b/macros/latex/contrib/easybook/doc/easybook.tex @@ -8,7 +8,7 @@ \title{\sffamily easybook书籍文档类} \author{瞿毅} -\date{2021/01/18\hskip\ccwd\relax v1.21f\thanks{\url{https://gitee.com/texl3/easybook}}} +\date{2021/01/19\hskip\ccwd\relax v1.21h\thanks{\url{https://gitee.com/texl3/easybook}}} \begin{document} \maketitle @@ -544,4 +544,4 @@ \IndexLayout \PrintChanges \PrintIndex -\end{document} \ No newline at end of file +\end{document} \ No newline at end of file diff --git a/macros/latex/contrib/easybook/easybook.cls b/macros/latex/contrib/easybook/easybook.cls index 59eee8726e..934e5dc1df 100644 --- a/macros/latex/contrib/easybook/easybook.cls +++ b/macros/latex/contrib/easybook/easybook.cls @@ -9,7 +9,7 @@ %% https://creativecommons.org/licenses/by/4.0/legalcode \NeedsTeXFormat{LaTeX2e} \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2021/01/18}{1.21f}{} +\ProvidesExplClass{easybook}{2021/01/19}{1.21h}{} \cs_generate_variant:Nn \keys_define:nn {nx} \cs_generate_variant:Nn \int_to_arabic:n {v} @@ -93,7 +93,6 @@ \PassOptionsToPackage{CJKmath = true}{xeCJK} \LoadClass[UTF8]{ctexbook} -\bool_set_true:N \l__backend_bibtex_bool \bool_new:N \l__capdash_bool \bool_new:N \l__multoc_bool \bool_new:N \l__chap_withpart_bool @@ -1004,6 +1003,7 @@ colback = #1!15!white,#2 }{#3} +\bool_set_true:N \l__backend_bibtex_bool \tl_new:N \l__bib_mysty_tl \tl_new:N \l__bib_style_tl \tl_new:N \l__bib_citesty_tl diff --git a/macros/latex/contrib/everysel/README.md b/macros/latex/contrib/everysel/README.md new file mode 100644 index 0000000000..900fac86ef --- /dev/null +++ b/macros/latex/contrib/everysel/README.md @@ -0,0 +1,26 @@ +# The obsolete LaTeX package `everysel` + +Copyright (C) 1995–2011 Martin Schröder, 2021 Marei Peischl (peiTeX) + +everysel 2021/01/18 v2.0 EverySelectfont Package + +The current maintainer of this package is Marei Peischl + +*************************************************************************** + + This material is subject to the LaTeX Project Public License version 1.3c + or later. See http://www.latex-project.org/lppl.txt for details. + +*************************************************************************** + +## Provided files + +* README.md +* everysel.dtx +* everysel.ins + +The files +* everysel.sty +* everysel-2011-10-28.sty +can be generated from the everysel.dtx by processing the everysel.ins-file. + diff --git a/macros/latex/contrib/everysel/everysel.dtx b/macros/latex/contrib/everysel/everysel.dtx new file mode 100644 index 0000000000..9a4c702f83 --- /dev/null +++ b/macros/latex/contrib/everysel/everysel.dtx @@ -0,0 +1,441 @@ +% \iffalse meta-comment +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Copyright (C) Martin Schröder, 1994–2001 +% Marei Peischl (peiTeX) , 2021 +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is +% Marei Peischl . +% +% This work consists of the files +% README.md +% everysel.dtx +% everysel.ins +% and the derived files +% everysel.sty +% everysel-2011/10/28.sty +% everysel.pdf +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \fi +% \iffalse +%\NeedsTeXFormat{LaTeX2e}[1995/12/01] +%\ProvidesPackage{everysel} +% [2021/01/18 v2.0 EverySelectfont Package (MS)] +% +%<*driver> +\documentclass[a4paper]{ltxdoc} +\usepackage[T1]{fontenc} +\usepackage{url} +\usepackage[toc]{multitoc} +\usepackage{lmodern,microtype} +\usepackage{geometry} +\usepackage{everysel} +\GetFileInfo{everysel.sty} +\RecordChanges % Gather update information +\EnableCrossrefs +%%\DisableCrossrefs% Say \DisableCrossrefs if index is ready +\CodelineIndex % Index code by line number +%\OnlyDescription % comment out for implementation details +%%\OldMakeIndex % use if your MakeIndex is pre-v2.9 +\setcounter{IndexColumns}{1} +% onecolumn glossary +%% \makeatletter +%% \renewenvironment{theglossary}{% +%% \glossary@prologue +%% \setlength\emergencystretch{5em} +%% \GlossaryParms \let\item\@idxitem \ignorespaces}{} +%% \makeatother +\setlength{\IndexMin}{40ex} +\setlength{\columnseprule}{.4pt} +\addtolength{\oddsidemargin}{2cm} +\addtolength{\textwidth}{-2cm} +\raggedright % otherwise we get over/underfull hboxes +\begin{document} + \DocInput{everysel.dtx} + \PrintChanges + % Make sure that the index is not printed twice + % (ltxdoc.cfg might have a second \PrintIndex command) + \let\PrintChanges\relax +\end{document} +% +% \fi +% \CheckSum{172} +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +% +% \changes{v1.00}{1996-05-24}{New} +% \changes{v1.02}{1998-04-11}{Minor documentation enhancements} +% \changes{v1.02}{1998-08-09}{Minor documentation enhancements} +% \changes{v1.03}{1999/06/08}{Moved to LPPL} +% \changes{v1.1}{2009/05/30}{New address, LPPL 1.3} +% +% +% ^^A ----------------------------- +% +% \pagestyle{headings} +% +% \newcommand*{\file}[1]{\texttt{#1}} +% \newcommand*{\package}[1]{\textsf{#1}} +% \hyphenation{every-select-font} +% +% +% ^^A ----------------------------- +% +% \changes{v1.01}{1997-03-09}{Fixed use of \cs{newline} in title.} +% \title{\unskip +% The obsolete \package{EverySel} package^^A +% \thanks{^^A +% The version umber of this file is \fileversion.\protect\newline +% The name \textsf{EverySel} is a tribute to the $8+3$ file-naming +% convention of certain ``operating systems'' and their ``file systems''; +% strictly speaking it should be \textsf{EverySelectfont}.}^^A +% } +% \author{Martin Schröder\thanks{maintained by Marei Peischl}} +% \maketitle +% +% +% ^^A ----------------------------- +% \changes{v2.0}{2021/01/17}{Information on new kernel methods} +% \renewcommand*{\abstractname}{Why you should no longer use this package:} +% \begin{abstract} +% This packages provides hooks into the NFSS-command +% \cs{selectfont} called \cs{EverySelectfont} and +% \cs{AtNextSelectfont} analogous to \cs{AtBeginDocument}. +% In January 2021 the hook management \LaTeX{} provides since autumn 2020 the kernel directly contains these hooks. Information on their usage can be found in the the corresponding documentation for +% \package{lthooks}\cite{lthooks-doc} and look for Hooks provided in NFSS command. +% We only provide this package to allow backwards compatibility. +% For current versions of \LaTeX{} it's only mapping the hooks to the original \package{everysel} macros. +% In case you use an older \LaTeX{} format, \package{everysel} will automatically fallback to its' old implementation by loading \package{everysel-2011/10/28.sty}. +% \end{abstract} +% +% \pagestyle{headings} +% +% +% ^^A ----------------------------- +% +% \tableofcontents +% +% +% ^^A ----------------------------- +% +% \section{Introduction} +% ^^A +% This package provides the hooks \cs{EverySelectfont} and +% \cs{AtNextSelectfont} whose arguments are executed just after +% \LaTeX{} has loaded a new font using \cs{selectfont} (which means +% that it will be executed after \emph{every} font loaded via NFSS). +% +% An example application would be a package for setting ragged text +% which needs to distiguinsh between monospaced and proportional +% fonts. +% Such a package exists: \package{ragged2e}\cite{package:ragged2e}. +% +% +% ^^A ----------------------------- +% +% \section{Usage} +% ^^A +% \DescribeMacro{\EverySelectfont} +% \cs{EverySelectfont}\marg{code} declares +% \mbox{$\langle$\emph{code}$\rangle$} that is saved internally +% and executed just after \emph{each} \cs{selectfont}. +% +% \emph{Warning:} The \mbox{$\langle$\emph{code}$\rangle$} is saved +% globally; there is currently no way to remove it. +% +% \DescribeMacro{\AtNextSelectfont} +% \cs{AtNextSelectfont}\marg{code} declares +% \mbox{$\langle$\emph{code}$\rangle$} that is saved internally +% and executed just after \emph{and only the next} \cs{selectfont}. +% +% Repeated use of the commands is permitted: the code in their +% argument is stored (and executed) in the order of their +% declarations. +% +% The argument of \cs{AtNextSelectfont} is executed \emph{after} +% the argument of \cs{EverySelectfont}. +% +% +% ^^A ----------------------------- +% +% \section{Options} +% ^^A +% The package has no options. +% +% +% ^^A ----------------------------- +% +% \section{Required packages} +% ^^A +% The package requires no further packages. +% +% +% ^^A ----------------------------- +% +% \StopEventually{^^A +% +% +% ^^A ----------------------------- +% +% \section{Acknowledgements} +% ^^A +% David Carlisle provided the solution for my problems with \cs{CheckCommand}. +% +% Thanks to the \LaTeX-Project-Team for creating solutions which made this an obsolete package. Special thanks to Ulrike Fischer to keep the maintainer up to date. +% +% +% ^^A ----------------------------- +% +% \begin{thebibliography}{1} +% \raggedright +% \bibitem{lthooks-doc} +% Frank Mittelbach. +% \newblock The \package{ltshipout} package. +% \newblock \url{http://mirrors.ctan.org/macros/latex/base/lthooks-doc.pdf} +% \bibitem{package:tracefnt} +% Frank Mittelbach and Rainer Sch\"opf. +% \newblock The \package{tracefnt} package for use with the new +% font selection scheme. +% \newblock \url{http://mirrors.ctan.org/macros/latex/base/ltfsstrc.dtx}. +% \newblock \LaTeXe{} package. +% \bibitem{package:ragged2e} +% Martin Schr\"oder. +% \newblock The \package{ragged2e} package. +% \newblock \url{http://mirrors.ctan.org/macros/latex/contrib/supported/ms/ragged2e.dtx}. +% \newblock \LaTeXe{} package. +% \end{thebibliography} +% +% } +% +% +% ^^A ----------------------------- +% +% \section{The implementation} +% ^^A +% \changes{v2.0}{2021/01/17}{Emulate everysel if the kernel is new enough.} +% \begin{macrocode} +%<*package> +% \raggedright +% \begin{macrocode} +\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} +\IfFormatAtLeastTF{2021/01/05}{}{\input{everysel-2011-10-28.sty}} +\IfFormatAtLeastTF{2021/01/05}{}{\endinput} +\newcommand*{\EverySelectfont}[1]{\AddToHook{selectfont}{#1}} +\newcommand*{\AtNextSelectfont}[1]{\AddToHookNext{selectfont}{#1}} +% +% \end{macrocode} +% ^^A ----------------------------- +% \subsection{The original implementation by Martin Schröder} +% To provide compatibility for older \LaTeX{} formats we wrap the +% original implementation of \package{everysel} version 1.2 into +% the fallback package \package{everyshi-2011-01-10}. +% \subsubsection{Allocations} +% ^^A +% First we allocate the hooks +% \begin{macro}{\@EverySelectfont@EveryHook} +% The code to be executed just after the normal \cs{selectfont}. +% \begin{macrocode} +%<*fallback> +\newcommand{\@EverySelectfont@EveryHook}{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@EverySelectfont@AtNextHook} +% The code to be executed just after the normal \cs{selectfont} +% and \cs{@EverySelectfont@EveryHook}. +% \begin{macrocode} +\newcommand{\@EverySelectfont@AtNextHook}{} +% \end{macrocode} +% \end{macro} +% +% +% ^^A ----------------------------- +% +% \subsubsection{The user-visible commands} +% ^^A +% \begin{macro}{\EverySelectfont} +% \begin{macro}{\AtNextSelectfont} +% These commands are modeled after \cs{AtBeginDocument}. +% \begin{macrocode} +\newcommand*{\EverySelectfont}[1] + {\g@addto@macro\@EverySelectfont@EveryHook{#1}} +\newcommand*{\AtNextSelectfont}[1] + {\g@addto@macro\@EverySelectfont@AtNextHook{#1}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% ^^A ----------------------------- +% +% \subsubsection{Inserting the hooks} +% ^^A +% The hooks are placed \emph{inside} \cs{selectfont}. +% Unfortunately for us there are \emph{two} versions of +% \cs{selectfont} in normal \LaTeX: One is defined in the kernel and +% the other by the package \package{tracefnt}\cite{package:tracefnt}. +% The \package{CJK} also redefines \cs{selectfont}. +% +% So we have to check for three versions. +% \begin{macro}{\@EverySelectfont@Init} +% We do this in the macro \cs{@EverySelectfont@Init}, which is +% executed just after \cs{begin\{document\}} (with the aid of +% \cs{AtBeginDocument}), when we know for sure which version of +% \cs{selectfont} we have to overload. +% \begin{macrocode} +\newcommand*{\@EverySelectfont@Init}{% + \message{ABD: EverySelectfont initializing macros}% +% \end{macrocode} +% We have to distinguish three cases: \package{tracefnt}, +% \package{CJK} and everything else. +% \begin{macrocode} + \@ifpackageloaded{tracefnt}{% +% \end{macrocode} +% And we have a problem: \cs{selectfont} is defined using +% \cs{DeclareRobustCommand}, which really defines +% \cs{selectfont\textvisiblespace}. +% So instead of simply using \cs{CheckCommand} we also have to use +% \cs{expandafter} and \cs{csname}\ldots\cs{endcsname}. +% \begin{macrocode} + \expandafter\CheckCommand\csname selectfont \endcsname{% + \ifx\f@linespread\baselinestretch \else + \set@fontsize\baselinestretch\f@size\f@baselineskip \fi + \xdef\font@name{% + \csname\curr@fontshape/\f@size\endcsname}% + \pickup@font + \font@name + \ifnum \tracingfonts>\tw@ + \@font@info{Switching to \font@name}\fi + \size@update + \enc@update + }% + }{% +% \end{macrocode} +% The case with \package{CJK} +% \changes{v1.2}{2011-10-27}{Check for \package{CJK}.} +% \begin{macrocode} + \@ifpackageloaded{CJK}{% + \expandafter\CheckCommand\csname selectfont \endcsname{% + \ifx\f@linespread\baselinestretch \else + \set@fontsize\baselinestretch\f@size\f@baselineskip \fi + \xdef\font@name{% + \csname\curr@fontshape/\f@size\endcsname}% + \pickup@font + \font@name + \expandafter\ifx\csname CJK@\curr@fontshape\endcsname \relax + \else + \CJK@bold@false + \csname CJK@\curr@fontshape\endcsname + \fi + \size@update + \enc@update}% + }{% +% \end{macrocode} +% Now the default (no \package{tracefnt} and no \package{CJK}). +% \begin{macrocode} + \expandafter\CheckCommand\csname selectfont \endcsname{% + \ifx\f@linespread\baselinestretch \else + \set@fontsize\baselinestretch\f@size\f@baselineskip \fi + \xdef\font@name{% + \csname\curr@fontshape/\f@size\endcsname}% + \pickup@font + \font@name + \size@update + \enc@update + }% + }% + }% +% \end{macrocode} +% After the checks we can be sure we have the correct version of +% \cs{selectfont}, so we redefine it with our hooks. +% \begin{macrocode} + \DeclareRobustCommand{\selectfont}% + {% + \ifx\f@linespread\baselinestretch \else + \set@fontsize\baselinestretch\f@size\f@baselineskip \fi + \xdef\font@name{% + \csname\curr@fontshape/\f@size\endcsname}% + \pickup@font + \font@name + \@EverySelectfont@EveryHook + \@EverySelectfont@AtNextHook +% \end{macrocode} +% We have to reset \cs{@EverySelectfont@AtNextHook} after each use. +% \begin{macrocode} + \gdef\@EverySelectfont@AtNextHook{}% + \size@update + \enc@update + }% +% \end{macrocode} +% The additions of \package{tracefnt} to \cs{selectfont} can be +% implemented using \cs{EverySelectfont}. +% \begin{macrocode} + \@ifpackageloaded{tracefnt}{% + \EverySelectfont{% + \ifnum \tracingfonts>\tw@ + \@font@info{Switching to \font@name}\fi}% + }{}% +% \end{macrocode} +% The additions of \package{CJK} to \cs{selectfont} can be +% implemented using \cs{EverySelectfont}. +% \changes{v1.2}{2011-10-27}{Check for \package{CJK}.} +% \begin{macrocode} + \@ifpackageloaded{CJK}{% + \EverySelectfont{% + \expandafter\ifx\csname CJK@\curr@fontshape\endcsname \relax + \else + \CJK@bold@false + \csname CJK@\curr@fontshape\endcsname + \fi}% + }{}% +% \end{macrocode} +% Since \cs{@EverySelectfont@Init} should only be used once it is +% self-destructing. +% \begin{macrocode} + \let\@EverySelectfont@Init\undefined + } +% \end{macrocode} +% Finally we insert \cs{EverySelectfont@Init} into \cs{begin\{document\}}. +% \begin{macrocode} +\AtBeginDocument{\@EverySelectfont@Init} +% \end{macrocode} +% \end{macro} +% +% +% ^^A ----------------------------- +% +% \begin{macrocode} +% +% \end{macrocode} +% +% +% ^^A ----------------------------- +% +% \Finale +% ^^A diff --git a/macros/latex/contrib/everysel/everysel.ins b/macros/latex/contrib/everysel/everysel.ins new file mode 100644 index 0000000000..9d53007e29 --- /dev/null +++ b/macros/latex/contrib/everysel/everysel.ins @@ -0,0 +1,49 @@ +\input docstrip.tex + +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{everysel.ins} + [2020/01/17 v2,0 Installation script for EverySelectfont Package] + +\preamble +Copyright (C) 1996–2009 Martin Schröder, 2020 Marei Peischl (peiTeX) + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3c +of this license or (at your option) any later version. +The latest version of this license is in +http://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is + Marei Peischl . + +This work consists of the files everysel.dtx and everysel.ins +and the derived files everysel.sty and everysel-2011-10-28.sty. + +\endpreamble +\keepsilent +\askforoverwritefalse +\generate{% + \file{everysel.sty}{\from{everysel.dtx}{package}} + \file{everysel-2011-10-28.sty}{\from{everysel.dtx}{fallback,origpackage}} +} + +\Msg{***********************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* style files into a directory searched by TeX:} +\Msg{*} +\Msg{* \space\space everysel.sty} +\Msg{* \space\space everysel-2011-10-28.sty} +\Msg{*} +\Msg{* To produce the documentation run the file everysel.dtx} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing} +\Msg{***********************************************************} +\endbatchfile +%% +%% End of file `everysel.ins'. diff --git a/macros/latex/contrib/everysel/everysel.pdf b/macros/latex/contrib/everysel/everysel.pdf new file mode 100644 index 0000000000..90dbd90b63 Binary files /dev/null and b/macros/latex/contrib/everysel/everysel.pdf differ diff --git a/macros/latex/contrib/ms/README.md b/macros/latex/contrib/ms/README.md index 0d05a5ddbb..65a355a9fc 100644 --- a/macros/latex/contrib/ms/README.md +++ b/macros/latex/contrib/ms/README.md @@ -2,11 +2,10 @@ Copyright (C) 1994–2011 Martin Schröder -everysel 2011/19/28 v2.1 EverySelectfont Package multitoc 1999/06/08 v2.01 MultiToc Package count1to 2009/05/25 v2.1 Count1to LaTeX Package The new upload has only been done to split the ms-bundle. -The packages everyshi and prelim2e are no longer part of this bundle +The packages everyshi, everysel and prelim2e are no longer part of this bundle The current maintainer of this package is Marei Peischl diff --git a/macros/latex/contrib/ms/everysel.dtx b/macros/latex/contrib/ms/everysel.dtx deleted file mode 100644 index 7e415dfa40..0000000000 --- a/macros/latex/contrib/ms/everysel.dtx +++ /dev/null @@ -1,418 +0,0 @@ -% \iffalse -\NeedsTeXFormat{LaTeX2e}[1995/12/01] -%\ProvidesPackage{everysel} -% [2011/10/28 v1.2 EverySelectfont Package (MS)] -% -%<*driver> -\ProvidesFile{everysel.drv} - [2009/05/30 v1.1 Driver for EverySelectfont Package (MS)] -\documentclass[a4paper]{ltxdoc} -\usepackage[T1]{fontenc} -\usepackage{url} -\usepackage[toc]{multitoc} -\usepackage{lmodern,microtype,svn} -\usepackage{hypdoc} -\usepackage{geometry} -\usepackage{everysel} -\GetFileInfo{everysel.sty} -\RecordChanges % Gather update information -\EnableCrossrefs -%%\DisableCrossrefs% Say \DisableCrossrefs if index is ready -\CodelineIndex % Index code by line number -%\OnlyDescription % comment out for implementation details -%%\OldMakeIndex % use if your MakeIndex is pre-v2.9 -\setcounter{IndexColumns}{2} -% onecolumn glossary -\makeatletter - \renewenvironment{theglossary}{% - \glossary@prologue - \setlength\emergencystretch{5em} - \GlossaryParms \let\item\@idxitem \ignorespaces}{} -\makeatother -\setlength{\IndexMin}{40ex} -\setlength{\columnseprule}{.4pt} -\addtolength{\oddsidemargin}{2cm} -\addtolength{\textwidth}{-2cm} -\raggedright % otherwise we get over/underfull hboxes -\begin{document} - \DocInput{everysel.dtx} - \PrintIndex\PrintChanges - % Make sure that the index is not printed twice - % (ltxdoc.cfg might have a second \PrintIndex command) - \let\PrintChanges\relax -\end{document} -% -% -% Copyright (C) [1996..2011] by Martin Schr\"oder. -% -% This work may be distributed and/or modified under the conditions of the -% LaTeX Project Public License, either version 1.3 of this license or (at your -% option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3 or later is part of all distributions of LaTeX version -% 2005/12/01 or later. -% -% This work has the LPPL maintenance status `maintained'. -% -% The Current Maintainer of this work is Martin Schröder -% -% This work consists of the files everysel.dtx and everysel.ins -% and the derived files everysel.sty -% -% \fi -% -% \CheckSum{156} -% -%% \CharacterTable -%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z -%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z -%% Digits \0\1\2\3\4\5\6\7\8\9 -%% Exclamation \! Double quote \" Hash (number) \# -%% Dollar \$ Percent \% Ampersand \& -%% Acute accent \' Left paren \( Right paren \) -%% Asterisk \* Plus \+ Comma \, -%% Minus \- Point \. Solidus \/ -%% Colon \: Semicolon \; Less than \< -%% Equals \= Greater than \> Question mark \? -%% Commercial at \@ Left bracket \[ Backslash \\ -%% Right bracket \] Circumflex \^ Underscore \_ -%% Grave accent \` Left brace \{ Vertical bar \| -%% Right brace \} Tilde \~} -% -% \SVN $Rev: 1712 $ -% \SVNdate $Date: 2011-10-28 23:10:13 +0200 (Fr, 28. Okt 2011) $ -% -% \changes{v1.00}{1996-05-24}{New} -% \changes{v1.02}{1998-04-11}{Minor documentation enhancements} -% \changes{v1.02}{1998-08-09}{Minor documentation enhancements} -% \changes{v1.03}{1999/06/08}{Moved to LPPL} -% \changes{v1.1}{2009/05/30}{New address, LPPL 1.3} -% -% -% ^^A ----------------------------- -% -% \pagestyle{headings} -% -% \newcommand*{\file}[1]{\texttt{#1}} -% \newcommand*{\package}[1]{\textsf{#1}} -% \hyphenation{every-select-font} -% -% -% ^^A ----------------------------- -% -% \changes{v1.01}{1997-03-09}{Fixed use of \cs{newline} in title.} -% \title{\unskip -% The \package{EverySel} package^^A -% \thanks{^^A -% The version number of this file is \fileversion, subversion -% revision~\#\SVNRev, last revised \protect\SVNDate.\protect\newline -% The name \textsf{EverySel} is a tribute to the $8+3$ file-naming -% convention of certain ``operating systems'' and their ``file systems''; -% strictly speaking it should be \textsf{EverySelectfont}.}^^A -% } -% \author{Martin Schr\"oder\\[0.5ex] -% \normalsize Unterstra\ss{}e 31\\ -% \normalsize 47051 Duisburg\\ -% \normalsize Germany\\ -% \normalsize \href{mailto:martin@oneiros.de}{\texttt{martin@oneiros.de}}} -% \maketitle -% -% -% ^^A ----------------------------- -% -% -% \begin{abstract} -% This packages provides hooks into the NFSS-command -% \cs{selectfont} called \cs{EverySelectfont} and -% \cs{AtNextSelectfont} analogous to \cs{AtBeginDocument}. -% \end{abstract} -% -% \pagestyle{headings} -% -% -% ^^A ----------------------------- -% -% \tableofcontents -% -% -% ^^A ----------------------------- -% -% \section{Introduction} -% ^^A -% This package provides the hooks \cs{EverySelectfont} and -% \cs{AtNextSelectfont} whose arguments are executed just after -% \LaTeX{} has loaded a new font using \cs{selectfont} (which means -% that it will be executed after \emph{every} font loaded via NFSS). -% -% An example application would be a package for setting ragged text -% which needs to distiguinsh between monospaced and proportional -% fonts. -% Such a package exists: \package{ragged2e}\cite{package:ragged2e}. -% -% -% ^^A ----------------------------- -% -% \section{Usage} -% ^^A -% \DescribeMacro{\EverySelectfont} -% \cs{EverySelectfont}\marg{code} declares -% \mbox{$\langle$\emph{code}$\rangle$} that is saved internally -% and executed just after \emph{each} \cs{selectfont}. -% -% \emph{Warning:} The \mbox{$\langle$\emph{code}$\rangle$} is saved -% globally; there is currently no way to remove it. -% -% \DescribeMacro{\AtNextSelectfont} -% \cs{AtNextSelectfont}\marg{code} declares -% \mbox{$\langle$\emph{code}$\rangle$} that is saved internally -% and executed just after \emph{and only the next} \cs{selectfont}. -% -% Repeated use of the commands is permitted: the code in their -% argument is stored (and executed) in the order of their -% declarations. -% -% The argument of \cs{AtNextSelectfont} is executed \emph{after} -% the argument of \cs{EverySelectfont}. -% -% -% ^^A ----------------------------- -% -% \section{Options} -% ^^A -% The package has no options. -% -% -% ^^A ----------------------------- -% -% \section{Required packages} -% ^^A -% The package requires no further packages. -% -% -% ^^A ----------------------------- -% -% \StopEventually{^^A -% -% -% ^^A ----------------------------- -% -% \section{Acknowledgements} -% ^^A -% David Carlisle provided the solution for my problems with \cs{CheckCommand}. -% -% -% ^^A ----------------------------- -% -% \begin{thebibliography}{1} -% \raggedright -% \bibitem{package:tracefnt} -% Frank Mittelbach and Rainer Sch\"opf. -% \newblock The \package{tracefnt} package for use with the new -% font selection scheme. -% \newblock \url{CTAN: tex-archive/macros/latex/base/ltfsstrc.dtx}. -% \newblock \LaTeXe{} package. -% \bibitem{package:ragged2e} -% Martin Schr\"oder. -% \newblock The \package{ragged2e} package. -% \newblock \url{CTAN: tex-archive/macros/latex/contrib/supported/ms/ragged2e.dtx}. -% \newblock \LaTeXe{} package. -% \end{thebibliography} -% -% } -% -% -% ^^A ----------------------------- -% -% \section{The implementation} -% ^^A -% \begin{macrocode} -%<*package> -% \end{macrocode} -% -% -% ^^A ----------------------------- -% -% \subsection{Allocations} -% ^^A -% First we allocate the hooks -% \begin{macro}{\@EverySelectfont@EveryHook} -% The code to be executed just after the normal \cs{selectfont}. -% \begin{macrocode} -\newcommand{\@EverySelectfont@EveryHook}{} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@EverySelectfont@AtNextHook} -% The code to be executed just after the normal \cs{selectfont} -% and \cs{@EverySelectfont@EveryHook}. -% \begin{macrocode} -\newcommand{\@EverySelectfont@AtNextHook}{} -% \end{macrocode} -% \end{macro} -% -% -% ^^A ----------------------------- -% -% \subsection{The user-visible commands} -% ^^A -% \begin{macro}{\EverySelectfont} -% \begin{macro}{\AtNextSelectfont} -% These commands are modeled after \cs{AtBeginDocument}. -% \begin{macrocode} -\newcommand*{\EverySelectfont}[1] - {\g@addto@macro\@EverySelectfont@EveryHook{#1}} -\newcommand*{\AtNextSelectfont}[1] - {\g@addto@macro\@EverySelectfont@AtNextHook{#1}} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% -% ^^A ----------------------------- -% -% \subsection{Inserting the hooks} -% ^^A -% The hooks are placed \emph{inside} \cs{selectfont}. -% Unfortunately for us there are \emph{two} versions of -% \cs{selectfont} in normal \LaTeX: One is defined in the kernel and -% the other by the package \package{tracefnt}\cite{package:tracefnt}. -% The \package{CJK} also redefines \cs{selectfont}. -% -% So we have to check for three versions. -% \begin{macro}{\@EverySelectfont@Init} -% We do this in the macro \cs{@EverySelectfont@Init}, which is -% executed just after \cs{begin\{document\}} (with the aid of -% \cs{AtBeginDocument}), when we know for sure which version of -% \cs{selectfont} we have to overload. -% \begin{macrocode} -\newcommand*{\@EverySelectfont@Init}{% - \message{ABD: EverySelectfont initializing macros}% -% \end{macrocode} -% We have to distinguish three cases: \package{tracefnt}, -% \package{CJK} and everything else. -% \begin{macrocode} - \@ifpackageloaded{tracefnt}{% -% \end{macrocode} -% And we have a problem: \cs{selectfont} is defined using -% \cs{DeclareRobustCommand}, which really defines -% \cs{selectfont\textvisiblespace}. -% So instead of simply using \cs{CheckCommand} we also have to use -% \cs{expandafter} and \cs{csname}\ldots\cs{endcsname}. -% \begin{macrocode} - \expandafter\CheckCommand\csname selectfont \endcsname{% - \ifx\f@linespread\baselinestretch \else - \set@fontsize\baselinestretch\f@size\f@baselineskip \fi - \xdef\font@name{% - \csname\curr@fontshape/\f@size\endcsname}% - \pickup@font - \font@name - \ifnum \tracingfonts>\tw@ - \@font@info{Switching to \font@name}\fi - \size@update - \enc@update - }% - }{% -% \end{macrocode} -% The case with \package{CJK} -% \changes{v1.2}{2011-10-27}{Check for \package{CJK}.} -% \begin{macrocode} - \@ifpackageloaded{CJK}{% - \expandafter\CheckCommand\csname selectfont \endcsname{% - \ifx\f@linespread\baselinestretch \else - \set@fontsize\baselinestretch\f@size\f@baselineskip \fi - \xdef\font@name{% - \csname\curr@fontshape/\f@size\endcsname}% - \pickup@font - \font@name - \expandafter\ifx\csname CJK@\curr@fontshape\endcsname \relax - \else - \CJK@bold@false - \csname CJK@\curr@fontshape\endcsname - \fi - \size@update - \enc@update}% - }{% -% \end{macrocode} -% Now the default (no \package{tracefnt} and no \package{CJK}). -% \begin{macrocode} - \expandafter\CheckCommand\csname selectfont \endcsname{% - \ifx\f@linespread\baselinestretch \else - \set@fontsize\baselinestretch\f@size\f@baselineskip \fi - \xdef\font@name{% - \csname\curr@fontshape/\f@size\endcsname}% - \pickup@font - \font@name - \size@update - \enc@update - }% - }% - }% -% \end{macrocode} -% After the checks we can be sure we have the correct version of -% \cs{selectfont}, so we redefine it with our hooks. -% \begin{macrocode} - \DeclareRobustCommand{\selectfont}% - {% - \ifx\f@linespread\baselinestretch \else - \set@fontsize\baselinestretch\f@size\f@baselineskip \fi - \xdef\font@name{% - \csname\curr@fontshape/\f@size\endcsname}% - \pickup@font - \font@name - \@EverySelectfont@EveryHook - \@EverySelectfont@AtNextHook -% \end{macrocode} -% We have to reset \cs{@EverySelectfont@AtNextHook} after each use. -% \begin{macrocode} - \gdef\@EverySelectfont@AtNextHook{}% - \size@update - \enc@update - }% -% \end{macrocode} -% The additions of \package{tracefnt} to \cs{selectfont} can be -% implemented using \cs{EverySelectfont}. -% \begin{macrocode} - \@ifpackageloaded{tracefnt}{% - \EverySelectfont{% - \ifnum \tracingfonts>\tw@ - \@font@info{Switching to \font@name}\fi}% - }{}% -% \end{macrocode} -% The additions of \package{CJK} to \cs{selectfont} can be -% implemented using \cs{EverySelectfont}. -% \changes{v1.2}{2011-10-27}{Check for \package{CJK}.} -% \begin{macrocode} - \@ifpackageloaded{CJK}{% - \EverySelectfont{% - \expandafter\ifx\csname CJK@\curr@fontshape\endcsname \relax - \else - \CJK@bold@false - \csname CJK@\curr@fontshape\endcsname - \fi}% - }{}% -% \end{macrocode} -% Since \cs{@EverySelectfont@Init} should only be used once it is -% self-destructing. -% \begin{macrocode} - \let\@EverySelectfont@Init\undefined - } -% \end{macrocode} -% Finally we insert \cs{EverySelectfont@Init} into \cs{begin\{document\}}. -% \begin{macrocode} -\AtBeginDocument{\@EverySelectfont@Init} -% \end{macrocode} -% \end{macro} -% -% -% ^^A ----------------------------- -% -% \begin{macrocode} -% -% \end{macrocode} -% -% -% ^^A ----------------------------- -% -% \Finale -% ^^A vim:tw=70:ts=2 diff --git a/macros/latex/contrib/ms/everysel.ins b/macros/latex/contrib/ms/everysel.ins deleted file mode 100644 index dab9e781a2..0000000000 --- a/macros/latex/contrib/ms/everysel.ins +++ /dev/null @@ -1,108 +0,0 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesFile{everysel.ins} - [2009/05/30 v1.1 Installation script for EverySelectfont Package (MS)] -%% -%% Copyright (C) 1996..2009 by Martin Schroeder. -%% -%% This work may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. -%% -%% This work has the LPPL maintenance status `maintained'. -%% -%% The Current Maintainer of this work is Martin Schr\"oder. -%% -%% This work consists of the files everysel.dtx and everysel.ins -%% and the derived file everysel.sty. -%% -%% $Id: everysel.ins 1373 2009-05-30 20:22:19Z oneiros $ -%% --------------- start of docstrip commands ------------------ -\input docstrip.tex -{\ifx\endbatchfile\undefined -\Msg{**********************************************} -\Msg{*} -\Msg{* This installation requires docstrip} -\Msg{* version 2.4d or later.} -\Msg{*} -\Msg{* An older version of docstrip has been input} -\Msg{*} -\Msg{**********************************************} -\errhelp{Move or rename old docstrip.tex.} -\errmessage{Old docstrip in input path} -\batchmode -\csname @@end\endcsname -\fi} - -\Msg{***********************************************************} -\Msg{*} -\Msg{* The everysel distribution contains these files:} -\Msg{*} -\Msg{* \space\space everysel.dtx} -\Msg{* \space\space everysel.ins} -\Msg{*} -\Msg{* If you receive only some of these files from someone, complain!} -\Msg{*} -\Msg{***********************************************************} - -\preamble - -Copyright (C) 1996..2009 by Martin Schroeder. - -This file is part of the EverySel package ------------------------------------------ - -This work may be distributed and/or modified under the -conditions of the LaTeX Project Public License, either version 1.3 -of this license or (at your option) any later version. -The latest version of this license is in - http://www.latex-project.org/lppl.txt -and version 1.3 or later is part of all distributions of LaTeX -version 2005/12/01 or later. - -This work has the LPPL maintenance status `maintained'. - -The Current Maintainer of this work is Martin Schroeder. - -This work consists of the files everysel.dtx and everysel.ins -and the derived file everysel.sty. - -\endpreamble -\declarepreamble\driverpreamble -Copyright (C) 1996..2009 Martin Schroeoder. - -This file is part of the EverySel package ------------------------------------------ - -To produce the documentation in the way you like you are allowed -to change this driver file. - -\endpreamble - -% Don't display progress -\keepsilent -\askforoverwritefalse -\generate{\file{everysel.sty}{\from{everysel.dtx}{package}} - \usepreamble\driverpreamble - \file{everysel.drv}{\from{everysel.dtx}{driver}} - } - -\Msg{***********************************************************} -\Msg{*} -\Msg{* To finish the installation you have to move the following} -\Msg{* style files into a directory searched by TeX:} -\Msg{*} -\Msg{* \space\space everysel.sty} -\Msg{*} -\Msg{* To produce the documentation run the file everysel.drv} -\Msg{* through LaTeX.} -\Msg{*} -\Msg{* Happy TeXing} -\Msg{***********************************************************} -\endbatchfile -%% -%% End of file `everysel.ins'. -%% vim:tw=70:ts=2:syntax=tex diff --git a/macros/latex/contrib/ms/everysel.pdf b/macros/latex/contrib/ms/everysel.pdf deleted file mode 100644 index e4322787fc..0000000000 Binary files a/macros/latex/contrib/ms/everysel.pdf and /dev/null differ diff --git a/systems/texlive/tlnet/tlpkg/texlive.tlpdb b/systems/texlive/tlnet/tlpkg/texlive.tlpdb index 2dd00638b6..358d5a7f72 100644 --- a/systems/texlive/tlnet/tlpkg/texlive.tlpdb +++ b/systems/texlive/tlnet/tlpkg/texlive.tlpdb @@ -26,11 +26,11 @@ depend container_split_src_files/1 depend frozen/0 depend minrelease/2016 depend release/2020 -depend revision/57452 +depend revision/57464 name 00texlive.image category TLCore -revision 57452 +revision 57463 shortdesc TeX Live files only in the source repository longdesc The files here are not copied by the installer and containers longdesc are not built for them; they exist only in the source @@ -40,7 +40,7 @@ longdesc IgnorePatterns in the check_files routine in tlmgr.pl augment longdesc this list. Those are not included in the source/ tarball. For longdesc information on the 00texlive prefix see longdesc 00texlive.installation(.tlpsrc) -runfiles size=13822 +runfiles size=13823 .mkisofsrc autorun.inf texmf-dist/README @@ -376,6 +376,7 @@ runfiles size=13822 tlpkg/tlpsrc/a4wide.tlpsrc tlpkg/tlpsrc/a5comb.tlpsrc tlpkg/tlpsrc/aaai-named.tlpsrc + tlpkg/tlpsrc/aalok.tlpsrc tlpkg/tlpsrc/aastex.tlpsrc tlpkg/tlpsrc/abbr.tlpsrc tlpkg/tlpsrc/abc.tlpsrc @@ -2522,6 +2523,7 @@ runfiles size=13822 tlpkg/tlpsrc/luainputenc.tlpsrc tlpkg/tlpsrc/luaintro.tlpsrc tlpkg/tlpsrc/luajittex.tlpsrc + tlpkg/tlpsrc/luakeys.tlpsrc tlpkg/tlpsrc/lualatex-doc-de.tlpsrc tlpkg/tlpsrc/lualatex-doc.tlpsrc tlpkg/tlpsrc/lualatex-math.tlpsrc @@ -3145,6 +3147,7 @@ runfiles size=13822 tlpkg/tlpsrc/procIAGssymp.tlpsrc tlpkg/tlpsrc/prodint.tlpsrc tlpkg/tlpsrc/productbox.tlpsrc + tlpkg/tlpsrc/profcollege.tlpsrc tlpkg/tlpsrc/program.tlpsrc tlpkg/tlpsrc/progress.tlpsrc tlpkg/tlpsrc/progressbar.tlpsrc @@ -7769,6 +7772,37 @@ catalogue-ctan /biblio/bibtex/contrib/misc/aaai-named.bst catalogue-license other-free catalogue-topics bibtex-sty +name aalok +category Package +revision 57462 +shortdesc LaTeX class file for the Marathi journal 'Aalok' +relocated 1 +longdesc aalok mraatthii niytkaalikaacii akssrjulnnii krnnyaakritaa +longdesc laattek-vrg. This package provides the class file for +longdesc typesetting 'Aalok', a Marathi journal with LaTeX. +containersize 6220 +containerchecksum 7690984dbe1ed0edbfe373d8f441c88a3c15a4efc6eaa62bba8df0d4384822a5840fcb81c34b705b2b3da5faf8063d73f6d27fb56fb2b739cc19a3e85a33f7b7 +doccontainersize 185656 +doccontainerchecksum 29cbd69081ca3a0acdda397ea1dd2ddcb87b0b84cdc02b6a573aa2b1ce29fb4f54b60368691119f62eb5c713df6de0c35ede0268ca5bfeee9bec94cfc2dfa7b4 +docfiles size=61 + RELOC/doc/latex/aalok/COPYING + RELOC/doc/latex/aalok/LICENSE.md + RELOC/doc/latex/aalok/README.txt details="Readme" + RELOC/doc/latex/aalok/aalok.pdf details="Package documentation" language="mr" +srccontainersize 18036 +srccontainerchecksum 2505a6d8f362c00af4527f92838529b2c00a08ef19f864d3a10b9ab5afbe3943926274d61895e687d4ada5e67861f6ba0975126f6482b48ede1ffbc8690f313b +srcfiles size=21 + RELOC/source/latex/aalok/aalok.dtx + RELOC/source/latex/aalok/aalok.ins +runfiles size=7 + RELOC/tex/latex/aalok/aalok.cls +catalogue-contact-bugs https://gitlab.com/aalok/aalok-latex/-/issues +catalogue-contact-repository https://gitlab.com/aalok/aalok-latex +catalogue-ctan /macros/unicodetex/latex/aalok +catalogue-license gpl3+ other-free +catalogue-topics class journalpub marathi +catalogue-version 0.1 + name aastex category Package revision 51836 @@ -65506,7 +65540,7 @@ containerchecksum f66542d8abfa38917bc3455e132c276a42d1688c54abeb28eeb03447a10353 name collection-langfrench category Collection -revision 56051 +revision 57456 shortdesc French relocated 1 longdesc Support for French and Basque. @@ -65539,6 +65573,7 @@ depend l2tabu-french depend latex2e-help-texinfo-fr depend lshort-french depend mafr +depend profcollege depend tabvar depend tdsfrmath depend texlive-fr @@ -65548,8 +65583,8 @@ depend translation-natbib-fr depend translation-tabbing-fr depend variations depend visualtikz -containersize 584 -containerchecksum 48b1851d391cf4208ec844edd47a103e1c375f398cabc14749bbd44118fef4959d50189db724d1cd1f7fd5fe672697812ae692715947ec02dede53345822bc57 +containersize 592 +containerchecksum 2ebe2c6bc2f20099643ba155f80fc83d95b64dbe5e51e219752c6c0c9c5f03a21fb3497996677daf7cdd9bd432bd26af4e1b04a7435aa898130274aec98b3cf9 name collection-langgerman category Collection @@ -65757,7 +65792,7 @@ containerchecksum 2d93df728d34137c8f9a884aa2871a2980e806672006f2c5f0c5f79412d578 name collection-langother category Collection -revision 55932 +revision 57462 shortdesc Other languages relocated 1 longdesc Support for languages not otherwise listed, including Indic, @@ -65765,6 +65800,7 @@ longdesc Thai, Vietnamese, Hebrew, Indonesian, African languages, and longdesc plenty more. The split is made simply on the basis of the size longdesc of the support, to keep both collection sizes and the number of longdesc collections reasonable. +depend aalok depend akshar depend amsldoc-vn depend aramaic-serto @@ -65821,8 +65857,8 @@ depend vntex depend wnri depend wnri-latex depend xetex-devanagari -containersize 788 -containerchecksum 8b22cb1d574989bfa18b1ef44c5a16abe68b747c1adbd3874a97646c5cf3fc89cf7cede05cf706bd16dfc3c0dce33f3b954e35b416ca98c0d84202cbb1d27021 +containersize 792 +containerchecksum d784bb61de75fb00066537762cbba4c48fee125db33054ba7a23d529574b2c4af1797e96f29abe2173294fa10c1ff772434a41543c18b7613c5398d98c031f9f name collection-langpolish category Collection @@ -67400,7 +67436,7 @@ containerchecksum 48c907513c676435bfe0ba08c4be0be50eb4eb04d2fc8e8db4e39ea98dbe61 name collection-luatex category Collection -revision 57257 +revision 57463 shortdesc LuaTeX packages relocated 1 longdesc Packages for LuaTeX, a Unicode-aware extension of pdfTeX, using @@ -67435,6 +67471,7 @@ depend luaimageembed depend luaindex depend luainputenc depend luaintro +depend luakeys depend lualatex-doc depend lualatex-math depend lualatex-truncate @@ -67461,8 +67498,8 @@ depend spelling depend stricttex depend typewriter depend uninormalize -containersize 700 -containerchecksum b9ca96993591c1ea819387646d7e2bdb637d7bc56b807cd1787c199fbbdb03e01f4fbe35edda68fe0a0388e5e176aa2d51871f8b902f39a42b477686d7e2f3ff +containersize 704 +containerchecksum 57ec4259d55416ca351fda1e201ce02db4d0ace41c43b02e956bfc10821a45670fa19de54e504a727cf10e6a7a6b6a9279813f18959a73eb2c0c7b9fabc1a3b1 name collection-mathscience category Collection @@ -96829,16 +96866,16 @@ catalogue-topics notes editorial name easybook category Package -revision 57431 +revision 57460 shortdesc Typeset Chinese books or notes relocated 1 longdesc Easybook is a minimalist style template based on the ctexbook longdesc book document class. -containersize 9824 -containerchecksum bda9a99244839f0b05108dd3e2402e41bc25d9694328622ac2e2dad10ff23340313e96fd1bcf80892f204718f1b61216c8e9c0eae28c0c0efa8ef72ea5e6f71c -doccontainersize 527376 -doccontainerchecksum d55c9962e2a3acd155bf9fd509b1e020dcae1bf1c8ca0a11bde2e60a3dd9857e6f6f293c9a68e53ebaf794a46c75063bd070f0dc1eb1e38976c04001e0a0b83d -docfiles size=149 +containersize 9856 +containerchecksum 68edc2cf72f07850433b19010ec8e7803d8e6a4bc14923dee48559e2e9b0fc9295db02a9460c28f882757f1b8acc44aa2998326702b3dd91076dba9a10e516d7 +doccontainersize 530348 +doccontainerchecksum ff9c40d9294c683a4b8a794fa19def744117e1e7a934ae05c37f843fd2d4273f45a1f63cf4addd2442d36cef26361bbf133cba28e1dc57514055db09205b66ce +docfiles size=150 RELOC/doc/latex/easybook/README.md details="Readme" RELOC/doc/latex/easybook/appendix.tex RELOC/doc/latex/easybook/chapter1.tex @@ -96857,7 +96894,7 @@ catalogue-contact-repository https://gitee.com/texl3/easybook catalogue-ctan /macros/latex/contrib/easybook catalogue-license cc-by-4 catalogue-topics book-pub class chinese expl3 -catalogue-version 1.21e +catalogue-version 1.21f name easyfig category Package @@ -178819,35 +178856,41 @@ catalogue-version 2.5 name logix category Package -revision 56414 +revision 57457 shortdesc Supplement to the Unicode math symbols relocated 1 longdesc The package provides a Unicode font with over 4,000 symbols to longdesc supplement the Unicode math symbols. It is compatible with and longdesc complements the AMS STIX2 math fonts, but focuses on new longdesc symbols and symbol variants more suited to work in logic. -containersize 1469476 -containerchecksum 09a49f9df0ccc48f97a2c4a80bbbd97586902788c09549e45651594abcb774034f0ab4ba80c72585594a78af581f3db1ecabc60e14e36cfa60b323549ad6ce75 -doccontainersize 1519580 -doccontainerchecksum 21ba6bfb54c668719a887f31a95a8cca2f943488e0c837d4cfcd624ed5bc09c0530f13466455c2d477e2a06d9dbf654c43ccbd87c1e6763b668660b97a9d1a2b -docfiles size=1503 +containersize 2090608 +containerchecksum fc499a8c77e2d3a285888ee01837c88077906fc57ac73223f5887796e0f32bf4179b5b2df1a87d4535b59137ca12b6dc9ac1f9084dbd158b038ae622aca92eb9 +doccontainersize 1211856 +doccontainerchecksum b483c80466b883cbc56fdc5807420b01ee5c720d262908d0ec5bd9b61a51a15be5e1de90097026b1d2e87b54d19cf3dcafec33b5d8075edff46f2b4a6bfb6bb6 +docfiles size=1597 RELOC/doc/fonts/logix/CHANGELOG RELOC/doc/fonts/logix/README details="Readme" - RELOC/doc/fonts/logix/logix.eot RELOC/doc/fonts/logix/logix.math RELOC/doc/fonts/logix/logix.pdf details="Package documentation" RELOC/doc/fonts/logix/logix.tex RELOC/doc/fonts/logix/logix.vfc -runfiles size=638 + RELOC/doc/fonts/logix/logixMono.vfc +runfiles size=831 + RELOC/fonts/opentype/public/logix/logix.eot RELOC/fonts/opentype/public/logix/logix.otf RELOC/fonts/opentype/public/logix/logix.woff RELOC/fonts/opentype/public/logix/logix.woff2 + RELOC/fonts/opentype/public/logix/logixMono.eot + RELOC/fonts/opentype/public/logix/logixMono.otf + RELOC/fonts/opentype/public/logix/logixMono.woff + RELOC/fonts/opentype/public/logix/logixMono.woff2 RELOC/fonts/truetype/public/logix/logix.ttf + RELOC/fonts/truetype/public/logix/logixMono.ttf RELOC/tex/latex/logix/logix.sty catalogue-ctan /fonts/logix catalogue-license ofl lppl1.3c catalogue-topics font font-maths font-symbol-maths font-otf font-ttf font-supp logic -catalogue-version 1.07 +catalogue-version 1.08 name logpap category Package @@ -181946,6 +181989,37 @@ binfiles arch=x86_64-linuxmusl size=3854 bin/x86_64-linuxmusl/texluajit bin/x86_64-linuxmusl/texluajitc +name luakeys +category Package +revision 57463 +shortdesc A Lua module for parsing key-value options +relocated 1 +longdesc This package provides a Lua module that can parse key-value +longdesc options like the TeX packages keyval, kvsetkeys, kvoptions, +longdesc xkeyval, pgfkeys etc. luakeys, however, accomplishes this task +longdesc entirely by using the Lua language and does not rely on TeX. +longdesc Therefore this package can only be used with the TeX engine +longdesc LuaTeX. Since luakeys uses LPeg, the parsing mechanism should +longdesc be pretty robust. +containersize 4904 +containerchecksum 873879c6495479db77cf0e7a0f5ac99ad2eb67088d1d4abaf55e4ec341c07103ced954310b67f5ee0bec6986793f9e68613b7a85c3a8fee8b5697e0a05f1e1c5 +doccontainersize 140576 +doccontainerchecksum 58b2550998915a20226ef4890255c8a90aad9faf248a0c2a880b086941af256d9f83edc2b29ed615da6355a5bb5d95605580824581ebd7ed191d82b92786e8ac +docfiles size=40 + RELOC/doc/luatex/luakeys/README.md details="Readme" + RELOC/doc/luatex/luakeys/luakeys-debug.tex + RELOC/doc/luatex/luakeys/luakeys.pdf details="Package documentation" + RELOC/doc/luatex/luakeys/luakeys.tex +runfiles size=5 + RELOC/tex/luatex/luakeys/luakeys-debug.sty + RELOC/tex/luatex/luakeys/luakeys.lua +catalogue-contact-bugs https://github.com/Josef-Friedrich/luakeys/issues +catalogue-contact-repository https://github.com/Josef-Friedrich/luakeys +catalogue-ctan /macros/luatex/generic/luakeys +catalogue-license lppl1.3c +catalogue-topics keyval luatex +catalogue-version 0.1 + name lualatex-doc category Package revision 30473 @@ -196131,7 +196205,7 @@ catalogue-version 0.6a name mlmodern category Package -revision 57411 +revision 57458 shortdesc A blacker Type 1 version of Computer Modern, with multilingual support relocated 1 longdesc MLModern is a text and math font family with (La)TeX support, @@ -196139,16 +196213,16 @@ longdesc based on the design of Donald Knuth's Computer Modern and the longdesc Latin Modern project. It avoids the spindliness of most other longdesc Type 1 versions of Computer Modern. execute addMap mlm.map -containersize 7019984 -containerchecksum d97e1b6532757f581e7be3c83570a3db1fbc826cb6f7f15429a6a72fa4365a0e73e9661afb954aec58b7443ecd9441b76536f6bc0205fcf6ae828b4f53667353 -doccontainersize 33756 -doccontainerchecksum fd20e9941a8e927027a7f1a185c8824fdab7da6ce1c11563fb286fa5df70e28c54ad9cca339a435289df531077320950fe215d0f4d0ce3848f77cebcd32c25bd -docfiles size=16 +containersize 7595924 +containerchecksum 6fe8c67f768cde92e38741885c336786f65f9793fce0027b0476a8e45366e33c4a559c3bb6367014646e89f0ac39bd92219bc59921c3b3e0fa3a9c4314f2a632 +doccontainersize 46740 +doccontainerchecksum bd5ac414d3b3ff53b059543d25cf0296d59365dc219748d849f89a085225d864361923b4220a0a989585d99e9dc221f9a4209b622be5f279e0f02e5e1cc2d966 +docfiles size=19 RELOC/doc/fonts/mlmodern/LICENSE RELOC/doc/fonts/mlmodern/README details="Readme" RELOC/doc/fonts/mlmodern/mlmodern.pdf details="Package documentation" RELOC/doc/fonts/mlmodern/mlmodern.tex -runfiles size=3451 +runfiles size=3583 RELOC/fonts/map/dvips/mlmodern/mlm-substitute.map RELOC/fonts/map/dvips/mlmodern/mlm.map RELOC/fonts/tfm/public/mlmodern/cs-mlmb10.tfm @@ -196902,7 +196976,7 @@ runfiles size=3451 catalogue-ctan /fonts/mlmodern catalogue-license lppl1.3c catalogue-topics font font-cm font-body font-proportional font-mono font-serif font-sans font-maths font-type1 font-supp font-t1enc -catalogue-version 1.1a +catalogue-version 1.2 name mltex category Package @@ -208724,23 +208798,23 @@ catalogue-version 2.0 name newcomputermodern category Package -revision 57309 +revision 57459 shortdesc Computer Modern fonts including matching non-latin alphabets relocated 1 longdesc This is a new assembly of Computer Modern fonts plus glyphs for longdesc non Latin alphabets which are considered compatible in style to longdesc CM fonts. In addition to the Regular weight of Computer Modern, longdesc it provides a Book weight for heavier printing. -containersize 4535988 -containerchecksum 224ed498d10dfb5a855f94e8cb605b7664d9f4f0624ecc5a813ad8a899a29da613026428def92f3e36bfe25a69eef043330cffdd23ea537050d7e15f8afe1564 -doccontainersize 1662632 -doccontainerchecksum 7a75899ee918d4a80d9b1f6d9f0c242671c86710d119511f1345d979f412dc426164ae93ade55dfe474aeb24d8ab462d16e904573f57911cb4dbb0aafc60c04f -docfiles size=426 +containersize 4708832 +containerchecksum 1d77f24f78814798897dbceb63c939017b8b356702a2c3be278447cc898b5a5cbaccf5b7f73431cae67a596995ef5daf4bc10a63c5d2f3d9a24f43c8e38cac8a +doccontainersize 1662972 +doccontainerchecksum 8546fe25fd712b6328b34d7aa01f5a6c3fce30987dec1df07d87de655a8a3b1516153ef302022263966f1a01d6fadf18e0ef5c1d20342939c13cdd2582722c49 +docfiles size=427 RELOC/doc/fonts/newcomputermodern/README details="Readme" RELOC/doc/fonts/newcomputermodern/newcm-unimath-symbols.pdf RELOC/doc/fonts/newcomputermodern/newcomputermodern-sample.pdf details="Font samples" RELOC/doc/fonts/newcomputermodern/newcomputermodern-sample.tex -runfiles size=3186 +runfiles size=3278 RELOC/fonts/opentype/public/newcomputermodern/NewCM10-Bold.otf RELOC/fonts/opentype/public/newcomputermodern/NewCM10-BoldItalic.otf RELOC/fonts/opentype/public/newcomputermodern/NewCM10-Book.otf @@ -208771,7 +208845,7 @@ runfiles size=3186 catalogue-ctan /fonts/newcomputermodern catalogue-license gfl catalogue-topics font font-cm font-body font-proportional font-mono font-serif font-sans font-multilingual font-greek font-cyrillic font-hebrew font-maths font-otf cherokee -catalogue-version 2.34 +catalogue-version 3.00 name newenviron category Package @@ -246695,6 +246769,44 @@ catalogue-license other-free catalogue-topics graphics-3d catalogue-version 1.1 +name profcollege +category Package +revision 57456 +shortdesc A LaTeX package for French maths teachers in college +relocated 1 +longdesc This package provides some commands to help French mathematics +longdesc teachers for 11-16 years olds, for example: \Tableau[Metre] to +longdesc write the tabular km|hm|... with some facilities, +longdesc \Pythagore{ABC}{5}{7} to write the entire calculation of AC +longdesc with the Pythagorean theorem, \Trigo[Cosinus]{ABC}{3}{}{60} to +longdesc write the entire calculation of AC with cosine, ... and some +longdesc others. +containersize 59492 +containerchecksum d4a980b10a1df130a9fb09fe218f8e6c495fe622185292c65762971242a0b942613ce06895b89fcc2ffbf6bacb9033db4162ab680cd0e94b480245ba17e41e12 +doccontainersize 2330552 +doccontainerchecksum 432beb29a452ad1c249e7d326f3f3a88354d82a44bb1f1897debcb0eddbc83677d60a72c6bcb2777996d78b71f8cae3986b1dbdf618971f739c6ccb258f697d5 +docfiles size=661 + RELOC/doc/latex/profcollege/ProfCollege-doc.pdf details="Package documentation" language="fr" + RELOC/doc/latex/profcollege/ProfCollege-doc.zip + RELOC/doc/latex/profcollege/README details="Readme" +runfiles size=149 + RELOC/metapost/profcollege/PfC-Calculatrice.mp + RELOC/metapost/profcollege/PfC-Constantes.mp + RELOC/metapost/profcollege/PfC-Geometrie.mp + RELOC/metapost/profcollege/PfC-LaTeX.mp + RELOC/metapost/profcollege/PfC-Svgnames.mp + RELOC/tex/latex/profcollege/PfC-EquationComposition1.tex + RELOC/tex/latex/profcollege/PfC-EquationLaurent1.tex + RELOC/tex/latex/profcollege/PfC-EquationPose1.tex + RELOC/tex/latex/profcollege/PfC-EquationSoustraction1.tex + RELOC/tex/latex/profcollege/PfC-EquationSymbole1.tex + RELOC/tex/latex/profcollege/PfC-EquationTerme1.tex + RELOC/tex/latex/profcollege/ProfCollege.sty +catalogue-ctan /macros/latex/contrib/profcollege +catalogue-license lppl1.3c +catalogue-topics maths french teaching +catalogue-version 0.89 + name program category Package revision 44214 @@ -295529,15 +295641,15 @@ docfiles size=591 name texlive-docindex category TLCore -revision 57450 +revision 57454 shortdesc top-level TeX Live doc.html, etc. longdesc These files are regenerated as needed, which is often, so we longdesc make them a separate package. See the tl-update-auto script for longdesc the process. containersize 388 -containerchecksum a890ccb392405b3d94217318dc85b28d4c78316a58affaaa747cbdaa8328c1b52439b9f2aa7910e975707afc8c452d120dff2353ed5cecbc19d1a045086200bb -doccontainersize 171292 -doccontainerchecksum 37b770329f6b7f1137ff2b272e49212935dc49ded5ad1a155359f6fee003726b4054775e3782f7e96a5b69b68b5cc64c972d7885ee15ceb877579e431dc594f3 +containerchecksum 7148ef5da7c6fa6019deaa373a9b24c7df9cca8ed7bbeec11119a8b1502ae90acb9a622bbb018108b53ed75b0675d5d2c5930aae8eaf09b209df53b6598e973f +doccontainersize 171448 +doccontainerchecksum 8a2916e6a11334dd58d748c4478698613281bcd910c8e5afc851b703a5050021adedad236263a6494e4f88c3d4f0c6df7ea6c375be10e3785fca57fdbe10a5e6 docfiles size=339 doc.html @@ -295759,7 +295871,7 @@ docfiles size=368 name texlive-scripts category TLCore -revision 57450 +revision 57455 shortdesc TeX Live infrastructure programs longdesc Includes install-tl, tl-portable, rungs, etc.; not needed for longdesc tlmgr to run but still ours. Not included in tlcritical. @@ -295768,9 +295880,9 @@ depend texlive.infra execute addMap mathpple.map postaction shortcut type=menu name="TeX Live command-line" cmd=TEXDIR/tlpkg/installer/tl-cmd.bat containersize 132176 -containerchecksum 47f9194be3cb46a22529580cfa765b83391b84f326a9da176ecf606f2dacd7368b7fc7c08bd2f09e3b09ef9f76500e2302fa073f9fa7e32f23ac7570f6e5d8e7 -doccontainersize 218820 -doccontainerchecksum 6022ee0b977078ea968dc57c3735d86c382062540690a776175c09f0df49e6ebca59e8f998f8cac4208f81d222b8f3482438abfeabd13519a023163285812331 +containerchecksum 6132989ce80f46278e7fc6445320836eb0ad1fe076b5de47f9598bc1c4f08977e36613ae0013ce75b211391a17857ac1f2c73c9f317004a07d15a11e1dd506d9 +doccontainersize 218816 +doccontainerchecksum 64a78b43d6679906a8624390431a4c5d4294d8906e15fc30cae42e0bf9e8da2d21f2fc4aeef7ce3ac230040d3b52b0a4c4a0a8db7dbece667e9d6c0e424630cb docfiles size=141 texmf-dist/doc/man/man1/fmtutil-sys.1 texmf-dist/doc/man/man1/fmtutil-sys.man1.pdf @@ -309963,7 +310075,7 @@ catalogue-topics french-doc translation name translations category Package -revision 57446 +revision 57461 shortdesc Internationalisation of LaTeX2e packages relocated 1 longdesc This package (once part of the exsheets package), provides a @@ -309975,10 +310087,10 @@ longdesc German, Italian, Spanish, Catalan, Turkish, Croatian, longdesc Hungarian, Danish and Portuguese from babel or polyglossia if longdesc either is in use in the document. (Additional languages from longdesc the multilingual packages may be possible: ask the author.) -containersize 12776 -containerchecksum 1043e0e033235b67b54843e32225be2c6f224834a55c3e9a503e817b6b487029b09e01fbf579746d68902cb8338e3bdb307ac6b3ab2b86a3179bb9ff05938335 -doccontainersize 503620 -doccontainerchecksum fa3f22ceb00ca6ccb9d2c9afd4213fcbd3b238758d4abd4ffcf018a1db68a456b779fbe8994afd0f228396b00dd83474f9e99f59ad2706439bdb9309fb0e83a6 +containersize 12820 +containerchecksum bc85fb20313e9e1e6eca3373eb1fa58f0dd3971c04039ead0cdff9479f9d8a2f7ace407bfef0b7a5caa9194573911e3cd0dafda51243db34e922d39af42b0f1e +doccontainersize 503624 +doccontainerchecksum e5faff88c1b8f9588e6b7bba20aa3aef9711ee273d79623ea79f90345be6c6420595dcbb5419f87463c2a89b019b8999c330627a74f4f03ebc1af41ee7894006 docfiles size=132 RELOC/doc/latex/translations/README details="Readme" RELOC/doc/latex/translations/translations_en.pdf details="Package documentation (English)" language="en" @@ -309998,7 +310110,7 @@ catalogue-contact-repository https://github.com/cgnieder/translations/ catalogue-ctan /macros/latex/contrib/translations catalogue-license lppl1.3c catalogue-topics multilingual package-supp -catalogue-version 1.10 +catalogue-version 1.10a name translator category Package diff --git a/systems/texlive/tlnet/tlpkg/texlive.tlpdb.md5 b/systems/texlive/tlnet/tlpkg/texlive.tlpdb.md5 index d1bcd1442c..b05d93d62d 100644 --- a/systems/texlive/tlnet/tlpkg/texlive.tlpdb.md5 +++ b/systems/texlive/tlnet/tlpkg/texlive.tlpdb.md5 @@ -1 +1 @@ -6ed067d513dcb9f37c6a6e3395e099e9 texlive.tlpdb +fa6ce75aa449be8ba069b54b44046ec2 texlive.tlpdb diff --git a/systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512 b/systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512 index 48d3ff95d7..fcbc120561 100644 --- a/systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512 +++ b/systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512 @@ -1 +1 @@ -8d876ad0e0241f2177c585d779355e71b28cb0836b61bb9e1009ebcfae2d09e5a1edd631d485662d18635f7140688276c84372ed10974ceb1a5f78434e216f66 texlive.tlpdb +1ede910ea571bd34e2a6d2a10904a8765aef53dfbe75ae32310114af5f1764565b52343f2930c0849c2e6fe731a053665cfc003d42306a1085ea22db45f26dc7 texlive.tlpdb diff --git a/systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512.asc b/systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512.asc index cc95beb98c..eae03360c0 100644 --- a/systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512.asc +++ b/systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512.asc @@ -1,10 +1,10 @@ -----BEGIN PGP SIGNATURE----- -iQEcBAEBCgAGBQJgBNz1AAoJEEzhh34ZQ4xwzmEIAJlbaaf4whni81Ur0P1ancZg -KwLRceqmH8VfCcUcwjg+CUg6WYsmjbP3aW7LRFtV4wauEcVBYy83hk0yUZX1fPf+ -vN/hnlIu+tsNSeCDEOzvzgrjCQCKCYkXZu79+TUDxzryShzHgElBC+6hZHqX9wIL -7QmmilewC8oK3x8oyj8Gk9gOInoGJKHhgGuBrI89MaiLftSrj2j+qjEzEk2gIkZs -ewsWUIKJFfIupxLwgrIXrrS4XfqXEVKzc07D7/sqD42Diu0BjGzg+vw3YQGwtwtj -HmN6Z9bN/x3YxVFGdDz0QWKafsIU17V4D9K/asrx1x1HVnsMx9V4nC0lM7u1Crc= -=Mojm +iQEcBAEBCgAGBQJgBi7AAAoJEEzhh34ZQ4xwse0H/Aw0n+Xqw2ASUYnbJYbNxgJU +Ip+YJ5bqfaWI0Tn+Pih7eSERVqc+NDBynh7ljAxfkJhnGIYW2pioQURivPR2Nn4U +DrV8IEvAW6w4vNY3ti2F29idCSWqgQ6LpQvGgMUbd30s/U+sihULWPtYzGqcnQZj +6NxVVsI83H2MFjE6VFZMAHBLK90yGcUxTDXCdSwui2Uwv57PAVnFH00fnTjcVvwK +dMQa6gHi213p6q6nQiSP1xpl/BcyChmnz6aVupg0gOy2dnqAmfYCcsE04EIj8uOl +szdJ+Wl43yFL/nBP5JizUlZSYPVg5GScEUzvPzeyyrE1DcQ3Xz8xfsvvr7Vpm8k= +=Jp0x -----END PGP SIGNATURE----- diff --git a/systems/texlive/tlnet/tlpkg/texlive.tlpdb.xz b/systems/texlive/tlnet/tlpkg/texlive.tlpdb.xz index 371cdb8508..1b4ba5fdd9 100644 Binary files a/systems/texlive/tlnet/tlpkg/texlive.tlpdb.xz and b/systems/texlive/tlnet/tlpkg/texlive.tlpdb.xz differ diff --git a/systems/win32/miktex/source/CHANGELOG.md b/systems/win32/miktex/source/CHANGELOG.md index f940c5a9a4..3e2b4dca3e 100644 --- a/systems/win32/miktex/source/CHANGELOG.md +++ b/systems/win32/miktex/source/CHANGELOG.md @@ -1,5 +1,23 @@ # MiKTeX Change Log +## 21.1 - 2021-01-18 + +### MiKTeX Console German translation + +MiKTeX Console now supports localization. To begin with, the user interface has been translated to German. + +### Upgraded programs + +* asymptote 2.68 +* autosp 2020-07-01 +* dvipdfmx 20210116 +* dvisvgm 2.11 +* luatex 1.13.0 + +### Fixed issues + +- [676](https://github.com/MiKTeX/miktex/issues/676): MiKTeX Console localization: de_DE + ## 20.12 - 2020-12-14 ### Breaking changes diff --git a/systems/win32/miktex/tm/packages/next/pr.ini b/systems/win32/miktex/tm/packages/next/pr.ini index 5011a5eed0..73710d2435 100644 --- a/systems/win32/miktex/tm/packages/next/pr.ini +++ b/systems/win32/miktex/tm/packages/next/pr.ini @@ -1,13 +1,13 @@ [repository] -date=1611004465 +date=1611090870 lastupd=miktex-arctrl-bin-2.9 miktex-arctrl-bin-x64-2.9 miktex-asymptote-bin-2.9 miktex-asymptote-bin-x64-2.9 miktex-autosp-bin-2.9 miktex-autosp-bin-x64-2.9 miktex-axohelp-bin-2.9 miktex-axohelp-bin-x64-2.9 miktex-bibarts-bin-2.9 miktex-bibarts-bin-x64-2.9 miktex-bibtex-bin-2.9 miktex-bibtex-bin-x64-2.9 miktex-bibtex8bit-bin-2.9 miktex-bibtex8bit-bin-x64-2.9 miktex-bzip2-bin-2.9 miktex-bzip2-bin-x64-2.9 miktex-cairo-bin-2.9 miktex-cairo-bin-x64-2.9 miktex-chktex-bin-2.9 miktex-chktex-bin-x64-2.9 -lstdigest=b031e4aacca9c01e77983d17791aa7f8 +lstdigest=b1320c91a671feacf2a3889abbf5a92d numpkg=4037 relstate=next -version=7688 +version=7689 ;;;;This configuration file is signed by a MiKTeX maintainer. The signature follows. ;;;;-----BEGIN MIKTEX SIGNATURE----- -;;;; signature/miktex: HkEvCWQ9liTsJQHEY00ohbZsRKyZ3fF29BqL36Lwt3mCS2vhuhmIqedqHM2Z2bUOKDbO48+GwVQgXzxPP2h5tMkxWnN95UyZfId0v2szz9fRyEWVXDUaE49LX+Rwua1TCpGexvCQ2ti2qIrfZxNN2DMRUmQ9Nqpp3AgZyT6xBpLyga6pn4A5aZoFOi7WNYNDLVBgy2wEjXSuRLJ6FL3i93J/ULURQkRejokQzCcnIExsO10L3beZxk4dSbpKwHOvEah9+Ct3Q4l4ieAuqdH9SdoD22kRZ9xUR/6B3Hn5vNrVa97PjAaY3JXSLYKR3B3QOSkq9C/nyQmbKSrneXxlKA== +;;;; signature/miktex: f2KsQ3AgbknM+rswn4oxfK+HWo8s/N2Ar2DDz/yZsjRAIpZXiksOsbAi/Kb+zLTMOVpUNEUUfPRtJqR0W/T8d0ZQ9l0pvb8Anwjzn6B9/499gFMGt/Mit1ozyGqnR5ZKzXqrNqerAHq7YlI1k7RAetb4rYRJONUSHmuvA1TpzF/DQsq1upyi7xlplwmRB05rPyog3HGdkBK7eiHgjSf9cJVEwCuUgeVaB/SE5q1IVK6cE2SQGUbGOBkcP3hUB11bWLyBhVyNAufU4hn8Fd+S2WwuKPpvucNj/OIZYmd7BDFERwhMxwYskhBSGV/+83umRKkuDRAwjM5Ct50TM0/IeA== ;;;;-----END MIKTEX SIGNATURE----- diff --git a/systems/win32/miktex/tm/packages/pr.ini b/systems/win32/miktex/tm/packages/pr.ini index 300d4b5240..4c5d7cfc82 100644 --- a/systems/win32/miktex/tm/packages/pr.ini +++ b/systems/win32/miktex/tm/packages/pr.ini @@ -1,13 +1,13 @@ [repository] -date=1611004291 +date=1611090685 lastupd=acro alfaslabone asmeconf babel-ukrainian easybook luaotfload marathi miktex-dvipdfmx-bin-2.9 miktex-dvipdfmx-bin-x64-2.9 miktex-luatex-bin-2.9 miktex-luatex-bin-x64-2.9 miktex-misc miktex-pdftex-bin-2.9 miktex-pdftex-bin-x64-2.9 miktex-runtime-bin-2.9 miktex-runtime-bin-x64-2.9 nunito pslatex pxpic stix2-type1 -lstdigest=627d0e0b57475c06feb7770b14220e20 +lstdigest=ecfb39b56a7494e1330ec324edb3fa97 numpkg=4037 relstate=stable -version=7688 +version=7689 ;;;;This configuration file is signed by a MiKTeX maintainer. The signature follows. ;;;;-----BEGIN MIKTEX SIGNATURE----- -;;;; signature/miktex: Fpc5GkwWNcblbulEUrgTeTGGTozKfYwn8LithPHOnhoc4frE4vbdcXQsb4ssAbF4gW1iyVQqxhFeCo/P47ukfRj1u7/wtOxs+kQGb9STLHA0qT3umKBymqL2d50znQe4KsmLEkNXCcrYRDJ5FnzGtbEQpK3hY5hRsii8vpcogkjJCTp6BJ2Uy2FYtq5gIfuI1KQCncqHrtfREyKSHbNwFgg8wvmw+Ruk8oTvsgx/CI1mSzMSmoj9+zdWKNyWSP8x5ih9sWmFKmx3X0aRL5MJdKUX2fwReRkvnUkMlmcwPfF7nqeR4a5MLOHrvmZuV4PX625w/wss1/5xi/Vc5/+TxQ== +;;;; signature/miktex: fGPy9oOMFu8yHQSkzW3CbTP9Il0/+2RELJVtiPZlW94H00ETCTdLJfy3Y7/bMSOHOrcnKNXocpEhzOB/gCm1z2OQH44jaZoX++4wfLjr/fvW8SB8m+YVPiwds+v4tDrD0zIkJAq/yh5nwLT3h5126WqP/WEKfaOYfyrnxGKdqSJggGyqSCGDsRupbktblStjoBRCoRK924V2SCjPAKyaT9UFD8xbC9k5MbUpoQoVXUK9ZF4eJf4y+g3VV4iMe9RzvKo9SJEY4ItEUev9qMXbodl6A7XYhqijo0Q10zfFAK1C0hFRJk+NBM8i+eoxMR9tYZSCm7IUWGFB5Tasq08dzg== ;;;;-----END MIKTEX SIGNATURE----- diff --git a/systems/win32/w32tex/ChangeLog b/systems/win32/w32tex/ChangeLog index 12b346ead8..d09b981714 100644 --- a/systems/win32/w32tex/ChangeLog +++ b/systems/win32/w32tex/ChangeLog @@ -1,5 +1,11 @@ W32TeX (x86 & x64) ChangeLog +[2021/01/18] +(01) context.tar.xz + ConTeXt version: 2021.01.17 21:39. +(02) texinfo-w32.tar.xz + Update texinfo.tex (2020-11-25.18). + [2021/01/17] (01) dvipdfm-w32.tar.xz Update dvipdfmx.dll. diff --git a/timestamp b/timestamp index 2611f8d244..55b18ac7b1 100644 --- a/timestamp +++ b/timestamp @@ -2,4 +2,4 @@ # The source CTAN of this site's material: dante.ctan.org # The year-month-day-hour-minute of this site's material: -2021-01-19-02-02 +2021-01-20-02-02 -- cgit v1.2.3