Linespread space independent

line-spacingsetspace

I'm trying to set linespread independent of my content. But I don't know how.
I need single space between Professor 1 & Professor 2

Here is MWE.

\documentclass[a4paper,12pt]{report}
\usepackage{geometry}
\geometry{margin=2.5cm}
\usepackage{kantlipsum}
\linespread{1.2}


%-------------Title Chap & Section------------------------
\usepackage{titlesec}

\titleformat{\section}[block]{\filleft\bfseries\Large}{\thesection.}{0.5em}{}
\titleformat{\subsection}[block]{\filleft\bfseries\large}{\thesection.}{0.5em}{}
\titleformat{\subsubsection}[block]{\filleft\bfseries\large}{\thesection.}{0.5em}{}


\titleformat
{\chapter}                       % command
[display]                        % shape
{\Huge\bfseries\raggedleft}      % format
{}                               % label
{22pt}                           % separation between label and chapter-title
{\Huge}[\vspace{1ex}]            % before-code

\titleformat
{\section}                       % command
[display]                        % shape
{\Huge\bfseries\raggedleft}      % format
{}                               % label
{25pt}                           % separation between label and chapter-title
{\Huge}[\vspace{2ex}]            % before-code

% \titleformat{\section}{\bfseries\Large\raggedleft}{}{0.5em}{}
\titleformat{\subsection}{\bfseries\normalsize\raggedleft}{}{0.5em}{}
\titleformat{\subsubsection}{\bfseries\normalsize\raggedleft}{}{0.5em}{}

\titlespacing*{\chapter}{0pt}{\baselineskip}{\baselineskip}
\titlespacing*{\section}{0pt}{4ex}{1ex}
\titlespacing*{\subsection}{0pt}{0pt}{1ex}
\titlespacing*{\subsubsection}{0pt}{0pt}{6ex}

\newcommand{\autor}[1]{\textbf{\Large {#1}}\medskip\par}
\newcommand{\scoala}[1]{\textit{\normalsize{#1}}\medskip\par}
\newcommand{\prof}[1]{\textit{\small prof. coord. {#1}}\\ \smallskip}


\begin{document}
    \chapter{Chapter 1}
    \begin{flushright}
        \autor{Author 1}
        \scoala{Name of School}
        \prof{Professor 1}
        \prof{Professor 2}
    \end{flushright}
\kant[1]
\end{document}

Best Answer

I suggest to modify the \prof command to accept a full list of names separated by \\.

\newcommand{\prof}[1]{%
  \par\begingroup\linespread{1}\small\itshape
  \begin{tabular}[t]{@{}r@{}}#1\end{tabular}%
  \par\endgroup\smallskip
}

The code for the document would be

\begin{document}
    \chapter{Chapter 1}
    \begin{flushright}
        \autor{Author 1}
        \scoala{Name of School}
        \prof{Professor 1 \\ Professor 2}
    \end{flushright}
\kant[1]
\end{document}

enter image description here

You might prefer a key-value approach, that has the advantage of not requiring a particular order in which the keys are given; however the order in which multiple prof keys appear will be respected.

\documentclass[a4paper,12pt]{report}
\usepackage{geometry}
\usepackage{titlesec}

\usepackage{kantlipsum}

% page setup
\geometry{margin=2.5cm}
\linespread{1.2}


%-------------Title Chap & Section------------------------

\titleformat{\section}[block]{\filleft\bfseries\Large}{\thesection.}{0.5em}{}
\titleformat{\subsection}[block]{\filleft\bfseries\large}{\thesection.}{0.5em}{}
\titleformat{\subsubsection}[block]{\filleft\bfseries\large}{\thesection.}{0.5em}{}


\titleformat
{\chapter}                       % command
[display]                        % shape
{\Huge\bfseries\raggedleft}      % format
{}                               % label
{22pt}                           % separation between label and chapter-title
{\Huge}[\vspace{1ex}]            % before-code

\titleformat
{\section}                       % command
[display]                        % shape
{\Huge\bfseries\raggedleft}      % format
{}                               % label
{25pt}                           % separation between label and chapter-title
{\Huge}[\vspace{2ex}]            % before-code

% \titleformat{\section}{\bfseries\Large\raggedleft}{}{0.5em}{}
\titleformat{\subsection}{\bfseries\normalsize\raggedleft}{}{0.5em}{}
\titleformat{\subsubsection}{\bfseries\normalsize\raggedleft}{}{0.5em}{}

\titlespacing*{\chapter}{0pt}{\baselineskip}{\baselineskip}
\titlespacing*{\section}{0pt}{4ex}{1ex}
\titlespacing*{\subsection}{0pt}{0pt}{1ex}
\titlespacing*{\subsubsection}{0pt}{0pt}{6ex}

\ExplSyntaxOn

\NewDocumentCommand{\chapterdata}{m}
 {
  \begin{flushright}
  \keys_set:nn { mafsi/chapterdata } { #1 }
  \mafsi_chapterdata:
  \end{flushright}
 }

\keys_define:nn { mafsi/chapterdata }
 {
  autor  .tl_set:N = \l_mafsi_chapterdata_autor_tl,
  scoala .tl_set:N = \l_mafsi_chapterdata_scoala_tl,
  prof   .code:n = \seq_put_right:Nn \l_mafsi_chapterdata_prof_seq { #1 },
 }
\seq_new:N \l_mafsi_chapterdata_prof_seq

\cs_new:Nn \mafsi_chapterdata:
 {
  \textbf{\Large\l_mafsi_chapterdata_autor_tl}
  \par\medskip
  \textit{\normalsize\l_mafsi_chapterdata_scoala_tl}
  \par\medskip
  \linespread{1}\small\itshape
  \seq_use:Nn \l_mafsi_chapterdata_prof_seq { \\ }
 }

\ExplSyntaxOff


\begin{document}

\chapter{Chapter 1}
\chapterdata{
  autor=Author 1,
  scoala=Name of School,
  prof=Professor 1,
  prof=Professor 2,
}

\kant[1]

\end{document}

You'd get the same output with

\chapterdata{
  prof=Professor 1,
  prof=Professor 2,
  autor=Author 1,
  scoala=Name of School,
}

or variations thereon.

Related Question