自定义命令表

自定义命令表

我创建了以下四个命令,并在 \section 下方使用它们

\coursename{Mathematics for Biotechnology/Food Technology-I}
\credit{4}
\lecture{3}
\tutorial{1}
\lab{0}

我想要生成如下的自动表:

---------------------------------------------------------------------
S. No.     Subject Name                                    L    T    P    Credit
---------------------------------------------------------------------
1.    Mathematics for Biotechnology/Food Technology-I      3    1    0      4
--------------------------------------------------------------------
2. ....
---------------------------------------------------------------------

该表将出现在章节环境下方。感谢您的任何建议。

答案1

也许是这样的,我添加了键值来使用有关课程的附加信息,键值的顺序并不重要。

\CourseInfo[]{Course Description}{bib entries}

它将使用\subsection{Course Number Subject Name}并打印描述并添加一个小参考书目。

目前您必须指定课程键,我将更新到更安全的版本。

如果添加新的\CourseInfo,请\jobname.crs在本地目录中删除。到目前为止,我还没有检查覆盖情况。

\listofcourses打印一份概览。

\documentclass[paper=a4,12pt]{scrbook}

\usepackage{etoolbox}%
\usepackage{xcolor}%
\usepackage{xkeyval}%

\usepackage{hyperref}

\newcounter{course}%
\newwrite\courselistfile%


\newcommand{\addcourselist}[6]{%
\immediate\write\courselistfile{%
  \number\value{course} \string& #1 & #2 & #3 & #4 & #5 & #6\tabularnewline
  \string\hline%
}%
}%

\newcommand{\listofcourses}{%
\begin{center}
\begin{tabular}{| c |c |p{2.7in} |c|c|c|c|}
\hline%
  \textbf{S.No.} & \textbf{Subject Code} & \textbf{Subject} & \textbf{L} & \textbf{T} & \textbf{P} & \textbf{Credit}  \tabularnewline
  \hline%
  \hline%
\IfFileExists{\jobname.crs}{\input{\jobname.crs}}{\input{\jobname.crs}}%
\end{tabular}
\end{center}
\clearpage
}%

\makeatletter
\define@key{CourseInfoKeys}{CourseCode}[]{%
\def\CourseInfoKeysSubjectCode{#1}%
}

\define@key{CourseInfoKeys}{Subject}[]{%
\def\CourseInfoKeysSubject{#1}%
}

\define@key{CourseInfoKeys}{Lectures}[]{%
\def\CourseInfoKeysLectures{#1}%
}

\define@key{CourseInfoKeys}{Tutorial}[]{%
\def\CourseInfoKeysTutorial{#1}%
}

\define@key{CourseInfoKeys}{Practical}[]{%
\def\CourseInfoKeysPractical{#1}%
}

\define@key{CourseInfoKeys}{Credit}[]{%
\def\CourseInfoKeysCredit{#1}%
}%
\makeatother



\newcommand{\CourseInfo}[3][]{%
\setkeys{CourseInfoKeys}{#1}%
%
\refstepcounter{course}%
\addcourselist{\CourseInfoKeysSubjectCode}{\CourseInfoKeysSubject}{\CourseInfoKeysLectures}{\CourseInfoKeysTutorial}{
\CourseInfoKeysPractical}{\CourseInfoKeysCredit}%
\subsection{\CourseInfoKeysSubjectCode~\CourseInfoKeysSubject}%
#2% Course Description
\vspace{\baselineskip}%
\ifblank{#3}{%
}{%
\begin{thebibliography}{99}
#3
\end{thebibliography}%
}%
\clearpage
}%


\AtBeginDocument{%
\IfFileExists{\jobname.crs}{%
}{%
\immediate\openout\courselistfile=\jobname.crs
}
}%

\AtEndDocument{%
\immediate\closeout\courselistfile%
}%


\begin{document}
\listofcourses

\CourseInfo[CourseCode={AS 601},Subject={Research Methodology},Lectures={3}, Tutorial={0}, Practical={0},Credit={3}]{%
Objectives and types of research: Motivation and objectives – Research methods vs Methodology. Types of research – Descriptive vs. Analytical, Applied vs. Fundamental, Quantitative vs. Qualitative, Conceptual vs. Empirical. 
}{%
\bibitem{p} Design and Analysis of Experiments by Montogomery D.C. (2001), John Wiley, ISBN: 0471260088  
\bibitem{p} Satarkar, S.V., 2000. Intellectual property rights and Copy right. Ess Ess Publications. 
}%

\CourseInfo[CourseCode={MA 604},Subject={Linear Algebra and ODE},Lectures={2}, Tutorial={0}, Practical={0},Credit={2}]{%
\textsc{Review of Linear Algebra:} Finite dimensional Vector spaces; basis and dimension; Linear transformations and their matrix representation; eigen values and eigen vectors; digonalization; invariant spaces and Canonical forms.
}{%
\bibitem{p} Kenneth Hoffman, R Kunze, \emph{Linear Algebra}, 2th edition, PHI, 1971
\bibitem{p} Gilbert Strang, \emph{Linear Algebra and Its Applications}, 4th edition, Brooks/Cole (Cengage Learning), 2006
\bibitem{p} Gilbert Strang, \emph{Introduction to Linear Algebra}, 4th edition, Cambridge University Press India Pvt Ltd, 2009
\bibitem{p} \url{http://web.mit.edu/18.06/www/}
}%
\end{document}

笔记表格不是原始意义上的目录。应将其替换为\longtable环境

在此处输入图片描述

相关内容