10

How can i produce the following imageenter image description here

TeX commands of this would be extremely helpful.

  • @texenthusiast It would be very helpful of you in case u can give me the tex commands of the above pic. I know to typeset Math, but not exactly sure as to how to draw that box. Ur link was helpful, but i still need an example exactly like this. – crskhr Oct 12 '13 at 17:13
  • 3
    some interesting examples in create a framed environment for a margin note – barbara beeton Oct 12 '13 at 17:16
  • 4
    @Chandrasekhar you would get faster answers and as well get more rep incase you add minimal working example (MWE) that illustrates your problem/effort. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – texenthusiast Oct 12 '13 at 17:46
  • Oooh, from "Proofs from the book" :) – Per Alexandersson Oct 31 '13 at 21:31
12
\documentclass[twoside]{article}
\usepackage{geometry}
\geometry{a4paper,left=3cm,right=8cm,marginparwidth=6cm}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{amsmath,amsthm}
\newtheorem{theorem}{Theorem}

\usepackage{mdframed}
\usepackage{marginnote}
\newcommand\mnote[2][0pt]{%
  \marginnote{%
    \fcolorbox{black}{black!10}{\parbox{\dimexpr\linewidth-2\fboxsep-2\fboxrule}{#2}}}[#1]}

\begin{document}

\mnote[-\fboxsep]{% a vertical optional offset
\begin{theorem}{Legendre's Theorem}
\emph{The number $n!$ contains the prime factor $p$ exactly
\begin{align*}
\sum_{k \geq 1} \left \lfloor \frac{n}{p^k} \right \rfloor
\end{align*}
times}
\begin{proof}
Left as an exercise for the reader.
\end{proof}
\end{theorem}%
}
\lipsum[1]

\newpage
foo
\mnote{% without an offset
\begin{theorem}{Legendre's Theorem}
\emph{The number $n!$ contains the prime factor $p$ exactly
\begin{align*}
\sum_{k \geq 1} \left \lfloor \frac{n}{p^k} \right \rfloor
\end{align*}
times}
\begin{proof}
Left as an exercise for the reader.
\end{proof}
\end{theorem}%
}
\lipsum[1]

\end{document}

Output for a twosided document

enter image description here

enter image description here

6

You could use a minipage environment to separate the note from the text, and use mdframed to color the box:

\documentclass{article}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{fullpage}
\usepackage{amsmath,amsthm}
\colorlet{verylightgray}{black!10!white}
\newtheorem{theorem}{Theorem}

\usepackage{mdframed}

\begin{document}
\begin{minipage}[t]{0.366\linewidth}
\begin{mdframed}[linecolor=black, backgroundcolor = verylightgray]
\textbf{Legendre's Theorem}

\emph{The number $n!$ contains the prime factor $p$ exactly
\begin{align*}
\sum_{k \geq 1} \left \lfloor \frac{n}{p^k} \right \rfloor
\end{align*}
times}
\begin{proof}
Left as an exercise for the reader.
\end{proof}
\end{mdframed}
\end{minipage}
\hfill
\begin{minipage}[t]{0.55\linewidth}
\lipsum[1] %put your text here
\end{minipage}

\end{document}

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.