My question is probably not very clear! I am writing a summary paper on students. Each student has a section. In the section I specify its qualities and results and at the end I put a noted opinion

% !TEX TS-program = pdflatex
% !TEX encoding = UTF-8 Unicode

















I would like that in the summary we find on the same line

Last name1 first name1: Opinion=8------------------------page no.

Last name2 first name2: Opinion=5------------------------page no.

enter image description here

  • The sectioning commands of mist classes have an optional argument. So you could use: \section[Last Name1 First Name1: Opinion=8]{Last Name1 First Name1} If your class also provides an optional argument (or even two) is unclear, because you've not shown the class.
    – cabohah
    Commented Apr 14 at 15:31
  • Related: tex.stackexchange.com/q/6862/277964
    – cabohah
    Commented Apr 14 at 15:36
  • I use an article class. I don't want to use the section option, for that I would have to go back, I would prefer to write my opinion at the end of my comments and add it to the summary. For the moment I "cheat" I put the opinion as the title of the subsection and it appears in the summary.
    – rpapa
    Commented Apr 14 at 16:23
  • 1
    Please add all relevant information to the question and make the example compile without error. You are ling enough here to know, how to ask good questions. However, I don't see a reason, why not adding the opinion at the beginning instead at the end of the section,
    – cabohah
    Commented Apr 14 at 16:43
  • There are a number of ways to do this. Easiest would be to create a new file like toc or lof and use \addcontentsline to record the data and \@starttoc in the summary. section. You will also need a \l@summary or something similar to format each entry. (see \@dottedtocline). Commented Apr 14 at 17:11

1 Answer 1


Here's a way to do it. A few comments:

  • one idea was defining a new environment; however using it is clumsy AND for some reason it didn't like an argument, like #3, in its end-part
  • so I introduced \newcommand\student[4]{% last, first, avis, comments ...
  • it incorporates cabohah's idea about the sections
  • in the documents body I show some ways to use it, i.e. by adjusting code formatting
  • packages: tikz is probably on your system, while simpsons might be missing (just comment out, if you don't want these)
  • basically you write your normal LaTeX code as parameter #4
  • if you miss the dots in the TOC, that's no big deal to introduce



% ~~~ simpsonizing ... ~~~
\usepackage{tikz}       % is probably on your system
\usepackage{simpsons}   % perhaps needs to be installed

% ~~~~~~~~~~~~~~~~~~~~~~~~~~
\newcommand\student[4]{% last, first, avis, comments
\section[#1, #2: Avis=\ #3]{#1, #2}%

\textbf{Avis: #3}%

% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Master or horriffic horror secenes. 
 % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 \student   {Simpson}
    Do I really need to say more?
        \node[draw=red] {You s**k!};


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .