Edited book: Multiple authors in one chapter and Table of contents for the same











up vote
2
down vote

favorite












I want to include the author name before the chapter title. I am using the following:



documentclass{book}
usepackage{titlesec}
usepackage{titletoc}
usepackage{lipsum}% just to generate some text

makeatletter
newcommand*l@authors{@dottedtocline{1}{0pt}{0pt}}
makeatother
newcommandchapaut[1]{%
addcontentsline{toc}{authors}{#1}%
{bfseries#1}vskip35pt}

titleformat{chapter}[display]
{normalfonthugebfseries}{}{20pt}{Huge}[addvspace{5pt}]
titlespacing*{chapter}
{0pt}{10pt}{0pt}
titlecontents{chapter}
[0pt]{addvspace{10pt}}{bfseries}{bfseries}{}

begin{document}
tableofcontents

chapter{Test chapter one}
chapaut{The name of the first author, The name of second author and The name of the third author}
lipsum[1-20]

chapter{Test chapter two}
chapaut{The First author and The second author}
lipsum[1-20]

end{document}


I want to change chapter with chapaut, so it will look like:



enter image description here



Also, in the table of contents:



enter image description here










share|improve this question
























  • drives me nuts, not sure want you mean. Can you please show me a code example
    – mvp285286
    May 29 '16 at 7:18










  • Is the problem resolved?
    – Runar
    May 29 '16 at 20:51










  • thank you for your example. But my problem isn't solved yet. Your code is good, but very complex :-) Is it possible to change my code, I just want to change the chapter with the author name like the img above
    – mvp285286
    May 30 '16 at 14:30












  • I simplified the code, removed some unused packages and some other code, and added a lot of comments to make sense of the code. Does it help?
    – Runar
    May 30 '16 at 20:55












  • awesome! thx, it works fine
    – mvp285286
    May 31 '16 at 9:49















up vote
2
down vote

favorite












I want to include the author name before the chapter title. I am using the following:



documentclass{book}
usepackage{titlesec}
usepackage{titletoc}
usepackage{lipsum}% just to generate some text

makeatletter
newcommand*l@authors{@dottedtocline{1}{0pt}{0pt}}
makeatother
newcommandchapaut[1]{%
addcontentsline{toc}{authors}{#1}%
{bfseries#1}vskip35pt}

titleformat{chapter}[display]
{normalfonthugebfseries}{}{20pt}{Huge}[addvspace{5pt}]
titlespacing*{chapter}
{0pt}{10pt}{0pt}
titlecontents{chapter}
[0pt]{addvspace{10pt}}{bfseries}{bfseries}{}

begin{document}
tableofcontents

chapter{Test chapter one}
chapaut{The name of the first author, The name of second author and The name of the third author}
lipsum[1-20]

chapter{Test chapter two}
chapaut{The First author and The second author}
lipsum[1-20]

end{document}


I want to change chapter with chapaut, so it will look like:



enter image description here



Also, in the table of contents:



enter image description here










share|improve this question
























  • drives me nuts, not sure want you mean. Can you please show me a code example
    – mvp285286
    May 29 '16 at 7:18










  • Is the problem resolved?
    – Runar
    May 29 '16 at 20:51










  • thank you for your example. But my problem isn't solved yet. Your code is good, but very complex :-) Is it possible to change my code, I just want to change the chapter with the author name like the img above
    – mvp285286
    May 30 '16 at 14:30












  • I simplified the code, removed some unused packages and some other code, and added a lot of comments to make sense of the code. Does it help?
    – Runar
    May 30 '16 at 20:55












  • awesome! thx, it works fine
    – mvp285286
    May 31 '16 at 9:49













up vote
2
down vote

favorite









up vote
2
down vote

favorite











I want to include the author name before the chapter title. I am using the following:



documentclass{book}
usepackage{titlesec}
usepackage{titletoc}
usepackage{lipsum}% just to generate some text

makeatletter
newcommand*l@authors{@dottedtocline{1}{0pt}{0pt}}
makeatother
newcommandchapaut[1]{%
addcontentsline{toc}{authors}{#1}%
{bfseries#1}vskip35pt}

titleformat{chapter}[display]
{normalfonthugebfseries}{}{20pt}{Huge}[addvspace{5pt}]
titlespacing*{chapter}
{0pt}{10pt}{0pt}
titlecontents{chapter}
[0pt]{addvspace{10pt}}{bfseries}{bfseries}{}

begin{document}
tableofcontents

chapter{Test chapter one}
chapaut{The name of the first author, The name of second author and The name of the third author}
lipsum[1-20]

chapter{Test chapter two}
chapaut{The First author and The second author}
lipsum[1-20]

end{document}


I want to change chapter with chapaut, so it will look like:



enter image description here



Also, in the table of contents:



enter image description here










share|improve this question















I want to include the author name before the chapter title. I am using the following:



documentclass{book}
usepackage{titlesec}
usepackage{titletoc}
usepackage{lipsum}% just to generate some text

makeatletter
newcommand*l@authors{@dottedtocline{1}{0pt}{0pt}}
makeatother
newcommandchapaut[1]{%
addcontentsline{toc}{authors}{#1}%
{bfseries#1}vskip35pt}

titleformat{chapter}[display]
{normalfonthugebfseries}{}{20pt}{Huge}[addvspace{5pt}]
titlespacing*{chapter}
{0pt}{10pt}{0pt}
titlecontents{chapter}
[0pt]{addvspace{10pt}}{bfseries}{bfseries}{}

begin{document}
tableofcontents

chapter{Test chapter one}
chapaut{The name of the first author, The name of second author and The name of the third author}
lipsum[1-20]

chapter{Test chapter two}
chapaut{The First author and The second author}
lipsum[1-20]

end{document}


I want to change chapter with chapaut, so it will look like:



enter image description here



Also, in the table of contents:



enter image description here







table-of-contents chapters author-number tocstyle authorindex






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago









Wings

289




289










asked May 29 '16 at 6:51









mvp285286

1398




1398












  • drives me nuts, not sure want you mean. Can you please show me a code example
    – mvp285286
    May 29 '16 at 7:18










  • Is the problem resolved?
    – Runar
    May 29 '16 at 20:51










  • thank you for your example. But my problem isn't solved yet. Your code is good, but very complex :-) Is it possible to change my code, I just want to change the chapter with the author name like the img above
    – mvp285286
    May 30 '16 at 14:30












  • I simplified the code, removed some unused packages and some other code, and added a lot of comments to make sense of the code. Does it help?
    – Runar
    May 30 '16 at 20:55












  • awesome! thx, it works fine
    – mvp285286
    May 31 '16 at 9:49


















  • drives me nuts, not sure want you mean. Can you please show me a code example
    – mvp285286
    May 29 '16 at 7:18










  • Is the problem resolved?
    – Runar
    May 29 '16 at 20:51










  • thank you for your example. But my problem isn't solved yet. Your code is good, but very complex :-) Is it possible to change my code, I just want to change the chapter with the author name like the img above
    – mvp285286
    May 30 '16 at 14:30












  • I simplified the code, removed some unused packages and some other code, and added a lot of comments to make sense of the code. Does it help?
    – Runar
    May 30 '16 at 20:55












  • awesome! thx, it works fine
    – mvp285286
    May 31 '16 at 9:49
















drives me nuts, not sure want you mean. Can you please show me a code example
– mvp285286
May 29 '16 at 7:18




drives me nuts, not sure want you mean. Can you please show me a code example
– mvp285286
May 29 '16 at 7:18












Is the problem resolved?
– Runar
May 29 '16 at 20:51




Is the problem resolved?
– Runar
May 29 '16 at 20:51












thank you for your example. But my problem isn't solved yet. Your code is good, but very complex :-) Is it possible to change my code, I just want to change the chapter with the author name like the img above
– mvp285286
May 30 '16 at 14:30






thank you for your example. But my problem isn't solved yet. Your code is good, but very complex :-) Is it possible to change my code, I just want to change the chapter with the author name like the img above
– mvp285286
May 30 '16 at 14:30














I simplified the code, removed some unused packages and some other code, and added a lot of comments to make sense of the code. Does it help?
– Runar
May 30 '16 at 20:55






I simplified the code, removed some unused packages and some other code, and added a lot of comments to make sense of the code. Does it help?
– Runar
May 30 '16 at 20:55














awesome! thx, it works fine
– mvp285286
May 31 '16 at 9:49




awesome! thx, it works fine
– mvp285286
May 31 '16 at 9:49










1 Answer
1






active

oldest

votes

















up vote
5
down vote



accepted










if I understand you correctly, you want to achieve two things:



In the Tabel of Contents, you would like the author(s) of that chapter to be listed before the title of the chapter.



When the chapter is printed, you would also here, like to have the author(s) before the chapter title.



I think this might help, but I do believe there is a better way to do it, than this, especially for the ToC.



One other way to print the authors on top of the chaptertitle in the text, might be to change the definition of chapter, but sometimes changing the definition of certain commands might have unforeseen sideeffects, so only do that if you know what you are doing. This question might be of interest: Start new chapter on same page.



EDIT: Really long chaptertitles, spanning multiple lines in the toc, will now be indentet on every line, instead of only the first.



documentclass{book}
usepackage{titletoc}
usepackage{lipsum}% just to generate some text

% This part changes how chapters are displayed in the Table of COntents
titlecontents{chapter}
[0pt]% Left margin, optional
{}% Code insertet above
{bfseries}% Numbered-entryformat
{bfseries}% Numberless-format
{contentspagevskip1.5ex} %Below code, here: add dotfill and pagenumber for entry, and some vertical space between entries

% Custom command to keep the author on the same page of chaptertitle, and above it.
newcommand{chapterAndAuthor}[2]{%
% Takes the following input
% #1: Author
% #2: Chaptertitle
clearpage%
% Minipage to keep the author and chaptertitle on same page
noindentbegin{minipage}{textwidth}
% Set the author style
{bfseries#1}
% Bring the chaptertitle a bit closer to the authrotitle
vspace{-3baselineskip}
% Add an entry to the Table of Contents, with the name of the author in italics and the chapter title
addcontentsline{toc}{chapter}{{normalfontitshape #1}vspace{1ex}newline%
%To make long chapter titles spanning multiple lines indent on each line, a parbox is created. This is siimply a box holding a wrapped paragraph at a certain length. Also, we need to move the dotfill here.
hspace*{1em}protect{parbox[b]{textwidth}{#2 dotfill}}}
% Print the chapter
chapter*{#2}
end{minipage}
}

begin{document}
tableofcontents

clearpage

chapterAndAuthor{The name of the first author, The name of second author and The name of the third author}{Test Chapter One is really long, and I wouldn't really bother to read it as I am falling asleep}

lipsum[1-20]

chapterAndAuthor{John Doe}{Test Chapter Two}
lipsum[1-20]

end{document}


enter image description hereChapter title






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f312046%2fedited-book-multiple-authors-in-one-chapter-and-table-of-contents-for-the-same%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    5
    down vote



    accepted










    if I understand you correctly, you want to achieve two things:



    In the Tabel of Contents, you would like the author(s) of that chapter to be listed before the title of the chapter.



    When the chapter is printed, you would also here, like to have the author(s) before the chapter title.



    I think this might help, but I do believe there is a better way to do it, than this, especially for the ToC.



    One other way to print the authors on top of the chaptertitle in the text, might be to change the definition of chapter, but sometimes changing the definition of certain commands might have unforeseen sideeffects, so only do that if you know what you are doing. This question might be of interest: Start new chapter on same page.



    EDIT: Really long chaptertitles, spanning multiple lines in the toc, will now be indentet on every line, instead of only the first.



    documentclass{book}
    usepackage{titletoc}
    usepackage{lipsum}% just to generate some text

    % This part changes how chapters are displayed in the Table of COntents
    titlecontents{chapter}
    [0pt]% Left margin, optional
    {}% Code insertet above
    {bfseries}% Numbered-entryformat
    {bfseries}% Numberless-format
    {contentspagevskip1.5ex} %Below code, here: add dotfill and pagenumber for entry, and some vertical space between entries

    % Custom command to keep the author on the same page of chaptertitle, and above it.
    newcommand{chapterAndAuthor}[2]{%
    % Takes the following input
    % #1: Author
    % #2: Chaptertitle
    clearpage%
    % Minipage to keep the author and chaptertitle on same page
    noindentbegin{minipage}{textwidth}
    % Set the author style
    {bfseries#1}
    % Bring the chaptertitle a bit closer to the authrotitle
    vspace{-3baselineskip}
    % Add an entry to the Table of Contents, with the name of the author in italics and the chapter title
    addcontentsline{toc}{chapter}{{normalfontitshape #1}vspace{1ex}newline%
    %To make long chapter titles spanning multiple lines indent on each line, a parbox is created. This is siimply a box holding a wrapped paragraph at a certain length. Also, we need to move the dotfill here.
    hspace*{1em}protect{parbox[b]{textwidth}{#2 dotfill}}}
    % Print the chapter
    chapter*{#2}
    end{minipage}
    }

    begin{document}
    tableofcontents

    clearpage

    chapterAndAuthor{The name of the first author, The name of second author and The name of the third author}{Test Chapter One is really long, and I wouldn't really bother to read it as I am falling asleep}

    lipsum[1-20]

    chapterAndAuthor{John Doe}{Test Chapter Two}
    lipsum[1-20]

    end{document}


    enter image description hereChapter title






    share|improve this answer



























      up vote
      5
      down vote



      accepted










      if I understand you correctly, you want to achieve two things:



      In the Tabel of Contents, you would like the author(s) of that chapter to be listed before the title of the chapter.



      When the chapter is printed, you would also here, like to have the author(s) before the chapter title.



      I think this might help, but I do believe there is a better way to do it, than this, especially for the ToC.



      One other way to print the authors on top of the chaptertitle in the text, might be to change the definition of chapter, but sometimes changing the definition of certain commands might have unforeseen sideeffects, so only do that if you know what you are doing. This question might be of interest: Start new chapter on same page.



      EDIT: Really long chaptertitles, spanning multiple lines in the toc, will now be indentet on every line, instead of only the first.



      documentclass{book}
      usepackage{titletoc}
      usepackage{lipsum}% just to generate some text

      % This part changes how chapters are displayed in the Table of COntents
      titlecontents{chapter}
      [0pt]% Left margin, optional
      {}% Code insertet above
      {bfseries}% Numbered-entryformat
      {bfseries}% Numberless-format
      {contentspagevskip1.5ex} %Below code, here: add dotfill and pagenumber for entry, and some vertical space between entries

      % Custom command to keep the author on the same page of chaptertitle, and above it.
      newcommand{chapterAndAuthor}[2]{%
      % Takes the following input
      % #1: Author
      % #2: Chaptertitle
      clearpage%
      % Minipage to keep the author and chaptertitle on same page
      noindentbegin{minipage}{textwidth}
      % Set the author style
      {bfseries#1}
      % Bring the chaptertitle a bit closer to the authrotitle
      vspace{-3baselineskip}
      % Add an entry to the Table of Contents, with the name of the author in italics and the chapter title
      addcontentsline{toc}{chapter}{{normalfontitshape #1}vspace{1ex}newline%
      %To make long chapter titles spanning multiple lines indent on each line, a parbox is created. This is siimply a box holding a wrapped paragraph at a certain length. Also, we need to move the dotfill here.
      hspace*{1em}protect{parbox[b]{textwidth}{#2 dotfill}}}
      % Print the chapter
      chapter*{#2}
      end{minipage}
      }

      begin{document}
      tableofcontents

      clearpage

      chapterAndAuthor{The name of the first author, The name of second author and The name of the third author}{Test Chapter One is really long, and I wouldn't really bother to read it as I am falling asleep}

      lipsum[1-20]

      chapterAndAuthor{John Doe}{Test Chapter Two}
      lipsum[1-20]

      end{document}


      enter image description hereChapter title






      share|improve this answer

























        up vote
        5
        down vote



        accepted







        up vote
        5
        down vote



        accepted






        if I understand you correctly, you want to achieve two things:



        In the Tabel of Contents, you would like the author(s) of that chapter to be listed before the title of the chapter.



        When the chapter is printed, you would also here, like to have the author(s) before the chapter title.



        I think this might help, but I do believe there is a better way to do it, than this, especially for the ToC.



        One other way to print the authors on top of the chaptertitle in the text, might be to change the definition of chapter, but sometimes changing the definition of certain commands might have unforeseen sideeffects, so only do that if you know what you are doing. This question might be of interest: Start new chapter on same page.



        EDIT: Really long chaptertitles, spanning multiple lines in the toc, will now be indentet on every line, instead of only the first.



        documentclass{book}
        usepackage{titletoc}
        usepackage{lipsum}% just to generate some text

        % This part changes how chapters are displayed in the Table of COntents
        titlecontents{chapter}
        [0pt]% Left margin, optional
        {}% Code insertet above
        {bfseries}% Numbered-entryformat
        {bfseries}% Numberless-format
        {contentspagevskip1.5ex} %Below code, here: add dotfill and pagenumber for entry, and some vertical space between entries

        % Custom command to keep the author on the same page of chaptertitle, and above it.
        newcommand{chapterAndAuthor}[2]{%
        % Takes the following input
        % #1: Author
        % #2: Chaptertitle
        clearpage%
        % Minipage to keep the author and chaptertitle on same page
        noindentbegin{minipage}{textwidth}
        % Set the author style
        {bfseries#1}
        % Bring the chaptertitle a bit closer to the authrotitle
        vspace{-3baselineskip}
        % Add an entry to the Table of Contents, with the name of the author in italics and the chapter title
        addcontentsline{toc}{chapter}{{normalfontitshape #1}vspace{1ex}newline%
        %To make long chapter titles spanning multiple lines indent on each line, a parbox is created. This is siimply a box holding a wrapped paragraph at a certain length. Also, we need to move the dotfill here.
        hspace*{1em}protect{parbox[b]{textwidth}{#2 dotfill}}}
        % Print the chapter
        chapter*{#2}
        end{minipage}
        }

        begin{document}
        tableofcontents

        clearpage

        chapterAndAuthor{The name of the first author, The name of second author and The name of the third author}{Test Chapter One is really long, and I wouldn't really bother to read it as I am falling asleep}

        lipsum[1-20]

        chapterAndAuthor{John Doe}{Test Chapter Two}
        lipsum[1-20]

        end{document}


        enter image description hereChapter title






        share|improve this answer














        if I understand you correctly, you want to achieve two things:



        In the Tabel of Contents, you would like the author(s) of that chapter to be listed before the title of the chapter.



        When the chapter is printed, you would also here, like to have the author(s) before the chapter title.



        I think this might help, but I do believe there is a better way to do it, than this, especially for the ToC.



        One other way to print the authors on top of the chaptertitle in the text, might be to change the definition of chapter, but sometimes changing the definition of certain commands might have unforeseen sideeffects, so only do that if you know what you are doing. This question might be of interest: Start new chapter on same page.



        EDIT: Really long chaptertitles, spanning multiple lines in the toc, will now be indentet on every line, instead of only the first.



        documentclass{book}
        usepackage{titletoc}
        usepackage{lipsum}% just to generate some text

        % This part changes how chapters are displayed in the Table of COntents
        titlecontents{chapter}
        [0pt]% Left margin, optional
        {}% Code insertet above
        {bfseries}% Numbered-entryformat
        {bfseries}% Numberless-format
        {contentspagevskip1.5ex} %Below code, here: add dotfill and pagenumber for entry, and some vertical space between entries

        % Custom command to keep the author on the same page of chaptertitle, and above it.
        newcommand{chapterAndAuthor}[2]{%
        % Takes the following input
        % #1: Author
        % #2: Chaptertitle
        clearpage%
        % Minipage to keep the author and chaptertitle on same page
        noindentbegin{minipage}{textwidth}
        % Set the author style
        {bfseries#1}
        % Bring the chaptertitle a bit closer to the authrotitle
        vspace{-3baselineskip}
        % Add an entry to the Table of Contents, with the name of the author in italics and the chapter title
        addcontentsline{toc}{chapter}{{normalfontitshape #1}vspace{1ex}newline%
        %To make long chapter titles spanning multiple lines indent on each line, a parbox is created. This is siimply a box holding a wrapped paragraph at a certain length. Also, we need to move the dotfill here.
        hspace*{1em}protect{parbox[b]{textwidth}{#2 dotfill}}}
        % Print the chapter
        chapter*{#2}
        end{minipage}
        }

        begin{document}
        tableofcontents

        clearpage

        chapterAndAuthor{The name of the first author, The name of second author and The name of the third author}{Test Chapter One is really long, and I wouldn't really bother to read it as I am falling asleep}

        lipsum[1-20]

        chapterAndAuthor{John Doe}{Test Chapter Two}
        lipsum[1-20]

        end{document}


        enter image description hereChapter title







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 13 '17 at 12:34









        Community

        1




        1










        answered May 29 '16 at 9:16









        Runar

        5,098730




        5,098730






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f312046%2fedited-book-multiple-authors-in-one-chapter-and-table-of-contents-for-the-same%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Accessing regular linux commands in Huawei's Dopra Linux

            Can't connect RFCOMM socket: Host is down

            Kernel panic - not syncing: Fatal Exception in Interrupt