Text FormattingDefinitions in LaTeX

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
helllo
Posts: 44
Joined: Sat Jun 05, 2010 5:20 pm

Definitions in LaTeX

Post by helllo »

Hi guys,
Sorry if I'm not posting in the right place :!:

I'm trying to use "definitions" in my maths Latex file, but it's not working.

Here is the code I'm putting in the beginning of the Tex file:

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage{amsmath,amssymb,graphicx}
\usepackage{psfrag}
\usepackage{color}
\usepackage[mathscr]{eucal}

\newcommand\sectionbreak{\clearpage}
\numberwithin{equation}{section}
\usepackage{fullpage}


% Caligraphic letters
\newcommand{\cA}{{\cal A}}
\newcommand{\cB}{{\cal B}}
\newcommand{\cC}{{\cal C}}
\newcommand{\cE}{{\cal E}}
\newcommand{\cF}{{\cal F}}
\newcommand{\cH}{{\cal H}}
\newcommand{\cI}{{\cal I}}
\newcommand{\cP}{{\cal P}}
\newcommand{\cR}{{\cal R}}
\newcommand{\cS}{{\cal S}}
\newcommand{\cT}{{\cal T}}
\newcommand{\cK}{{\cal K}}
\newcommand{\cN}{{\cal N}}
\newcommand{\cD}{{\cal D}}
\newcommand{\cV}{{\cal V}}
\newcommand{\cW}{{\cal W}}
\newcommand{\cX}{{\cal X}}
\newcommand{\cU}{{\cal U}}

% Bold letters
\newcommand{\bi}{{\mbox{\boldmath$i$}}}
\newcommand{\bj}{{\mbox{\boldmath$j$}}}
\newcommand{\bk}{{\mbox{\boldmath$k$}}}
\newcommand{\bK}{{\mbox{\boldmath$K$}}}
\newcommand{\bl}{{\mbox{\boldmath$l$}}}
\newcommand{\bm}{{\mbox{\boldmath$m$}}}
\newcommand{\bB}{{\mbox{\boldmath$B$}}}
\newcommand{\bE}{{\mbox{\boldmath$E$}}}
\newcommand{\bF}{{\mbox{\boldmath$F$}}}
\newcommand{\bG}{{\mbox{\boldmath$G$}}}
\newcommand{\bR}{{\mbox{\boldmath$R$}}}
\newcommand{\bV}{{\mbox{\boldmath$V$}}}
\newcommand{\bU}{{\mbox{\boldmath$U$}}}
\newcommand{\bp}{{\mbox{\boldmath $p$}}}
\newcommand{\bq}{{\mbox{\boldmath $q$}}}
\newcommand{\bT}{{\mbox{\boldmath $T$}}}
\newcommand{\bu}{{\mbox{\boldmath $u$}}}
\newcommand{\bw}{{\mbox{\boldmath $w$}}}
\newcommand{\bx}{{\mbox{\boldmath $x$}}}
\newcommand{\bd}{{\mbox{\boldmath $d$}}}
\newcommand{\br}{{\mbox{\boldmath $r$}}}
\newcommand{\bg}{{\mbox{\boldmath $g$}}}
\newcommand{\bz}{{\mbox{\boldmath $z$}}}
\newcommand{\bc}{{\mbox{\boldmath $c$}}}
\newcommand{\bb}{{\mbox{\boldmath $b$}}}
\newcommand{\ba}{{\mbox{\boldmath $a$}}}
\newcommand{\bh}{{\mbox{\boldmath $h$}}}
\newcommand{\be}{{\mbox{\boldmath $e$}}}
\newcommand{\bff}{{\mbox{\boldmath $f$}}}
\newcommand{\bv}{{\mbox{\boldmath $v$}}}
\newcommand{\by}{{\mbox{\boldmath $y$}}}
\newcommand{\byy}{{\mbox{\boldmath $\widetilde{\by}$}}}
\newcommand{\bn}{{\mbox{\boldmath $n$}}}
\newcommand{\bzero}{{\mbox{\boldmath $0$}}}
\newcommand{\bone}{{\mbox{\boldmath $1$}}}
\newcommand{\bdS}{{\mbox{\boldmath $dS$}}}
\newcommand{\bPhi}{\boldsymbol{\Phi}}
\newcommand{\sN}{\mathscr{N}}
\newcommand{\sT}{\mathscr{T}}

\newcommand{\grad}{\mathrm{grad}}
\newcommand{\Div}{\mathrm{div}}
\newcommand{\curl}{\mathrm{curl}}
\newcommand{\DIY}{\fbox{\bf DIY}\ \ }
\newcommand{\noi}{\noindent}

\newcommand{\dint}{\int \!\!\! \int}
\newcommand{\trint}{\int \!\!\! \int \!\!\! \int}
\newcommand{\cL}{{\cal L}}
\newcommand*{\R}{\mathbb{R}}
\newcommand*{\C}{\mathbb{C}}
\newcommand*{\Z}{\mathbb{Z}}
\newcommand*{\N}{\mathbb{N}}
\newcommand*{\Q}{\mathbb{Q}}
\newcommand\relphantom[2]{\mathrel{\phantom{#1}}}



\usepackage{amsthm}


\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}



\usepackage{mathrsfs}
\usepackage{xkeyval}
So can you see what I'm doing wrong?
Thanks! :)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Definitions in LaTeX

Post by gmedina »

proof and \qed are already defined (when loading the amsthm package). To avoid conflicts between your definitions and the ones from amsthm, you need to use \renewenvironment (for proof) and \renewcommand (for \qed), or choose different names (Mproof and \Mqed, for example).
1,1,2,3,5,8,13,21,34,55,89,144,233,...
helllo
Posts: 44
Joined: Sat Jun 05, 2010 5:20 pm

Definitions in LaTeX

Post by helllo »

gmedina wrote:proof and \qed are already defined (when loading the amsthm package). To avoid conflicts between your definitions and the ones from amsthm, you need to use \renewenvironment (for proof) and \renewcommand (for \qed), or choose different names (Mproof and \Mqed, for example).
Hi Gmedina,
Thanks for this but I'm not too sure I actually understand what you're saying.

Are you suggesting I get rid of this bit:

Code: Select all

\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}
And replacing it with something else (\renewenvironment (for proof) and \renewcommand (for \qed)) ??

Sorry I'm not very good with Latex :oops:
helllo
Posts: 44
Joined: Sat Jun 05, 2010 5:20 pm

Re: Definitions in LaTeX

Post by helllo »

Anyone ?
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Definitions in LaTeX

Post by frabjous »

Didn't you try it for yourself already? That should probably work, yes, but it's impossible to tell without a proper minimal working example. See the Post on Avoidable Mistakes.
Post Reply