My question is how we can put a tikzpicture shapes in specific position in latex slides? I mean I do not want to change the position of texts in slide but draw a shape in a specific position. (like powerpoint)
If you use the overlay option, your tikz picture won't influence the rest of the text:
\documentclass[aspectratio=169]{beamer}
\usepackage{tikz}
% trick taken from https://topanswers.xyz/tex?q=1989
\tikzset{
use page relative coordinates/.style={
shift={(current page.south west)},
x={(current page.south east)},
y={(current page.north west)}
},
}
\begin{document}
\begin{frame}
some text, does not change position
\begin{tikzpicture}[remember picture, overlay,use page relative coordinates]
\fill[red] (0.7,0.3) circle [radius=0.5cm];
\end{tikzpicture}%
\end{frame}
\end{document}
Related
I would like to add images in the top left/right or bottom left/right in a two-column page while ignoring the margins and having the text wrap around the picture. How can I also extend the solution to include half page images while ignoring the margins and with text wrapping.
I tried tikz package, but the text doesn't wrap around even when I use the wrapfig package.
For example, this is the code I used to insert image on the top left side of the page:
\documentclass[twocolumn, 12pt]{book}
\usepackage{lipsum}
\usepackage{tikz}
\begin{document}
\lipsum[1-3]
\begin{tikzpicture} [remember picture, overlay]
\node[anchor=north west,yshift=-1.5pt,xshift=1pt]%
at (current page.north west)
{\includegraphics[width=0.5\paperwidth,height=0.5\paperheight]{example.jpg}};
\end{tikzpicture}
\lipsum[1-3]
\end{document}
This results in the picture at the desired position, but the text is obscured behind the image. Thank you!
Not very pretty, but does the job I think (using geometry package only to get the correct values for top margin):
\documentclass[twocolumn, 12pt]{book}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{geometry}
\begin{document}
\begin{tikzpicture} [remember picture, overlay]
\node[anchor=north west]%
at (current page.north west)
{\includegraphics[width=0.46\paperwidth,height=0.5\paperheight]{example.png}};
\end{tikzpicture}
\vspace*{\dimexpr(0.5\paperheight-\voffset-1in-\headsep-\headheight)}
\lipsum[1-3]
\lipsum[1-3]
\end{document}
I'm replicating an word documment and need to place some text over an image in the header, but i can't find a simple method to do that.
It's just some text centered over a retangular image, but the best anwser I've found, so far, for doing that is reading an 880 page manual for PFG package.
Is there anyway to do that with some simple package, like minipage?
One possible approach using tikz:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node at (0,0) {\includegraphics[width=6cm]{example-image-duck}};
\node at (current bounding box.center) {Quack};
\end{tikzpicture}
\end{document}
I'm using this code to implement a "background image" on my page:
\tikz[remember picture,overlay] \node[inner sep=0pt] at (current page.center){\includegraphics{Images/picture.pdf}};
However, I'd like it to show up at the bottom of the page. I've tried changing the current page.center and played around with \vfill but I can't quite figure it out.
Something along the lines of this answer may be what you are looking for (adapted for this question):
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{graphicx}
\begin{document}
\begin{titlepage}
\begin{tikzpicture}[overlay, remember picture]
\node[anchor=south west, %anchor is bottom left corner of the graphic
xshift=5cm, %shifting around
yshift=-5cm]
at (current page.south west) %left bottom corner of the page
{\includegraphics[width=5cm]{tiger}};
\end{tikzpicture}
\end{titlepage}
\end{document}
I put two image.png in my latex documnet using \includegraphics. Now I want to joint two points of these images together by a line. I wonder if it is possible to do so in Latex?
First: no it is impossible: as Gyro Gearloose had said LaTeX has no idea about the content of your png.
Second: sure you can ;-) A little cheat with tikz. You can connect two arbitrary points with an arrow (or a line).
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{tikzmark} % arrows in tex
\usetikzlibrary{arrows} % arrows in tex
\usetikzlibrary{calc} % (node)+(3cm,2cm)
\tikzstyle{every picture}+=[remember picture]
\begin{document}
\lipsum[1]
\includegraphics[width=0.2\textwidth]{solidtex.png}
{\tikz\node[coordinate](start1){};}
\lipsum[2]
{\tikz\node[coordinate](end1){};}
\includegraphics[width=0.2\textwidth]{solidtex.png}
\lipsum[3]
\begin{tikzpicture}[overlay, remember picture, -latex, color=blue!15!red, yshift=1ex, shorten >=1pt, shorten <=1pt, line width=0.1cm]
\path[->] (start1) edge [out=150, in=240] (end1);
\end{tikzpicture}
\end{document}
But it still connects the corners of the images. To connect points inside the pictures, you have to modify the coordinates manually e.g.:
\path[->] (start1) edge [out=150, in=240] ($(end1)+(2cm,2cm)$);
or pt, ex, mm ect...
If you want line without arrow head, use:
\path[-] (start1) edge [out=150, in=240] (end1);
Note that like labeling and referring figures, you have to run latex (or pdflatex or ...) twice.
For a small project I'm trying something that feels as if it should be peanut, but au contraire (Hey, that's french, never thought I'd remember some parts of that. anyway...).
The thing is, I want a latex layout where the header and footer span the entire pagewidth and have a background color, and also can have some elements on the left, center, or right (like with fancyhdr). The thing is, I simply cannot get this to work without screwing up the rest of the layout.
edit: added example.
Here's an example of what I have tried. The header is shown incorrectly since the background doesn't span the whole width of the page. The footer is not shown at all.
\documentclass[10pt,a4paper,notitlepage]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[usenames,dvipsnames]{color}
\usepackage{fancyhdr}
\usepackage{calc}
\usepackage{tikz}
\usepackage[landscape, top=0cm, bottom=3cm]{geometry}
\definecolor{logoGreen}{RGB}{218,226,87}
\newcommand{\HBG}{
\begin{tikzpicture}[remember picture,overlay]
\node[yshift=-2cm] at (current page.north west)
{
\begin{tikzpicture}[remember picture, overlay]
\draw[fill=logoGreen] (0,0) rectangle (\paperwidth,2cm);
\end{tikzpicture}
};
\end{tikzpicture}
}
\fancyhead{}
\fancyhead[L]{\HBG}
\fancyhead[C]{\includegraphics[height=1.2cm]{"img/headerimg"}}
\fancyfoot[C]{\includegraphics[height=1.2cm]{"img/footerimg"}}
\fancyhfoffset[]{1in+\hoffset+\oddsidemargin}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\headheight 3cm
\footskip -2cm
\pagestyle{fancy}
\begin{document}
\section{first section}
content
\end{document}
You can use TikZ to position coloured boxes absolutely on the page. See an example here.
This example includes usage of \thechapter, so you can probably go on from there.