如何使块与文本块对齐?

如何使块与文本块对齐?

我正在尝试使用 beamerposter 制作海报。我使用 textpos 包在海报上定位文本块。在文本块中,我使用 block 获取标题和具有自定义配色方案的项目列表。但是,块与文本块不对齐。我使用 showboxes 选项显示文本块的轮廓,并使用 eso-pic 包帮助我定位,它显示块向下和向左移动。

\documentclass[final]{beamer}

\usepackage[T1]{fontenc}
\usepackage{helvet}
\usepackage{xcolor}
\usepackage[showboxes,absolute,overlay]{textpos}

\usepackage[texcoord,grid,gridunit=mm,gridcolor=red!50,subgridcolor=green!50]{eso-pic}

\usepackage[size=a1,orientation=landscape,scale=1.8]{beamerposter}

\setbeamertemplate{blocks}[shadow=false]
\setbeamertemplate{itemize item}[circle]

\definecolor{Aquamarine}{rgb}{0.5,1.0,0.83}
\definecolor{Gainsboro}{rgb}{0.86,0.86,0.86}
\definecolor{Black}{rgb}{0.0,0.0,0.0}

\setbeamercolor{block title}{fg=Black,bg=Aquamarine}
\setbeamercolor{block body}{bg=Gainsboro,fg=Black}
\setbeamercolor{itemize item}{fg=Black}
\setbeamercolor{itemize subitem}{fg=Black}

\usefonttheme{default}

\begin{document}

\begin{frame}{}

\begin{textblock*}{200mm}(100mm,100mm)
    \begin{block}{
        \centering
        \textbf{The block title}
          }
    \begin{itemize}
        \item some text
        \item more text
        \item even more text

    \end{itemize}
    \end{block}
\end{textblock*}

\end{frame}

\end{document}

代码输出

答案1

当我编译您的代码时,我得到的结果与您的不同。 bloch 居中,水平偏移(左和右)。 您是否已更新到 textpos 的最新版本?在此处输入图片描述

答案2

我找到了一种解决我的问题的方法,即使用 tcolorbox 而不是块:

\documentclass[final]{beamer}

\usepackage[T1]{fontenc}
\usepackage{helvet}
\usepackage{xcolor}
\usepackage[showboxes,absolute,overlay]{textpos}

\usepackage{tcolorbox} %use this instead of blocks

\usepackage[texcoord,grid,gridunit=mm,gridcolor=red!50,subgridcolor=green!50]{eso-pic}

\usepackage[size=a1,orientation=landscape,scale=1.8]{beamerposter}

\setbeamertemplate{blocks}[shadow=false]
\setbeamertemplate{itemize item}[circle]

\definecolor{Aquamarine}{rgb}{0.5,1.0,0.83}
\definecolor{Gainsboro}{rgb}{0.86,0.86,0.86}
\definecolor{Black}{rgb}{0.0,0.0,0.0}

\setbeamercolor{block title}{fg=Black,bg=Aquamarine}
\setbeamercolor{block body}{bg=Gainsboro,fg=Black}
\setbeamercolor{itemize item}{fg=Black}
\setbeamercolor{itemize subitem}{fg=Black}

\usefonttheme{default}

\begin{document}

\begin{frame}{}

\begin{textblock*}{200mm}(100mm,100mm)
    \begin{block}{
        \centering
        \textbf{Normal block}
          }
    \begin{itemize}
        \item has horizontal offset
        \item more text
        \item even more text

    \end{itemize}
    \end{block}
\end{textblock*}

\begin{textblock*}{200mm}(100mm,200mm)
    \begin{tcolorbox}
    \centering
    \textbf{tcolorbox}
    \tcblower
    \begin{itemize}
        \item no horizontal offset 
        \item more text
        \item even more text

    \end{itemize}
    \end{tcolorbox}
\end{textblock*}

\end{frame}

\end{document}

在此处输入图片描述

tcolorbox 与文本块水平对齐。现在我只需要弄清楚如何按我想要的方式设置配色方案...

相关内容