我试过了\mbox
,\fbox
但无法让它正常工作。谢谢你的帮助!
代码
\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{amssymb,amsthm}
\usepackage{tikz}
\usetikzlibrary{tikzmark, quotes, decorations.pathmorphing, shapes, arrows.meta, positioning, calc}
\usepackage{pgfplots}
\usepackage{enumitem}
\usepackage[most]{tcolorbox}
\usepackage{booktabs}
\usepackage{float}
\usepackage{graphicx}
%======================================================================================
% FOR TEXTBOX
%======================================================================================
\usepackage[pscoord]{eso-pic}
\newcommand{\placetextbox}[3]{% \placetextbox{<horizontal pos>}{<vertical pos>}{<stuff>}
\setbox0=\hbox{#3}% Put <stuff> in a box
\AddToShipoutPictureFG*
{\put(\LenToUnit{#1\paperwidth},\LenToUnit{#2\paperheight}){\makebox[0pt][c]{\begin{tabular}{l}#3\end{tabular}}}}
}%
\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}
%-------------------ROOT LOCUS-----------------------------------
\begin{minipage}{0.4\textwidth}
\begin{mybox}{Root Locus Method - Analysis and Design}
Let: $G(s)=\frac{N_{1}}{D_{1}}$ and $H(s)=\frac{N_{2}}{D_{2}}$, then $\frac{C(s)}{R(s)}=\frac{K\frac{N_{1}(s)}{D_{1}(s)}}{1 + K\frac{N_{1}(s)}{D_{1}(s)}}=\frac{KN_{1}(s)D_{2}(s)}{D_{1}(s)D_{2}(s) + K N_{1}(s)N_{2}(s)}$
\placetextbox{0.35}{.965}{
\scriptsize{
Closed-Loop T.F.}}
\vspace*{0.3cm}
The poles of the Closed-Loop T.F. are the roots of $D_{1}(s)D_{2}(s) + K N_{1}(s)N_{2}(s)$
\end{mybox}
\end{minipage}
\end{multicols*}
\end{document}
编辑1
根据 KJO 的建议,使用他指导的网站上发布的解决方案,我尝试了,\tcbhighmath
结果如下:
这不是我想要的。谢谢!
答案1
以下是基于最新版本的tikzmark
提议这些好技巧。文本的放置方式最终可能会导致问题,因为文本是通过叠加设置的,即它可能会超出边界tcolorbox
。另一方面,\overset
允许您将文本设置在分数上。然后,所有需要做的就是将需要放入框中的东西打包到\tikzmarknode
s 中,然后通过叠加绘制框。为了获得模糊的阴影,我使用了Paul Gaborit 的绝招。
\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{amssymb,amsthm}
\usepackage{tikz}
\usetikzlibrary{tikzmark,fit,backgrounds}
\usepackage{enumitem}
\usepackage[most]{tcolorbox}
\usepackage{booktabs}
\usepackage{ifthen}
% there is the wonderful geometry package which you are loading...
% wanna have a look at it? this will allow you to replace the following lines by sth much nicer ;-)
\advance\topmargin-1in
\advance\textheight3in
\advance\textwidth3in
\advance\oddsidemargin-1.5in
\advance\evensidemargin-1.5in
\parindent0pt
\parskip2pt
% from https://tex.stackexchange.com/a/80207/121799
\tikzset{
laser beam action/.style={
line width=\pgflinewidth+.2pt,draw opacity=.1,draw=#1,
},
laser beam recurs/.code 2 args={%
\pgfmathtruncatemacro{\level}{#1-1}%
\ifthenelse{\equal{\level}{0}}%
{\tikzset{preaction={laser beam action=#2}}}%
{\tikzset{preaction={laser beam action=#2,laser beam recurs={\level}{#2}}}}
},
laser beam/.style={preaction={laser beam recurs={10}{#1}},draw opacity=1,draw=#1},
}
\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}
%-------------------ROOT LOCUS-----------------------------------
\begin{minipage}{0.4\textwidth}
\begin{mybox}{Root Locus Method - Analysis and Design}
Let: $ G(s)=\frac{N_{1}}{D_{1}}$
and $ H(s)=\frac{N_{2}}{D_{2}}$,
then $ \frac{C(s)}{R(s)}=
\frac{K\frac{N_{1}(s)}{D_{1}(s)}}{1 + K\frac{N_{1}(s)}{D_{1}(s)}}=
\overset{\raisebox{3pt}{\scriptsize\tikzmarknode{text}{\text{Closed-Loop
T.F.}}}}{%
\tikzmarknode{frac}{\frac{KN_{1}(s)D_{2}(s)}{D_{1}(s)D_{2}(s) + K N_{1}(s)N_{2}(s)}}}$
\tikz[overlay,remember picture]{
\node[green!60!black,draw,thick,inner sep=1pt,fit=(text) (frac)](box){};
\begin{scope}[on background layer]
\draw[thin,laser beam=gray!50] ([xshift=2pt,yshift=-1.5pt]box.north west) rectangle
([xshift=2pt,yshift=-1.5pt]box.south east);
\end{scope}}
The poles of the Closed-Loop T.F. are the roots of $D_{1}(s)D_{2}(s) + K N_{1}(s)N_{2}(s)$
\end{mybox}
\end{minipage}
\end{multicols*}
\end{document}