\newcommand{\mycite}[2][]{% citation, just like \citep optional params: chapter or page number (a right to left thing!). 
  \ifthenelse{\isempty{#1}}%
  		{\lr{\cite{#2}}}% if #1 empty: mycite{sth}
  		{\lr{\cite[\rl{#1}]{#2}}}% if #1 is not empty: mycite[sth1]{sth2}
}

\newcommand{\نقلم}[2][]{\mycite[#1]{#2}}  % just the same as \mycite

%\newcommand{\trans}[3][]{% Translation. params: translation, original latin term, optional rtl note
%	\ifthenelse{\isempty{#1}}%
%		{\emph{#2}\LTRfootnote{ #3}}% if #1 is empty
%		{\emph{#2}\footnote{\lr{#3 }؛ #1}}% if #1 is not empty
%}
\newcommand{\trans}[3][]{% Translation. params: translation, original latin term, optional rtl note
\newtrans{#2}{#3}% add to glossary
\term[#1]{#2}%cite the added word
}

\newcommand{\واژه}[2][]{\term[#1]{#2}}
\newcommand{\واژهجمع}[2][]{\termpl[#1]{#2}}
\newcommand{\ترجمهجدید}[3][]{\newtrans[#1]{#2}{#3}}
\newcommand{\ترجمهجدیدوجمع}[4][]{\newtranspl[#1]{#2}{#3}{#4}}

\newcommand{\ترجمه}[3][]{\trans[#1]{#2}{#3}}
\newcommand{\transf}[3]{\trans[#3]{#1}{#2}}
\newcommand{\name}[3][]{% % Name translation. params: Foreign name in Persian, its original latin form, optional rtl note
	\ifthenelse{\isempty{#1}}%
		{\emph{#2}\LTRfootnote{ #3}}% if #1 is empty
		{\emph{#2}\footnote{\lr{#3 }؛ #1}}% if #1 is not empty
}
\newcommand{\نامم}[3][]{\name[#1]{#2}{#3}}
\newcommand{\abbr}[2]{\lr{#1}\LTRfootnote{ #2}} % Abbreviation. params: latin abbreviation, full latin
\newcommand{\abbrf}[3]{\lr{#1}\LTRfootnote{ #2}}
%\newcommand{\todo}[1]{\uwave{#1}}%\textcolor{blue}{#1}}
\newcommand{\todo}[1]{}%\textcolor{blue}{#1}}
\newcommand{\بعدا}[1]{\todo{#1}}
\newcommand{\member}[1]{\ensuremath{#1}}% set member
\newcommand{\set}[1]{\ensuremath{#1}}% set
\newcommand{\fset}[1]{\ensuremath{\underset{\widetilde{}}{\set{#1}}}}% fuzzy set
\newcommand{\prep}[1]{\ensuremath{#1}}% preposition
\newcommand{\function}[2]{\ensuremath{#1 (#2)}}% function name and papameters
\newcommand{\بندم}[1][]{\item \textbf{#1}}
%\newcommand{\Checkmark}{درست}
% Definition of some new math functions 
%\DeclareMathOperator{\bel}{Bel}
%\DeclareMathOperator{\pl}{Pl}
%\DeclareMathOperator{\pro}{Pro}
%\DeclareMathOperator{\nec}{Nec}
%\DeclareMathOperator{\pos}{Pos}
%\DeclareMathOperator{\dou}{Dou}

%\addtolength{\parskip}{2mm}
% SVG (PDF+LaTeX) graphics. The SVG files must have been converted to PDF+LaTeX and the path to .pdf file added to the search path of images
\let\Oldsmash\smash
\newcommand{\includesvg}[2][]{% required:the SVG file name without extension.If any thing should be persian, must be defined in \rl{}. optional: width
	\ifthenelse{\isempty{#1}}%
		{}% if #1 is empty
		{\def\svgwidth{#1}}% if #1 is not empty
	\begin{latin}%
	{%restrict the renew to this block only
	\newcommand{\transparent}[1]{#1} % transparent package doesn't work with XeTeX but the .pdf_tex files need it
	\renewcommand{\smash}[1]{\Oldsmash{\rl{##1}}} % texts are Persian by default
	
	\input{#2.pdf_tex}%
	}%
	\end{latin}%
}
