2

I've started to work with Latex recently but I can't figure out how to put an image to the right of my equations (whichare in an align-environment). I've read in other topics to use a tabular to fix the problem. Yet it didn't work for me as kill the whole textflow and my image won't rescale. Below you'll find my code. Could you guys help out?

\documentclass{article}
\usepackage[dutch]{babel}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{textcomp}
\usepackage{xspace}
\setlength{\parindent}{0pt}
\begin{document}
In dit document worden enkele van de belangrijkste bewijsjes opgesomd uit de cursus 
Elektriciteit 1, gegeven door Anita Van Der Maele aan de UGent campus Schoonmeersen. 
\section{Elektrostatica 1}
\subsection{De elektrische potentiaal}

\begin{align*}
    W & = F \, d\\ 
    \Delta W & = q\vec{E} \cdot \Delta\vec{s}\\
\end{align*}

Splits de veldsterkte in zijn componenten. Bedenk dat de component loodrecht op de verplaatsing geen arbeid uitvoert

\begin{tabular}{l r}
{\begin{align*}
    \Delta W & = q\vec{E_1} \cdot \Delta\vec{s} \\
    & = qE_1 \Delta s \cos\alpha
    \intertext{Daarna gaan we over naar de volledige tekening (tekening 2)
Hierbij willen we berekenen welke arbeid wordt geleverd tussen A en B.}
    W^B_A & = \sum^{B}_A \Delta W\\
    & = q \sum^B_A \vec{E_1} \cdot \Delta s\\
    & = q \lim_{\Delta s \to 0} \sum^B_A \vec{E} \cdot \Delta s\\
    & = q \int_A^B \vec{E} \cdot \, \vec{ds}\\
    & = q \int_A^B \frac{Q \cos \alpha}{4 \pi \epsilon r^2} \, ds\\
    & =  \frac{q Q}{4 \pi \epsilon } \int_{r_a}^{r_b} \frac{1}{r^2} \, dr\\
    \intertext{bedenk dat de integraal van een macht, \'e\'en over 'de nieuwe macht' maal de variabele tot de 'oude macht plus \'e\'en' wordt.}\\
    & = \frac{q Q}{4 \pi \epsilon } \left[-\frac{1}{r_b} - (-\frac{1}{r_a})\right]\\
    &  = \frac{q Q}{4 \pi \epsilon } \left[\frac{1}{r_a} - \frac{1}{r_b}\right]\\
    \intertext{ Per definitie is het potentiaalveschil V = $$\frac{Q}{4 \pi \epsilon r}$$}
    & = q(V_a-V_b)
\end{align*}}
&
\includegraphics[0.5\textwidth]{Ele1.jpg}
\end{tabular}

Thanks in advance

  • not mentioned in the answer is the fact that, in the last \intertext, a math string is wrapped in double dollar signs. that is the old code indicating display math, and it will wreak havoc with \intertext. single dollar signs, or \( ... \), are what should be used to indicate in-line math. – barbara beeton Dec 29 '13 at 15:01
  • Ah, I used that before. But got some errors, that's why I changed it to double $'s. But I suppose I did something wrong then :) Thanks for pointing out the ways to display in-line math. – Barrie Dec 29 '13 at 15:39
2

Remarks

There is no convenient way of placing a picture in the margin inside of an equation. I suggest putting it before or after the equation.

Implementation

\documentclass{article}
\pagestyle{empty}% for cropping
\usepackage{amsmath}
\usepackage[demo]{graphicx}
\begin{document}
In dit document worden enkele van de belangrijkste bewijsjes opgesomd uit de cursus 
Elektriciteit 1, gegeven door Anita Van Der Maele aan de UGent campus Schoonmeersen.

\section{Elektrostatica 1}
\subsection{De elektrische potentiaal}

\begin{align*}
    W & = F \, d\\ 
    \Delta W & = q\vec{E} \cdot \Delta\vec{s}\\
\end{align*}

Splits de veldsterkte in zijn componenten. Bedenk dat de component loodrecht op de verplaatsing geen arbeid uitvoert

\marginpar{\includegraphics[width=\marginparwidth]{demo}}
\begin{align*}
    \Delta W & = q\vec{E_1} \cdot \Delta\vec{s} \\
    & = qE_1 \Delta s \cos\alpha
    \intertext{Daarna gaan we over naar de volledige tekening (tekening 2)
    Hierbij willen we berekenen welke arbeid wordt geleverd tussen A en B.}
    W^B_A
    &= \sum^{B}_A \Delta W\\
    &= q \sum^B_A \vec{E_1} \cdot \Delta s\\
    &= q \lim_{\Delta s \to 0} \sum^B_A \vec{E} \cdot \Delta s\\
    &= q \int_A^B \vec{E} \cdot \, \vec{ds}\\
    &= q \int_A^B \frac{Q \cos \alpha}{4 \pi \epsilon r^2} \, ds\\
    &= \frac{q Q}{4 \pi \epsilon } \int_{r_a}^{r_b} \frac{1}{r^2} \, dr
    \intertext{bedenk dat de integraal van een macht, \'e\'en over 'de nieuwe macht' maal de variabele tot de 'oude macht plus \'e\'en' wordt.}
    & = \frac{q Q}{4 \pi \epsilon } \left[-\frac{1}{r_b} - (-\frac{1}{r_a})\right]\\
    &= \frac{q Q}{4 \pi \epsilon } \left[\frac{1}{r_a} - \frac{1}{r_b}\right]\\
    \intertext{ Per definitie is het potentiaalveschil V = $\frac{Q}{4 \pi \epsilon r}$}
    & = q(V_a-V_b)
\end{align*}
\marginpar{\includegraphics[width=\marginparwidth]{demo}}
\end{document}

Output

enter image description here enter image description here

  • If you like my answer and it was helpful to you, consider upvoting and marking it as accepted answer by clicking on the checkmark ✓ next to the score. – Henri Menke Dec 29 '13 at 16:30
  • There you go mate :) – Barrie Dec 29 '13 at 19:26

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.