1

At multiple instances in a document, i have to add a common section called Core courses. The core courses depending on the institution will vary.

For instance

Under one institution, i want to add the below courses

Core courses
1. Artificial Intelligence
2. Software Engineering
3. Software Architecture
4. Software Testing
5. Software Construction 

At other particular place in the document, i will be adding the below.

    Core courses
1. Machine Learning and Pattern Recognition
2. Deep Learning
3. Reinforcement Learning
4. Text mining

Is it possible to write a new command (i.e \newcommand) in latex, which takes the subjects alone and formats them into an list.

James K J
  • 155
  • The issue is simplify writing an itemize or enumerate environment ? In that case, run texdoc wikicheat ot texdoc markdown before of break your horns with a macro. Nonetheless I am pretty sure that this kind of macro already exists somewhere in this site, but never it will so readable as using a simplified markup. – Fran Oct 20 '18 at 19:58
  • 1
    The first example in this answer should suit your needs. – leandriis Oct 20 '18 at 19:58

1 Answers1

4

Something like this?

\documentclass{article}
\usepackage{etoolbox}
\newcommand\CoreCourses[2][Core courses]{
  \renewcommand*\do[1]{\item ##1}
  \noindent\textsf{#1}
  \begin{enumerate}
    \docsvlist{#2}
  \end{enumerate}
}

\begin{document}

\CoreCourses{
  Artificial Intelligence,
  Software Engineering,
  Software Architecture,
  Software Testing,
  Software Construction
}

\CoreCourses{
  Machine Learning and Pattern Recognition,
  Deep Learning,
  Reinforcement Learning,
  Text mining
}

\end{document}

The key is to use the \docsvlist command from the etoolbox package to convert a comma separated list into an enumerate environment.

As defined above, the \CoreCourse macro has an optional argument for setting the "title". The default is "Core Courses".

If you want to "style" the enumerate environment, I recommend using the enumitem package.

Here is the output:

enter image description here