Chapter with graphical formatting











up vote
6
down vote

favorite












I am formatting a book and I am using LuaLaTex. I am trying to obtain the following formatting for the chapters,
reproduction of the chapter number and title



The following code correctly generates the chapter title



usepackage{titlesec}

%Chapter heading
newfontfamilychapterfont[Color=black]{Avenir Light}% set font

titlespacing{chapter}% {left}{before}{after}[right]
{50pt}%left
{3ex plus 2ex}%before
{1.7cm}%after

titleformat{chapter}% command to be modified
{fontsize{24}{27}bfseriesscshapechapterfont} %format
{thechapter.}% label
{1em}% sep
{} % before-code
[{color{red}titlerule[1pt]}] % after-code


but I cannot find a way to make the graphical chapter number, and also to extend the red rule to the right page border. Any help would be much appreciated. Thank you in advance.










share|improve this question




























    up vote
    6
    down vote

    favorite












    I am formatting a book and I am using LuaLaTex. I am trying to obtain the following formatting for the chapters,
    reproduction of the chapter number and title



    The following code correctly generates the chapter title



    usepackage{titlesec}

    %Chapter heading
    newfontfamilychapterfont[Color=black]{Avenir Light}% set font

    titlespacing{chapter}% {left}{before}{after}[right]
    {50pt}%left
    {3ex plus 2ex}%before
    {1.7cm}%after

    titleformat{chapter}% command to be modified
    {fontsize{24}{27}bfseriesscshapechapterfont} %format
    {thechapter.}% label
    {1em}% sep
    {} % before-code
    [{color{red}titlerule[1pt]}] % after-code


    but I cannot find a way to make the graphical chapter number, and also to extend the red rule to the right page border. Any help would be much appreciated. Thank you in advance.










    share|improve this question


























      up vote
      6
      down vote

      favorite









      up vote
      6
      down vote

      favorite











      I am formatting a book and I am using LuaLaTex. I am trying to obtain the following formatting for the chapters,
      reproduction of the chapter number and title



      The following code correctly generates the chapter title



      usepackage{titlesec}

      %Chapter heading
      newfontfamilychapterfont[Color=black]{Avenir Light}% set font

      titlespacing{chapter}% {left}{before}{after}[right]
      {50pt}%left
      {3ex plus 2ex}%before
      {1.7cm}%after

      titleformat{chapter}% command to be modified
      {fontsize{24}{27}bfseriesscshapechapterfont} %format
      {thechapter.}% label
      {1em}% sep
      {} % before-code
      [{color{red}titlerule[1pt]}] % after-code


      but I cannot find a way to make the graphical chapter number, and also to extend the red rule to the right page border. Any help would be much appreciated. Thank you in advance.










      share|improve this question















      I am formatting a book and I am using LuaLaTex. I am trying to obtain the following formatting for the chapters,
      reproduction of the chapter number and title



      The following code correctly generates the chapter title



      usepackage{titlesec}

      %Chapter heading
      newfontfamilychapterfont[Color=black]{Avenir Light}% set font

      titlespacing{chapter}% {left}{before}{after}[right]
      {50pt}%left
      {3ex plus 2ex}%before
      {1.7cm}%after

      titleformat{chapter}% command to be modified
      {fontsize{24}{27}bfseriesscshapechapterfont} %format
      {thechapter.}% label
      {1em}% sep
      {} % before-code
      [{color{red}titlerule[1pt]}] % after-code


      but I cannot find a way to make the graphical chapter number, and also to extend the red rule to the right page border. Any help would be much appreciated. Thank you in advance.







      graphics numbering chapters titlesec






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 1 at 15:26









      sergiokapone

      2,417926




      2,417926










      asked Dec 1 at 13:48









      pierocol

      546




      546






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          6
          down vote



          accepted










          A solution based on tcolorbox package





          % !TeX program = lualatex                                   
          % !TeX encoding = utf8
          documentclass[14pt]{book}
          usepackage{fontspec}
          usepackage[svgnames]{xcolor}
          usepackage{titlesec}
          usepackage{lipsum}
          usepackage[many]{tcolorbox}
          usepackage[
          a4paper,
          left=2cm,
          right=2cm,
          top=2.5cm,
          bottom=2cm,
          ]{geometry}

          newtcbox{mychapternum}{enhanced,nobeforeafter,tcbox raise base,boxrule=1pt,top=0mm,bottom=0mm,
          colframe=cyan,coltext=cyan,colback=cyan!10!white, halign = right,
          width=50pt,arc=7mm, sharp corners=west, boxsep=4mm,
          overlay={draw[thick] ([yshift=3ex]frame.north west) -- ([yshift=-3ex]frame.south west);

          }
          }

          %Chapter heading
          %newfontfamilychapterfont[Color=black]{Avenir Light}% set font
          titlespacing{chapter}% {left}{before}{after}[right]
          {60pt}%left
          {1ex plus 2ex}%before
          {1.7cm}%after

          titleformat{chapter}% command to be modified
          {fontsize{24}{27}bfseriesscshape} %format
          {hspace*{-70pt}
          mychapternum{thechapter}
          }% label
          {0em}% sep
          {} % before-code
          [{color{red}
          begingroup
          setlength{titlewidth}{textwidth}
          titleline*{titlerule[1pt]}
          endgroup
          }] % after-code

          begin{document}


          chapter{My title}

          lipsum[20-30]

          chapter{My title}

          lipsum[20-30]
          end{document}


          enter image description here



          A solution based on TikZ package. This solution more flexible for adjustemets.





          % !TeX program = lualatex                                   
          % !TeX encoding = utf8
          documentclass[14pt]{book}
          usepackage{fontspec}
          usepackage[svgnames]{xcolor}
          usepackage{titlesec}
          usepackage{lipsum}
          usepackage[many]{tcolorbox}
          usetikzlibrary{shapes.misc, positioning}
          usetikzlibrary{calc}
          usepackage[
          a4paper,
          left=2cm,
          right=2cm,
          top=2.5cm,
          bottom=2cm,
          ]{geometry}
          %Chapter heading
          %newfontfamilychapterfont[Color=black]{Avenir Light}% set font
          titlespacing{chapter}% {left}{before}{after}[right]
          {2cm}%left
          {2ex}%before
          {1.7cm}%after

          titleformat{chapter}% command to be modified
          {Hugebfseriesscshape} %format
          {hspace*{-1cm}
          tikz [anchor=base, baseline,remember picture, overlay]{%
          node[line width = 2pt, draw=cyan, fill =cyan!10, anchor=base, rectangle, text width=2cm, align=right, rounded rectangle,rounded rectangle west arc=5pt, minimum height=4ex,
          inner sep=11pt] (A)
          {color{cyan}thechapter};
          draw[line width = 2.5pt] ([yshift=3ex]A.north west) -- ([yshift=-3ex]A.south west);
          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
          {} % before-code
          % after-code

          begin{document}
          chapter{My title}
          lipsum[20-30]
          addtocounter{chapter}{20}
          chapter{My title}
          lipsum[20-30]
          end{document}


          enter image description here






          share|improve this answer























          • Wow! Spectacular! Thanks a whole lot!!
            – pierocol
            Dec 1 at 14:52












          • Would you also be able to tell me how I can extend the red rule to the right page margin instead that to the right of textwidth?
            – pierocol
            Dec 1 at 15:03








          • 1




            @pierocol instead {color{red}titlerule[1pt]} put {color{red}rule{dimexpr5pt+textwidthrelax}{0.2pt}}
            – sergiokapone
            Dec 1 at 15:16






          • 1




            @pierocol I had changed code.
            – sergiokapone
            Dec 1 at 15:52








          • 1




            @pierocol I had added another solution.
            – sergiokapone
            Dec 1 at 20:29











          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%2f462686%2fchapter-with-graphical-formatting%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
          6
          down vote



          accepted










          A solution based on tcolorbox package





          % !TeX program = lualatex                                   
          % !TeX encoding = utf8
          documentclass[14pt]{book}
          usepackage{fontspec}
          usepackage[svgnames]{xcolor}
          usepackage{titlesec}
          usepackage{lipsum}
          usepackage[many]{tcolorbox}
          usepackage[
          a4paper,
          left=2cm,
          right=2cm,
          top=2.5cm,
          bottom=2cm,
          ]{geometry}

          newtcbox{mychapternum}{enhanced,nobeforeafter,tcbox raise base,boxrule=1pt,top=0mm,bottom=0mm,
          colframe=cyan,coltext=cyan,colback=cyan!10!white, halign = right,
          width=50pt,arc=7mm, sharp corners=west, boxsep=4mm,
          overlay={draw[thick] ([yshift=3ex]frame.north west) -- ([yshift=-3ex]frame.south west);

          }
          }

          %Chapter heading
          %newfontfamilychapterfont[Color=black]{Avenir Light}% set font
          titlespacing{chapter}% {left}{before}{after}[right]
          {60pt}%left
          {1ex plus 2ex}%before
          {1.7cm}%after

          titleformat{chapter}% command to be modified
          {fontsize{24}{27}bfseriesscshape} %format
          {hspace*{-70pt}
          mychapternum{thechapter}
          }% label
          {0em}% sep
          {} % before-code
          [{color{red}
          begingroup
          setlength{titlewidth}{textwidth}
          titleline*{titlerule[1pt]}
          endgroup
          }] % after-code

          begin{document}


          chapter{My title}

          lipsum[20-30]

          chapter{My title}

          lipsum[20-30]
          end{document}


          enter image description here



          A solution based on TikZ package. This solution more flexible for adjustemets.





          % !TeX program = lualatex                                   
          % !TeX encoding = utf8
          documentclass[14pt]{book}
          usepackage{fontspec}
          usepackage[svgnames]{xcolor}
          usepackage{titlesec}
          usepackage{lipsum}
          usepackage[many]{tcolorbox}
          usetikzlibrary{shapes.misc, positioning}
          usetikzlibrary{calc}
          usepackage[
          a4paper,
          left=2cm,
          right=2cm,
          top=2.5cm,
          bottom=2cm,
          ]{geometry}
          %Chapter heading
          %newfontfamilychapterfont[Color=black]{Avenir Light}% set font
          titlespacing{chapter}% {left}{before}{after}[right]
          {2cm}%left
          {2ex}%before
          {1.7cm}%after

          titleformat{chapter}% command to be modified
          {Hugebfseriesscshape} %format
          {hspace*{-1cm}
          tikz [anchor=base, baseline,remember picture, overlay]{%
          node[line width = 2pt, draw=cyan, fill =cyan!10, anchor=base, rectangle, text width=2cm, align=right, rounded rectangle,rounded rectangle west arc=5pt, minimum height=4ex,
          inner sep=11pt] (A)
          {color{cyan}thechapter};
          draw[line width = 2.5pt] ([yshift=3ex]A.north west) -- ([yshift=-3ex]A.south west);
          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
          {} % before-code
          % after-code

          begin{document}
          chapter{My title}
          lipsum[20-30]
          addtocounter{chapter}{20}
          chapter{My title}
          lipsum[20-30]
          end{document}


          enter image description here






          share|improve this answer























          • Wow! Spectacular! Thanks a whole lot!!
            – pierocol
            Dec 1 at 14:52












          • Would you also be able to tell me how I can extend the red rule to the right page margin instead that to the right of textwidth?
            – pierocol
            Dec 1 at 15:03








          • 1




            @pierocol instead {color{red}titlerule[1pt]} put {color{red}rule{dimexpr5pt+textwidthrelax}{0.2pt}}
            – sergiokapone
            Dec 1 at 15:16






          • 1




            @pierocol I had changed code.
            – sergiokapone
            Dec 1 at 15:52








          • 1




            @pierocol I had added another solution.
            – sergiokapone
            Dec 1 at 20:29















          up vote
          6
          down vote



          accepted










          A solution based on tcolorbox package





          % !TeX program = lualatex                                   
          % !TeX encoding = utf8
          documentclass[14pt]{book}
          usepackage{fontspec}
          usepackage[svgnames]{xcolor}
          usepackage{titlesec}
          usepackage{lipsum}
          usepackage[many]{tcolorbox}
          usepackage[
          a4paper,
          left=2cm,
          right=2cm,
          top=2.5cm,
          bottom=2cm,
          ]{geometry}

          newtcbox{mychapternum}{enhanced,nobeforeafter,tcbox raise base,boxrule=1pt,top=0mm,bottom=0mm,
          colframe=cyan,coltext=cyan,colback=cyan!10!white, halign = right,
          width=50pt,arc=7mm, sharp corners=west, boxsep=4mm,
          overlay={draw[thick] ([yshift=3ex]frame.north west) -- ([yshift=-3ex]frame.south west);

          }
          }

          %Chapter heading
          %newfontfamilychapterfont[Color=black]{Avenir Light}% set font
          titlespacing{chapter}% {left}{before}{after}[right]
          {60pt}%left
          {1ex plus 2ex}%before
          {1.7cm}%after

          titleformat{chapter}% command to be modified
          {fontsize{24}{27}bfseriesscshape} %format
          {hspace*{-70pt}
          mychapternum{thechapter}
          }% label
          {0em}% sep
          {} % before-code
          [{color{red}
          begingroup
          setlength{titlewidth}{textwidth}
          titleline*{titlerule[1pt]}
          endgroup
          }] % after-code

          begin{document}


          chapter{My title}

          lipsum[20-30]

          chapter{My title}

          lipsum[20-30]
          end{document}


          enter image description here



          A solution based on TikZ package. This solution more flexible for adjustemets.





          % !TeX program = lualatex                                   
          % !TeX encoding = utf8
          documentclass[14pt]{book}
          usepackage{fontspec}
          usepackage[svgnames]{xcolor}
          usepackage{titlesec}
          usepackage{lipsum}
          usepackage[many]{tcolorbox}
          usetikzlibrary{shapes.misc, positioning}
          usetikzlibrary{calc}
          usepackage[
          a4paper,
          left=2cm,
          right=2cm,
          top=2.5cm,
          bottom=2cm,
          ]{geometry}
          %Chapter heading
          %newfontfamilychapterfont[Color=black]{Avenir Light}% set font
          titlespacing{chapter}% {left}{before}{after}[right]
          {2cm}%left
          {2ex}%before
          {1.7cm}%after

          titleformat{chapter}% command to be modified
          {Hugebfseriesscshape} %format
          {hspace*{-1cm}
          tikz [anchor=base, baseline,remember picture, overlay]{%
          node[line width = 2pt, draw=cyan, fill =cyan!10, anchor=base, rectangle, text width=2cm, align=right, rounded rectangle,rounded rectangle west arc=5pt, minimum height=4ex,
          inner sep=11pt] (A)
          {color{cyan}thechapter};
          draw[line width = 2.5pt] ([yshift=3ex]A.north west) -- ([yshift=-3ex]A.south west);
          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
          {} % before-code
          % after-code

          begin{document}
          chapter{My title}
          lipsum[20-30]
          addtocounter{chapter}{20}
          chapter{My title}
          lipsum[20-30]
          end{document}


          enter image description here






          share|improve this answer























          • Wow! Spectacular! Thanks a whole lot!!
            – pierocol
            Dec 1 at 14:52












          • Would you also be able to tell me how I can extend the red rule to the right page margin instead that to the right of textwidth?
            – pierocol
            Dec 1 at 15:03








          • 1




            @pierocol instead {color{red}titlerule[1pt]} put {color{red}rule{dimexpr5pt+textwidthrelax}{0.2pt}}
            – sergiokapone
            Dec 1 at 15:16






          • 1




            @pierocol I had changed code.
            – sergiokapone
            Dec 1 at 15:52








          • 1




            @pierocol I had added another solution.
            – sergiokapone
            Dec 1 at 20:29













          up vote
          6
          down vote



          accepted







          up vote
          6
          down vote



          accepted






          A solution based on tcolorbox package





          % !TeX program = lualatex                                   
          % !TeX encoding = utf8
          documentclass[14pt]{book}
          usepackage{fontspec}
          usepackage[svgnames]{xcolor}
          usepackage{titlesec}
          usepackage{lipsum}
          usepackage[many]{tcolorbox}
          usepackage[
          a4paper,
          left=2cm,
          right=2cm,
          top=2.5cm,
          bottom=2cm,
          ]{geometry}

          newtcbox{mychapternum}{enhanced,nobeforeafter,tcbox raise base,boxrule=1pt,top=0mm,bottom=0mm,
          colframe=cyan,coltext=cyan,colback=cyan!10!white, halign = right,
          width=50pt,arc=7mm, sharp corners=west, boxsep=4mm,
          overlay={draw[thick] ([yshift=3ex]frame.north west) -- ([yshift=-3ex]frame.south west);

          }
          }

          %Chapter heading
          %newfontfamilychapterfont[Color=black]{Avenir Light}% set font
          titlespacing{chapter}% {left}{before}{after}[right]
          {60pt}%left
          {1ex plus 2ex}%before
          {1.7cm}%after

          titleformat{chapter}% command to be modified
          {fontsize{24}{27}bfseriesscshape} %format
          {hspace*{-70pt}
          mychapternum{thechapter}
          }% label
          {0em}% sep
          {} % before-code
          [{color{red}
          begingroup
          setlength{titlewidth}{textwidth}
          titleline*{titlerule[1pt]}
          endgroup
          }] % after-code

          begin{document}


          chapter{My title}

          lipsum[20-30]

          chapter{My title}

          lipsum[20-30]
          end{document}


          enter image description here



          A solution based on TikZ package. This solution more flexible for adjustemets.





          % !TeX program = lualatex                                   
          % !TeX encoding = utf8
          documentclass[14pt]{book}
          usepackage{fontspec}
          usepackage[svgnames]{xcolor}
          usepackage{titlesec}
          usepackage{lipsum}
          usepackage[many]{tcolorbox}
          usetikzlibrary{shapes.misc, positioning}
          usetikzlibrary{calc}
          usepackage[
          a4paper,
          left=2cm,
          right=2cm,
          top=2.5cm,
          bottom=2cm,
          ]{geometry}
          %Chapter heading
          %newfontfamilychapterfont[Color=black]{Avenir Light}% set font
          titlespacing{chapter}% {left}{before}{after}[right]
          {2cm}%left
          {2ex}%before
          {1.7cm}%after

          titleformat{chapter}% command to be modified
          {Hugebfseriesscshape} %format
          {hspace*{-1cm}
          tikz [anchor=base, baseline,remember picture, overlay]{%
          node[line width = 2pt, draw=cyan, fill =cyan!10, anchor=base, rectangle, text width=2cm, align=right, rounded rectangle,rounded rectangle west arc=5pt, minimum height=4ex,
          inner sep=11pt] (A)
          {color{cyan}thechapter};
          draw[line width = 2.5pt] ([yshift=3ex]A.north west) -- ([yshift=-3ex]A.south west);
          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
          {} % before-code
          % after-code

          begin{document}
          chapter{My title}
          lipsum[20-30]
          addtocounter{chapter}{20}
          chapter{My title}
          lipsum[20-30]
          end{document}


          enter image description here






          share|improve this answer














          A solution based on tcolorbox package





          % !TeX program = lualatex                                   
          % !TeX encoding = utf8
          documentclass[14pt]{book}
          usepackage{fontspec}
          usepackage[svgnames]{xcolor}
          usepackage{titlesec}
          usepackage{lipsum}
          usepackage[many]{tcolorbox}
          usepackage[
          a4paper,
          left=2cm,
          right=2cm,
          top=2.5cm,
          bottom=2cm,
          ]{geometry}

          newtcbox{mychapternum}{enhanced,nobeforeafter,tcbox raise base,boxrule=1pt,top=0mm,bottom=0mm,
          colframe=cyan,coltext=cyan,colback=cyan!10!white, halign = right,
          width=50pt,arc=7mm, sharp corners=west, boxsep=4mm,
          overlay={draw[thick] ([yshift=3ex]frame.north west) -- ([yshift=-3ex]frame.south west);

          }
          }

          %Chapter heading
          %newfontfamilychapterfont[Color=black]{Avenir Light}% set font
          titlespacing{chapter}% {left}{before}{after}[right]
          {60pt}%left
          {1ex plus 2ex}%before
          {1.7cm}%after

          titleformat{chapter}% command to be modified
          {fontsize{24}{27}bfseriesscshape} %format
          {hspace*{-70pt}
          mychapternum{thechapter}
          }% label
          {0em}% sep
          {} % before-code
          [{color{red}
          begingroup
          setlength{titlewidth}{textwidth}
          titleline*{titlerule[1pt]}
          endgroup
          }] % after-code

          begin{document}


          chapter{My title}

          lipsum[20-30]

          chapter{My title}

          lipsum[20-30]
          end{document}


          enter image description here



          A solution based on TikZ package. This solution more flexible for adjustemets.





          % !TeX program = lualatex                                   
          % !TeX encoding = utf8
          documentclass[14pt]{book}
          usepackage{fontspec}
          usepackage[svgnames]{xcolor}
          usepackage{titlesec}
          usepackage{lipsum}
          usepackage[many]{tcolorbox}
          usetikzlibrary{shapes.misc, positioning}
          usetikzlibrary{calc}
          usepackage[
          a4paper,
          left=2cm,
          right=2cm,
          top=2.5cm,
          bottom=2cm,
          ]{geometry}
          %Chapter heading
          %newfontfamilychapterfont[Color=black]{Avenir Light}% set font
          titlespacing{chapter}% {left}{before}{after}[right]
          {2cm}%left
          {2ex}%before
          {1.7cm}%after

          titleformat{chapter}% command to be modified
          {Hugebfseriesscshape} %format
          {hspace*{-1cm}
          tikz [anchor=base, baseline,remember picture, overlay]{%
          node[line width = 2pt, draw=cyan, fill =cyan!10, anchor=base, rectangle, text width=2cm, align=right, rounded rectangle,rounded rectangle west arc=5pt, minimum height=4ex,
          inner sep=11pt] (A)
          {color{cyan}thechapter};
          draw[line width = 2.5pt] ([yshift=3ex]A.north west) -- ([yshift=-3ex]A.south west);
          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
          {} % before-code
          % after-code

          begin{document}
          chapter{My title}
          lipsum[20-30]
          addtocounter{chapter}{20}
          chapter{My title}
          lipsum[20-30]
          end{document}


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 1 at 20:41

























          answered Dec 1 at 14:49









          sergiokapone

          2,417926




          2,417926












          • Wow! Spectacular! Thanks a whole lot!!
            – pierocol
            Dec 1 at 14:52












          • Would you also be able to tell me how I can extend the red rule to the right page margin instead that to the right of textwidth?
            – pierocol
            Dec 1 at 15:03








          • 1




            @pierocol instead {color{red}titlerule[1pt]} put {color{red}rule{dimexpr5pt+textwidthrelax}{0.2pt}}
            – sergiokapone
            Dec 1 at 15:16






          • 1




            @pierocol I had changed code.
            – sergiokapone
            Dec 1 at 15:52








          • 1




            @pierocol I had added another solution.
            – sergiokapone
            Dec 1 at 20:29


















          • Wow! Spectacular! Thanks a whole lot!!
            – pierocol
            Dec 1 at 14:52












          • Would you also be able to tell me how I can extend the red rule to the right page margin instead that to the right of textwidth?
            – pierocol
            Dec 1 at 15:03








          • 1




            @pierocol instead {color{red}titlerule[1pt]} put {color{red}rule{dimexpr5pt+textwidthrelax}{0.2pt}}
            – sergiokapone
            Dec 1 at 15:16






          • 1




            @pierocol I had changed code.
            – sergiokapone
            Dec 1 at 15:52








          • 1




            @pierocol I had added another solution.
            – sergiokapone
            Dec 1 at 20:29
















          Wow! Spectacular! Thanks a whole lot!!
          – pierocol
          Dec 1 at 14:52






          Wow! Spectacular! Thanks a whole lot!!
          – pierocol
          Dec 1 at 14:52














          Would you also be able to tell me how I can extend the red rule to the right page margin instead that to the right of textwidth?
          – pierocol
          Dec 1 at 15:03






          Would you also be able to tell me how I can extend the red rule to the right page margin instead that to the right of textwidth?
          – pierocol
          Dec 1 at 15:03






          1




          1




          @pierocol instead {color{red}titlerule[1pt]} put {color{red}rule{dimexpr5pt+textwidthrelax}{0.2pt}}
          – sergiokapone
          Dec 1 at 15:16




          @pierocol instead {color{red}titlerule[1pt]} put {color{red}rule{dimexpr5pt+textwidthrelax}{0.2pt}}
          – sergiokapone
          Dec 1 at 15:16




          1




          1




          @pierocol I had changed code.
          – sergiokapone
          Dec 1 at 15:52






          @pierocol I had changed code.
          – sergiokapone
          Dec 1 at 15:52






          1




          1




          @pierocol I had added another solution.
          – sergiokapone
          Dec 1 at 20:29




          @pierocol I had added another solution.
          – sergiokapone
          Dec 1 at 20:29


















          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%2f462686%2fchapter-with-graphical-formatting%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

          Quarter-circle Tiles

          build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

          Mont Emei