i used this code but there is an error:
! Use of \@ doesn't match its definition.
I'm trying to make my book such as:

\documentclass[a4paper,14pt,twoside]{tufte-book}
\usepackage{amsthm,amssymb,amsmath}
\usepackage{graphicx ,xcolor ,mdframed}
\usepackage[version=0.96]{pgf}
%\input{mystyle}
\setcounter{secnumdepth}{3}
\usepackage{color}
\def\chpcolor{blue!45}
\def\chpcolortxt{blue!60}
%Section: ---------------------------------------------------------------------------------
\def\@makesectionhead#1{
{ \vspace{20pt}
\parindent 0pt \raggedleft \sectionfont
\colorbox{\chpcolor} { \parbox[c][17pt][c]{90pt}{\color{white} \hfill \thesection }}
\hspace*{5pt}
\vspace{10pt}
\begin{minipage}[c][17pt][c]{\textwidth}
\color{\chpcolortxt} #1
\end{minipage}
}
}
\def\section{\@afterindentfalse \secdef\@section\@ssection}
\def\@section[#1]#2{\ifnum \c@secnumdepth >\m@ne
\refstepcounter{section}
\addcontentsline{toc}{section}{\protect
\numberline{\thesection}#1}\else
\addcontentsline{toc}{section}{#1}\fi
\sectionmark{#1}
\if@twocolumn\@topnewpage[\@makesectionhead{#2}]
\else \@makesectionhead{#2}\@afterheading \fi}
\def\@ssection#1{\if@twocolumn \@topnewpage[\@makesectionhead{#1}]
\else \@makesectionhead{#1}\@afterheading\fi}
\begin{document}
\chapter{chapter}
This is test.
\section{section}
This is test.
\end{document}

\documentclass. If I retype the\documentclassline, then the problem moves to the next line. There was a recent question where a similar problem existed: LaTeX Error: Missing \begin{document}. Have a look at that and see if that helps you with these characters. – Peter Grill Nov 17 '12 at 07:19%Section: ---------\def\@makesectionhead#1{ ... \fi}compile successfully. but i want to change color and style of chapters and sections and ..., can you help me? – mohammad azadi Nov 17 '12 at 07:30