0

I am attempting to place some text/equations/table within a minibox next to a figure. I was following the example solution given here. When I try to do a page break I get a compile error. This is what I get with the current code:

enter image description here

I would like to fit the equations within the red box via a page break or any other means.

Is there a simpler solution available?

CODE

\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}
  • how is this question related to your tex.stackexchange.com/questions/455775/…? there, as i can judge, you have solution. just adapt table to your need. – Zarko Oct 20 '18 at 22:03
  • When I put a line break, say for example I use this code, Step Response: \\$C(s) =\dfrac{\omega^{2}_{n}}{s(s^{2}+2\zeta\omega_{n}s+\omega^{2}_{n})},$\\,' I get the error Missing } inserted...l.371 \end{multicols*}` How can I break up the lines without the error? – Joe Oct 20 '18 at 22:06
  • if you like to have multi line math expressions, than you need to use appropriate math environments defined amsmath, mathtools, nccmath or other packages. for start search for example of use gather, align environments or questions tagged with amsmath or mathtools. – Zarko Oct 20 '18 at 22:51
  • and please, reduce your document example to a mwe, for example on base of this answer: tex.stackexchange.com/questions/455775/… ... – Zarko Oct 20 '18 at 23:03
  • @Zarko, are you suggesting that I put the images, text in a table? If that is the case, there will be a lot of wasted space. I need to fill up as much white space that I can. Thanks! – Joe Oct 21 '18 at 0:01
2

if i correct understood you ... than the best what i can manages from your code is the following:

\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*}

which gives:

enter image description here

code in above mwe is based on my answer to one of yours previous question. to it are added few new packages (indicated by % <--- new).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.