-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/

Alan Munn
  • 218,180
oliver
  • 339
  • 1
    beamerposter doesn't force xelatex. – Torbjørn T. Oct 02 '17 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 02 '17 at 19:19
  • (Sorry, my comment was a bit terse.) That might be so, but beamerposter in itself doesn't force xelatex, so it's the specific code you're using that's the problem. The following works fine with pdflatex, or latex+dvips+ps2pdf: \documentclass{beamer} \usepackage{beamerposter} \begin{document} \begin{frame} foo \end{frame} \end{document} – Torbjørn T. Oct 02 '17 at 19:22
  • @TorbjørnT. Yes, it's very likely that the inclusion of particular templates forces XeLaTeX. Building a beamerposter from scratch instead of using a template just in order to use an arrow is not worth the effort. So, I'm looking for a solution that will generally work for XeLaTeX and beamerposter templates. – oliver Oct 02 '17 at 19:46
  • 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 03 '17 at 15:01
  • @AlanMunn Hi Alan, thanks for your reply. Yes, I've (so far) tried to minimize the effort hoping that someone knows a simple solution to this problem. I'd be more than happy to simply be able to use forest for the arrows in the bracketed examples, but is it even possible? (I do use forest in some other files for tree drawing but not for arrows in brackets). – oliver Oct 03 '17 at 15:32
  • 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 03 '17 at 16:39
  • @AlanMunn My other question has already been deleted, as was suggested earlier. You mean the overleaf link is not enough and I have to make an entire beamerposter template with a .sty file instead? (the problem lies probably in the .sty file, bot beamerposter as such). A lot of work in order to just get an arrow... Does forest allow for arrows in bracketed examples by any chance? That would solve the problem right away. – oliver Oct 03 '17 at 17:06
  • 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 03 '17 at 17:32
  • @AlanMunn Yes, I do claim in my comment that the solution in the linked question doesn't work for certain beamerposter templates that I have tried it for. https://www.overleaf.com/11396506yxdxbwnwbhpw#/43033242/ This is my first ever attempt at beamerposter so excuse my usage of overleaf. Some have said elsewhere that it should be used exactly because it is easy to fix the code. – oliver Oct 03 '17 at 17:42

1 Answers1

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

Alan Munn
  • 218,180
  • 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 03 '17 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 03 '17 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 03 '17 at 21:03