1

I wanted to create a function for maths notes that makes this result but in an easy way, like the function \underset{}{} where you place between the brackets what you want to appear below the text, so this function I am asking for is one that box the equation and allows you to put something under (longer than a line) and something with in the right with the structure that I made.

Also if you see this could you comment any post related to math notes or margin notes, just for see examples of what to do. Thank you for your help.

\documentclass{book}

\usepackage{amsmath,amssymb}
\usepackage{nccmath}

\usepackage{tcolorbox}
\tcbuselibrary{most}
\newtcolorbox[auto counter,
              number within=chapter,
              list inside=myexercise
              ]{myexercise}[1][]{%
    enhanced,
    title={{\begin{minipage}{\linewidth}\textbf{Ejercicio}~\thetcbcounter.~\textit{#1}\end{minipage}}},
    halign title=left,
    sharp corners,
    colback=white,
    coltitle=black,
    colbacktitle=white,
    boxrule=0pt,frame hidden,
    overlay unbroken={\draw[black,double] (interior.north west)--(segmentation.west);},
    boxed title style={%
      colframe=white, 
      boxrule=0pt,
      colback=white,
      left=0pt,
      right=0pt},
    attach boxed title to top left={xshift={-5pt}},
    underlay unbroken={\draw[help lines,step=3.8mm,black!20!white](interior.south west) grid (segmentation.east);},
    lower separated=false, 
    before lower = {\tcbsubtitle[colback=white, opacityback=0, colframe=black, opacityframe=0, boxrule=1pt, height=1cm,  width=2.55cm, valign=center]{\textbf{Solution:}}}
}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\underset{Hi}{\fbox{$\vec{m}_{total}=\displaystyle\int_{V'}\vec{M}(\vec{r'})d\tau'$}} $\longrightarrow\left|\substack{\\\text{ }\\d\tau'\text{debe ser lo suficientemente}\\\text{grande para que podamos}\\\text{considerar a }\vec{M}\text{ una función suave}\\\text{ }}\right.$

\end{document}

enter image description here

4
  • 1
    Off topic ... the baselines for the text at the right are quite dreadfully uneven. It would be much better looking if you put that text into a parbox; you will have to specify a width, but since you know how long the longest line should be, you can measure it and use that. Commented Jan 3, 2022 at 0:20
  • Thank you for the help Commented Jan 3, 2022 at 0:31
  • @alvaritomendez just curious about the word Hi below the left block of your figure!
    – Black Mild
    Commented Jan 3, 2022 at 15:36
  • Because I didn't have anything under it, so to make a code of what I wanted to make in an easy way I put it there, but it is just for the example Commented Jan 3, 2022 at 15:40

1 Answer 1

2

Here is my TikZ solution.

enter image description here

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{tikzpicture}
\path[nodes={minimum height=1.4cm}]
(0,0) node[draw] (L) {$\vec{m}_{total}=\displaystyle\int_{V'}\vec{M}(\vec{r'})d\tau'$}
(5.5,0) node[align=center] (R) {$d\tau'$ debe ser lo suficientemente\\grande para que podamos\\considerar a $\vec{M}$ una suave}
;
\draw[thick] (R.north west)--(R.south west);
\draw[->,thick] (L.east)+(0:.1)--+(0:1);
\path (L.south) node[below]{Hi};        
\end{tikzpicture}
\end{center}
\end{document}

Update: This is \mybox - a \newcommand as requested.

enter image description here

\documentclass{article}
\usepackage{tikz}

% usage: \mybox{left}{right}{below}
\newcommand\mybox[3]{
\begin{tikzpicture}
\path[nodes={minimum height=1.4cm}]
(0,0) node[draw] (L) {#1}
(5.5,0) node[align=center] (R) {#2}
;
\draw[thick] (R.north west)--(R.south west);
\draw[->,thick] (L.east)+(0:.1)--+(0:1);
\path (L.south) node[below]{#3};
\end{tikzpicture}
}

\begin{document}
\begin{center}
\mybox{This is the left}{This is the right\\with some fomular}{and this is below}
\end{center}

\begin{center}
\mybox{$\vec{m}_{total}=\displaystyle\int_{V'}\vec{M}(\vec{r'})d\tau'$}{$d\tau'$ debe ser lo suficientemente\\grande para que podamos\\considerar a $\vec{M}$ una suave}{Hi}
\end{center}
\end{document}
4
  • Is there any way of usin this as a \newcommand, where you have a bracket for what is inside the box, for what is under the box, and for what is in the right? Commented Jan 3, 2022 at 16:27
  • @alvaritomendez I added a new command. Is that what you want?
    – Black Mild
    Commented Jan 3, 2022 at 16:53
  • Great and awesome as always.
    – Sebastiano
    Commented Jan 3, 2022 at 17:06
  • It's pretty good, but maybe my question is a bit confusing, I wanted to create a command (or maybe is an environment what I'm searching for) that recreates that with multiple lines for below and right text (so the width of the text could change), sorry if it wasn't clear. This is because is a format I want to use in more equations, also if a parameter is empty (like the right text bracket) it shouldn't appear all the structure. I know I'm asking for a lot, that's why your help is beeing really helpfull Commented Jan 3, 2022 at 17:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .