1

I'm currently writing a summary for my semiconducter devices course and I'm trying to do it with Latex (just started today). I have the following problem:

I have two chapters with two formulas each. But they writing is too close together. Here my first attempt:

\section{Quantum Theory of solids}
\begin{multicols}{2}
\subsection{Density of States} 
$D_c(E)=\displaystyle\frac{4\pi (2m^*_n)^{3/2}}{h^3}\displaystyle\sqrt{E-E_c}$\\
$D_v(E)=\displaystyle\frac{4\pi (2m^*_p)^{3/2}}{h^3}\displaystyle\sqrt{E_v-E}$

\columnbreak

\subsection{Fermi-Dirac Distribution}
$f_e(E)=\displaystyle\frac{1}{1-exp(\frac{E-E_F}{k_BT})}$\\
$f_h(E)=1-f_e(E)$

\end{multicols}

Which looks like this: enter image description here

then i tried to add the command \flushright like this:

\columnbreak

\begin{flushright}
\subsection{Fermi-Dirac Distribution}
$f_e(E)=\displaystyle\frac{1}{1-exp(\frac{E-E_F}{k_BT})}$\\
$f_h(E)=1-f_e(E)$
\end{flushright}

The result: enter image description here

I would be really grateful if you were to help a noob like me to make this formation better.

PS: here is the full text

\documentclass[11pt]{article}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{color} 
\usepackage{comment}
\usepackage{multicol}

\begin{document}
\title{Semiconducter Devices}
\author{Jean-Marc Sujata}
\date{\today}
\maketitle
\newpage

\begin{wrapfigure}{r}{0.25\textwidth} %this figure will be at the right
    \centering
    \includegraphics[width=0.25\textwidth]{DC.png}
\end{wrapfigure}
\section{Unit Cells}
$package\ density = \displaystyle{\frac{N_{Atoms} \cdot V_{Atoms}}{V_{unit cell}}}$
\\
\begin{tabular}{|c|c|c|c|}
\hline
$Type$ & Atoms & r-a ratio & Volume\\ \hline
$simple\ cubic$ & $N=1$ & $2r=a$ & $V_a=\frac{\pi}{6}r^3$\\ \hline
$body\ centered$ & $N=2$ & $2r=\frac{\sqrt{3}}{2} a$ & $V_a=\frac{8\pi}{3}r^3$\\ \hline
$face\ centered$ & $N=4$ & $2r=\frac{\sqrt{2}}{2}\cdot a$ & $V_a=\frac{16\pi}{3}r^3$\\ \hline
$simple\ cubic$ & $N=8$ & $2r=\frac{\sqrt{3}}{4}a$ & $V_a=\frac{32\pi}{3}r^3$\\ \hline
\end{tabular}

\includegraphics[width=8cm, height=2cm]{Faces.png}
\section{Quantum Theory of solids}
  \begin{multicols}{2}
    \subsection{Density of States}
    $D_c(E)=\displaystyle\frac{4\pi (2m^*_n)^{3/2}}{h^3}\displaystyle\sqrt{E-E_c}$

    \noindent $D_v(E)=\displaystyle\frac{4\pi (2m^*_p)^{3/2}}{h^3}\displaystyle\sqrt{E_v-E}$

    \columnbreak

    \subsection{Fermi-Dirac Distribution}
    $f_e(E)=\displaystyle\frac{1}{1-exp(\frac{E-E_F}{k_BT})}$

    \noindent $f_h(E)=1-f_e(E)$

  \end{multicols}


\end{document}
\

If it helps: I'm using Texmaker

JSujata
  • 11
  • 1
    Welcome to TeX SE! Thanks for posting some code. Could you complete it to make a small, compilable document? With just your document class and the packages your example needs. This means people can copy-paste-compile in order to see the problem and play with solutions. Makes it easier to answer and so encourages people to give you good answers! – cfr Apr 03 '15 at 21:09
  • Without knowing the document setting, in particular the text width, it's impossible to help. – egreg Apr 03 '15 at 21:22
  • Well, the wrapfig next to a \section is something that will certainly break things. – egreg Apr 03 '15 at 21:49
  • @egreg I thought so too. But the documentation actually claims that this should work - it just says it will look awful. I was sure that the documentation said differently...? – cfr Apr 03 '15 at 22:03

2 Answers2

2

Note: This is an answer to the original question. It does not answer the current question.

If I complete your code in a standard way, I don't see any problem. However, I have replaced \\ by paragraph breaks and added \noindent just to avoid the problems which \\ in regular text mode can cause.

\documentclass{article}
\usepackage{multicol}

\begin{document}
  \section{Quantum Theory of solids}
  \begin{multicols}{2}
    \subsection{Density of States}
    $D_c(E)=\displaystyle\frac{4\pi (2m^*_n)^{3/2}}{h^3}\displaystyle\sqrt{E-E_c}$

    \noindent $D_v(E)=\displaystyle\frac{4\pi (2m^*_p)^{3/2}}{h^3}\displaystyle\sqrt{E_v-E}$

    \columnbreak

    \subsection{Fermi-Dirac Distribution}
    $f_e(E)=\displaystyle\frac{1}{1-exp(\frac{E-E_F}{k_BT})}$

    \noindent $f_h(E)=1-f_e(E)$

  \end{multicols}
\end{document}

two columns

But you might be best served by one of the environments provided by amsmath. For example:

