1

I am doing a math assignment, and want to place a box next to my calculations for side calculations. I tried to use the tabular environment, but then there is a huge space besides the box, and the rest of the calculations comes before and after the box, like this:

\documentclass[a4paper, norsk, 11pt]{article}
\begin{document
\begin{itemize}
    \item[a)]
    $$\int\frac{\cot^3{x}}{\sin^2{x}}dx$$
\end{itemize}

\begin{flushright}
    \begin{tabular}{| c |}
    \hline
        u $=\cot x$\\
        du $= -\frac{1}{\sin^2x}$dx\\
    \\
    \hline
    \end{tabular}
\end{flushright}
$$\int -u^3$$
$$=-\frac{u^4}{4}$$
$$=\underline{\underline{-\frac{\cot^4x}{4}}}$$
\end{document}

Can anybody help me, how to get the box beside the calculations and not instead of?

1 Answer 1

1

First of all, don't use $$ in LaTeX. If you want equations centered on their own lines, use \[ ... \]. Then, instead of flushright, which can't be used in the middle of a line, I just use \hfill to push the remaining content (the box) rightward.

If you want the subsequent lines part of the derivation, use a blank line to start a new paragraph within the itemize.

You could also consider an edit, using \smash{\begin{tabular} ... \end{tabular}} if you did not want the right-hand box to affect the vertical spacing on the left-hand side.

\documentclass[a4paper, norsk, 11pt]{article}
\begin{document}
\begin{itemize}
    \item[a)]
    $\int\frac{\cot^3{x}}{\sin^2{x}}dx$
\hfill
    \begin{tabular}{| c |}
    \hline
        u $=\cot x$\\
        du $= -\frac{1}{\sin^2x}$dx\\
    \\
    \hline
    \end{tabular}

$\int -u^3$

$=-\frac{u^4}{4}$
$=\underline{\underline{-\frac{\cot^4x}{4}}}$
\end{itemize}

\end{document}

enter image description here

3
  • Thanks a lot! Why not use $$ ? It seems much easier, since you can place it right inside your text, instead of having to put it on a new line?
    – Andreas
    Commented Oct 24, 2014 at 13:39
  • @Andreas see tex.stackexchange.com/questions/503/why-is-preferable-to Commented Oct 24, 2014 at 14:04
  • Haha, okey. Thanks for the help. I liked the part with, "Because it is a deadly sin!".
    – Andreas
    Commented Oct 24, 2014 at 15:35

You must log in to answer this question.

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