latex - how to reduce space after drawing graphs in RMarkdown using tikz
问题描述
I am writing a RMarkdown presentation and in a specific slide (New subsection, please see below) I have 5 graphs and then too much space after that. This does not allow me to write more in that slide and moves the Text just below the title where there is no need for that. How to reduce that space?
---
title: name
author: name
date: "`r format(Sys.time(), '%d %B %Y')`"
output:
beamer_presentation:
theme: Szeged
slide_level: 2
includes:
in_header: header.tex
keep_tex: true
linkcolor: false
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
# Outline
## Outline
1. Item 1
2. item 2
3. Item 3
# New section
## New subsection
\small
\justify
Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.
More text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text tex.
\begin{tikzpicture}[>=triangle 45, font=\footnotesize]
\put(-3,-20){
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{T}}] (T) at (0,0) {};
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{Y}}] (Y) at (1,0) {};
\draw[->,shorten >= 1pt] (T)--(Y);
}
\end{tikzpicture}
\begin{tikzpicture}[>=triangle 45, font=\footnotesize]
\put(45,7){
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{T}}] (T) at (0,0) {};
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{Y}}] (Y) at (1,0) {};
\draw[<-,shorten >= 1pt] (T)--(Y);
}
\end{tikzpicture}
\begin{tikzpicture}[>=triangle 45, font=\footnotesize]
\put(94,62){
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{T}}] (T) at (0,0) {};
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{Y}}] (Y) at (2,0) {};
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={above:{U}}] (U) at (1,0.5) {};
\draw[->,shorten >= 1pt] (T)--(Y);
\draw[->,shorten >= 1pt] (U)--(T);
\draw[->,shorten >= 1pt] (U)--(Y);
}
\end{tikzpicture}
\begin{tikzpicture}[>=triangle 45, font=\footnotesize]
\put(169,116){
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{T}}] (T) at (0,0) {};
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{Y}}] (Y) at (2,0) {};
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={above:{U}}] (U) at (1,0.5) {};
\draw[<-,shorten >= 1pt] (T)--(Y);
\draw[->,shorten >= 1pt] (U)--(T);
\draw[->,shorten >= 1pt] (U)--(Y);
}
\end{tikzpicture}
\begin{tikzpicture}[>=triangle 45, font=\footnotesize]
\put(245,171){
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{T}}] (T) at (0,0) {};
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{Y}}] (Y) at (2,0) {};
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={above:{U}}] (U) at (1,0.5) {};
\draw[->,shorten >= 1pt] (U)--(T);
\draw[->,shorten >= 1pt] (U)--(Y);
}
\end{tikzpicture}
Finally, more text in here.
My header.tex is:
\definecolor{mycolorlightblue}{RGB}{103,153,200}
\definecolor{mycolordarkblue}{RGB}{0,70,127}
% add packages
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{tcolorbox}
\usepackage{ragged2e}
% remove 2nd section from header
\makeatletter
\beamer@theme@subsectionfalse
\makeatother
% change colour of lines
\setbeamercolor{separation line}{bg=mycolorlightblue}
% text title
\setbeamercolor{title}{fg=mycolordarkblue}
\setbeamercolor{frametitle}{fg=mycolordarkblue}
% text colour
\setbeamercolor{frametitle}{fg=mycolordarkblue}
% item colour
\setbeamercolor{structure}{fg=mycolordarkblue}
% define colour text
% \usebeamerfont{section title}\color{blue!70!green}\insertsection\par
% no header or footer on first page
\thispagestyle{empty}
% remove title slides at beginning of sections
\AtBeginSection{}
% add page counter to the footer
\setbeamertemplate{footline}[frame number]
% logo of my university
\titlegraphic{%
\begin{picture}(0,0)
\put(155,0){\makebox(0,0)[rt]{\includegraphics[]{ALL-ICONS.png}}}
\end{picture}}
解决方案
The problem is the \put(94,62){...}
syntax you use. This won't place the image where the tikzpicture is, but will shatter them all over the frame.
Instead you can just let tex position the tikzpicture
s for you:
\small
\justify
Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.
More text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text tex.
\begin{tikzpicture}[>=triangle 45, font=\footnotesize]
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{T}}] (T) at (0,0) {};
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{Y}}] (Y) at (1,0) {};
\draw[->,shorten >= 1pt] (T)--(Y);
\end{tikzpicture}%
\begin{tikzpicture}[>=triangle 45, font=\footnotesize]
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{T}}] (T) at (0,0) {};
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{Y}}] (Y) at (1,0) {};
\draw[<-,shorten >= 1pt] (T)--(Y);
\end{tikzpicture}%
\begin{tikzpicture}[>=triangle 45, font=\footnotesize]
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{T}}] (T) at (0,0) {};
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{Y}}] (Y) at (2,0) {};
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={above:{U}}] (U) at (1,0.5) {};
\draw[->,shorten >= 1pt] (T)--(Y);
\draw[->,shorten >= 1pt] (U)--(T);
\draw[->,shorten >= 1pt] (U)--(Y);
\end{tikzpicture}%
\begin{tikzpicture}[>=triangle 45, font=\footnotesize]
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{T}}] (T) at (0,0) {};
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{Y}}] (Y) at (2,0) {};
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={above:{U}}] (U) at (1,0.5) {};
\draw[<-,shorten >= 1pt] (T)--(Y);
\draw[->,shorten >= 1pt] (U)--(T);
\draw[->,shorten >= 1pt] (U)--(Y);
\end{tikzpicture}%
\begin{tikzpicture}[>=triangle 45, font=\footnotesize]
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{T}}] (T) at (0,0) {};
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={below:{Y}}] (Y) at (2,0) {};
\node[fill,circle,inner sep=0pt,minimum size=5pt,label={above:{U}}] (U) at (1,0.5) {};
\draw[->,shorten >= 1pt] (U)--(T);
\draw[->,shorten >= 1pt] (U)--(Y);
\end{tikzpicture}%
推荐阅读
- python - 在 pandas 1.0.1 中使用“datetime64 [ns, UTC]”采样的 groupby 行为不正确?
- angular - 如何避免在日期选择器字段中输入字母?
- hadoop - 如何在 Java 代码中获得 HDFS 可用空间?
- amazon-web-services - 如何将 linux 日志文件直接发送到 S3(从而绕过 CloudWatch)
- postgresql - 更改 postgres 表中的列顺序
- android - 在androidx生物识别提示中尝试三次失败后关闭提示?
- python - 检查单词中间是否有标点或数字
- python - 如何在 Python 中使用 AckID 确认 Google PubSub 消息
- machine-learning - 如何使用机器学习使用可用关键字对文本进行分类?
- typescript - react typescript eslint plugin - 文件(.svg)的扩展名是非标准的