2

How to put the section number and title in the specified box with the possibility that the sections are variable.

\documentclass{book}
\usepackage{fourier}% change to lmodern if fourier is no available
\usepackage{tikz}
\usepackage[explicit]{titlesec}

\definecolor{mybluei}{RGB}{0,173,239} \definecolor{myblueii}{RGB}{63,200,244} \definecolor{myblueiii}{RGB}{199,234,253} \definecolor{mybluen}{RGB}{190,234,253}

\renewcommand\thechapter{\arabic{chapter}}

\newcommand\chapternumfont{% font specification for the number \fontsize{380}{130}\color{myblueii}\selectfont% }

\newcommand\chapternamefont{% font specification for the name "chapter" \normalfont\color{white}\scshape\small\bfseries }

\titleformat{\chapter} {\normalfont\huge\filleft} {} {20pt} {\begin{tikzpicture}[remember picture,overlay] \fill[myblueiii] (current page.north west) rectangle ([yshift=-12cm]current page.north east);
\draw[myblueiii,draw,fill=mybluen] ([xshift=15cm,yshift=-16cm]current page.north west) rectangle ([yshift=-22cm]current page.north east);
\draw[mybluei] ([xshift=13cm,yshift=-18cm]current page.north west) rectangle ([xshift=-6.6cm,yshift=-17cm]current page.north east);
\draw[mybluei] ([xshift=13cm,yshift=-20cm]current page.north west) rectangle ([xshift=-6.6cm,yshift=-21cm]current page.north east);
\node[ fill=mybluei, text width=2\paperwidth, rounded corners=6cm, text depth=18cm, anchor=center, inner sep=0pt] at (current page.north east) (chaptertop) {\thechapter};% \node[ anchor=south east, inner sep=0pt, outer sep=0pt] (chapternum) at ([xshift=-20pt]chaptertop.south) {\chapternumfont\thechapter}; \node[ anchor=south, inner sep=0pt] (chaptername) at ([yshift=2pt]chapternum.south)
{\chapternamefont }; %\rl{Chapter} \node[ anchor=north east, align=right, inner xsep=0pt] at ([xshift=3cm,yshift=-9cm]chaptername.east|-chapternum.south) {\parbox{.7\textwidth}{\raggedleft#1}}; \end{tikzpicture}% }

\begin{document}

\chapter{Chapter Nema} \newpage \section{Section one } \section{Section two}

\end{document}

enter image description here

Hassan
  • 21
  • 4
  • Welcome! Thanks for posting code. This looks like a good question. It may help if you explain which specified box you mean. Reading your question, I'm not clear. You could also mark up the image with hand-drawn arrows or something - just so it's clear what you want to move where. [Note that I won't answer this because I don't get on with titlesec, but most people like it, so there will be somebody who can help for sure.] – cfr Aug 17 '23 at 02:06
  • Or is that the output you're trying to reproduce? Because I don't think you're going to be able to do this with a simple styling of \chapter. You want something like a mini-table of contents? There are various packages for that. The alternative would be to specify the sections manually, I guess. – cfr Aug 17 '23 at 02:09
  • Thank you, because there is a possibility that there will be more or less parts in each chapter, so it is better to make a style if there is a place. – Hassan Aug 17 '23 at 05:38
  • Then I would look at a package which lets you use locate tables of contents. The only one I've used personally is etoc and, although I do something like you want, I don't use etoc for that. (I just specify what I want manually.) https://www.ctan.org/pkg/etoc or click on the links to the relevant topic to find other packages. – cfr Aug 18 '23 at 03:57
  • Unfortunately, I don't have enough knowledge to draw it. – Hassan Aug 18 '23 at 06:53
  • It's not really a question of drawing it, is it? I thought it was a question about how to get the section information to display at the start of the chapter? For the drawing, the tutorials at the start of the tikz manual or look at styles in tcolorbox. There's also a bunch of examples of fancy-chapter styles on this site and there might even be a package to that effect. The drawing is just boxes and a curve. – cfr Aug 19 '23 at 02:52
  • It doesn't matter what to draw with, I just need to use a fantasy design for the chapter and the section of the same chapter. Thank you for your time. – Hassan Aug 19 '23 at 12:42
  • Does https://tex.stackexchange.com/questions/307301/how-to-show-mini-table-only-sections-in-a-chapter-not-other-chapter?rq=1 help? – cfr Aug 19 '23 at 14:26
  • Thanks, I'll try to use the question you posted. – Hassan Aug 22 '23 at 12:53
  • If you can't make it work in your case, you'll be able to edit this question with code somebody can work with and you're more likely to get help in that case. – cfr Aug 22 '23 at 15:49

0 Answers0