我使用 \usetheme{Warsaw} '\rightskip\rightmargin' 来帮助我使用阿拉伯语的 beamer,但是它不能让我很好地将 tikzpicture 居中,尽管我使用:\centering, begin{figure}[!h]...
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[swedish]{babel}
\usepackage{float}
\usepackage{subfig}
\usepackage{tikz,tkz-tab}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{graphicx}
\usetikzlibrary{calc}
\usepackage{float}
\usepackage{amssymb}
\usetheme{Warsaw}
\rightskip\rightmargin
%+++++++++++++++++ def block itemize
\makeatletter
\newenvironment{bitemize}{%
\ifnum\@itemdepth >2\relax\@toodeep\else%
\advance\@itemdepth\@ne%
\beamer@computepref\@itemdepth%
\usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
\usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
\usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
\begin{list}
{%
\usebeamertemplate{itemize \beameritemnestingprefix item}%
}%
{ \itemindent=1.75em%
\def\makelabel##1{%
{%
\hss\llap{{%
\usebeamerfont*{itemize \beameritemnestingprefix item}%
\usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
}%
}%
}
\raggedright
\fi
}
{
\end{list}
\usebeamertemplate{itemize/enumerate \beameritemnestingprefix body end}%
}
\expandafter\let\csname beamer@@tmpop@itemize item@default\endcsname\relax
\expandafter\let\csname beamer@@tmpop@itemize subitem@default\endcsname\relax
\expandafter\let\csname beamer@@tmpop@itemize subsubitem@default\endcsname\relax
\makeatother
%+++++++++++++++++
\rightskip\rightmargin
\title{}
\author{}
\date{}
\begin{document}
\begin{frame}{First section 3\dots}
\begin{figure}[!h]
\centering
\begin{tikzpicture}
\tkzTabInit{$x$ / 1 , $x^{2}-1$ / 1}{$-\infty$, $-1$, $1$, $+\infty$}
\tkzTabLine{ , +, z, -, z, +, }
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
答案1
您需要更改tkz-tab
图片的默认设置,即使其变窄。例如使用\tkzTabInit[lgt=1.2,espcl=2]{...}
。
梅威瑟:
\documentclass{beamer}
\usetheme{Warsaw}
\usepackage[swedish]{babel}
\usepackage{subfig}
\usepackage{tikz,tkz-tab}
\usetikzlibrary{calc}
\usepackage{mathtools, amssymb}
\begin{document}
\begin{frame}{First section 3\dots}
\begin{figure}
\small
\begin{tikzpicture}
\tkzTabInit[lgt=1.2,espcl=2]% new settings for tkz-tab
{$x$ / 1 , $x^{2}-1$ / 1}{$-\infty$, $-1$, $1$, $+\infty$}
\tkzTabLine{ , +, z, -, z, +, }
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
笔记:
beamer load
graphicx` 包,因此不需要再次加载它。- 为什么需要
float
包装?因为在 beamer 中没有浮动,float
所以不需要定位figure
mathtools
加载amsmath
,这样你就不用再加载了
答案2
我看不出在这里使用 tikz 的理由
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[swedish,english]{babel}
\usepackage{float}
\usepackage{subfig}
\usepackage{tikz,tkz-tab}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{graphicx}
\usetikzlibrary{calc}
\usepackage{float}
\usepackage{amssymb}
\usepackage{booktabs}
\usetheme{Warsaw}
\rightskip\rightmargin
%+++++++++++++++++ def block itemize
%+++++++++++++++++
\rightskip\rightmargin
\begin{document}
\begin{frame}{First section 3\dots}
\begin{figure}
\centering
\setlength\tabcolsep{10pt}
\begin{tabular}{@{\hspace{6pt}}*{9}{c}@{\hspace{6pt}}}
\toprule
$x$ & $-\infty$ & & $-1$ & & $1$ & & $\infty$ \\
\midrule
$x^2-1$ & & $+$ & $0$ & $-$ & $0$ & + & \\
\bottomrule
\end{tabular}
\caption{Functional behavior for $x^2-1$}
\end{figure}
\end{frame}
\end{document}