%=================================================================
% form05_tokutei_koubo_header.tex
%	2007-09-14: Taku
%		Switched to a new method using "Picture" environment, and
%		readjusted parameters for the new 2008 form.
%========================================================
\usepackage{calc}
\usepackage{watermark}
\usepackage{longtable}
\usepackage{geometry}                % See geometry.pdf to learn the layout options. There are lots.

\geometry{noheadfoot,scale=1}  %scale=1 resets margins to 0
\setlength{\unitlength}{1pt}

% define variables for positions ==========================
% picture environment location, in  units of points
\newcommand{\KLOddPictureX}{}
\newcommand{\KLEvenPictureX}{}
\newcommand{\KLPictureY}{}
\newcommand{\KLOddPictureInWaterMarkX}{}
\newcommand{\KLEvenPictureInWaterMarkX}{}
\newcommand{\KLPictureInWaterMarkY}{}

% standard left edge positions
\newcommand{\KLOddLeftEdge}{}
\newcommand{\KLOddRightEdge}{}
\newcommand{\KLEvenLeftEdge}{}
\newcommand{\KLEvenRightEdge}{}
%------------------------------------------------------------

\newcommand{\KLLeftEdge}{}
\newcommand{\KLRightEdge}{}

% standard margins for text in frames
\setcounter{KLParboxSideMargin}{7}
\setcounter{KLParboxTopMargin}{12}
\setcounter{KLParboxBottomMargin}{5}

% ===== Global definitions for the Kakenhi form ======================
%　基本情報
\newcommand{\研究種目}{特定領域研究}
\newcommand{\研究種目後半}{　公募研究(新規)}
\ifthenelse{\isundefined{\研究種別}}{
	\newcommand{\研究種別}{}
}{}%
\newcommand{\KLMainFile}{tokutei\_koubo.tex}
\newcommand{\KLForms}{tokutei_koubo_forms}
\newcommand{\KLYoshiki}{tokutei_koubo}

%　奇数ページの下に記入される情報
\newcommand{\klbyYup}{}
\newcommand{\klbyYdown}{}
\newcommand{\klbyAreaXleft}{}
\newcommand{\klbyAreaXright}{}
\newcommand{\klbyKikanXleft}{}
\newcommand{\klbyKikanXright}{}
\newcommand{\klbyNameXleft}{}
\newcommand{\klbyNameXright}{}

\newcommand{\KLBottomInfo}[8]{%
	\ifthenelse{\equal{#1}{}}{%
		\renewcommand{\klbyYup}{91}
		\renewcommand{\klbyYdown}{63}
	}{%
		\renewcommand{\klbyYup}{#1}
		\renewcommand{\klbyYdown}{#2}
	}
	
	\ifthenelse{\equal{#3}{}}{%
		\renewcommand{\klbyAreaXleft}{143}
		\renewcommand{\klbyAreaXright}{226}
		\renewcommand{\klbyKikanXleft}{297}
		\renewcommand{\klbyKikanXright}{389}
		\renewcommand{\klbyNameXleft}{453}
		\renewcommand{\klbyNameXright}{538}
	}{%
		\renewcommand{\klbyAreaXleft}{#3}
		\renewcommand{\klbyAreaXright}{#4}
		\renewcommand{\klbyKikanXleft}{#5}
		\renewcommand{\klbyKikanXright}{#6}
		\renewcommand{\klbyNameXleft}{#7}
		\renewcommand{\klbyNameXright}{#8}
	}
	\KLTextBox{\klbyAreaXleft}{\klbyYup}{\klbyAreaXright}{\klbyYdown}{}{\領域略称名}%
	\KLTextBox{\klbyKikanXleft}{\klbyYup}{\klbyKikanXright}{\klbyYdown}{}{\研究機関名}%
	\KLTextBox{\klbyNameXleft}{\klbyYup}{\klbyNameXright}{\klbyYdown}{}{\研究代表者氏名}%
}

%==========================================================
\newcommand{\KLStandardLengths}{%
	\setlength{\textwidth}{468pt}
	\setlength{\textheight}{660pt}
}

\newcommand{\KLStandardPositions}{%
	% picture environment location, in  units of points
	\renewcommand{\KLOddPictureX}{75}% was 77
	\renewcommand{\KLEvenPictureX}{75}% was 50
	\renewcommand{\KLPictureY}{725}% was 760
	\renewcommand{\KLOddPictureInWaterMarkX}{64.5}% was 67
	\renewcommand{\KLEvenPictureInWaterMarkX}{64.5}% was 39
	\renewcommand{\KLPictureInWaterMarkY}{733.5}% was 768

	% standard left edge positions
	\renewcommand{\KLOddLeftEdge}{57}% was 58
	\renewcommand{\KLOddRightEdge}{538}% was 563
	\renewcommand{\KLEvenLeftEdge}{57}% was 31
	\renewcommand{\KLEvenRightEdge}{539}% was 535

	\setlength{\oddsidemargin}{-2.5mm}
	\setlength{\evensidemargin}{-2.5mm}
	\setlength{\topmargin}{41pt} % = 777 - 736
}

%------ This should be set before \begin{document} ------
\KLStandardLengths
\KLStandardPositions
%----------------------------------------------------------------------------
