Theses, Books, Title pagesLegrand Orange Book: title page out of alignment with XeTeX

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
Post Reply
kdelwat
Posts: 4
Joined: Wed Feb 15, 2017 1:21 am

Legrand Orange Book: title page out of alignment with XeTeX

Post by kdelwat »

Hi everyone,

Using the Legrand Orange Book template from http://www.latextemplates.com/template/ ... range-book, I have run into a problem with the title page. When using pdflatex to compile the document, the title page is correctly aligned, but using xelatex the center box (containing the title and author) is smaller and out of alignment. Any help fixing this problem would be very appreciated!

The box is drawn by Tikz, but I can't find the problem with the relevant code:

Code: Select all

\begingroup
\thispagestyle{empty}
\begin{tikzpicture}[remember picture,overlay]
\coordinate [below=12cm] (midpoint) at (current page.north);
\node at (current page.north west)
{\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north west,inner sep=0pt] at (0,0) {\includegraphics[width=\paperwidth]{background}}; % Background image
\draw[anchor=north] (midpoint) node [fill=ocre!30!white,fill opacity=0.6,text opacity=1,inner sep=1cm]{\Huge\centering\bfseries\sffamily\parbox[c][][t]{\paperwidth}{\centering The Search for a Title\\[15pt] % Book title
{\Large A Profound Subtitle}\\[20pt] % Subtitle
{\huge Dr. John Smith}}}; % Author name
\end{tikzpicture}};
\end{tikzpicture}
\vfill
\endgroup
For comparison:

Pdflatex
pdflatex.png
pdflatex.png (76.16 KiB) Viewed 8899 times
Xelatex
xetex.png
xetex.png (72.88 KiB) Viewed 8899 times

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Legrand Orange Book: title page out of alignment with XeTeX

Post by Johannes_B »

Without having tested anything: did you do multiple compile runs?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
kdelwat
Posts: 4
Joined: Wed Feb 15, 2017 1:21 am

Legrand Orange Book: title page out of alignment with XeTeX

Post by kdelwat »

Johannes_B wrote:Without having tested anything: did you do multiple compile runs?
Yes, I have tried that already. Your post inspired me to do a bit more experimentation and I'm getting the following strange results:

1st run: pdflatex
2nd run: pdflatex
Result: correct alignment

1st run: xelatex
2nd run: xelatex
Result: incorrect alignment

1st run: pdflatex
2nd run: xelatex
Result: correct alignment

1st run: xelatex
2nd run: pdflatex
Result: title doesn't show at all
User avatar
Vel
Site Moderator
Posts: 463
Joined: Fri Jun 29, 2012 1:20 am

Legrand Orange Book: title page out of alignment with XeTeX

Post by Vel »

Just had a quick look at this and I can confirm this behavior. I've never actually tried compiling it with XeLaTeX but I can see how you'd need to if you want to use a custom font.

I'll fix up the template and release a new version once we figure out what's going on.
Founder and administrator of LaTeXTemplates.com and LaTeXTypesetting.com
kdelwat
Posts: 4
Joined: Wed Feb 15, 2017 1:21 am

Legrand Orange Book: title page out of alignment with XeTeX

Post by kdelwat »

Vel wrote:Just had a quick look at this and I can confirm this behavior. I've never actually tried compiling it with XeLaTeX but I can see how you'd need to if you want to use a custom font.

I'll fix up the template and release a new version once we figure out what's going on.
Thanks, that would be really helpful! I'm pretty much locked-in to Xetex for font and Unicode support so I don't have another option.
kdelwat
Posts: 4
Joined: Wed Feb 15, 2017 1:21 am

Legrand Orange Book: title page out of alignment with XeTeX

Post by kdelwat »

In case anyone stumbles across this page with the same problem, I managed to get it working!

The problem was the nested tikzpicture environments. Replacing those with a simpler solution did the trick. The new title page code is as follows:

Code: Select all

\begingroup
\thispagestyle{empty}

\begin{tikzpicture}[remember picture,overlay]

\node[inner sep=0pt] (background) at (current page.center) {\includegraphics[width=\paperwidth]{background}};

\draw (current page.center) node [fill=ocre!30!white,fill opacity=0.6,text opacity=1,inner sep=1cm]{\Huge\centering\bfseries\sffamily\parbox[c][][t]{\paperwidth}{\centering The Search for a Title\\[15pt] % Book title
{\Large A Profound Subtitle}\\[20pt] % Subtitle
{\huge Dr. John Smith}}}; % Author name

\end{tikzpicture}
\vfill
\endgroup
User avatar
Vel
Site Moderator
Posts: 463
Joined: Fri Jun 29, 2012 1:20 am

Legrand Orange Book: title page out of alignment with XeTeX

Post by Vel »

Awesome, thanks for finding the solution! I'll implement it and push a new version of the template soon.
Founder and administrator of LaTeXTemplates.com and LaTeXTypesetting.com
User avatar
Vel
Site Moderator
Posts: 463
Joined: Fri Jun 29, 2012 1:20 am

Legrand Orange Book: title page out of alignment with XeTeX

Post by Vel »

The template has been updated to include this change, v2.2.
Founder and administrator of LaTeXTemplates.com and LaTeXTypesetting.com
Post Reply