![将“text-block”添加到 \sbBloc](https://linux22.com/image/288429/%E5%B0%86%E2%80%9Ctext-block%E2%80%9D%E6%B7%BB%E5%8A%A0%E5%88%B0%20%5CsbBloc.png)
我对 TiKz 和 schemabloc 包还不熟悉。我想知道两件事:(1) 如何向 \sbBloc 添加“文本块”,如下图所示(这是我尝试复制的图像);(2) 如何在 schemabloc 中绘制 T_d(s) 信号?提前致谢!
我的代码在这里:
\documentclass[11pt, twoside]{report}
% ------- Enable UTF8 characters ------- %
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
% ------- Page layout ------- %
\usepackage{fullpage}
\headsep = 24pt % spacing between header and text
\usepackage{fancyhdr}
\fancyhf{}
\fancyhead[LE]{\slshape \rightmark} % section
\fancyhead[RE]{\thepage}
\fancyhead[RO]{\slshape \leftmark} % chapter
\fancyhead[LO]{\thepage}
\pagestyle{fancy}
\setlength{\headheight}{15pt}
\usepackage[toc,page]{appendix}
\usepackage{blindtext} % lorem ipsum replica
\usepackage{paralist}
\usepackage{framed}
% ------- Math ------- %
\newcommand{\bm}[1]{\mbox{\boldmath $#1$}} % bold math characters
\usepackage{icomma} % use , as decimal pointer
\usepackage{amstext}
\usepackage{fixltx2e,amsmath}
\MakeRobust{\eqref}
%------- Coding ------- %
\usepackage{listings}
\lstset{
frame = false,
language = C++,
aboveskip = 3mm,
belowskip = 3mm,
showstringspaces = false,
columns = flexible,
basicstyle = {\small\ttfamily},
numbers = left,
numberstyle = \tiny\color{gray},
keywordstyle = \color{blue},
commentstyle = \color{dkgreen},
stringstyle = \color{mauve},
breaklines = true,
breakatwhitespace = true,
tabsize = 3,
moredelim = **[is][\color{mauve}]{@}{@},
}
\lstdefinelanguage{VHDL}{
morekeywords={
abs,access,after,alias,all,and,architecture,array,assert,attribute,
begin,block,body,buffer,bus,
case,component,configuration,constant,
disconnect,downto,
else,elsif,end,entity,exit,
file,for,function,generate,generic,generic,
if,impure,in,inertial,inout,is,
label,library,linkage,literal,loop,
map,mod,
nand,new,next,nor,not,null,
of,on,open,or,others,out,
package,port,postponed,procedure,process,pure,
range,record,register,reject,rem,report,return,rol,ror,
select,severity,shared,shared,sla,sll,sra,srl,subtype,
then,to,transport,type,
unaffected,units,until,use,
variable,
wait,when,while,with,
xnor,xor
},
morekeywords={rising_edge,falling_edge},
sensitive=false,
morecomment=[l]--
}
\lstdefinestyle{vhdl}{
language = VHDL,
basicstyle = \ttfamily,
keywordstyle = \color{blue}\bfseries,
commentstyle = \color{dkgreen}
}
\lstset{
emph={falling_edge,rising_edge,std_logic_vector,std_logic}, emphstyle=\color{mauve}
}
%\lstinline|•|
%\begin{lstlisting}
%\lstinputlisting{filename.c}
% ------- Images ------- %
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\DeclareCaptionFont{gray}{\color{gray}\hypersetup{linkcolor=gray}}
\captionsetup{
textfont={footnotesize,sc,gray},
font={footnotesize,sc,gray},
%linkcolor={footnotesize,sc,gray},
}
\usepackage{booktabs}
% ------- Tikz ------- %
\usepackage{schemabloc}
\usetikzlibrary{circuits}
\usepackage{verbatim}
% ------- Colors ------- %
\usepackage{color}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
% ------- Links -------- %
\usepackage{hyperref} % clickable references
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black
}
% ------- Debug ------- %
\usepackage{todonotes}
\begin{document}
\begin{tikzpicture}
\sbEntree{E}
\sbComp*{a}{E}
\sbBloc{pacemaker}{$\frac{K}{\frac{1}{12}s+1}$}{a}
\sbRelier[]{E}{a}
\sbRelier[]{a}{pacemaker}
\sbSumh*{c}{pacemaker}
\sbRelier[]{pacemaker}{c}
\sbBloc{heart}{$\frac{1}{s}$}{c}
\sbRelier[]{c}{heart}
\sbSortie{S}{heart}
\sbRelier[]{heart}{S}
\sbDecaleNoeudy[4]{S}{U}
\sbBlocr{sensor}{$K_m=1$}{U}
\sbRelieryx{heart-S}{sensor}
\sbRelierxy[]{sensor}{a}
\end{tikzpicture}
\end{document}
输出结果如下:
答案1
为了回答第一个问题,我使用了rectangle split
节点样式:
\documentclass{article}
\usepackage{amsmath}
\usepackage{mathptmx}
\usepackage{tikz}
\usetikzlibrary{shapes}
\usepackage{schemabloc}
\begin{document}
\begin{tikzpicture}[node distance=2cm]
\sbStyleBloc{rectangle split,rectangle split parts=2,align=center}
\sbEntree{E}
\sbComp*{a}{E}
\sbBloc{pacemaker}{Pacemaker \nodepart{second} $\dfrac K{\frac1{12}s+1}$}{a}
\sbRelier[]{E}{a}
\sbRelier[]{a}{pacemaker}
\sbSumh*[5]{c}{pacemaker}
\sbRelier[]{pacemaker}{c}
\sbBloc{heart}{Heart \nodepart{second} $\dfrac1s$}{c}
\sbRelier[]{c}{heart}
\sbSortie{S}{heart}
\sbRelier[]{heart}{S}
\sbDecaleNoeudy[6]{S}{U}
\sbBlocr{sensor}{Rate measurement \\ sensor \nodepart{second} $K_m=1$}{U}
\sbRelieryx{heart-S}{sensor}
\sbRelierxy[]{sensor}{a}
\end{tikzpicture}
\end{document}