% 
% 
%  Style for  FSB Math docs
% 
% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{fsbmath}[2010/04/09 v0.31 LaTeX Macros for FSB Math Dept, University of Zagreb]
			

\RequirePackage{amsmath, amsthm, amssymb}
% \RequirePackage{esvect}
%\RequirePackage{theorem}



\RequirePackage[dvips]{graphicx}
\RequirePackage[default, rjesenja]{optional}


\RequirePackage{calc}
\RequirePackage{ifthen}

\RequirePackage[enc=cp1250]{hrlatex}


\RequirePackage{framed}
% \RequirePackage{picins}
\RequirePackage{multicol}



\RequirePackage{enumerate}
\RequirePackage{paralist}


\RequirePackage{xcolor}



% \RequirePackage{pst-plot}
% \RequirePackage{pstricks-add}
% \RequirePackage{pstricks, pst-node, pst-tree}

\RequirePackage{cancel}


% \RequirePackage{txfonts}

\RequirePackage[%
	linkcolor=blue,%
	urlcolor=blue,%
	colorlinks,%
% 	breaklinks,%
]{hyperref}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\R}{\mathbb{R}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\D}{\displaystyle}
\newcommand{\F}{\mathbf{F}}

\renewcommand{\Re}{\mathop{\textrm{Re}}}
\renewcommand{\Im}{\mathop{\textrm{Im}}}
\newcommand{\Ln}{\mathop{\textrm{Ln}}}
\newcommand{\Arg}{\mathop{\textrm{Arg}}}
% \newcommand{\ch}{\mathop{\textrm{ch}}}
% \newcommand{\sh}{\mathop{\textrm{sh}}}



\newcommand{\hpm}{\ensuremath{\hphantom{-}}}


\newcommand{\eqdef}{\ensuremath{\stackrel{\mathrm{def}}{=}}}

% \DeclareMathOperator{\arccos}{arc cos}



\ProcessOptions*

%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
%       fsbmath.sty macros
%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


