0

I am typesetting class notes in TeXstudio for myself. Although I have typeset formulas before using LaTeX code, it's my first time putting a whole LaTeX document together, so I suppose some of the errors might be due to my preamble? Also, I'm pretty sure I don't need most of the packages for the example shown below, but I think I need them for my whole document.

1) My main problem is that the spacing between similar "code" is not consistent. For example, the spacing between my theorems and proofs are not the same everywhere. Also, the two parts where I wrote "... of the equation yields:"; the spacing between that text and the \[ \] are not the same in both cases.

(I know the proofs are incomplete and have repetitive lines, but I just cut most of it out to avoid having too much text for this question.)

2) My other problem is when I add \renewenvironment{proof}{\textit{\textbf {Proof:}}} to the preamble to modify the "Proof" text to bold and italics, all my QED blacksquare symbols no longer show up.

My code is: enter image description here

\documentclass[11pt]{book}

\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\graphicspath{{images/}}

\usepackage{tikz}
\usetikzlibrary{shapes,snakes}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage[english]{babel}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage{commath}
\usepackage{mathtools}
\usepackage{array}
\usepackage{cancel}
\usepackage{xcolor}
\usepackage[top=1in, bottom=0.75in, left=0.65in, right=0.65in]{geometry}
\usepackage{boiboites}
\usepackage{xkeyval}


\usepackage{mdframed}
\usepackage{lipsum}

\renewcommand\qedsymbol{$\blacksquare$}
\renewcommand*{\CancelColor}{\color{red}}

\newboxedtheorem[boxcolor=blue, background=blue!5, titlebackground=blue,
titleboxcolor = black]{theo}{Theorem}{subsection}

%\renewenvironment{proof}{\textit{\textbf {Proof:}}}

\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    filecolor=magenta,      
    urlcolor=cyan,
    pdftitle={Sharelatex Example},
    bookmarks=true
    }

\title{Probability}

\begin{document}

\frontmatter 

\maketitle

\tableofcontents 

\mainmatter
\chapter{Introductory Material}
\section{Useful Results}

\begin{theo}[\textbf{Multinomial Theorem}]
Let \(m\ge 2\), then
\[\left(x_1+x_2+\dotsb+x_m \right)^n=\sum_{\substack{ 0 \le k_1,k_2,\dotsc,k_m\le n\\ k_1+k_2+\dotsb+k_m=n}}\frac{n!}{k_1!k_2!\dotsm k_m!}x_1^{k_1}x_2^{k_2}\dotsm x_m^{k_m} \]
\end{theo}
\begin{proof}
We will proceed by induction.
\\
\\
\underline{Base case}: \(m=2\)\\
The left side of the equation yields:
\[\left(x_1+x_2 \right)^n\]
\underline{Inductive Step}: Need to show that the formula works for \(m=\ell+1\)
\\
\\
Thus, the left side of the equation yields:
\begin{align*}
\left(x_1+x_2+\dotsb+x_{\ell}+x_{\ell+1} \right)^n & = \left( \left(x_1+x_2+\dotsb+x_{\ell} \right)+x_{\ell+1} \right)^n\\
&= \sum_{r=0}^n{n\choose r}x_{\ell+1}^r \left(x_1+x_2+\dotsb+x_{\ell} \right)^{n-r}\\
&= \sum_{r=0}^n{n\choose r}x_{\ell+1}^r \left(x_1+x_2+\dotsb+x_{\ell} \right)^{n-r}\\
&= \sum_{r=0}^n{n\choose r}x_{\ell+1}^r \left(x_1+x_2+\dotsb+x_{\ell} \right)^{n-r}\\
&= \sum_{r=0}^n{n\choose r}x_{\ell+1}^r \left(x_1+x_2+\dotsb+x_{\ell} \right)^{n-r}  \qedhere
\end{align*}
\end{proof}
\begin{theo}[\textbf{Vandermonde's Identity}]
Let \(m,n,r\) be positive integers, then
\[\sum_{i=0}^r{m\choose i}{n \choose r-j}={m+n \choose r}\]
\end{theo}
\begin{proof}
Now, using the binomial theorem, we observe:
\begin{align*}
\sum_{r=0}^{m+n}{m+n \choose r}x^r 
&= \left(1+x \right)^{m+n} \\
&=\left(1+x\right)^m\left(1+x\right)^n  \qedhere
\end{align*}
\end{proof}


\end{document}

I have posted a link of the PDF output here: http://docdroid.net/llt4 if you need to see it quickly (with added commentary and blue, red and green arrows illustrating my spacing problems).

  • Where can one find boiboites.sty? In answer to the second question, perhaps try using only \renewcommand{\proofname}{\textbf{Proof:}}... – Werner Nov 21 '14 at 6:35
  • Ah sorry. I downloaded it from here: snouffy.free.fr/blog-en/index.php/tag/Download I did modify it very slightly to make the boxed theorems rectangular and blue all-around though. I don't think the issue is with those cosmetic changes. I tried your line for the proof. The squares are back, but "Proof" is still in the default un-bold, italics style. It didn't seem to have done anything for some reason? – user84226 Nov 21 '14 at 7:10
  • \\ \\ I could have guessed they were there from the question title alone. You should remove all \\ that are not in tabular or math alignments. – David Carlisle Nov 21 '14 at 8:23
  • Naturally the qed symbol goes if you redefine proof not to add it (and to remove all the correct spacing normally added by proof environments) in fact you have omitted the argument to \renewenvironment that specifies the end code so it picked up the blank line in your file as the definition of \end{proof} – David Carlisle Nov 21 '14 at 8:30
  • not relevant to the question as asked, but you could simplify your \usepackage list by combining mathtools and amsmath (which is loaded by the former) and similarly for amssymb and amsfonts. i haven't looked into boiboites, but the way that amsthm defines and uses \proofname, it shouldn't have any adverse side effects if you tried \renewcommand{\proofname}{{\normalfont\bfseries Proof}} – barbara beeton Nov 21 '14 at 14:42
1

I can't compile your document without boiboites.sty, but I think your "issue" is due to the book documetclass. Book uses the \flushbottom command to stretch and compress content wherever allowed in order to make all the pages end exactly at the bottom margin to make all content justified on all sides, not just the left and right.

Adding \raggedbottom to your document just after \begin{document} may solve your problem, but personally I believe \flushbottom looks better for printed material.

On the last page, I believe the blue gap you highlighted is due to the height of the equation above; if LaTeX used a smaller gap there then characters on the left side of the equation would run into the equation above. It only looks slightly "off" to you because you don't have a left side to the equation.

  • Thank you. This seems to be working quite well in my document. – user84226 Nov 22 '14 at 6:49

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.