在框图中微调节点文本位置

在框图中微调节点文本位置

在下面的代码中,我该如何微调文本的位置:

在此处输入图片描述

代码

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage[table]{xcolor}
\usepackage{url}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{amssymb,amsthm}
\usepackage{esint}
\usepackage{blox}
\usepackage{tikz}
\usetikzlibrary{quotes, decorations.pathmorphing, shapes, arrows.meta, positioning, calc}

\usepackage{enumitem}
\usepackage[most]{tcolorbox}

%======================================================================================
%   FONTS
%======================================================================================

\usepackage{unicode-math}  % loads 'fontspec' automatically

\setmainfont{Fira Sans Light}[
     Numbers       = OldStyle,
     BoldFont      = Fira Sans Medium,
     ItalicFont    = Fira Sans Light Italic,
     BoldItalicFont= Fira Sans Medium Italic]
\setsansfont{Fira Sans Light}[
     Numbers       = OldStyle,
     BoldFont      = Fira Sans Medium,
     ItalicFont    = Fira Sans Light Italic,
     BoldItalicFont= Fira Sans Medium Italic]
% For source code
\setmonofont{Source Code Pro Light}[
     BoldFont=Source Code Pro]

%% Math font
\setmathfont{Asana Math} % or some other suitable font


\advance\topmargin-1in
\advance\textheight3in
\advance\textwidth3in
\advance\oddsidemargin-1.5in
\advance\evensidemargin-1.5in
\parindent0pt
\parskip2pt
\newcommand{\hr}{\centerline{\rule{3.5in}{1pt}}}

\begin{document}

\begin{multicols*}{3}