\newcommand{\ispitFooter}{\noindent\emph{\textbf{Rezultati ispita}: sljede\'ci radni dan u 13:00 sati}}


\let\@fsbZadatakBodovi\empty
\def\bodovi#1{%
%  PROVJERI jel #1 prazan string:
\ifthenelse{\equal{#1}{}}%
{\def\@fsbZadatakBodovi{}}%
{\def\@fsbZadatakBodovi{(#1)}}%
}

\newcommand{\fsbShowBodovi}{\medskip\hfill \small \@fsbZadatakBodovi\relax}


\newenvironment{zadaca}[1]
{
    \newpage
    \pagestyle{marcelstyleb}
    \setcounter{zad}{0}

    \phantomsection
    \addcontentsline{toc}{subsubsection}{#1}

    \date{#1}
    \makeheadertitle
}
{
    \pagebreak
}

\newenvironment{ispit}[1]
{
    \newpage
    \thispagestyle{empty}

    \setcounter{zad}{0}
    \date{#1}

    \phantomsection
    \addcontentsline{toc}{subsubsection}{#1}

    \makeheadertitle
}
{
    \vfill
    \ispitFooter
%     \pagebreak
}



\newenvironment{kolokvij}[2]
{
    % #1 -> datum
    % #2 -> grupa (A ili B)

    \newpage
    \pagestyle{empty}
    \setcounter{zad}{0}
    \date{#1}
    \grupa{#2}

    \phantomsection
    \addcontentsline{toc}{subsubsection}{#1\   --\  #2}

    \makeheadertitle
}
{
%     \pagebreak
}



%--------------------------------------------------------
%
%  section styles
%
%
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\normalfont\Large\bfseries\sffamily}}

\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\large\bfseries\sffamily}}

\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\bfseries\sffamily}}

\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
                                    {3.25ex \@plus1ex \@minus.2ex}%
                                    {-1em}%
				    {\normalfont\bfseries\sffamily}}

\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\z@}%\parindent}%
                                       {3.25ex \@plus1ex \@minus .2ex}%
                                       {-1em}%
                                      {\normalfont\normalsize\bfseries\sffamily}}

%--------------------------------------------------------

\newenvironment{lekcija}[1]%
{\newpage\section*{#1}}%
{}

\newtheorem{primjer}{Primjer}
\newtheorem*{napomena}{Napomena}

% \theoremstyle{definition}

\newtheoremstyle{zadatakstyle}%
{\topsep}{\topsep}%
{\rmfamily}%
{0cm}%{-0.145cm}%-12pt}%
{\bfseries}%
{}%
{0pt}%
{\makebox[0cm]{{\makebox[1cm][r]{\thmnumber{ #2}.\,}}}}%


\newtheoremstyle{zzadatakstyle}%
{\topsep}{\topsep}%
{\rmfamily}%
{0cm}%{-0.145cm}%-12pt}%
{\bfseries}%
{}%
{0pt}%
{\makebox[0cm]{{\makebox[1cm][r]{\thmnumber{ #2}.\!$^{*}$\,}}}}%

\newtheoremstyle{zvjezdastibrojac}%
{\topsep}{\topsep}%
{\rmfamily}%
{}%-12pt}%-12pt}%
{\bfseries}%
{.\!$^{*}$}%
{ }%
{}%





%\theoremstyle{plain}

\theoremstyle{zadatakstyle}%
\newtheorem{zad}{}%

\theoremstyle{zzadatakstyle}%
\newtheorem{zzad}[zad]{}%


% ======================================



\newenvironment{zadatak}[1][]{
% \if\notempty{##1}%d
% \relax
% \else 
% \ifthenelse{\equal{#1}{}}%
% {\bodovi{}}%
\bodovi{#1}
% \bodovi{#1}
% \fi
\begin{zad}% 
\begin{list}{}{%
\setlength\leftmargin{0.8165cm}%\makebox{\textbf{\textsf{111.\  }}\ }}
% \setlength{\labelwidth}{1cm}%
\setlength{\labelsep}{0pt}%
\setlength{\listparindent}{0cm}%
\setlength{\itemindent}{0cm}%
}
\item 
\setlength{\labelsep}{1ex}%
}%
{%END environment
\end{list}%
\end{zad}%
\fsbShowBodovi\relax
\bigskip% 
}

\newenvironment{zzadatak}[1][]{%kopija zadatak environmenta
\bodovi{#1}
\begin{zzad}% 
\begin{list}{}{%
\setlength\leftmargin{0.8165cm}%\makebox{\textbf{\textsf{111.\  }}\ }}
% \setlength{\labelwidth}{1cm}%
\setlength{\labelsep}{0pt}%
\setlength{\listparindent}{0cm}%
\setlength{\itemindent}{0cm}%
}
\item 
}%
{%END environment
\end{list}%
\end{zzad}%
\fsbShowBodovi\relax
\bigskip% 
}



\setlength{\parindent}{0pt}


%BEGIN  RJESENJA ...............
% otvori novi filedescriptor
\newwrite\tf@rjesenja

\newcommand{\rjesenje}[1]{%
\opt{inlinerjesenja}{%
\par\textcolor{lightgray}{\fbox{\scriptsize \textcolor{red}{Rj. }\textcolor{lightgray}{ #1}}}
}% end opt inlinerjesenja
\protected@write{\@auxout}
  {}
  {\string\@writefile{rjesenja}{
  {\protect\par {\small \textbf{\thezad.} #1}}
  }}}

\newcommand{\rjesenjeSection}[1]{
\protected@write{\@auxout}
  {}
  {\string\@writefile{rjesenja}{
  {\protect{\bigskip}\protect\par \protect\itshape \protect\fbox\protect{#1\protect} \protect\dotfill {str.~\thepage}\protect\par\protect\medskip   }
  }}}
% }


%BEGIN ispis rjesenja


\newcommand{\printRjesenja}{%
\section*{Rje\v{s}enja zadataka}
\addcontentsline{toc}{section}{Rje\v{s}enja zadataka}

    \begin{multicols*}{2} %mcols* je nebalansirana verzija...
    \raggedright
    \makeatletter
    \@starttoc{rjesenja}
    \makeatother
    \vfill 
    \end{multicols*}
% 
}

%END ispis rjesenja


\newcommand{\stopRjesenja}{
    \let\oldrjesenjeMacro\rjesenje
    \let\rjesenje\@gobble
}

% \continueRjesenja
%     \let\rjesenje\oldrjesenjeMacro

%END rjesenja

