Page Layoutsidebar question

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
comandos
Posts: 15
Joined: Sat Dec 15, 2018 3:46 pm

sidebar question

Post by comandos »

Greetings all,

I have a quick question :)
I’m using the following example code (https://tex.stackexchange.com/questions ... n-headings) and I would like to know is there a way to permanently fix the position of the middle text in the side bar (attached picture for better clarity, but I would like to write the following in the side bar-> chapter title (always far left on the page)…..company name (always in center of the pag) …..rightmark (always far right on the page)).

The attached picture shows the desired effect, my problem is when the chapter title or the section are longer they move the center of the side bar and the company name is moving (up and down) compared to different pages.


Hope I am being clear enough.
Attachments
1.JPG
1.JPG (297.84 KiB) Viewed 6121 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

sidebar question

Post by Stefan Kottwitz »

Hi,

I don't see code for the sidebar at the link you provided. That's about section headings.

Can you post your current code with the sidebar here?

Thanks!

Stefan
LaTeX.org admin
comandos
Posts: 15
Joined: Sat Dec 15, 2018 3:46 pm

sidebar question

Post by comandos »

I'm sorry for the delay I have attached bellow my latest code. And marked where I think the side bar was created, if there is a way to achieve the desired effect with less code I’m all ears :)

Code: Select all

Code, edit and compile here:
\documentclass[11pt,fleqn]{book}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{mathtools,amsfonts,amssymb,amsthm}
\usepackage[most]{tcolorbox}
\definecolor{ocre}{RGB}{52,177,201}
\definecolor{ultramarine}{RGB}{0,45,97}
\definecolor{mybluei}{RGB}{0,173,239}
\definecolor{myblueii}{RGB}{63,200,244}
\definecolor{myblueiii}{RGB}{199,234,253}
\usepackage{blindtext}
\usepackage{fourier}
\usepackage[explicit,calcwidth]{titlesec}
\renewcommand\thechapter{\arabic{chapter}}
\newcommand\chapnumfont{%
\fontsize{38}{13}\color{myblueii}\selectfont%380-130
}
\newcommand\chapnamefont{%
\normalfont\color{white}\scshape\small\bfseries
}
\titleformat{\chapter}
{\normalfont\huge\filleft}
{}
{0pt}
{\stepcounter{chapshift}%
\begin{tikzpicture}[remember picture,overlay]
\fill[myblueiii]
(current page.north west) rectangle ([yshift=-2cm]current page.north east); %svetlomodra
\node[
fill=mybluei,
text width=2\paperwidth,
rounded corners=1cm,
text depth=2cm,%temnomodra
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
comandos
Posts: 15
Joined: Sat Dec 15, 2018 3:46 pm

sidebar question

Post by comandos »

Is there another way to create a sidebar that behaves like this in latex?
rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

sidebar question

Post by rais »

Well, instead of a single \parbox inside the \rotatebox, you could use 3 smaller ones:

Code: Select all

Code, edit and compile here:
{\rotatebox{90}{%
\parbox{10cm}{%
\raggedleft\textcolor{black}{\bfseries\scshape\thechapter.\leftmark}%
}%
\hspace{2cm}%
\parbox{4cm}{\centering\color{red!70!black} company name}%
\hspace{2cm}%
\parbox{10cm}{\raggedright\rightmark}%
}};
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
(the different color for the center part is not really part of my suggestion, it rather made it easier for me to spot where that ends up, exactly)

Or you could use a {tabular} environment, like

Code: Select all

Code, edit and compile here:
{\rotatebox{90}{%
\setlength\tabcolsep{1cm}%
\begin{tabular}{@{}>{\raggedleft}p{10cm}>{\centering}p{4cm}p{10cm}@{}}%
\textcolor{black}{\bfseries\scshape\thechapter.\leftmark}%
& \textcolor{myblueiii}{company name}%
& \rightmark\\
\end{tabular}}};
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
(I haven't checked if this changes \tabcolsep throughout the document. If it does, double the braces for the second argument to \rotatebox)

You may need to add the table option to the xcolor package (or load array package yourself) for the > modifier to work in the tabular's column specification.

Both snippets show the last argument to their respective \node commands, the rest I left untouched (with the exception of the aforementioned table option).

BTW: your posted code doesn't work, because you've inserted blank lines into the argument of \fancyhead[LO] when you inserted your comment about `code for side bar'

KR
Rainer
comandos
Posts: 15
Joined: Sat Dec 15, 2018 3:46 pm

sidebar question

Post by comandos »

Greetings,
:S sorry must have missed it and sorry for the delay it has been crazy around here lately.

Yes I would prefer the use of tabular, so it’s scalable depending on page size (A3/A4) could you tell me if tabularX is an feasible solution and what am I doing wrong here:

Code: Select all

Code, edit and compile here:
\begin{tikzpicture}[overlay,remember picture]
\node[fill=\BoxColor,inner sep=-1pt,rectangle,text width=1cm,
text height=28cm,align=center,anchor=north east]
at ($ (current page.north east) $)
{\rotatebox{90}{%
\setlength\tabcolsep{1cm}
\begin{tabularx}{\textwidth}{XXX}
\bfseries\scshape\thechapter.\leftmark & company name & \rightmark\\
\end{tabularx}}};
\end{tikzpicture}}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The sidebar is generated but it’s all squished on the bottom side of the page (if I use the X parameter). If I use any other parameter is’s expectable but not ok (c,l,r) because it moves.


If there is a cleaner/simpler solution to achieve this look I’m all ears.


Current COMPLEATE code:

Code: Select all

Code, edit and compile here:
\documentclass[11pt,fleqn]{book}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{array}
\usepackage{tabulary}
\usepackage{tabularx}
\usepackage{mathtools,amsfonts,amssymb,amsthm}
\usepackage[most]{tcolorbox}
\definecolor{ocre}{RGB}{52,177,201}
\definecolor{ultramarine}{RGB}{0,45,97}
\definecolor{mybluei}{RGB}{0,173,239}
\definecolor{myblueii}{RGB}{63,200,244}
\definecolor{myblueiii}{RGB}{199,234,253}
\usepackage{blindtext}
\usepackage{fourier}
\usepackage[explicit,calcwidth]{titlesec}
\newcolumntype{Y}{>{\centering\arraybackslash}X} %centrira tabularx
\renewcommand\thechapter{\arabic{chapter}}
\newcommand\chapnumfont{%
\fontsize{38}{13}\color{myblueii}\selectfont%380-130
}
\newcommand\chapnamefont{%
\normalfont\color{white}\scshape\small\bfseries
}
\titleformat{\chapter}
{\normalfont\huge\filleft}
{}
{0pt}
{\stepcounter{chapshift}%
\begin{tikzpicture}[remember picture,overlay]
\fill[myblueiii]
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Attachments
1.JPG
1.JPG (28.21 KiB) Viewed 5822 times
rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

sidebar question

Post by rais »

comandos wrote:The sidebar is generated but it’s all squished on the bottom side of the page (if I use the X parameter).
You're limiting the `width' of your {tabularx} to \textwidth.
Then you have raised \tabcolsep to 1 cm, which is inserted `left' and `right' of each of the three columns, that leaves \textwidth - 6cm space for the three columns.
Try

Code: Select all

\begin{tabularx}{\paperheight}{XXX}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
instead.

If you further change the second column specifier to Y, the company name should be centered at page's height.

KR

Rainer
comandos
Posts: 15
Joined: Sat Dec 15, 2018 3:46 pm

sidebar question

Post by comandos »

Will try
thank you!
Post Reply