7

For my poster I am using the tikzfigure environment within tikzposter to add figures. It works fine, but I want to have the figure captions justified or left aligned instead of centered.

I have tried \justify or \begin{flushleft} ... \end{flushleft} within the caption, changing the tikzposter class file but it does not work.

MWE:

\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}

Thanks!

2
  • Would you mind to include some Minimal Working Example to play with. Please from \documentclass to \end{document} and including all packages related with your problem. It will be easy to help you. Thanks.
    – Ignasi
    Apr 10, 2015 at 9:22
  • My apologies. I have added a MWE.
    – jon86
    Apr 10, 2015 at 9:51

1 Answer 1

4

First version:

Put this in your preamble. Here the caption is aligned to the left starting with the figure:

\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}
}

enter image description here

Second version:

Here the caption is aligned totally to the left.

\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}
}

enter image description here

Code:

\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}

If you want to do it on per figure basis you may use a \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}

enter image description here

Please note that an extra pair of braces is needed surroung the \parbox in

\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 }}]
5
  • Thanks!But now I the lines don't break according to the column end. How do I fix that?
    – jon86
    Apr 10, 2015 at 10:36
  • @jon86 In which version do you want the modification for breaking lines?
    – user11232
    Apr 10, 2015 at 10:38
  • Kumar. The first version. Is it maybe also possible to do this for each caption seperately?
    – jon86
    Apr 10, 2015 at 11:19
  • @jon86 Instead of l column, use p column with a width equal to the width of the figure (here 0.4\colwidth. You have to do it manually).
    – user11232
    Apr 10, 2015 at 13:27
  • 1
    @jon86 line break and per figure basis added now.
    – user11232
    Apr 10, 2015 at 13:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .