iwase/grouptable - PukiWiki

今年の基盤Aを申請したときに使ったマクロです。数年前から既存のマクロを XeLaTeX を使用できるようにしていましたが、面倒になったので、昨年一から全部作りました。既存のマクロと比較した利点は

1:プログラム自体が小さく単純で、毎年の変更箇所も少ないのでさっさと使える。 2:コマンド内でなく地の部分に文章を書き込む形式なので、他のマクロとの干渉がほぼ無い。 3:上の2と関連して、PDFのクリックでソースを表示できる。 4:XeLaTeX と pLaTeX の両方に対応する。 の4点あります。

以下申請者グループの表です。

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%	This is a file for xelatex.			%
%		Group Table						%
%	by Norio Iwase  (Feb. 1994)			%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%!TEX encoding = UTF-8 Unicode
%!TEX TS-program = XeLaTeX%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%	基盤Aマクロ						%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\input table10.inc
%======================================
% group_table.tex (研究組織表)
%	2006-09-12 TakuYamanaka (Osaka Univ.)
%======================================
%
\研究組織
%
%===== 研究代表者 =====================================
%
\研究代表者
%
\昭和{56}年度生まれ研究者:{九大 何某}/{キュウダイ ナニガシ}({})
\研究者所属研究機関{}({})部局{}({})職{}({})
\研究者専門{}@{}:{}
\研究者初年度研究経費{3478}千円:エフォート{12}%
%
%===== 研究分担者(例にならって、並べてください)======
%
\研究分担者
%
%-----( カラのひながた。必要に応じてコピーしてください)----
%\昭和{23}年度生まれ研究者:{}/{}({})
%\研究者所属研究機関{信}({})部局{}({})職{}({})
%\研究者専門{}@{}:{}
%\研究者初年度研究経費{}千円:エフォート{}%
%---------------
%
%\研究協力者
%
%---------------
%\昭和{}年度生まれ研究者:{}/{}({})
%\研究者所属研究機関{信}({})部局{}({})職{}({})
%\研究者専門{}@{}:{}
%\研究者初年度研究経費{}千円:エフォート{}%
%============================================
\ここまで

そのインクルードファイル table10.inc は元の科研費マクロのとほぼ同じです。

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%	This is a file for XeLaTeX/LaTeX	%
%	  table10.inc                       %
%	by Norio Iwase  (Feb. 1994)			%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%	基盤Aマクロ						%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifx\undefined\XeTeXversion
 \documentclass[a4paper]{article}
 \usepackage[dvipdfmx]{graphicx,xcolor}
\else
 \documentclass[a4paper]{article}
 \usepackage[xetex]{graphicx,xcolor}
\fi
 \usepackage{amsthm}
 \usepackage[leqno]{amsmath}
 \usepackage{amsfonts,amssymb}
 \usepackage{fancybox,ascmac}
 \usepackage{curves}
 \usepackage{tikz-cd}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifx\undefined\XeTeXversion
 \usepackage[deluxe]{otf}
 \usepackage[bookmarks=true,bookmarksnumbered=true,bookmarkstype=toc,colorlinks=true,linkcolor=black]{hyperref}
 \usepackage{uline--}
\else
 \usepackage[no-math]{fontspec}
 \defaultfontfeatures{Mapping=tex-text}
 \setromanfont{Times}
 \setsansfont{Lucida Sans}
 \setmonofont{Arial}
 \usepackage[slantfont,boldfont]{xeCJK}
 \CJKspace
 \usepackage{zxjatype} % xeCJK を内部で読み込んでいる。
 \usepackage[xetex,bookmarks=true,bookmarksnumbered=true,bookmarkstype=toc,colorlinks=true,linkcolor=black]{hyperref}
 \usepackage{xunicode}
 \usepackage{xltxtra}
 \def\mincho{\setjamainfont[Bold=HiraMinProN-W6]{HiraMinProN-W3}}
 \def\gothic{\setjamainfont[Bold=HiraKakuProN-W6]{HiraKakuProN-W3}}
 \def\mouhitsu{\setjamainfont[Bold=HGSGyoshotai]{HGSeikaishotaiPRO}}
 \def\hiramin{\fontspec{HiraMinProN-W3}}
 \def\hirakaku{\fontspec{HiraKakuProN-W3}}
 \def\hiramaru{\fontspec{HiraMaruProN-W4}}
 \def\timesrm{\fontspec[Scale=1.0]{Times}}
 \def\timesnr{\fontspec[Scale=1.0]{Times New Roman}}
 \def\osaka{\fontspec{Osaka}}
 \def\mono{\fontspec{Osaka-Mono}}
 %
  \setjamainfont[Scale=.962,RawFeature=-palt]{Meiryo}
 \setjasansfont[Scale=0.962,RawFeature=-palt]{DFPLeiSho-SB}
  \setjamonofont[Scale=.962,RawFeature=-palt]{Hiragino Maru Gothic ProN W4}
 \usepackage{uline-x}
 \usepackage{pdfsync}
