0

I'm trying to type some things from school in LaTeX. I encountered a problem:
If I use the wrapfigure command, with a very short text, the next paragraph also wrap, which I don't want.
Here is the code:

            \subsubsection{Des E-Feld eines Plattenkondensators}

        \begin{wrapfigure}{l}{0.4\textwidth}
                \centering
                \includegraphics[width=0.4\textwidth]{B2}
                \caption{Das E-Feld eines Plattenkondensators.}
                \caption*{Quelle: Selbst erstellt}
                \label{fig: Das E-Feld eines Plattenkondensators}
        \end{wrapfigure} Im inneren des Plattenkondensators spricht man von einem \textcolor{green}{homogenem Feld}.


        \subsection{Die elektrische Feldstärke E}
            Für das \textcolor{green}{Kräftedreieck} gilt:\\
            $\tan(\alpha)=\frac{\vec{F_el}}{\vec{F_G}} \Leftrightarrow \vec{F_el}=\tan(\alpha)\cdot \vec{F_G}$

\end{document}

example

enter image description here

7
  • Welcome to TeX.SX! Could you please minimize your code example (only relevant paragraphs and using an example image (like example-image.pdf) instead of an image we do not have?
    – TeXnician
    Dec 15 '18 at 12:13
  • Aside: You should use \[formula\] instead of {\centering $formula$}.
    – TeXnician
    Dec 15 '18 at 12:13
  • 2
    also never use \\ at the end of a paragraph like \end{tabular}\` (latex presumably warns you about that). wrapfig` has an optional argument to say how many lines to wrap. (we can not run your example to demonstrate, you could edit using example-image which is generally available Dec 15 '18 at 12:28
  • For pretty printing numbers and units you should maybe take a look at siunitx. You could then use something like \SI{1}{\ampere} entspricht ungefähr \SI{6.24e18}{\electron\per\second} with \DeclareSIUnit\electron{e^-} in your preamble.
    – Skillmon
    Dec 15 '18 at 12:32
  • @TeXnician Thanks for the tip with \[formular\]. I don't know what you mean by using (example-image.pdf). @DavidCarlisle I tried \begin{wrapfigure}[2]{l}{0.4\textwidth} but he just throws the next Paragraph in my picture... I don't know why...
    – Mr.LJ
    Dec 15 '18 at 12:58
1

A solution based on tabularx in the place of wrapfigure:

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{wrapfig, tabularx, caption}
\usepackage[demo]{graphicx}
\usepackage[export]{adjustbox}

\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.3pt}
\setcounter{section}{1}
\setcounter{subsection}{1}
\setcounter{subsubsection}{2}


\begin{document}


          \subsubsection{Des E-Feld eines Plattenkondensators}

    \begin{tabularx}{\linewidth}{@{} p{0.4\linewidth}X@{}}
           \color{green} {\includegraphics[width=0.4\textwidth, valign=t]{B2}}\newline
            \captionof{figure}{Das E-Feld eines Plattenkondensators.}
            \caption*{Quelle: Selbst erstellt}
            \label{fig: Das E-Feld eines Plattenkondensators}
 & Im inneren des Plattenkondensators spricht man von einem \textcolor{green}{homogenem Feld}.
    \end{tabularx}


    \subsection{Die elektrische Feldstärke E}
        Für das \textcolor{green}{Kräftedreieck} gilt:\\
        $\tan(\alpha)=\frac{\vec{F_el}}{\vec{F_G}} \Leftrightarrow \vec{F_el}=\tan(\alpha)\cdot \vec{F_G}$

\end{document} 

enter image description here

1
  • Hey @Bernard. This helped quite a lot. I got it to work. Thanks a lot.
    – Mr.LJ
    Dec 15 '18 at 16:25

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.