0

As the title described, I would like to put a figure on the left and make some complex comments parallelly on the right. I write some code, but I feel the code is not "clean" . Sometimes works but sometimes with an error notice. I appreciate someone could help me to give out a clean and nice code, then I can use it for many other similar jobs.

One practical example is as following (I would like to have something shown by the picture) enter image description here

And the current bad written Latex code with error message as follow:

\begin{SCfigure}[\sidecaptionrelwidth][h]
\centering
\includegraphics[scale=0.6]{E:/.../Sample.jpg}
\caption{$\boxed{
\varphi(y)=\frac{1}{\sqrt{2\pi}}\cdot exp (-\frac{y^2}{2})
}$
\\ 
Density of $N(0,1)$ with $y=\frac{x-\mu}{\sigma}$}
\end{SCfigure}

The Error Message:

enter image description here

1
  • 1
    Please always post complete documents that show the problem. A non standard command appears to be complaining about a blank line (\par) in the document but your fragment doesn't have a blank line and gives no indication where SCfigure or \boxed are defined. Apr 24 '14 at 11:32
1

The best method to realize something like this is to use two adjacent minipages.

Implementation

\documentclass{article}
\pagestyle{empty}% for cropping
\usepackage{mathtools,pgfplots}
\begin{document}
\begin{figure}
  \centering
  \begin{minipage}[c]{0.45\linewidth}
    \begin{tikzpicture}
      \begin{axis}[
        no marks,
        smooth,
        axis lines=middle,
        enlargelimits=true,
        domain=-3:3,
        width=\linewidth,
        xlabel=$x$,
        ylabel=$f(x)$,
        xtick=\empty,
        ytick=\empty,
        ]
        \addplot {1/sqrt(2*pi)*exp(-x^2/2)};
        \draw[<->] (axis cs:-1,0.25) -- node[above,pos=0.25] {1} node[above,pos=0.75] {1} (axis cs:1,0.25);
      \end{axis}
    \end{tikzpicture}
  \end{minipage}
  \quad
  \begin{minipage}[c]{0.45\linewidth}
    \[ \boxed{f(y) = \frac{1}{\sqrt{2\pi}} \exp\left(\frac{y^2}{2}\right)} \]
    Density of $N(0,1)$ with $y=\frac{x-\mu}{\sigma}$
  \end{minipage}
  \caption{Gaussian distributon}
\end{figure}
\end{document}

Output

enter image description here

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.