-2

How to draw simple movement arrows under XeLaTeX? I must do a poster with beamerposter (which unfortunately works under XeLaTeX). Preferably compatible with linguex AND g4be.

I'm literally looking for a way to do nothing but a simple tree-dvips arrow like below. This one is generated under LaTeX, not XeLaTeX, hence my question.

\documentclass[11pt]{article}
\usepackage{url}
\usepackage[normalem]{ulem} 
\usepackage{linguex}
\usepackage{tree-dvips}
\begin{document}

  \ex.
  \node{c}{\strut A} {} \ldots {} [ B {\sout{[ \node{a} A ]}}]

  \abarnodeconnect[-12pt]{a}{c}

\end{document}

enter image description here

Note, the following solution does NOT work in beamerposter (or maybe just not with my template): Movement arrow in gloss

To illustrate the problem, see the Introduction section where this example is generated but without arrows (packages are added under \documentclass[final]{beamer}): https://www.overleaf.com/11396506yxdxbwnwbhpw#/43033242/

10
  • 1
    beamerposter doesn't force xelatex. Oct 2, 2017 at 19:09
  • Perhaps, but I can only get beamerposter generated when I run it through XeLaTeX, all my beamerposters (no matter what the template) get the "% End of enclosing frame" problem when run with LaTeX (may be due to templates). Nevertheless, I'm also using a skeleton for a different project and it only runs on XeLaTeX, so I'm looking for a solution that will serve both purposes at once.
    – oliver
    Oct 2, 2017 at 19:19
  • 1
    You've asked about beamerposter but your example code uses article. And you claim the the linked question 'doesn't work, but you don't provide code that shows how it doesn't work. People will be happy to help you, but you need to give us concrete examples to work with.
    – Alan Munn
    Oct 3, 2017 at 15:01
  • 1
    Well it's not minimizing the work since the solution in the linked question presumably works for article class. And when I commented on your other question it was totally unclear what you wanted tree-dvips for. But since you like the beamerposter template documents that use XeLaTeX, then it seems you should show why the solution in the linked question doesn't work with your beamerposter file and we'll try to solve that problem. So make a minimal document (don't just post a link to your document) showing that and edit this question (and delete your other one.)
    – Alan Munn
    Oct 3, 2017 at 16:39
  • 2
    This is not a "fix the code in my document site", it's a question answer site. So you need to do the work needed to show that the problem you're having. And you claim in your comment that the solution in the linked question doesn't work but your linked document doesn't even show that attempt. And no, forest doesn't do what you want, so that linked question is probably your best chance at a working solution. And you've even got the person who wrote that answer responding to you. But you're really not doing much to help here.
    – Alan Munn
    Oct 3, 2017 at 17:32

1 Answer 1

6

I shouldn't do this, because you really need to learn to ask a proper question. But here is a minimal working document that shows the problem, followed by a solution. (In fact this is not totally minimal; it could be made more minimal by removing first block).

This template (as with many) is full of bad LaTeX code. For example, using \small{...} and \rmfamily{...} as if they take arguments, which they don't. One of the many problems with templates.

\documentclass[final]{beamer}

