我正在尝试将一些文本/公式/表格放在图形旁边的小框内。我遵循此处提供的示例解决方案。当我尝试分页时,我收到编译错误。这是我使用当前代码得到的结果:
我想通过分页符或任何其他方式将方程式放入红色框内。
有没有更简单的解决方案?
代码
\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage[table]{xcolor}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{amssymb,amsthm}
\usepackage{tikz}
\usetikzlibrary{tikzmark, quotes, decorations.pathmorphing, shapes, arrows.meta, positioning, calc}
\usepackage[most]{tcolorbox}
\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}
%-------------------SECOND ORDER SYSTEM-----------------------------------
\begin{minipage}{0.33\textwidth}
\begin{mybox}{Second Order System}
$\dfrac{C(s)}{R(s)} =\dfrac{\omega^{2}_{n}}{s^{2}+2\zeta\omega_{n}s+\omega^{2}_{n}},$
$\omega_{n}=$ natural frequency, $\zeta=$ damping coefficient(ratio).
\hspace*{6cm}$s_{1,2}=-\zeta\omega_{n}\pm\omega_{n}\sqrt{\zeta^{2}-1}$
\vspace*{-0.4cm}
\begin{figure}[H]
\begin{flushleft}
\includegraphics[width=5cm, height=3cm]{example-image-b}
\end{flushleft}
\end{figure}
\placetextbox{0.4}{.9}{
\scriptsize{
Step Response: $C(s) =\dfrac{\omega^{2}_{n}}{s(s^{2}+2\zeta\omega_{n}s+\omega^{2}_{n})},$
$c(t)=1-\dfrac{1}{\sqrt{1-\zeta^{2}}}e^{-\zeta\omega_{n}t}\cos\left(\omega_{n}\sqrt{1-\zeta^{2}}t-\tan^{-1}\left(\zeta/\sqrt{1-\zeta^{2}}\right)\right)$}}
\end{mybox}
\end{minipage}
\end{multicols*}
\end{document}
答案1
如果我正确理解了你...那么我能从你的代码中得到的最好的东西如下:
\documentclass{article}
\usepackage[landscape,
margin=15mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
calc,
decorations.pathmorphing,
positioning,
quotes,
shapes}
\usepackage{multicol}
\setlength\columnsep{1mm}
\usepackage{enumitem}
\usepackage[most]{tcolorbox}
\newtcolorbox{mybox}[2][]{text width=\linewidth,
fontupper=\scriptsize,
fonttitle=\bfseries\sffamily\scriptsize,
colbacktitle=black,
enhanced,
attach boxed title to top left={yshift=-2mm,xshift=3mm},
boxed title style={sharp corners},
left=1pt, top=3pt, bottom=2pt, right=1pt,
title=#2,
colback=white}
\usepackage{array, booktabs} % <--- new
\usepackage{mathtools} % <--- new
\usepackage[export]{adjustbox} % <--- new
\parindent0pt
\parskip2pt
\begin{document}
\begin{multicols*}{3}
\begin{mybox}{Second Order System}
\setlength\tabcolsep{2pt}
\begin{tabular}{@{}c >{$}l<$}
\includegraphics[width=39mm, valign=c]{example-image-b}
& \begin{aligned}
\dfrac{C(s)}{R(s)}
& = \dfrac{\omega^{2}_{n}}{s^{2}+2\zeta\omega_{n}s+\omega^{2}_{n}}, \\
\omega_{n}
&{:}\; \text{natural frequency}, \\
\zeta
&{:}\; \text{damping coefficient (ratio).} \\
s_{1,2}
& =- \zeta\omega_{n}\pm\omega_{n}\sqrt{\zeta^{2}-1} \\[1ex]
& \text{Step Response:} \\
C(s) & = \dfrac{\omega^{2}_{n}}
{s(s^{2}+2\zeta\omega_{n}s+\omega^{2}_{n})}, \\
c(t) & = \begin{multlined}[t]
1-\dfrac{1}{\sqrt{1-\zeta^{2}}} e^{-\zeta\omega_{n}t} \\[-2ex]
\cos\Bigl[\omega_{n} \sqrt{1-\zeta^{2}}t \\
-\tan^{-1}\Bigl(\zeta/\sqrt{1-\zeta^{2}}\Bigr)\Bigr]
\end{multlined}
\end{aligned}
\end{tabular}
\end{mybox}
\end{multicols*}
这使:
上述 mwe 中的代码基于 我的答案回答您之前的一个问题。其中添加了一些新包(由 表示% <--- new
)。