# Code that compiled in ubuntu but not working in win 7

I was typing my thesis in ubuntu in gedit and compiling in the terminal and it worked fine but now due to some reasons I installed windows 7 in my PC but the same code is not working in texmaker. When I compile my code I see these errors.

Error-1- line 11- command \proof already defined.

Here is my (sample) code-

\documentclass{article}
\usepackage{graphicx}
\usepackage{amsmath,amsfonts,amssymb,amsthm,epsfig,epstopdf,titling,url,array}
\usepackage[a4paper, total={5in, 10in}]{geometry}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}

\newenvironment{proof}[1][Proof]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{definition}[1][Definition]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{example}[1][Example]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{remark}[1][Remark]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}

\newcommand{\qed}{\nobreak \ifvmode \relax \else
\ifdim\lastskip<1.5em \hskip-\lastskip
\hskip1.5em plus0em minus0.5em \fi \nobreak
\vrule height0.75em width0.5em depth0.25em\fi}

\begin{document}

\title{An Introduction to Differential Algebra-(Notes)}
\author{Jagdeep Singh}

\maketitle
\section{GENERALITIES CONCERNING DIFFERENTIAL RINGS}

\subsection{Derivations}
\begin{definition} - A derivation of a ring A is an additive mapping $a \mathbb{\to} a'$ of A into itself satisfying

$$(ab)' = a'b + ab'$$
\end{definition}

\end{document}

• Your code is failing with an updated TL2015, so either you have a very old TeX distro in your Ubuntu machine or your editor is simply ignoring errors and forcing compilation. – Paulo Cereda Mar 10 '16 at 18:25
• @HATEthePLOT Yes I have Miktex installed... and I have most packages installed. plz suggest which one I need for this sample so I can check them. – Bhaskar Vashishth Mar 10 '16 at 19:02
• i can't believe that this actually worked on any system. proof and \qed have been defined for decades in amsthm, so perhaps you added amsthm when you switched systems? – barbara beeton Mar 10 '16 at 19:05
• these packages are all fine, but since amsthm defines proof and \qed, either you didn't load amsthm on the old system, or you have added these new definitions when you changed systems, or you ignored error messages on the old system. there are no other possibilities. – barbara beeton Mar 10 '16 at 19:10

As barbara beeton has pointed out in the comments, the problem is that amsthm defines proof and \qed. Therefore, when you load amsthm and then have:

\newcommand{\qed}{\nobreak \ifvmode \relax \else
\ifdim\lastskip<1.5em \hskip-\lastskip
\hskip1.5em plus0em minus0.5em \fi \nobreak
\vrule height0.75em width0.5em depth0.25em\fi}


This is a problem, because

Command \qed already defined.


In other words, how can you define a new command \qed, when \qed is already defined? You can't. You need to re-define it, thus:

\renewcommand{\qed}{\nobreak \ifvmode \relax \else
\ifdim\lastskip<1.5em \hskip-\lastskip
\hskip1.5em plus0em minus0.5em \fi \nobreak
\vrule height0.75em width0.5em depth0.25em\fi}


Similarly

\renewenvironment{proof}[1][Proof]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}


For me,

\documentclass{article}
\usepackage{graphicx}
\usepackage{amsmath,amsfonts,amssymb,amsthm,epsfig,epstopdf,titling,url,array}
\usepackage[a4paper, total={5in, 10in}]{geometry}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}

\renewenvironment{proof}[1][Proof]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{definition}[1][Definition]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{example}[1][Example]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{remark}[1][Remark]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}

\renewcommand{\qed}{\nobreak \ifvmode \relax \else
\ifdim\lastskip<1.5em \hskip-\lastskip
\hskip1.5em plus0em minus0.5em \fi \nobreak
\vrule height0.75em width0.5em depth0.25em\fi}

\begin{document}

\title{An Introduction to Differential Algebra-(Notes)}
\author{Jagdeep Singh}

\maketitle
\section{GENERALITIES CONCERNING DIFFERENTIAL RINGS}

\subsection{Derivations}
\begin{definition} - A derivation of a ring A is an additive mapping
$a \mathbb{\to} a'$ of A into itself satisfying

$$(ab)' = a'b + ab'$$
\end{definition}

\end{document}


Compiles fine.

You should also remove the blank line before the displayed equation:

\begin{definition} - A derivation of a ring A is an additive mapping
$a \mathbb{\to} a'$ of A into itself satisfying
$(ab)' = a'b + ab'$
\end{definition}


I also genuinely don't understand what you're trying to accomplish by wrapping \to in \mathbb{} but you've destroyed the binary spacing around the arrow, is this intentional?