\documentclass{article}
\usepackage{multicol,mathtools}

\begin{document}
  \section{Quantum Theory of solids}
  \begin{multicols}{2}
    \subsection{Density of States}
    \begin{equation*}
      \begin{gathered}
        D_c(E)=\displaystyle\frac{4\pi (2m^*_n)^{3/2}}{h^3}\displaystyle\sqrt{E-E_c}\\
        D_v(E)=\displaystyle\frac{4\pi (2m^*_p)^{3/2}}{h^3}\displaystyle\sqrt{E_v-E}
      \end{gathered}
    \end{equation*}
    \columnbreak
    \subsection{Fermi-Dirac Distribution}
    \begin{equation*}
      \begin{gathered}
      f_e(E)=\displaystyle\frac{1}{1-exp(\frac{E-E_F}{k_BT})}\\
      f_h(E)=1-f_e(E)
      \end{gathered}
    \end{equation*}
  \end{multicols}
\end{document}

gathered equations

cfr
  • 198,882
  • Perhaps an en dash would be better for Fermi--Dirac? – Christopher Apr 03 '15 at 21:23
  • oh, the spacing in the second subsection head is dreadful! that should be (at least) ragged right! {since it's only one line, and not that much too wide, i'd be inclined to \rlap the last word.) – barbara beeton Apr 03 '15 at 21:23
  • what about using align for the equations (with alignment on =)? – Guido Apr 03 '15 at 21:24
  • @Guido I was guessing that the OP was using inline maths to avoid alignment and numbering, so I tried to use something which would respect that decision. – cfr Apr 03 '15 at 21:25
  • @barbarabeeton I agree. But since this is clearly not the layout the OP is using, I was not inclined to spend too much time cleaning it up. – cfr Apr 03 '15 at 21:26
  • @Christopher Hmmm... I would use just a hyphen - there. I tend to use -- for ranges of numbers, for example, and --- for dashes as punctuation. However, I might just be punctuating everything wrongly - I'm not sure what the correct usage is. – cfr Apr 03 '15 at 21:27
  • I wasn't sure myself, I just thought as it is two separate names. :) – Christopher Apr 03 '15 at 21:29
  • Thank you all for your contribution! @greg I will remember to post the whole part. @ cfr Thanks for your efforts, sadly I still have the same problem. If it's ok I give you the whole text. (I will look into the notation of amsmath. I've updated the full code in the original post. Thanks again to all of you! – JSujata Apr 03 '15 at 21:30
  • @barbarabeeton If I use \rlap on the last word, I get an extra vertical space. I thought that \rlap was supposed to not take space? (Only because I just found this. It is not a long-standing belief.) – cfr Apr 03 '15 at 21:38
1

This is an answer to the revised question. It involves issues not evident in the original question.

You cannot use wrapfigure without ensuring that there is sufficient text in regular paragraphs to accommodate it. In particular, you can't use it too near things like lists and other special environments, such as multicols.

I would use minipage environments to handle this layout by hand. I also recommend booktabs for the table and the use of the amsmath environments, with mathtools enhancements.

However, I'm not sure what to do about the second subsection heading....

\documentclass[11pt]{article}
\usepackage[demo]{graphicx}
\usepackage{multicol,mathtools,booktabs}

\begin{document}

  \section{Unit Cells}
  \begin{minipage}{.75\textwidth}
    \centering
    \begin{equation*}
        package\ density = \frac{N_{Atoms} \cdot V_{Atoms}}{V_{unit cell}}
    \end{equation*}

    \begin{tabular}{*{4}{c}}
      \toprule
      $Type$ & Atoms & r-a ratio & Volume\\ \midrule
      $simple\ cubic$ & $N=1$ & $2r=a$ & $V_a=\frac{\pi}{6}r^3$\\
      $body\ centered$ & $N=2$ & $2r=\frac{\sqrt{3}}{2} a$ & $V_a=\frac{8\pi}{3}r^3$\\
      $face\ centered$ & $N=4$ & $2r=\frac{\sqrt{2}}{2}\cdot a$ & $V_a=\frac{16\pi}{3}r^3$\\
      $simple\ cubic$ & $N=8$ & $2r=\frac{\sqrt{3}}{4}a$ & $V_a=\frac{32\pi}{3}r^3$\\ \bottomrule
    \end{tabular}
    \medskip

    \includegraphics[width=8cm, height=2cm, keepaspectratio=true]{Faces}
  \end{minipage}
  \begin{minipage}{.25\textwidth}
    \centering
    \includegraphics[width=\linewidth]{DC.png}
  \end{minipage}

  \section{Quantum Theory of solids}
  \begin{multicols}{2}
    \subsection{Density of States}
    \begin{flalign*}
        D_c(E)&=\frac{4\pi (2m^*_n)^{3/2}}{h^3}\sqrt{E-E_c}\\
        D_v(E)&=\frac{4\pi (2m^*_p)^{3/2}}{h^3}\sqrt{E_v-E}
    \end{flalign*}
    \columnbreak
    \subsection{Fermi-Dirac Distribution}
    \begin{flalign*}
        f_e(E)&=\frac{1}{1-exp(\frac{E-E_F}{k_BT})}\\
        f_h(E)&=1-f_e(E)
    \end{flalign*}
  \end{multicols}
\end{document}

equation groups in two columns

cfr
  • 198,882