\usepackage[scale=1.24]{beamerposter} % Use the beamerposter package for laying out the poster
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand\tikzmark[1]{\tikz[remember picture, baseline=(#1.base)] \node[anchor=base,inner sep=0pt, outer sep=0pt] (#1) {#1};}

% This code from http://tex.stackexchange.com/q/55068/2693
\tikzset{
    ncbar angle/.initial=90,
    ncbar/.style={
        to path=(\tikztostart)
        -- ($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)
        -- ($(\tikztotarget)!($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztostart)$)
        -- (\tikztotarget)
    },
    ncbar/.default=0.5cm,
}

% Thanks to Paul Gessler adn Percusse for code improvement here
\newcommand{\arrow}[2]{\begin{tikzpicture}[remember picture,overlay]
\draw[->,shorten >=3pt,shorten <=3pt] (#1.base) to [ncbar=\arrowht] (#2.base);
\end{tikzpicture}
\setlength{\arrowht}{0ex}
}
\usepackage{gb4e}
% The following code modified from 
% http://permalink.gmane.org/gmane.comp.tex.linguistics/1036
% This adds some extra space after the first line
\newlength{\arrowht}
\setlength{\arrowht}{0ex}
\newcommand*\cgdepthstrut{{\vrule height 0pt depth \arrowht width 0pt}}
\renewcommand\eachwordone{\cgdepthstrut\rmfamily}

\renewcommand\glt{\vskip -\topsep}
\let\trans=\glt
\newcommand\arrowex{\setlength{\arrowht}{2.5ex}\ex}


\usetheme{confposter} % Use the confposter theme supplied with this template

\setbeamercolor{block title}{fg=ngreen,bg=white} % Colors of the block titles
\setbeamercolor{block body}{fg=black,bg=white} % Colors of the body of blocks
\setbeamercolor{block alerted title}{fg=white,bg=dblue!70} % Colors of the highlighted block titles
\setbeamercolor{block alerted body}{fg=black,bg=dblue!10} % Colors of the body of highlighted blocks
% Many more colors are available for use in beamerthemeconfposter.sty

%-----------------------------------------------------------
% Define the column widths and overall poster size
% To set effective sepwid, onecolwid and twocolwid values, first choose how many columns you want and how much separation you want between columns
% In this template, the separation width chosen is 0.024 of the paper width and a 4-column layout
% onecolwid should therefore be (1-(# of columns+1)*sepwid)/# of columns e.g. (1-(4+1)*0.024)/4 = 0.22
% Set twocolwid to be (2*onecolwid)+sepwid = 0.464
% Set threecolwid to be (3*onecolwid)+2*sepwid = 0.708

\newlength{\sepwid}
\newlength{\onecolwid}
\newlength{\twocolwid}
\newlength{\threecolwid}
\setlength{\paperwidth}{48in} % A0 width: 46.8in
\setlength{\paperheight}{36in} % A0 height: 33.1in
\setlength{\sepwid}{0.024\paperwidth} % Separation width (white space) between columns
\setlength{\onecolwid}{0.22\paperwidth} % Width of one column
\setlength{\twocolwid}{0.464\paperwidth} % Width of two columns
\setlength{\threecolwid}{0.708\paperwidth} % Width of three columns
\setlength{\topmargin}{-0.5in} % Reduce the top margin size
%-----------------------------------------------------------

%----------------------------------------------------------------------------------------
%   TITLE SECTION 
%----------------------------------------------------------------------------------------

\title{Unnecessarily Complicated Research Title} % Poster title

\author{John Smith, James Smith and Jane Smith} % Author(s)

\institute{Department and University Name} % Institution(s)

%----------------------------------------------------------------------------------------

\begin{document}

\addtobeamertemplate{block end}{}{\vspace*{2ex}} % White space under blocks
\addtobeamertemplate{block alerted end}{}{\vspace*{2ex}} % White space under highlighted (alert) blocks

\setlength{\belowcaptionskip}{2ex} % White space under figures
\setlength\belowdisplayshortskip{2ex} % White space under equations

\begin{frame}[t] % The whole poster is enclosed in one beamer frame

\begin{columns}[t] % The whole poster consists of three major columns, the second of which is split into two columns twice - the [t] option aligns each column's content to the top

\begin{column}{\sepwid}\end{column} % Empty spacer column

\begin{column}{\onecolwid} % The first column

%----------------------------------------------------------------------------------------
%   OBJECTIVES
%----------------------------------------------------------------------------------------

\begin{alertblock}{Objectives}

Lorem ipsum dolor sit amet, consectetur, nunc tellus pulvinar tortor, commodo eleifend risus arcu sed odio:
\begin{itemize}
\item Mollis dignissim, magna augue tincidunt dolor, interdum vestibulum urna
\item Sed aliquet luctus lectus, eget aliquet leo ullamcorper consequat. Vivamus eros sem, iaculis ut euismod non, sollicitudin vel orci.
\item Nascetur ridiculus mus.  
\item Euismod non erat. Nam ultricies pellentesque nunc, ultrices volutpat nisl ultrices a.
\end{itemize}

\end{alertblock}

%----------------------------------------------------------------------------------------
%   INTRODUCTION
%----------------------------------------------------------------------------------------

\begin{block}{Introduction}

\begin{exe}
\ex\label{scramble-det}
\begin{xlist}
        \arrowex 
        \gll 
        \ldots dat Jan \tikzmark{een} auto gisteren \tikzmark{t}  gekregen heeft.\\
        \ldots that John a car  yesterday t gotten has \\
       \ldots that John a car yesterday.
        \arrow{t}{een}
\end{xlist}
\end{exe}

\begin{exe}
\ex\label{scramble-det}
\begin{xlist}
        \ex 
        \gll 
        \ldots dat Jan een auto gisteren t gekregen heeft.\\
        \ldots that John a car  yesterday t gotten has \\
       \ldots that John a car yesterday.
\end{xlist}
\end{exe}

\end{block}
\end{column}
\end{columns}
\end{frame}
\end{document}

output of code

This clearly shows (1) that the arrow code does work (two compilations are needed) but that gb4e and beamerposter have a weird interaction. If you had posted this document, you would have received an answer much more quickly.

First, you're using the gb4e glossing macros incorrectly. The last line of the example (the free translation) should be introduced by \glt or \trans (they are alternate names for the same macro).

Because of the way beamerposter handles fontsizes, it seems that it doesn't play well with gb4e out of the box. But this is easily solved by using the \eachwordone and \eachwordtwo (and \eachwordthree if you use \glll) macros which define the fonts for the gloss lines. I've added \normalsize to these definitions and now they scale correctly. So here's the final code.

\documentclass[final]{beamer}

\usepackage[scale=1.24]{beamerposter} % Use the beamerposter package for laying out the poster
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand\tikzmark[1]{\tikz[remember picture, baseline=(#1.base)] \node[anchor=base,inner sep=0pt, outer sep=0pt] (#1) {#1};}

% This code from http://tex.stackexchange.com/q/55068/2693
\tikzset{
    ncbar angle/.initial=90,
    ncbar/.style={
        to path=(\tikztostart)
        -- ($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)
        -- ($(\tikztotarget)!($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztostart)$)
        -- (\tikztotarget)
    },
    ncbar/.default=0.5cm,
}

% Thanks to Paul Gessler adn Percusse for code improvement here
\newcommand{\arrow}[2]{\begin{tikzpicture}[remember picture,overlay]
\draw[->,shorten >=3pt,shorten <=3pt] (#1.base) to [ncbar=\arrowht] (#2.base);
\end{tikzpicture}
\setlength{\arrowht}{0ex}
}
\usepackage{gb4e}
\noautomath % <---- added (avoids clashes with gb4e)
% The following code modified from 
% http://permalink.gmane.org/gmane.comp.tex.linguistics/1036
% This adds some extra space after the first line
\newlength{\arrowht}
\setlength{\arrowht}{0ex}
\newcommand*\cgdepthstrut{{\vrule height 0pt depth \arrowht width 0pt}}
\renewcommand\eachwordone{\cgdepthstrut\rmfamily\normalsize} % <---- modified
\renewcommand\eachwordtwo{\rmfamily\normalsize}   % <---- added
\renewcommand\glt{\vskip -\topsep}
\let\trans=\glt
\newcommand\arrowex{\setlength{\arrowht}{2.5ex}\ex}


\usetheme{confposter} % Use the confposter theme supplied with this template

\setbeamercolor{block title}{fg=ngreen,bg=white} % Colors of the block titles
\setbeamercolor{block body}{fg=black,bg=white} % Colors of the body of blocks
\setbeamercolor{block alerted title}{fg=white,bg=dblue!70} % Colors of the highlighted block titles
\setbeamercolor{block alerted body}{fg=black,bg=dblue!10} % Colors of the body of highlighted blocks
% Many more colors are available for use in beamerthemeconfposter.sty

%-----------------------------------------------------------
% Define the column widths and overall poster size
% To set effective sepwid, onecolwid and twocolwid values, first choose how many columns you want and how much separation you want between columns
% In this template, the separation width chosen is 0.024 of the paper width and a 4-column layout
% onecolwid should therefore be (1-(# of columns+1)*sepwid)/# of columns e.g. (1-(4+1)*0.024)/4 = 0.22
% Set twocolwid to be (2*onecolwid)+sepwid = 0.464
% Set threecolwid to be (3*onecolwid)+2*sepwid = 0.708

\newlength{\sepwid}
\newlength{\onecolwid}
\newlength{\twocolwid}
\newlength{\threecolwid}
\setlength{\paperwidth}{48in} % A0 width: 46.8in
\setlength{\paperheight}{36in} % A0 height: 33.1in
\setlength{\sepwid}{0.024\paperwidth} % Separation width (white space) between columns
\setlength{\onecolwid}{0.22\paperwidth} % Width of one column
\setlength{\twocolwid}{0.464\paperwidth} % Width of two columns
\setlength{\threecolwid}{0.708\paperwidth} % Width of three columns
\setlength{\topmargin}{-0.5in} % Reduce the top margin size
%-----------------------------------------------------------

%----------------------------------------------------------------------------------------
%   TITLE SECTION 
%----------------------------------------------------------------------------------------

\title{Unnecessarily Complicated Research Title} % Poster title

\author{John Smith, James Smith and Jane Smith} % Author(s)

\institute{Department and University Name} % Institution(s)

%----------------------------------------------------------------------------------------

\begin{document}

\addtobeamertemplate{block end}{}{\vspace*{2ex}} % White space under blocks
\addtobeamertemplate{block alerted end}{}{\vspace*{2ex}} % White space under highlighted (alert) blocks

\setlength{\belowcaptionskip}{2ex} % White space under figures
\setlength\belowdisplayshortskip{2ex} % White space under equations

\begin{frame}[t] % The whole poster is enclosed in one beamer frame

\begin{columns}[t] % The whole poster consists of three major columns, the second of which is split into two columns twice - the [t] option aligns each column's content to the top

\begin{column}{\sepwid}\end{column} % Empty spacer column

\begin{column}{\onecolwid} % The first column

%----------------------------------------------------------------------------------------
%   OBJECTIVES
%----------------------------------------------------------------------------------------

\begin{alertblock}{Objectives}

Lorem ipsum dolor sit amet, consectetur, nunc tellus pulvinar tortor, commodo eleifend risus arcu sed odio:
\begin{itemize}
\item Mollis dignissim, magna augue tincidunt dolor, interdum vestibulum urna
\item Sed aliquet luctus lectus, eget aliquet leo ullamcorper consequat. Vivamus eros sem, iaculis ut euismod non, sollicitudin vel orci.
\item Nascetur ridiculus mus.  
\item Euismod non erat. Nam ultricies pellentesque nunc, ultrices volutpat nisl ultrices a.
\end{itemize}

\end{alertblock}

%----------------------------------------------------------------------------------------
%   INTRODUCTION
%----------------------------------------------------------------------------------------

\begin{block}{Introduction}

\begin{exe}
\ex\label{scramble-det}
\begin{xlist}
        \arrowex 
        \gll 
        \ldots dat Jan \tikzmark{een} auto gisteren \tikzmark{t}  gekregen heeft.\\
        \ldots that John a car  yesterday t gotten has \\
        \glt\ldots that John a car yesterday.  % <--- added \glt
        \arrow{t}{een}
\end{xlist}
\end{exe}

\begin{exe}
\ex\label{scramble-det}
\begin{xlist}
        \ex 
        \gll 
        \ldots dat Jan een auto gisteren t gekregen heeft.\\
        \ldots that John a car  yesterday t gotten has \\
        \glt\ldots that John a car yesterday. % <--- added \glt
\end{xlist}
\end{exe}

\end{block}
\end{column}
\end{columns}
\end{frame}
\end{document}

output of code

3
  • Thanks a lot, Alan! Excellent. This not only solves the problem but it does have an educational import, too. However, there were reasons I did not want to confine this question to beamerposter only (as I mentioned, the same problem appears in certain more complex environment I work with, a skeleton with a modified g4be and a few other templates working under XeLaTeX) and I aimed for having a generic answer. Thanks!
    – oliver
    Oct 3, 2017 at 20:25
  • 1
    @oliver Sorry to be so blunt, but if you are still trying to rationalize your question as serving some larger purpose, you really need to think about the comments on this question much more carefully.
    – Alan Munn
    Oct 3, 2017 at 20:56
  • Oh, I have thought about the comments on this question very carefully, and I have my conclusions, don't worry about this, Alan.
    – oliver
    Oct 3, 2017 at 21:03

You must log in to answer this question.

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