Long chapter title with graphics: indentation and no hyphenation












1














I was already helped to obtain the chapter title formatting that I wanted in Chapter with graphical formatting



Now I have the problem of chapters with a long title, whereby I get



example of long-title chapter with wrong formatting



with this code



documentclass{book} 

%PAGES
usepackage[
vcentering,
hcentering,
inner=16mm,
outer=16mm,
top=22.0mm,
bottom=15.0mm,
headsep=9.3mm,
headheight=5mm,
% showframe
]
{geometry} % Extended page layout customization

geometry{papersize={189mm,246mm}} % Possible dimensions of textbook pages
%usepackage[cross,a4,center]{crop} %Package to print on A4 with crop signs.
usepackage{multicol}% handling of multicolumn in documents
usepackage[toc]{multitoc}%enables table of contents with multiple columns
renewcommand*{multicolumntoc}{2}% Set two columns for the table of contents
usepackage{emptypage} % suppresses page numbers and headings on empty pages
usepackage{xcolor}[2007/01/21] % Driver-independent color extensions

%SKETCHES AND PLOTS
usepackage{tikz} % To create graphics programmatically. TikZ is build on top of PGF.
usetikzlibrary{decorations.markings,arrows,backgrounds}
usetikzlibrary{patterns}
usetikzlibrary{shapes.misc, positioning}
usetikzlibrary{calc}

usepackage{xcolor}[2007/01/21] % Driver-independent color extensions
definecolor{BlueGreen}{RGB}{7,116,159}
definecolor{LightBlue}{RGB}{185,229,251}
definecolor{LightGreen}{RGB}{203,231,211}

%FONTS
usepackage{fontspec}%LuaLaTex fonts
setmainfont[Ligatures=TeX,ItalicFont={Apollo MT Std Italic}]{Apollo MT}
usepackage{titletoc,xpatch}%
usepackage[explicit]{titlesec}% An in­ter­face to sec­tion­ing com­mands for se­lec­tion from var­i­ous ti­tle styles.

%Font families
newfontfamilyAvenir{Avenir}
newfontfamilyAvenirLight{Avenir Light}
newfontfamilyAvenirHeavy{Avenir Heavy}


%Chapters in TOC
newcommand{chaptertocfont} {fontsize{10}{12}color{red}AvenirHeavy}
newcommand{chaptertocpagefont} {fontsize{10}{12}color{red}AvenirHeavy}

%Chapters
newcommand{chapterfont} {fontsize{24}{27}color{black}AvenirLight}
newcommand{chapternrfont} {fontsize{24}{27}color{BlueGreen}AvenirHeavy}


titlecontents{chapter}% section-type
[1.5em]% <- changed
{vspace*{0.6cm}}
{chaptertocfontcontentslabel{1.5em}}% <- changed
{hspace*{-1.5em}}% <- changed
{hfillchaptertocpagefontcontentspage}

%CHAPTER HEADINGS
titlespacing{chapter}{2cm}{-0.7cm}{1.7cm} % set spacing: left, before, after