\newtcolorbox{mybox}[2][]{text width=0.97\textwidth,fontupper=\scriptsize,
fonttitle=\bfseries\sffamily\scriptsize, colbacktitle=black,enhanced,
attach boxed title to top left={yshift=-2mm,xshift=3mm},
boxed title style={sharp corners},top=3pt,bottom=2pt,
  title=#2,colback=white}


    % https://tex.stackexchange.com/questions/175969/block-diagrams-using-tikz
\tikzset{block/.style={draw, fill=green!35, rectangle, scale=0.9,
    minimum height=1em, minimum width=1em},
sum/.style={draw, fill=white, circle, node distance=0.2cm},
input/.style={coordinate},
output/.style={coordinate},
pinstyle/.style={pin edge={to-,thin,black}},
dot/.style={draw,circle,fill=black,minimum size=0.6mm,inner sep=0pt},
branch/.style={fill,circle,minimum size=2pt,inner sep=0pt}}


%------------ Block Diagrams ---------------
\begin{minipage}{0.33\textwidth}
    \begin{mybox}{Block Diagrams}
    \vspace*{0.1cm}
    \begin{tabular}{p{2.5cm} p{3cm} p{2cm}}
%------------ Block Diagram Row 4 ---------------
        \begin{tikzpicture}[scale=0.6, every node/.style={scale=1}, remember picture,overlay, auto, node distance=0.5cm,>=latex']
            \node [input, name=input41] {};
            \node [block, right = 0.5cm of input41] (controller41) {$G$};
            \node [output, right = 0.5cm of controller41, name=output41] {};
            \node [output, below = 0.5cm of input41, name=output412] {};

            \draw [->] (input41) -- node[name=X41l] {$u$} (controller41);
            \draw [->] (controller41) -- node[name=g41] {$y$} (output41);
            \node[fill,circle,minimum width=0.08cm,inner sep=0pt] (dot41s) at
            ($(controller41.east)!0.5!(output41.west)$){};
            \draw [->] (dot41s.center) |- (output412) node[above,pos=0.85,name=X41l2] {$y$};
            %\draw [->] (dot41s) -| (input41);

            %\draw node at (1,-0.05) {\textbullet};
        \end{tikzpicture} &

        \begin{tikzpicture}[scale=0.6, every node/.style={scale=1}, remember picture,overlay, auto, node distance=0.5cm,>=latex', baseline]

            \node [input, name=input42] {};
            \node [block, below = 0.3cm of input42, name=cont421] (controller421) {$G$};
            \node [output, left = 0.5cm of controller421, name=output421] {$y$};
            \node [block, right = 1cm of input42, name=controller42] (controller42) {$G$};
            \node [output, right = 0.5cm of controller42, name=output422] {$y$};

            \draw [->] (input42) -- node[name=X42s] {$u$} (controller42);
            \node[fill,circle,minimum width=0.08cm,inner sep=0pt] (dot42s) at
            ($(input42.east)!0.7!(controller42.west)$){};
            \draw [->] (dot42s.center) |- (controller421);
            \draw [->] (controller421) -- (output421) node[name=out421] {$y$};
            \draw [->] (controller42) -- node[name=out422] {$y$} (output422);
        \end{tikzpicture} &
       $y=Gu$

        \end{tabular}
        \vspace*{1cm}

    \end{mybox}
\end{minipage}

\end{multicols*}

\end{document} 

答案1

pos=0.85你的代码中已经有了。这告诉 TiZ 将节点放置在路径 85% 的位置。您需要做的就是在代码中添加一些pos=0和。pos=1

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage[table]{xcolor}
\usepackage{url}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{amssymb,amsthm}
\usepackage{esint}
\usepackage{blox}
\usepackage{tikz}
\usetikzlibrary{quotes, decorations.pathmorphing, shapes, arrows.meta, positioning, calc}

\usepackage{enumitem}
\usepackage[most]{tcolorbox}

%======================================================================================
%   FONTS
%======================================================================================

% \usepackage{unicode-math}  % loads 'fontspec' automatically
% 
% \setmainfont{Fira Sans Light}[
%      Numbers       = OldStyle,
%      BoldFont      = Fira Sans Medium,
%      ItalicFont    = Fira Sans Light Italic,
%      BoldItalicFont= Fira Sans Medium Italic]
% \setsansfont{Fira Sans Light}[
%      Numbers       = OldStyle,
%      BoldFont      = Fira Sans Medium,
%      ItalicFont    = Fira Sans Light Italic,
%      BoldItalicFont= Fira Sans Medium Italic]
% % For source code
% \setmonofont{Source Code Pro Light}[
%      BoldFont=Source Code Pro]
% 
% %% Math font
% \setmathfont{Asana Math} % or some other suitable font
% 

\advance\topmargin-1in
\advance\textheight3in
\advance\textwidth3in
\advance\oddsidemargin-1.5in
\advance\evensidemargin-1.5in
\parindent0pt
\parskip2pt
\newcommand{\hr}{\centerline{\rule{3.5in}{1pt}}}

\begin{document}

\begin{multicols*}{3}

\newtcolorbox{mybox}[2][]{text width=0.97\textwidth,fontupper=\scriptsize,
fonttitle=\bfseries\sffamily\scriptsize, colbacktitle=black,enhanced,
attach boxed title to top left={yshift=-2mm,xshift=3mm},
boxed title style={sharp corners},top=3pt,bottom=2pt,
  title=#2,colback=white}


    % https://tex.stackexchange.com/questions/175969/block-diagrams-using-tikz
\tikzset{block/.style={draw, fill=green!35, rectangle, scale=0.9,
    minimum height=1em, minimum width=1em},
sum/.style={draw, fill=white, circle, node distance=0.2cm},
input/.style={coordinate},
output/.style={coordinate},
pinstyle/.style={pin edge={to-,thin,black}},
dot/.style={draw,circle,fill=black,minimum size=0.6mm,inner sep=0pt},
branch/.style={fill,circle,minimum size=2pt,inner sep=0pt}}


%------------ Block Diagrams ---------------
\begin{minipage}{0.33\textwidth}
    \begin{mybox}{Block Diagrams}
    \vspace*{0.1cm}
    \begin{tabular}{p{2.5cm} p{3cm} p{2cm}}
%------------ Block Diagram Row 4 ---------------
        \begin{tikzpicture}[scale=0.6, every node/.style={scale=1}, remember picture,overlay, auto, node distance=0.5cm,>=latex']
            \node [input, name=input41] {};
            \node [block, right = 0.5cm of input41] (controller41) {$G$};
            \node [output, right = 0.5cm of controller41, name=output41] {};
            \node [output, below = 0.5cm of input41, name=output412] {};

            \draw [->] (input41) -- node[pos=0,name=X41l] {$u$} (controller41);
            \draw [->] (controller41) -- node[pos=1,name=g41] {$y$} (output41);
            \node[fill,circle,minimum width=0.08cm,inner sep=0pt] (dot41s) at
            ($(controller41.east)!0.5!(output41.west)$){};
            \draw [->] (dot41s.center) |- (output412) node[above,pos=1,name=X41l2] {$y$};
            %\draw [->] (dot41s) -| (input41);

            %\draw node at (1,-0.05) {\textbullet};
        \end{tikzpicture} &

        \begin{tikzpicture}[scale=0.6, every node/.style={scale=1}, remember picture,overlay, auto, node distance=0.5cm,>=latex', baseline]

            \node [input, name=input42] {};
            \node [block, below = 0.3cm of input42, name=cont421] (controller421) {$G$};
            \node [output, left = 0.5cm of controller421, name=output421] {$y$};
            \node [block, right = 1cm of input42, name=controller42] (controller42) {$G$};
            \node [output, right = 0.5cm of controller42, name=output422] {$y$};

            \draw [->] (input42) -- node[pos=0,name=X42s] {$u$} (controller42);
            \node[fill,circle,minimum width=0.08cm,inner sep=0pt] (dot42s) at
            ($(input42.east)!0.7!(controller42.west)$){};
            \draw [->] (dot42s.center) |- (controller421);
            \draw [->] (controller421) -- (output421) node[pos=1,name=out421] {$y$};
            \draw [->] (controller42) -- node[pos=1,name=out422] {$y$} (output422);
        \end{tikzpicture} &
       $y=Gu$

        \end{tabular}
        \vspace*{1cm}

    \end{mybox}
\end{minipage}

\end{multicols*}

\end{document} 

在此处输入图片描述

相关内容