我怎样才能创建一条水平线,其中 pp 点位于上方,参考点位于下方,这样就整齐了?

我怎样才能创建一条水平线,其中 pp 点位于上方,参考点位于下方,这样就整齐了?

这正是我想要的那种线条。我希望参考资料就在页的正下方,而不是倾斜的,因为我最终编码了

\documentclass{beamer}
\usepackage{graphicx} % Required for inserting images
\usepackage{ctex, hyperref}
\usepackage[T1]{fontenc}
\usepackage{latexsym,amsmath,xcolor,multicol,booktabs,calligra}
\usepackage{graphicx,pstricks,listings,stackengine}
\usepackage{tabularx}
\usepackage{parskip}
\usepackage{titlesec}
\usepackage{setspace}
\usepackage{ragged2e}
\usepackage{tikz}
\usetikzlibrary{snakes}
\usepackage{rotating}
\usepackage{relsize}
\usepackage{chronology}
\usetikzlibrary{positioning,shapes.geometric, arrows.meta,chains, arrows.spaced}
\usepackage[overlay]{textpos}
\usepackage{lmodern}
\usepackage{forest}
\usepackage{booktabs}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amsopn} 
\usepackage[table]{xcolor}
\usepackage{multirow}
%\usepackage{newtxtext,newtxmath}
%\usetheme{Darmstadt}
\usetheme{Madrid}
%\usecolortheme{seahorse}
\let\tempItemizeBeg\itemize
\let\tempItemizeEnd\enditemize
\renewenvironment{itemize}{\tempItemizeBeg \justifying}{\tempItemizeEnd}

\begin{document}
\begin{frame}{Effect Sizes}
\begin{itemize}
    \item{\scriptsize Mauryama,(2014):Non-coresident parents-higher chance of longevity}
    \item {\scriptsize Varghese and Roy,(2019): Reduces anaemia in pregnant women}
    \item {\scriptsize Anukriti et al.,(2019): Likelihood to Visit HC}
\end{itemize}
%\vspace{-3cm}
\begin{center}
    \begin{tikzpicture}
        % draw horizontal line   
        \draw (-5,0) -- (6,0);
    
    
  
    
    % draw nodes
    \hspace{-1cm}
    \draw (-2,0) node[below=3pt] {$ $} node[above=3pt] {$\begin{turn}{0}  \textbf{3pp} \end{turn} $};
    \hspace{0.5cm}
    \draw (0,0) node[below=3pt] {$  $} node[above=3pt] {$\begin{turn}{0}\textbf {5.32pp} {$\begin{turn}{45}Mauryama,(2014) \end{turn}$}\end{turn}$};
     \hspace{2.5cm}
    \draw (0,0) node[below=3pt] {$  $} node[above=3pt] {$\begin{turn}{0}\textbf {(-)13.2pp} {$\begin{turn}{45}Varghese and Roy,(2019) \end{turn}$}\end{turn}$};
     \hspace{2.5cm}
    \draw (0,0) node[below=3pt] {$  $} node[above=3pt] {$\begin{turn}{0}\textbf {(-)13.4pp} {$\begin{turn}{45}Anukriti et al.,(2019) \end{turn}$}\end{turn}$};
   
           
\end{tikzpicture}
\end{center} 

\end{frame}
\end{document}

答案1

  • 你真的应该清理一下你的前言。特别是如果你是 Latex 新手,请只加载你在本文档中使用的包。这将避免因包之间的交互而遇到问题。

    如果您使用 beamer 类,这一点就更加重要。许多包是为普通文档类设计的,与 beamer 一起使用不一定是个好主意。

  • 重新定义 itemize 环境并不是最好的主意。您会失去 beamer 添加到此环境的所有额外好处,例如 overlay-awareness。

  • 如果您在不结束段落的情况下切换字体大小,行间距就会出错。相反,您可以简单地设置适当的 beamer 字体,beamer 会为您更改项目中的字体大小

  • 也许阅读 tikz 简介会很有用。你可以在用户指南的开头找到教程https://texdoc.org/serve/tikz/0。如果您更喜欢书籍,当前 TUGBoat 中有一篇关于 tikz 书籍的评论:https://tug.org/TUGboat/tb44-3/tb138reviews-kottwitz-tikz.pdf

    简而言之:您可以使用简单的语法将文本放置在 tikz 图片中\node at (2,4) {text}。Tikz 也可以自动放置此类节点,但如果您是完全的初学者,绝对坐标可能更直观。

\documentclass[xcolor={table}]{beamer}

\usepackage[T1]{fontenc}
\usepackage{ragged2e}
\usepackage{tikz}
\usetheme{Madrid}

\usepackage{xpatch}
\xpatchcmd{\itemize}{\raggedright}{\justifying}{}{}
\setbeamerfont{itemize/enumerate body}{size=\scriptsize}

\begin{document}
\begin{frame}
    \frametitle{Effect Sizes}
    \begin{itemize}
        \item Mauryama (2014): Non-coresident parents-higher chance of longevity
        \item Varghese and Roy (2019): Reduces anaemia in pregnant women
        \item Anukriti et al. (2019): Likelihood to Visit HC
    \end{itemize}
    
    \vfill
    \centering
    \begin{tikzpicture}
        \draw (-3,0) -- (6,0);
        \draw (-2,0.1) -- (-2,-0.1);
        \draw (2,0.1) -- (2,-0.1);
        \node[font=\bfseries,anchor=south] at (-2,0.15) {3pp};
        \node[font=\bfseries,anchor=south] at (2,0.15) {5.32pp};
        \node[anchor=north,text width=3cm,align=center] at (-2,-0.15) {Mauryama (2014)};
        \node[anchor=north,text width=3cm,align=center] at (2,-0.15) {Varghese and Roy (2019)};
    \end{tikzpicture}
\end{frame}
\end{document}

在此处输入图片描述

相关内容