TeX - LaTeX Asked on March 11, 2021
I’m trying to put a picture at bottom of a title page, and I’m getting a very small vertical gap that I would like to remove. Here’s a MWE to show my issue:
documentclass[letterpaper]{book}
usepackage[T1]{fontenc}
usepackage{microtype}
usepackage{libertine}
renewcommand*familydefault{sfdefault}
usepackage{anysize}
marginsize{1.5in}{1in}{0.5in}{0.5in}
usepackage[x11names]{xcolor}
definecolor{backgroundcolor}{RGB}{150, 170, 190}
usepackage{graphicx}
usepackage{here}
usepackage{afterpage}
usepackage{tikz}
usetikzlibrary{calc}
newcommand*{maintitle}{begingroup
pagecolor{backgroundcolor}
vfill
raggedleft {huge Name}
begin{figure}[H]
center
includegraphics[width=1textwidth]{example-image}
end{figure}
endgroup}
begin{document}
begin{titlepage}
% CADRE :
begin{tikzpicture}[remember picture, overlay]
draw[line width = 1in,color = white] ($(current page.north west) + (0.25in,0.25in)$) rectangle ($(current page.south east) + (0.25in,-0.25in)$);
draw[line width = 0.25pt,color = black] ($(current page.north west) + (0.75in,-0.25in)$) rectangle ($(current page.south east) + (-0.25in,0.25in)$);
draw[line width = 1pt,color = white] ($(current page.north west) + (1in,-0.5in)$) rectangle ($(current page.south east) + (-0.5in,0.5in)$);
end{tikzpicture}
maintitle
end{titlepage}
end{document}
Preview, with the issue shown in red:
At first sight, the spacing v is equal to h, which is what I want. But a closer inspection shows that v is actually slightly larger than h. How can I make v exactly the same as h ? What is wrong with my code?
EDIT: After zooming and measuring, the difference is v – h = 1pt. This is the same as the white line thickness drawn at the bottom, but I suspect this is just a coincidence. I could solve my issue by adding vspace{-1pt}
just under my figure environment, but I would like to understand (and properly fix) the issue.
IMHO that the picture/image can be directly placed as a node in tikz rather than a separate begingroup
If I know the precise position of the page corner (red circle)
node[inner sep=0pt, circle,red,fill,draw, minimum size=6pt] at
(%
$(current page text area.south west)+
(-0.75in,-0.6in)$
){};
then I can calculate precisely any other position-- in your case V
and h
by incrementing equal amount from the x and y side
node[inner sep=0pt, circle,red,fill,draw, minimum size=6pt] at (%
$(current page text area.south west)+
% (-0.75in,-0.6in)+<------------------increment v=.2in h=.2in from each side
(-0.55in,-0.4in)$){};
documentclass[letterpaper]{book}
usepackage[T1]{fontenc}
usepackage{microtype}
usepackage{libertine}
renewcommand*familydefault{sfdefault}
usepackage{anysize}
marginsize{1.5in}{1in}{0.5in}{0.5in}
usepackage[x11names]{xcolor}
definecolor{backgroundcolor}{RGB}{150, 170, 190}
usepackage{graphicx}
usepackage{here}
usepackage{afterpage}
usepackage{tikz}
usetikzlibrary{calc}
usepackage{tikzpagenodes}
newcommand*{maintitle}{begingroup%
pagecolor{backgroundcolor}
vfill
raggedleft {huge Name}
begin{figure}[H]
center
includegraphics[width=1textwidth]{example-image}
end{figure}
endgroup}%
begin{document}
begin{titlepage}
% CADRE :
begin{tikzpicture}[remember picture, overlay]
draw[line width = 1in,color = white] ($(current page.north west) +
(0.25in,0.25in)$) rectangle ($(current page.south east) + (0.25in,-0.25in)$);
draw[line width = 0.25pt,color = black] ($(current page.north west) +
(0.75in,-0.25in)$) rectangle ($(current page.south east) + (-0.25in,0.25in)$);
draw[line width = 1pt,color = white] ($(current page.north west) +
(1in,-0.5in)$) rectangle ($(current page.south east) + (-0.5in,0.5in)$);
end{tikzpicture}
maintitle
begin{tikzpicture}[remember picture,overlay]
node[inner sep=0pt, circle,red,fill,draw, minimum size=6pt] at
(%
$(current page text area.south west)+
(-0.75in,-0.6in)$
){};
node[inner sep=0pt, circle,red,fill,draw, minimum size=6pt] at (%
$(current page text area.south west)+
% (-0.75in,-0.6in)+
(-0.55in,-0.4in)$){};
%node at (0,0) {includegraphics[width=4cm]{example-image}};
end{tikzpicture}
end{titlepage}
end{document}
edit
I forgot to include the image
node[inner sep=0pt] at (%
$(current page text area.south west)+
% (-0.75in,-0.6in)+
(-0.55in,-0.4in)$){includegraphics[scale=0.2]{example-image}};
MWE
documentclass[letterpaper]{book}
usepackage[T1]{fontenc}
usepackage{microtype}
usepackage{libertine}
renewcommand*familydefault{sfdefault}
usepackage{anysize}
marginsize{1.5in}{1in}{0.5in}{0.5in}
usepackage[x11names]{xcolor}
definecolor{backgroundcolor}{RGB}{150, 170, 190}
usepackage{graphicx}
usepackage{here}
usepackage{afterpage}
usepackage{tikz}
usetikzlibrary{calc}
usepackage{tikzpagenodes}
newcommand*{maintitle}{begingroup%
pagecolor{backgroundcolor}
vfill
raggedleft {huge Name}
begin{figure}[H]
center
includegraphics[width=1textwidth]{example-image}
end{figure}
endgroup}%
begin{document}
begin{titlepage}
% CADRE :
begin{tikzpicture}[remember picture, overlay]
draw[line width = 1in,color = blue] ($(current page.north west) + (0.25in,0.25in)$) rectangle ($(current page.south east) + (0.25in,-0.25in)$);
draw[line width = 0.25pt,color = black] ($(current page.north west) + (0.75in,-0.25in)$) rectangle ($(current page.south east) + (-0.25in,0.25in)$);
draw[line width = 1pt,color = green] ($(current page.north west) + (1in,-0.5in)$) rectangle ($(current page.south east) + (-0.5in,0.5in)$);
end{tikzpicture}
% maintitle
begin{tikzpicture}[remember picture,overlay]
node[inner sep=0pt, circle,red,fill,draw, minimum size=6pt] at
(%
$(current page text area.south west)+
(-0.75in,-0.6in)$
){};
node[inner sep=0pt, circle,red,fill,draw, minimum size=6pt] at (%
$(current page text area.south west)+
% (-0.75in,-0.6in)+
(-0.55in,-0.4in)$){};
node[inner sep=0pt] at (%
$(current page text area.south west)+
% (-0.75in,-0.6in)+
(-0.55in,-0.4in)$){includegraphics[scale=0.2]{example-image}};
%node at (0,0) {includegraphics[width=4cm]{example-image}};
end{tikzpicture}
end{titlepage}
end{document}
If you see now you get better precision with tikz and removing the maketitle as also similarly commented by @HenriMenke
EDIT2
documentclass[letterpaper]{book}
usepackage[T1]{fontenc}
usepackage{microtype}
usepackage{libertine}
renewcommand*familydefault{sfdefault}
usepackage{anysize}
marginsize{1.5in}{1in}{0.5in}{0.5in}
usepackage[x11names]{xcolor}
definecolor{backgroundcolor}{RGB}{150, 170, 190}
usepackage{graphicx}
usepackage{here}
usepackage{afterpage}
usepackage{tikz}
usetikzlibrary{calc,positioning}
usepackage{tikzpagenodes}
%newcommand*{maintitle}{begingroup%
% pagecolor{backgroundcolor}
% vfill
% raggedleft {huge Name}
% begin{figure}[H]
% center
% includegraphics[width=1textwidth]{example-image}
% end{figure}
% endgroup}%
begin{document}
pagecolor{backgroundcolor}
begin{titlepage}
begin{tikzpicture}[remember picture, overlay]
draw[line width = 1in,color = blue!30] ($(current page.north west) + (0.25in,0.25in)$) rectangle ($(current page.south east) + (0.25in,-0.25in)$);
draw[line width = 0.25pt,color = black] ($(current page.north west) + (0.75in,-0.25in)$) rectangle ($(current page.south east) + (-0.25in,0.25in)$);
draw[line width = 1pt,color = green] ($(current page.north west) + (1in,-0.5in)$) rectangle ($(current page.south east) + (-0.5in,0.5in)$);
end{tikzpicture}
begin{tikzpicture}[remember picture,overlay, every label/.style=left,]
node[name=temp1, inner sep=0pt, circle,red,fill,draw, minimum size=6pt,anchor=center, label=a] at
(%
$(current page text area.south west)+
(-0.75in,-0.6in)$
){} ;
node[name=temp2,inner sep=0pt, circle,red,fill,draw, minimum size=6pt,anchor=center, label=b] at (%
$(current page text area.south west)+
% (-0.75in,-0.6in)+
(-0.05in,0.1in)$){};
node[name=temp3,inner sep=0pt, circle,red,fill,draw, minimum size=6pt, label=c] at (%
$(current page text area.south west)+
% (-0.75in,-0.6in)+
(-0.05in,-0.6in)$){};
node[name=temp4,inner sep=0pt, circle,red,fill,draw, minimum size=6pt, label=d] at (%
$(current page text area.south west)+
% (-0.75in,-0.6in)+
(-0.75in,0.1in)$){};
node[name=temp5,inner sep=0pt, anchor=south west] at (%
$(current page text area.south west)+
% (-0.75in,-0.6in)+
(-0.05in,0.1in)$)(b){includegraphics[scale=1,width=linewidth]{example-image}} node[above=of b.north, yshift=-1cm, xshift=7cm ](){Large Name};
draw(temp2)--node[midway, fill=white]{0.7in}(temp4);
draw(temp2)--node[midway, fill=white]{0.7in}(temp3);
end{tikzpicture}
end{titlepage}
end{document}
Answered by js bibra on March 11, 2021
It's maybe a bit easier to use eso-pic
to draw on the page background. This also only requires compiling once. The dimensions are not the same as yours but I'm sure you can figure it out.
documentclass[letterpaper]{book}
usepackage{eso-pic}
usepackage{tikz}
usepackage{xcolor}
definecolor{backgroundcolor}{RGB}{150,170,190}
begin{document}
AddToShipoutPictureBG*{%
AtTextLowerLeft{%
begin{tikzpicture}[overlay]
coordinate (ll) at (0,0);
coordinate (ur) at (textwidth,textheight);
draw[black,fill=backgroundcolor] ([shift={(-1in,-1in)}]ll) rectangle ([shift={(1in,1in)}]ur);
draw[white] ([shift={(-.25in,-.25in)}]ll) rectangle ([shift={(.25in,.25in)}]ur);
useasboundingbox (ll) rectangle (ur);
end{tikzpicture}%
}%
}
begin{titlepage}
raggedleft
leavevmode
vfill
huge Namepar
includegraphics[width=1textwidth]{example-image}
end{titlepage}
end{document}
Answered by Henri Menke on March 11, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP