Skip to content

Commit

Permalink
v2.1.5
Browse files Browse the repository at this point in the history
Changes:

1. Minor improvements:

  - Smarter `baseline` default for the linguistics library.

  - Yield warning when the `baseline` is set to a node that is not
    drawn (e.g. a `phantom` node).
  • Loading branch information
sasozivanovic committed Jul 14, 2017
1 parent ac0bd11 commit d053d05
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 33 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ v=current
use: currentruntime
echo Trying to switch to forest v$(v) ...
@if ! [[ -d runtime/$(v) && -f runtime/$(v)/forest.sty ]] ; then echo Runtimes files for forest v$(v) don\'t exist! Available versions: `ls runtime | grep -v zip`; false ; fi
@if [[ ! -h $(HOME)/texmf/tex/latex/forest ]] ; then echo Something is wrong with directory $(HOME)/texmf/tex/latex/forest ... it should be a symlink to some version\'s runtime directory. ; false ; fi
ln -sfT $(abspath runtime/$(v)) $(HOME)/texmf/tex/latex/forest
@if [[ ! -h $(HOME)/texmf/tex/latex/forest/latex ]] ; then echo Something is wrong with directory $(HOME)/texmf/tex/latex/forest/latex ... it should be a symlink to some version\'s runtime directory. ; false ; fi
ln -sfT $(abspath runtime/$(v)) $(HOME)/texmf/tex/latex/forest/latex
@texhash 2> /dev/null

used:
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LaTeX package: forest [2017/02/02 v2.1.4 Drawing (linguistic) trees]
LaTeX package: forest [2017/07/14 v2.1.5 Drawing (linguistic) trees]

Copyright (c) 2012-2017 Saso Zivanovic
(Sa\v{s}o \v{Z}ivanovi\'{c})
Expand Down
19 changes: 18 additions & 1 deletion forest-doc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1838,7 +1838,7 @@ \subsection{Package loading and options}

For example, the |linguistics| library defines c-command related nodewalks, changes the default
parent--child edges to south--north (the main package default is border--border) and sets the
baseline to the root node. Thus, if you write |\usepackage[linguistics]{forest}| in your preamble,
baseline to the root\footnote{For details, see \S\ref{sec:library-linguistics}.} node. Thus, if you write |\usepackage[linguistics]{forest}| in your preamble,
or use macro \cmdname{forestapplylibrarydefaults} like below, you get the following:

\begin{forestexample}[tree bin=minipage,index={for step,c-commanded}]
Expand Down Expand Up @@ -2016,6 +2016,15 @@ \subsection{The bracket representation}
\indexitem(none){bracket key>action character}|=|\meta{character}
\end{syntax}

\begin{advise}
\item Careful when setting the \index{opening bracket} to |(|, %)
as an initial |(| %)
is understood as the delimiter of the optional \meta{config} argument of the
\index{environment>forest} environment or \index{macro>Forest} macro. The workaround is to either
provide an empty \meta{config} argument |()|, or put some whitespace (e.g.\ a newline) before the
tree specification.
\end{advise}

By redefining the following two keys, the bracket parser can be used outside \foRest;.
\begin{syntax}
\indexitem{bracket key>new node}|=|\meta{preamble}\meta{node specification}\meta{csname}.
Expand Down Expand Up @@ -6409,6 +6418,14 @@ \subsection{Changelog}
\subsubsection{v2.1}

\begin{description}
\item[v2.1.5 (2017/07/14)] \mbox{}
Minor improvements:
\begin{itemize}
\item Smarter \index{baseline} defaults for the \reflibrary{linguistics} library.
\item Yield warning when the \index{baseline} is set to a node that is not drawn (e.g.\ a
\index{phantom} node).
\end{itemize}

\item[v2.1.4 (2017/02/02)] \mbox{}

Performance:
Expand Down
11 changes: 9 additions & 2 deletions forest-libs.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,15 @@
%\fi
% \librarysection{linguistics}
% \begin{macrocode}
\ProvidesForestLibrary{linguistics}[2017/01/27 v0.1.1]
\ProvidesForestLibrary{linguistics}[2017/07/14 v0.1.2]
% \end{macrocode}
%
% Defaults:
% \begin{macrocode}
\forestset{
linguistics@set@baseline/.style={
if phantom={for next node=linguistics@set@baseline}{baseline}
},
libraries/linguistics/defaults/.style={
default preamble={
% \end{macrocode}
Expand All @@ -59,8 +62,12 @@
sn edges,
% \end{macrocode}
% The root of the tree will be aligned with the text \dots\ or, more commonly, the example number.
% More precisely, we actually align the first (in linear order) non-phantom node. This covers the
% common case of side-by-side trees joined with a phantom root.
% \begin{macrocode}
baseline,
before drawing tree={
if nodewalk valid={name=forest@baseline@node}{}{linguistics@set@baseline},
},
% \end{macrocode}
% Enable (centered) multi-line nodes.
% \begin{macrocode}
Expand Down
64 changes: 37 additions & 27 deletions forest.dtx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
% \CheckSum{16623}
% \CheckSum{16651}
% \iffalse meta-comment
% forest.dtx
%% `forest' is a `pgf/tikz'-based package for drawing (linguistic) trees.
Expand Down Expand Up @@ -83,7 +83,7 @@
%
% \section{Identification}
% \begin{macrocode}
\ProvidesPackage{forest}[2017/02/02 v2.1.4 Drawing (linguistic) trees]
\ProvidesPackage{forest}[2017/07/14 v2.1.5 Drawing (linguistic) trees]

\RequirePackage{tikz}[2013/12/13]
\usetikzlibrary{shapes}
Expand Down Expand Up @@ -4079,7 +4079,7 @@
\pgfkeyssetvalue{#1'/option@name}{#3}%
\forest@copycommandkey{#1+}{#1}%
\pgfkeysalso{#1-/.code={%
\forest@fornode{register}{%
\forest@fornode{}{%
\forest@node@removekeysfromkeylist{##1}{#3}%
}}}%
\pgfkeyssetvalue{#1-/option@name}{#3}%
Expand Down Expand Up @@ -5178,7 +5178,7 @@
#4%
\let\forest@temp@pgfmathpostparse\pgfmathpostparse
\let\pgfmathpostparse\forest@aggregate@pgfmathpostparse
\forestmath@convert@to\forestmathtype@dimen{\forestmathresult}
\forestmath@convert@to\forestmathtype@dimen{\forestmathresult}%
\pgfmathqparse{\forestmathresult}%
\let\pgfmathpostparse\forest@temp@pgfmathpostparse
\forestrlet{aggregate result}\pgfmathresult
Expand Down Expand Up @@ -5359,7 +5359,7 @@
\ifx\forest@nodewalk@config@oninvalid\forest@nodewalk@oninvalid@inherited@text
\edef\forest@nodewalk@config@oninvalid{\forest@nodewalk@oninvalid}%
\fi
\edef\forest@marshal{%
\edef\forest@nw@marshal{%
\noexpand\pgfqkeys{/forest/nodewalk}{\unexpanded{#1}}%
\csname forest@nodewalk@config@everystep@\forest@nodewalk@config@everystep@method @after\endcsname
\csname forest@nodewalk@config@history@\forest@nodewalk@config@history@method @after\endcsname
Expand All @@ -5368,8 +5368,10 @@
\csname forest@nodewalk@config@everystep@\forest@nodewalk@config@everystep@method @before\endcsname{#2}%
\csname forest@nodewalk@config@history@\forest@nodewalk@config@history@method @before\endcsname
\edef\forest@nodewalk@oninvalid{\forest@nodewalk@config@oninvalid}%
\forest@nodewalk@fakefalse
\forest@marshal
\forest@saveandrestoreifcs{forest@nodewalk@fake}{%
\forest@nodewalk@fakefalse
\forest@nw@marshal
}%
}
\pgfmathdeclarefunction{valid}{1}{%
\forest@forthis{%
Expand Down Expand Up @@ -5488,15 +5490,15 @@
\expandafter\forest@temp@toks\expandafter{\expandafter\forest@saveandrestoremacro\expandafter\forest@nodewalk@currentstepname\expandafter{\the\forest@temp@toks}}%
\ifforestdebugnodewalks
\epretotoks\forest@temp@toks{\noexpand\typeout{Starting step "#1" from id=\noexpand\forest@cn
\ifnum\forest@nodewalkstephandler@nargs>0 \space with args ####1\fi
\ifnum\forest@nodewalkstephandler@nargs>1 ,####2\fi
\ifnum\forest@nodewalkstephandler@nargs>2 ,####3\fi
\ifnum\forest@nodewalkstephandler@nargs>3 ,####4\fi
\ifnum\forest@nodewalkstephandler@nargs>4 ,####5\fi
\ifnum\forest@nodewalkstephandler@nargs>5 ,####6\fi
\ifnum\forest@nodewalkstephandler@nargs>6 ,####7\fi
\ifnum\forest@nodewalkstephandler@nargs>7 ,####8\fi
\ifnum\forest@nodewalkstephandler@nargs>8 ,####9\fi
\ifnum\forest@nodewalkstephandler@nargs>0 \space with args \noexpand\unexpanded{####1}\fi
\ifnum\forest@nodewalkstephandler@nargs>1 ,\noexpand\unexpanded{####2}\fi
\ifnum\forest@nodewalkstephandler@nargs>2 ,\noexpand\unexpanded{####3}\fi
\ifnum\forest@nodewalkstephandler@nargs>3 ,\noexpand\unexpanded{####4}\fi
\ifnum\forest@nodewalkstephandler@nargs>4 ,\noexpand\unexpanded{####5}\fi
\ifnum\forest@nodewalkstephandler@nargs>5 ,\noexpand\unexpanded{####6}\fi
\ifnum\forest@nodewalkstephandler@nargs>6 ,\noexpand\unexpanded{####7}\fi
\ifnum\forest@nodewalkstephandler@nargs>7 ,\noexpand\unexpanded{####8}\fi
\ifnum\forest@nodewalkstephandler@nargs>8 ,\noexpand\unexpanded{####9}\fi
}}%
\fi
\def\forest@temp{/forest/nodewalk/#1/.code}%
Expand Down Expand Up @@ -8642,16 +8644,21 @@
}%
\forest@node@Ifnamedefined{forest@baseline@node}{%
\edef\forest@baseline@id{\forest@node@Nametoid{forest@baseline@node}}%
\ifcsdef{forest@drawn@\forest@baseline@id}{%
\edef\forest@marshal{%
\noexpand\pgfsetbaselinepointlater{%
\noexpand\pgfpointanchor
{\forestOve{\forest@baseline@id}{name}}%
{\forestOve{\forest@baseline@id}{anchor}}%
}%
}\forest@marshal
}{}%
}{}%
\ifnum\forest@baseline@id=0
\else
\ifcsdef{forest@drawn@\forest@baseline@id}{%
\edef\forest@marshal{%
\noexpand\pgfsetbaselinepointlater{%
\noexpand\pgfpointanchor
{\forestOve{\forest@baseline@id}{name}}%
{\forestOve{\forest@baseline@id}{anchor}}%
}%
}\forest@marshal
}{%
\PackageWarning{forest}{Baseline node (id=\forest@cn) was not drawn (most likely it's a phantom node)}%
}%
\fi
}%
\forest@clear@drawn
}
\def\forest@draw@node{%
Expand Down Expand Up @@ -10885,7 +10892,10 @@
\forest@global@marshal
}
% \end{macrocode}
%
% Fill in the values of the invalid node. (It's now easy to test for |id=0|.)
% \begin{macrocode}
\forest@node@init
% \end{macrocode}
% \section{Compatibility with previous versions}
% \begin{macrocode}
\ifdefempty{\forest@compat}{}{%
Expand Down

0 comments on commit d053d05

Please sign in to comment.