tikzposter 类的 tikzfigure 环境中的文本对齐

tikzposter 类的 tikzfigure 环境中的文本对齐

对于我的海报,我使用tikzfigure其中的环境tikzposter来添加图片。效果很好,但我希望图片标题对齐或左对齐,而不是居中。

我已尝试\justify\begin{flushleft} ... \end{flushleft}在标题内更改tikzposter类文件,但它不起作用。

梅威瑟:

\documentclass[25pt, a0paper, landscape, margin=0mm, innermargin=50mm,
 blockverticalspace=15mm, colspace=30mm, subcolspace=8mm]{tikzposter} 
\geometry{paperwidth=100cm,paperheight=197cm} 
\makeatletter
\setlength{\TP@visibletextwidth}{\textwidth-2\TP@innermargin}
\setlength{\TP@visibletextheight}{\textheight-2\TP@innermargin}
\makeatother
\tikzposterlatexaffectionproofon 
% Commands
\newcommand{\bs}{\textbackslash}   
\newcommand{\cmd}[1]{{\bf \color{red}#1}}   
\usetheme{Simple}
\usebackgroundstyle{Empty}

\begin{document}

    \maketitle

 \begin{columns}%blocks will be placed into columns

                \column{.5}
                    \block{someblock1}{
                     \begin{tikzfigure}[\justify CAPTION HERE]
                     \includegraphics[width=0.40\colwidth] {images/someimage1.pdf}
                     \end{tikzfigure}      
            }

                \column{.5}
                    \block{someblock2}{
                    \begin{flushleft}
                    \begin{tikzfigure}[CAPTION HERE]
                    \includegraphics[width=0.40\colwidth] {images/someimage2.pdf}
                    \end{tikzfigure} 
                    \end{flushleft}
            }

 \end{columns}

 \end{document}

谢谢!

答案1

第一个版本:

把这个放在你的序言中。这里的标题从图开始向左对齐:

\renewenvironment{tikzfigure}[1][]{
  \def \rememberparameter{#1}
  \vspace{10pt}
  \refstepcounter{figurecounter}
  \begin{center}
  \tabular{l}
  }{
    \ifx\rememberparameter\@empty
    \else %nothing
    \\[10pt]
    {\small Fig.~\thefigurecounter: \rememberparameter }
    \fi
  \endtabular
  \end{center}
}

在此处输入图片描述

第二版本:

此处的标题完全与左对齐。

\renewenvironment{tikzfigure}[1][]{
  \def \rememberparameter{#1}
  \vspace{10pt}
  \refstepcounter{figurecounter}
  \begin{center}
  }{
    \ifx\rememberparameter\@empty
    \else %nothing
    \\[10pt]
    {\small Fig.~\thefigurecounter: \rememberparameter \hfill \mbox{}}
    \fi
  \end{center}
}

在此处输入图片描述

代码:

\documentclass[25pt, a0paper, landscape, margin=0mm, innermargin=50mm,
 blockverticalspace=15mm, colspace=30mm, subcolspace=8mm]{tikzposter}
\geometry{paperwidth=100cm,paperheight=197cm}
\makeatletter
\setlength{\TP@visibletextwidth}{\textwidth-2\TP@innermargin}
\setlength{\TP@visibletextheight}{\textheight-2\TP@innermargin}
\makeatother
\tikzposterlatexaffectionproofon
% Commands
\newcommand{\bs}{\textbackslash}
\newcommand{\cmd}[1]{{\bf \color{red}#1}}
\usetheme{Simple}
\usebackgroundstyle{Empty}

%\renewenvironment{tikzfigure}[1][]{
%  \def \rememberparameter{#1}
%  \vspace{10pt}
%  \refstepcounter{figurecounter}
%  \begin{center}
%  \tabular{l}
%  }{
%    \ifx\rememberparameter\@empty
%    \else %nothing
%    \\[10pt]
%    {\small Fig.~\thefigurecounter: \rememberparameter }
%    \fi
%  \endtabular
%  \end{center}
%}

\renewenvironment{tikzfigure}[1][]{
  \def \rememberparameter{#1}
  \vspace{10pt}
  \refstepcounter{figurecounter}
  \begin{center}
  }{
    \ifx\rememberparameter\@empty
    \else %nothing
    \\[10pt]
    {\small Fig.~\thefigurecounter: \rememberparameter \hfill \mbox{}}
    \fi
  \end{center}
}

\begin{document}

    \maketitle

 \begin{columns}%blocks will be placed into columns

                \column{.5}
                    \block{someblock1}{
                     \begin{tikzfigure}[CAPTION HERE]
                     \includegraphics[width=0.40\colwidth] {example-image}
                     \end{tikzfigure}
            }

                \column{.5}
                    \block{someblock2}{
                    \begin{flushleft}
                    \begin{tikzfigure}[CAPTION HERE]
                    \includegraphics[width=0.40\colwidth] {example-image}
                    \end{tikzfigure}
                    \end{flushleft}
            }

 \end{columns}

 \end{document}

如果你想根据每个图形进行操作,你可以使用\parbox

\documentclass[25pt, a0paper, landscape, margin=0mm, innermargin=50mm,
 blockverticalspace=15mm, colspace=30mm, subcolspace=8mm]{tikzposter}
\geometry{paperwidth=100cm,paperheight=197cm}
\makeatletter
\setlength{\TP@visibletextwidth}{\textwidth-2\TP@innermargin}
\setlength{\TP@visibletextheight}{\textheight-2\TP@innermargin}
\makeatother
\tikzposterlatexaffectionproofon
% Commands
\newcommand{\bs}{\textbackslash}
\newcommand{\cmd}[1]{{\bf \color{red}#1}}
\usetheme{Simple}
\usebackgroundstyle{Empty}


\begin{document}

    \maketitle

 \begin{columns}%blocks will be placed into columns

                \column{.5}
                    \block{someblock1}{
                     \begin{tikzfigure}[{\parbox[t]{0.39\colwidth}{CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE }}]
                     \includegraphics[width=0.40\colwidth] {example-image}
                     \end{tikzfigure}
            }

                \column{.5}
                    \block{someblock2}{
                    \begin{flushleft}
                    \begin{tikzfigure}[CAPTION HERE]
                    \includegraphics[width=0.40\colwidth] {example-image}
                    \end{tikzfigure}
                    \end{flushleft}
            }

 \end{columns}

 \end{document}

在此处输入图片描述

请注意,\parbox

\begin{tikzfigure}[{\parbox[t]{0.39\colwidth}{CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE CAPTION HERE }}]

相关内容