titleformat{chapter}[hang]% command to be modified
{chapterfont} %format
{hspace*{-2.7cm}
tikz [anchor=base, baseline,remember picture, overlay]
{% colorbox for the chapter number
node[
line width = 1pt,
draw=BlueGreen,
fill =LightBlue,
anchor=base,
rectangle,
text width=2cm,
align=right,
rounded rectangle,
rounded rectangle west arc=5pt,
minimum height=15mm,
inner sep=11pt
] (A)
{
chapternrfontthechapter};
draw[line width = 1pt, red] let p1=(A.south east), p2=(current page.east) in ([xshift=2.6ex]A.south east) -- +(x2,0);
}
}% label
{dimexpr2emrelax}% sep
{#1} % before-code
% after-code

begin{document}

tableofcontents

chapter{Energy Conversion Systems}

chapter[Thermodynamic Properties of \ Multicomponent Fluids]{Thermodynamic Properties of \ Multicomponent Fluids}

end{document}


I tried all the examples I could find and I cannot get it to look like
wanter result



How can I get the indentation, no hyphenation and the red ruler correct?










share|improve this question






















  • Did you notice that for the answer from @sergiokapone in the topic you included using the tcolorbox package this problem does not exist?
    – Steyn W.
    Dec 10 at 10:11


















1














I was already helped to obtain the chapter title formatting that I wanted in Chapter with graphical formatting



Now I have the problem of chapters with a long title, whereby I get



example of long-title chapter with wrong formatting



with this code



documentclass{book} 

%PAGES
usepackage[
vcentering,
hcentering,
inner=16mm,
outer=16mm,
top=22.0mm,
bottom=15.0mm,
headsep=9.3mm,
headheight=5mm,
% showframe
]
{geometry} % Extended page layout customization

geometry{papersize={189mm,246mm}} % Possible dimensions of textbook pages
%usepackage[cross,a4,center]{crop} %Package to print on A4 with crop signs.
usepackage{multicol}% handling of multicolumn in documents
usepackage[toc]{multitoc}%enables table of contents with multiple columns
renewcommand*{multicolumntoc}{2}% Set two columns for the table of contents
usepackage{emptypage} % suppresses page numbers and headings on empty pages
usepackage{xcolor}[2007/01/21] % Driver-independent color extensions

%SKETCHES AND PLOTS
usepackage{tikz} % To create graphics programmatically. TikZ is build on top of PGF.
usetikzlibrary{decorations.markings,arrows,backgrounds}
usetikzlibrary{patterns}
usetikzlibrary{shapes.misc, positioning}
usetikzlibrary{calc}

usepackage{xcolor}[2007/01/21] % Driver-independent color extensions
definecolor{BlueGreen}{RGB}{7,116,159}
definecolor{LightBlue}{RGB}{185,229,251}
definecolor{LightGreen}{RGB}{203,231,211}

%FONTS
usepackage{fontspec}%LuaLaTex fonts
setmainfont[Ligatures=TeX,ItalicFont={Apollo MT Std Italic}]{Apollo MT}
usepackage{titletoc,xpatch}%
usepackage[explicit]{titlesec}% An in­ter­face to sec­tion­ing com­mands for se­lec­tion from var­i­ous ti­tle styles.

%Font families
newfontfamilyAvenir{Avenir}
newfontfamilyAvenirLight{Avenir Light}
newfontfamilyAvenirHeavy{Avenir Heavy}


%Chapters in TOC
newcommand{chaptertocfont} {fontsize{10}{12}color{red}AvenirHeavy}
newcommand{chaptertocpagefont} {fontsize{10}{12}color{red}AvenirHeavy}

%Chapters
newcommand{chapterfont} {fontsize{24}{27}color{black}AvenirLight}
newcommand{chapternrfont} {fontsize{24}{27}color{BlueGreen}AvenirHeavy}


titlecontents{chapter}% section-type
[1.5em]% <- changed
{vspace*{0.6cm}}
{chaptertocfontcontentslabel{1.5em}}% <- changed
{hspace*{-1.5em}}% <- changed
{hfillchaptertocpagefontcontentspage}

%CHAPTER HEADINGS
titlespacing{chapter}{2cm}{-0.7cm}{1.7cm} % set spacing: left, before, after

titleformat{chapter}[hang]% command to be modified
{chapterfont} %format
{hspace*{-2.7cm}
tikz [anchor=base, baseline,remember picture, overlay]
{% colorbox for the chapter number
node[
line width = 1pt,
draw=BlueGreen,
fill =LightBlue,
anchor=base,
rectangle,
text width=2cm,
align=right,
rounded rectangle,
rounded rectangle west arc=5pt,
minimum height=15mm,
inner sep=11pt
] (A)
{
chapternrfontthechapter};
draw[line width = 1pt, red] let p1=(A.south east), p2=(current page.east) in ([xshift=2.6ex]A.south east) -- +(x2,0);
}
}% label
{dimexpr2emrelax}% sep
{#1} % before-code
% after-code

begin{document}

tableofcontents

chapter{Energy Conversion Systems}

chapter[Thermodynamic Properties of \ Multicomponent Fluids]{Thermodynamic Properties of \ Multicomponent Fluids}

end{document}


I tried all the examples I could find and I cannot get it to look like
wanter result



How can I get the indentation, no hyphenation and the red ruler correct?










share|improve this question






















  • Did you notice that for the answer from @sergiokapone in the topic you included using the tcolorbox package this problem does not exist?
    – Steyn W.
    Dec 10 at 10:11
















1












1








1







I was already helped to obtain the chapter title formatting that I wanted in Chapter with graphical formatting



Now I have the problem of chapters with a long title, whereby I get



example of long-title chapter with wrong formatting



with this code



documentclass{book} 

%PAGES
usepackage[
vcentering,
hcentering,
inner=16mm,
outer=16mm,
top=22.0mm,
bottom=15.0mm,
headsep=9.3mm,
headheight=5mm,
% showframe
]
{geometry} % Extended page layout customization

geometry{papersize={189mm,246mm}} % Possible dimensions of textbook pages
%usepackage[cross,a4,center]{crop} %Package to print on A4 with crop signs.
usepackage{multicol}% handling of multicolumn in documents
usepackage[toc]{multitoc}%enables table of contents with multiple columns
renewcommand*{multicolumntoc}{2}% Set two columns for the table of contents
usepackage{emptypage} % suppresses page numbers and headings on empty pages
usepackage{xcolor}[2007/01/21] % Driver-independent color extensions

%SKETCHES AND PLOTS
usepackage{tikz} % To create graphics programmatically. TikZ is build on top of PGF.
usetikzlibrary{decorations.markings,arrows,backgrounds}
usetikzlibrary{patterns}
usetikzlibrary{shapes.misc, positioning}
usetikzlibrary{calc}

usepackage{xcolor}[2007/01/21] % Driver-independent color extensions
definecolor{BlueGreen}{RGB}{7,116,159}
definecolor{LightBlue}{RGB}{185,229,251}
definecolor{LightGreen}{RGB}{203,231,211}

%FONTS
usepackage{fontspec}%LuaLaTex fonts
setmainfont[Ligatures=TeX,ItalicFont={Apollo MT Std Italic}]{Apollo MT}
usepackage{titletoc,xpatch}%
usepackage[explicit]{titlesec}% An in­ter­face to sec­tion­ing com­mands for se­lec­tion from var­i­ous ti­tle styles.

%Font families
newfontfamilyAvenir{Avenir}
newfontfamilyAvenirLight{Avenir Light}
newfontfamilyAvenirHeavy{Avenir Heavy}


%Chapters in TOC
newcommand{chaptertocfont} {fontsize{10}{12}color{red}AvenirHeavy}
newcommand{chaptertocpagefont} {fontsize{10}{12}color{red}AvenirHeavy}

%Chapters
newcommand{chapterfont} {fontsize{24}{27}color{black}AvenirLight}
newcommand{chapternrfont} {fontsize{24}{27}color{BlueGreen}AvenirHeavy}


titlecontents{chapter}% section-type
[1.5em]% <- changed
{vspace*{0.6cm}}
{chaptertocfontcontentslabel{1.5em}}% <- changed
{hspace*{-1.5em}}% <- changed
{hfillchaptertocpagefontcontentspage}

%CHAPTER HEADINGS
titlespacing{chapter}{2cm}{-0.7cm}{1.7cm} % set spacing: left, before, after

titleformat{chapter}[hang]% command to be modified
{chapterfont} %format
{hspace*{-2.7cm}
tikz [anchor=base, baseline,remember picture, overlay]
{% colorbox for the chapter number
node[
line width = 1pt,
draw=BlueGreen,
fill =LightBlue,
anchor=base,
rectangle,
text width=2cm,
align=right,
rounded rectangle,
rounded rectangle west arc=5pt,
minimum height=15mm,
inner sep=11pt
] (A)
{
chapternrfontthechapter};
draw[line width = 1pt, red] let p1=(A.south east), p2=(current page.east) in ([xshift=2.6ex]A.south east) -- +(x2,0);
}
}% label
{dimexpr2emrelax}% sep
{#1} % before-code
% after-code

begin{document}

tableofcontents

chapter{Energy Conversion Systems}

chapter[Thermodynamic Properties of \ Multicomponent Fluids]{Thermodynamic Properties of \ Multicomponent Fluids}

end{document}


I tried all the examples I could find and I cannot get it to look like
wanter result



How can I get the indentation, no hyphenation and the red ruler correct?










share|improve this question













I was already helped to obtain the chapter title formatting that I wanted in Chapter with graphical formatting



Now I have the problem of chapters with a long title, whereby I get



example of long-title chapter with wrong formatting



with this code



documentclass{book} 

%PAGES
usepackage[
vcentering,
hcentering,
inner=16mm,
outer=16mm,
top=22.0mm,
bottom=15.0mm,
headsep=9.3mm,
headheight=5mm,
% showframe
]
{geometry} % Extended page layout customization

geometry{papersize={189mm,246mm}} % Possible dimensions of textbook pages
%usepackage[cross,a4,center]{crop} %Package to print on A4 with crop signs.
usepackage{multicol}% handling of multicolumn in documents
usepackage[toc]{multitoc}%enables table of contents with multiple columns
renewcommand*{multicolumntoc}{2}% Set two columns for the table of contents
usepackage{emptypage} % suppresses page numbers and headings on empty pages
usepackage{xcolor}[2007/01/21] % Driver-independent color extensions

%SKETCHES AND PLOTS
usepackage{tikz} % To create graphics programmatically. TikZ is build on top of PGF.
usetikzlibrary{decorations.markings,arrows,backgrounds}
usetikzlibrary{patterns}
usetikzlibrary{shapes.misc, positioning}
usetikzlibrary{calc}

usepackage{xcolor}[2007/01/21] % Driver-independent color extensions
definecolor{BlueGreen}{RGB}{7,116,159}
definecolor{LightBlue}{RGB}{185,229,251}
definecolor{LightGreen}{RGB}{203,231,211}

%FONTS
usepackage{fontspec}%LuaLaTex fonts
setmainfont[Ligatures=TeX,ItalicFont={Apollo MT Std Italic}]{Apollo MT}
usepackage{titletoc,xpatch}%
usepackage[explicit]{titlesec}% An in­ter­face to sec­tion­ing com­mands for se­lec­tion from var­i­ous ti­tle styles.

%Font families
newfontfamilyAvenir{Avenir}
newfontfamilyAvenirLight{Avenir Light}
newfontfamilyAvenirHeavy{Avenir Heavy}


%Chapters in TOC
newcommand{chaptertocfont} {fontsize{10}{12}color{red}AvenirHeavy}
newcommand{chaptertocpagefont} {fontsize{10}{12}color{red}AvenirHeavy}

%Chapters
newcommand{chapterfont} {fontsize{24}{27}color{black}AvenirLight}
newcommand{chapternrfont} {fontsize{24}{27}color{BlueGreen}AvenirHeavy}


titlecontents{chapter}% section-type
[1.5em]% <- changed
{vspace*{0.6cm}}
{chaptertocfontcontentslabel{1.5em}}% <- changed
{hspace*{-1.5em}}% <- changed
{hfillchaptertocpagefontcontentspage}

%CHAPTER HEADINGS
titlespacing{chapter}{2cm}{-0.7cm}{1.7cm} % set spacing: left, before, after

titleformat{chapter}[hang]% command to be modified
{chapterfont} %format
{hspace*{-2.7cm}
tikz [anchor=base, baseline,remember picture, overlay]
{% colorbox for the chapter number
node[
line width = 1pt,
draw=BlueGreen,
fill =LightBlue,
anchor=base,
rectangle,
text width=2cm,
align=right,
rounded rectangle,
rounded rectangle west arc=5pt,
minimum height=15mm,
inner sep=11pt
] (A)
{
chapternrfontthechapter};
draw[line width = 1pt, red] let p1=(A.south east), p2=(current page.east) in ([xshift=2.6ex]A.south east) -- +(x2,0);
}
}% label
{dimexpr2emrelax}% sep
{#1} % before-code
% after-code

begin{document}

tableofcontents

chapter{Energy Conversion Systems}

chapter[Thermodynamic Properties of \ Multicomponent Fluids]{Thermodynamic Properties of \ Multicomponent Fluids}

end{document}


I tried all the examples I could find and I cannot get it to look like
wanter result



How can I get the indentation, no hyphenation and the red ruler correct?







graphics indentation hyphenation






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 10 at 7:31









pierocol

547




547












  • Did you notice that for the answer from @sergiokapone in the topic you included using the tcolorbox package this problem does not exist?
    – Steyn W.
    Dec 10 at 10:11




















  • Did you notice that for the answer from @sergiokapone in the topic you included using the tcolorbox package this problem does not exist?
    – Steyn W.
    Dec 10 at 10:11


















Did you notice that for the answer from @sergiokapone in the topic you included using the tcolorbox package this problem does not exist?
– Steyn W.
Dec 10 at 10:11






Did you notice that for the answer from @sergiokapone in the topic you included using the tcolorbox package this problem does not exist?
– Steyn W.
Dec 10 at 10:11












1 Answer
1






active

oldest

votes


















1














I do not have your fonts, but maybe the following helps:



documentclass{book} 
usepackage{lipsum}

usepackage[
vcentering,
hcentering,
inner=16mm,
outer=16mm,
top=22.0mm,
bottom=15.0mm,
headsep=9.3mm,
headheight=5mm,
% showframe
]{geometry} % Extended page layout customization
geometry{papersize={189mm,246mm}} % Possible dimensions of textbook pages

usepackage{fontspec}

usepackage{multicol}% handling of multicolumn in documents

usepackage{tikz} % loads also xcolor, graphicx, ...
usetikzlibrary{shapes.misc}
usetikzlibrary{calc}
definecolor{BlueGreen}{RGB}{7,116,159}
definecolor{LightBlue}{RGB}{185,229,251}
definecolor{LightGreen}{RGB}{203,231,211}

usepackage{emptypage}

usepackage{tocbasic}
addtotoclist[jobname]{toc}
renewcommand*tableofcontents{listoftoc[contentsname]{toc}}
BeforeStartingTOC[toc]{begin{multicols}{2}}
AfterStartingTOC[toc]{end{multicols}}

DeclareTOCStyleEntry[
beforeskip=.6cm plus 1pt,
entryformat=chaptertocfont,
pagenumberformat=chaptertocpagefont,
raggedentrytext=true
]{tocline}{chapter}
newcommand*{chaptertocfont}[1]{normalsizebfseriestextcolor{red}{#1}}
newcommand*{chaptertocpagefont}[1]{chaptertocfont{#1}}

usepackage[explicit]{titlesec}
titlespacing{chapter}{2cm}{-0.7cm}{1.7cm} % set spacing: left, before, after

titleformat{chapter}[hang]% command to be modified
{chapterfont} %format
{hspace*{-2.7cm}
tikz [baseline,remember picture, overlay]
{% colorbox for the chapter number
node[
line width = 1pt,
draw=BlueGreen,
fill =LightBlue,
anchor=base,
rectangle,
text width=2cm,
align=right,
rounded rectangle,
rounded rectangle west arc=5pt,
minimum height=15mm,
inner sep=11pt
] (A)
{chapternrfontthechapter};
}
}% label
{2em}% sep
{%
tikz[baseline]{%
node[
anchor=base,
align=flush left,
text height=dpstrutbox,
text width=textwidth,
inner xsep=0pt
](A){#1};
draw[
overlay,
line width = 1pt,
red
]
let p1=(A.south west), p2=(current page.east) in
([xshift=-.6ex]p1) -- +(x2,0);
}%
}% before-code
% after-code
newcommand{chapterfont}{fontsize{24}{27}selectfontcolor{black}}
newcommand{chapternrfont}{fontsize{24}{27}selectfontcolor{BlueGreen}bfseries}

begin{document}
tableofcontents
chapter{Energy Conversion Systems}
lipsum
chapter{Thermodynamic Properties of Multicomponent Fluids}
lipsum
end{document}


Result:



enter image description here



If there should be no line below of the unnumbered TOC title, you have to add



titleformat{name=chapter,numberless}[hang]
{chapterfont} %format
{}% label
{0pt}% sep
{#1}% before-code
% after-code





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',
    autoActivateHeartbeat: false,
    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%2f464077%2flong-chapter-title-with-graphics-indentation-and-no-hyphenation%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









    1














    I do not have your fonts, but maybe the following helps:



    documentclass{book} 
    usepackage{lipsum}

    usepackage[
    vcentering,
    hcentering,
    inner=16mm,
    outer=16mm,
    top=22.0mm,
    bottom=15.0mm,
    headsep=9.3mm,
    headheight=5mm,
    % showframe
    ]{geometry} % Extended page layout customization
    geometry{papersize={189mm,246mm}} % Possible dimensions of textbook pages

    usepackage{fontspec}

    usepackage{multicol}% handling of multicolumn in documents

    usepackage{tikz} % loads also xcolor, graphicx, ...
    usetikzlibrary{shapes.misc}
    usetikzlibrary{calc}
    definecolor{BlueGreen}{RGB}{7,116,159}
    definecolor{LightBlue}{RGB}{185,229,251}
    definecolor{LightGreen}{RGB}{203,231,211}

    usepackage{emptypage}

    usepackage{tocbasic}
    addtotoclist[jobname]{toc}
    renewcommand*tableofcontents{listoftoc[contentsname]{toc}}
    BeforeStartingTOC[toc]{begin{multicols}{2}}
    AfterStartingTOC[toc]{end{multicols}}

    DeclareTOCStyleEntry[
    beforeskip=.6cm plus 1pt,
    entryformat=chaptertocfont,
    pagenumberformat=chaptertocpagefont,
    raggedentrytext=true
    ]{tocline}{chapter}
    newcommand*{chaptertocfont}[1]{normalsizebfseriestextcolor{red}{#1}}
    newcommand*{chaptertocpagefont}[1]{chaptertocfont{#1}}

    usepackage[explicit]{titlesec}
    titlespacing{chapter}{2cm}{-0.7cm}{1.7cm} % set spacing: left, before, after

    titleformat{chapter}[hang]% command to be modified
    {chapterfont} %format
    {hspace*{-2.7cm}
    tikz [baseline,remember picture, overlay]
    {% colorbox for the chapter number
    node[
    line width = 1pt,
    draw=BlueGreen,
    fill =LightBlue,
    anchor=base,
    rectangle,
    text width=2cm,
    align=right,
    rounded rectangle,
    rounded rectangle west arc=5pt,
    minimum height=15mm,
    inner sep=11pt
    ] (A)
    {chapternrfontthechapter};
    }
    }% label
    {2em}% sep
    {%
    tikz[baseline]{%
    node[
    anchor=base,
    align=flush left,
    text height=dpstrutbox,
    text width=textwidth,
    inner xsep=0pt
    ](A){#1};
    draw[
    overlay,
    line width = 1pt,
    red
    ]
    let p1=(A.south west), p2=(current page.east) in
    ([xshift=-.6ex]p1) -- +(x2,0);
    }%
    }% before-code
    % after-code
    newcommand{chapterfont}{fontsize{24}{27}selectfontcolor{black}}
    newcommand{chapternrfont}{fontsize{24}{27}selectfontcolor{BlueGreen}bfseries}

    begin{document}
    tableofcontents
    chapter{Energy Conversion Systems}
    lipsum
    chapter{Thermodynamic Properties of Multicomponent Fluids}
    lipsum
    end{document}


    Result:



    enter image description here



    If there should be no line below of the unnumbered TOC title, you have to add



    titleformat{name=chapter,numberless}[hang]
    {chapterfont} %format
    {}% label
    {0pt}% sep
    {#1}% before-code
    % after-code





    share|improve this answer


























      1














      I do not have your fonts, but maybe the following helps:



      documentclass{book} 
      usepackage{lipsum}

      usepackage[
      vcentering,
      hcentering,
      inner=16mm,
      outer=16mm,
      top=22.0mm,
      bottom=15.0mm,
      headsep=9.3mm,
      headheight=5mm,
      % showframe
      ]{geometry} % Extended page layout customization
      geometry{papersize={189mm,246mm}} % Possible dimensions of textbook pages

      usepackage{fontspec}

      usepackage{multicol}% handling of multicolumn in documents

      usepackage{tikz} % loads also xcolor, graphicx, ...
      usetikzlibrary{shapes.misc}
      usetikzlibrary{calc}
      definecolor{BlueGreen}{RGB}{7,116,159}
      definecolor{LightBlue}{RGB}{185,229,251}
      definecolor{LightGreen}{RGB}{203,231,211}

      usepackage{emptypage}

      usepackage{tocbasic}
      addtotoclist[jobname]{toc}
      renewcommand*tableofcontents{listoftoc[contentsname]{toc}}
      BeforeStartingTOC[toc]{begin{multicols}{2}}
      AfterStartingTOC[toc]{end{multicols}}

      DeclareTOCStyleEntry[
      beforeskip=.6cm plus 1pt,
      entryformat=chaptertocfont,
      pagenumberformat=chaptertocpagefont,
      raggedentrytext=true
      ]{tocline}{chapter}
      newcommand*{chaptertocfont}[1]{normalsizebfseriestextcolor{red}{#1}}
      newcommand*{chaptertocpagefont}[1]{chaptertocfont{#1}}

      usepackage[explicit]{titlesec}
      titlespacing{chapter}{2cm}{-0.7cm}{1.7cm} % set spacing: left, before, after

      titleformat{chapter}[hang]% command to be modified
      {chapterfont} %format
      {hspace*{-2.7cm}
      tikz [baseline,remember picture, overlay]
      {% colorbox for the chapter number
      node[
      line width = 1pt,
      draw=BlueGreen,
      fill =LightBlue,
      anchor=base,
      rectangle,
      text width=2cm,
      align=right,
      rounded rectangle,
      rounded rectangle west arc=5pt,
      minimum height=15mm,
      inner sep=11pt
      ] (A)
      {chapternrfontthechapter};
      }
      }% label
      {2em}% sep
      {%
      tikz[baseline]{%
      node[
      anchor=base,
      align=flush left,
      text height=dpstrutbox,
      text width=textwidth,
      inner xsep=0pt
      ](A){#1};
      draw[
      overlay,
      line width = 1pt,
      red
      ]
      let p1=(A.south west), p2=(current page.east) in
      ([xshift=-.6ex]p1) -- +(x2,0);
      }%
      }% before-code
      % after-code
      newcommand{chapterfont}{fontsize{24}{27}selectfontcolor{black}}
      newcommand{chapternrfont}{fontsize{24}{27}selectfontcolor{BlueGreen}bfseries}

      begin{document}
      tableofcontents
      chapter{Energy Conversion Systems}
      lipsum
      chapter{Thermodynamic Properties of Multicomponent Fluids}
      lipsum
      end{document}


      Result:



      enter image description here



      If there should be no line below of the unnumbered TOC title, you have to add



      titleformat{name=chapter,numberless}[hang]
      {chapterfont} %format
      {}% label
      {0pt}% sep
      {#1}% before-code
      % after-code





      share|improve this answer
























        1












        1








        1






        I do not have your fonts, but maybe the following helps:



        documentclass{book} 
        usepackage{lipsum}

        usepackage[
        vcentering,
        hcentering,
        inner=16mm,
        outer=16mm,
        top=22.0mm,
        bottom=15.0mm,
        headsep=9.3mm,
        headheight=5mm,
        % showframe
        ]{geometry} % Extended page layout customization
        geometry{papersize={189mm,246mm}} % Possible dimensions of textbook pages

        usepackage{fontspec}

        usepackage{multicol}% handling of multicolumn in documents

        usepackage{tikz} % loads also xcolor, graphicx, ...
        usetikzlibrary{shapes.misc}
        usetikzlibrary{calc}
        definecolor{BlueGreen}{RGB}{7,116,159}
        definecolor{LightBlue}{RGB}{185,229,251}
        definecolor{LightGreen}{RGB}{203,231,211}

        usepackage{emptypage}

        usepackage{tocbasic}
        addtotoclist[jobname]{toc}
        renewcommand*tableofcontents{listoftoc[contentsname]{toc}}
        BeforeStartingTOC[toc]{begin{multicols}{2}}
        AfterStartingTOC[toc]{end{multicols}}

        DeclareTOCStyleEntry[
        beforeskip=.6cm plus 1pt,
        entryformat=chaptertocfont,
        pagenumberformat=chaptertocpagefont,
        raggedentrytext=true
        ]{tocline}{chapter}
        newcommand*{chaptertocfont}[1]{normalsizebfseriestextcolor{red}{#1}}
        newcommand*{chaptertocpagefont}[1]{chaptertocfont{#1}}

        usepackage[explicit]{titlesec}
        titlespacing{chapter}{2cm}{-0.7cm}{1.7cm} % set spacing: left, before, after

        titleformat{chapter}[hang]% command to be modified
        {chapterfont} %format
        {hspace*{-2.7cm}
        tikz [baseline,remember picture, overlay]
        {% colorbox for the chapter number
        node[
        line width = 1pt,
        draw=BlueGreen,
        fill =LightBlue,
        anchor=base,
        rectangle,
        text width=2cm,
        align=right,
        rounded rectangle,
        rounded rectangle west arc=5pt,
        minimum height=15mm,
        inner sep=11pt
        ] (A)
        {chapternrfontthechapter};
        }
        }% label
        {2em}% sep
        {%
        tikz[baseline]{%
        node[
        anchor=base,
        align=flush left,
        text height=dpstrutbox,
        text width=textwidth,
        inner xsep=0pt
        ](A){#1};
        draw[
        overlay,
        line width = 1pt,
        red
        ]
        let p1=(A.south west), p2=(current page.east) in
        ([xshift=-.6ex]p1) -- +(x2,0);
        }%
        }% before-code
        % after-code
        newcommand{chapterfont}{fontsize{24}{27}selectfontcolor{black}}
        newcommand{chapternrfont}{fontsize{24}{27}selectfontcolor{BlueGreen}bfseries}

        begin{document}
        tableofcontents
        chapter{Energy Conversion Systems}
        lipsum
        chapter{Thermodynamic Properties of Multicomponent Fluids}
        lipsum
        end{document}


        Result:



        enter image description here



        If there should be no line below of the unnumbered TOC title, you have to add



        titleformat{name=chapter,numberless}[hang]
        {chapterfont} %format
        {}% label
        {0pt}% sep
        {#1}% before-code
        % after-code





        share|improve this answer












        I do not have your fonts, but maybe the following helps:



        documentclass{book} 
        usepackage{lipsum}

        usepackage[
        vcentering,
        hcentering,
        inner=16mm,
        outer=16mm,
        top=22.0mm,
        bottom=15.0mm,
        headsep=9.3mm,
        headheight=5mm,
        % showframe
        ]{geometry} % Extended page layout customization
        geometry{papersize={189mm,246mm}} % Possible dimensions of textbook pages

        usepackage{fontspec}

        usepackage{multicol}% handling of multicolumn in documents

        usepackage{tikz} % loads also xcolor, graphicx, ...
        usetikzlibrary{shapes.misc}
        usetikzlibrary{calc}
        definecolor{BlueGreen}{RGB}{7,116,159}
        definecolor{LightBlue}{RGB}{185,229,251}
        definecolor{LightGreen}{RGB}{203,231,211}

        usepackage{emptypage}

        usepackage{tocbasic}
        addtotoclist[jobname]{toc}
        renewcommand*tableofcontents{listoftoc[contentsname]{toc}}
        BeforeStartingTOC[toc]{begin{multicols}{2}}
        AfterStartingTOC[toc]{end{multicols}}

        DeclareTOCStyleEntry[
        beforeskip=.6cm plus 1pt,
        entryformat=chaptertocfont,
        pagenumberformat=chaptertocpagefont,
        raggedentrytext=true
        ]{tocline}{chapter}
        newcommand*{chaptertocfont}[1]{normalsizebfseriestextcolor{red}{#1}}
        newcommand*{chaptertocpagefont}[1]{chaptertocfont{#1}}

        usepackage[explicit]{titlesec}
        titlespacing{chapter}{2cm}{-0.7cm}{1.7cm} % set spacing: left, before, after

        titleformat{chapter}[hang]% command to be modified
        {chapterfont} %format
        {hspace*{-2.7cm}
        tikz [baseline,remember picture, overlay]
        {% colorbox for the chapter number
        node[
        line width = 1pt,
        draw=BlueGreen,
        fill =LightBlue,
        anchor=base,
        rectangle,
        text width=2cm,
        align=right,
        rounded rectangle,
        rounded rectangle west arc=5pt,
        minimum height=15mm,
        inner sep=11pt
        ] (A)
        {chapternrfontthechapter};
        }
        }% label
        {2em}% sep
        {%
        tikz[baseline]{%
        node[
        anchor=base,
        align=flush left,
        text height=dpstrutbox,
        text width=textwidth,
        inner xsep=0pt
        ](A){#1};
        draw[
        overlay,
        line width = 1pt,
        red
        ]
        let p1=(A.south west), p2=(current page.east) in
        ([xshift=-.6ex]p1) -- +(x2,0);
        }%
        }% before-code
        % after-code
        newcommand{chapterfont}{fontsize{24}{27}selectfontcolor{black}}
        newcommand{chapternrfont}{fontsize{24}{27}selectfontcolor{BlueGreen}bfseries}

        begin{document}
        tableofcontents
        chapter{Energy Conversion Systems}
        lipsum
        chapter{Thermodynamic Properties of Multicomponent Fluids}
        lipsum
        end{document}


        Result:



        enter image description here



        If there should be no line below of the unnumbered TOC title, you have to add



        titleformat{name=chapter,numberless}[hang]
        {chapterfont} %format
        {}% label
        {0pt}% sep
        {#1}% before-code
        % after-code






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 10 at 13:35









        esdd

        58.4k34586




        58.4k34586






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f464077%2flong-chapter-title-with-graphics-indentation-and-no-hyphenation%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

            How to change which sound is reproduced for terminal bell?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Can I use Tabulator js library in my java Spring + Thymeleaf project?