\fi
%
\usepackage{ifthen}
%
%	Page Definitions
%
\textwidth=16.5cm
\textheight=25.0cm
\hoffset -20.0mm
\voffset -23mm
\pagestyle{plain}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\phantom{x}	\vspace{1cm}
\newcounter{KLNumPeople}		% number of people in the group
\setcounter{KLNumPeople}{-1}		% not to count the first header row...
\newcounter{KLDistBudgetSum}	% sum of distributed budget
% Make counters for annual sums for each category-----------------------

\newcommand{\KLGname}[4]{%
	\begin{tabular}{l}%
		#1\\% kenkyusha ID
		#2\\% furigana
		#3\\% name in kanji
		age: #4 % age
	\end{tabular}%
	&%
	\ifthenelse{\equal{#3}{}}{% if blank, do nothing
	}{%
		\stepcounter{KLNumPeople}%
	}%
}

\newcommand{\KLGposition}[3]{%
	\begin{tabular}{l}%
		#1\\% institution
		#2\\% division
		#3% position
	\end{tabular}%
	&%
}

\newcommand{\KLGfield}[3]{%
	\begin{tabular}{l}%
		#1\\% research field
		#2\\%  degree
		#3% responsibility in this study
	\end{tabular}%
	&%
}

\newcommand{\KLGbudget}[1]{%
	\Number{#1} &% first year budget (k yen)
	\addtocounter{KLDistBudgetSum}{#1}
}

\newcommand{\KLGeffort}[1]{%
	#1 \\% effort for this study
}
\newif\ifNumWithCommas \NumWithCommastrue
\def\NumWithCommas{\NumWithCommastrue}
\def\NumWithoutCommas{\NumWithCommasfalse}
\newcount\Numa
\newcount\Numb
\def\Numempty{}%output blank if "-0" is given
\def\Number#1{\edef\Numpar{#1}\ifx\Numempty\Numpar\else%
\ifNumWithCommas\Numa=#1\relax
\ifnum\Numa>999999\divide\Numa by 1000000
\number\Numa,%
\multiply\Numa by -1000000\advance\Numa by #1\relax
\Numb=\Numa\divide\Numa by 1000
\ifnum\Numa<100 \ifnum\Numa<10 0\fi0\fi\number\Numa,%
\multiply\Numa by -1000\advance\Numa by \Numb
\ifnum\Numa<100 \ifnum\Numa<10 0\fi0\fi\number\Numa%
\else\ifnum\Numa>999\divide\Numa by 1000
\number\Numa,%
\multiply\Numa by -1000\advance\Numa by #1\relax
\ifnum\Numa<100 \ifnum\Numa<10 0\fi0\fi\number\Numa%
\else\number\Numa\fi\fi\else\number#1\fi\fi}
\newcounter{KLRemainingEffort}
\newcommand{\NumC}[1]{\Number{\value{#1}}}

\newcounter{kyen}
\newcommand{\NumCk}[1]{%
	\setcounter{kyen}{\arabic{#1}/1000}
	\Number{\value{kyen}}
}
\newcommand{\KLnewcounter}[2]{
	\setcounter{KLtmp}{0}
	\whiledo{\value{KLtmp} < #2}{
		\newcounter{#1\arabic{KLtmp}}
		\stepcounter{KLtmp}
	}
}
\newcommand{\KLdumpcounter}[2]{
	\setcounter{KLtmp}{0}
	\whiledo{\value{KLtmp} < #2}{
		#1\arabic{KLtmp} : \arabic{#1\arabic{KLtmp}}\\
		\stepcounter{KLtmp}
	}
}

%-----------------------------------------------------
\newcommand{\KLResetEffort}{
	\setcounter{KLRemainingEffort}{100}
}

%-----------------------------------------------------
\newcommand{\KLEffort}[1]{%
	#1%
	\addtocounter{KLRemainingEffort}{-#1}%
}
\newcounter{KLCost}				% to calculate cost = #units x unit cost
\newcounter{KLGrandTotalValue}		% for the grand total of all the categories in all years
\setcounter{KLGrandTotalValue}{0}

\newcommand{\KLCostCategory}{KLequipments}
\newcounter{KLYearCount}
\newcounter{KLPrintYear}
\newcounter{KLtmp}

\newcommand{\KLMaxYear}{8}
\KLnewcounter{KLequipments}{\KLMaxYear}
\KLnewcounter{KLexpendables}{\KLMaxYear}
\KLnewcounter{KLdomestic}{\KLMaxYear}
\KLnewcounter{KLforeign}{\KLMaxYear}
\KLnewcounter{KLtravel}{\KLMaxYear}
\KLnewcounter{KLgratitude}{\KLMaxYear}
\KLnewcounter{KLmisc}{\KLMaxYear}
\KLnewcounter{KLAnnualSum}{\KLMaxYear}
%
%===== 研究組織 ============================
%
\def\研究組織{
{\Large 研 究 組 織 表}\\[-5mm]
\begin{longtable}{|l|l|l|r|r|}
	\hline
	\KLGname{\  研究者番号}{\  フリガナ}{\  氏名}{\  年齢}%
	\KLGposition{\  所属研究機関}{\  部局}{\  職}%
	\KLGfield{\  現在の専門}{\  学位}{\  役割分担}%
	\begin{tabular}{l}
		{\ \!\!\!初年度\!\!\!}\\{\ \!\!\!研究経費\!\!\!}\\{\ \hfill (千円)\!\!\!}%
	\end{tabular}%
	&
	\begin{tabular}{l} 
		{\ \!\!\!エフォ\!\!\!}\\{\ \!\!\!ート\!\!\!}\\{\  \hfill(\%)\!\!\!}%
	\end{tabular}\\
}
%
%===== 研究者 ==============================
%
\newcount\yowai
%
\def\昭和#1年度生まれ研究者:#2/#3(#4){%
	\hline
\yowai=\year \advance\yowai by -1925 %
\advance\yowai by -#1%\代表者誕生年%
\def\研究者年齢{\number\yowai}%
\KLGname{#4}{#3}{#2}{\研究者年齢}}
%
\def\平成#1年度生まれ研究者:#2/#3(#4){%
	\hline
\yowai=\year \advance\yowai by -1988 %
\advance\yowai by -#1%\代表者誕生年%
\def\研究者年齢{\number\yowai}%
\KLGname{#4}{#3}{#2}{\研究者年齢}}
%
\def\令和#1年度生まれ研究者:#2/#3(#4){%
	\hline
\yowai=\year \advance\yowai by -2018 %
\advance\yowai by -#1%\代表者誕生年%
\def\研究者年齢{\number\yowai}%
\KLGname{#4}{#3}{#2}{\研究者年齢}}
%
\def\研究者所属研究機関#1(#2)部局#3(#4)職#5(#6){%
    \KLGposition{(#2) \ #1}{(#4) \ #3}{(#6) \ #5}}
\def\研究者専門#1@#2:#3{
    \KLGfield{#2}{#1}{#3}}
\def\研究者初年度研究経費#1千円:エフォート#2%{
    \KLGbudget{#1}\KLGeffort{#2}}
%
%===== 研究代表者 ==========================
%
\def\研究代表者{
	\hline\hline
	\multicolumn{5}{|l|}{研究代表者}\\
	\hline
}
%
%===== 研究分担者 ==========================
\def\研究分担者{
 	\hline\hline
	\multicolumn{5}{|l|}{研究分担者}\\
}
%
%===== 研究協力者 ==========================
\def\研究協力者{
 	\hline\hline
	\multicolumn{5}{|l|}{研究協力者}\\
}
%
%===== ここまで ============================
\def\ここまで{
	\hline\hline
	\multicolumn{2}{|c|}{合計 \arabic{KLNumPeople} 名} &
	\hfill 初年度研究経費合計額 &
	\NumC{KLDistBudgetSum} & \\
	\hline
\end{longtable}
\end{document} 
}
%
\usepackage{longtable}
\addtolength{\voffset}{-20mm}
\addtolength{\hoffset}{-10mm}
\addtolength{\textheight}{20mm}
%\addtolength{\paperheight}{100mm}
\begin{document}
\pagestyle{empty}
\baselineskip 21pt
%

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2020-11-14 (土) 20:08:23 (345d)