%\iffalse
%<*copyright>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% artthreads.sty package,                              %%
%% Copyright (C) 2016 -- 2020                           %%
%%   dpstory@uakron.edu                                 %%
%%                                                      %%
%% This program can redistributed and/or modified under %%
%% the terms of the LaTeX Project Public License        %%
%% Distributed from CTAN archives in directory          %%
%% macros/latex/base/lppl.txt; either version 1 of the  %%
%% License, or (at your option) any later version.      %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%</copyright>
%<package>\NeedsTeXFormat{LaTeX2e}[1997/12/01]
%<package>\ProvidesPackage{artthreads}
%<package> [2020/07/09 v1.3.1 Support for article threads (dps)]
%<*driver>
\documentclass{ltxdoc}
\usepackage[colorlinks,hyperindex=false]{hyperref}
\usepackage{fancyvrb,array,calc}
%\pdfstringdefDisableCommands{\let\\\textbackslash}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\bgroup\ttfamily
\gdef\brpr#1{\char123\relax#1\char125\relax}\egroup
\let\darg\brpr
\let\env\texttt
\let\opt\texttt
\let\app\textsf
\let\pkg\textsf
\let\tops\texorpdfstring
\def\nmpsep#1{\hskip-\marginparsep\texttt{#1}}
\def\ameta#1{\ensuremath{\langle\textsl{\texttt{#1}}\rangle}}
\def\meta#1{\textsl{\texttt{#1}}}
\def\SUB#1{\ensuremath{{}_{\mbox{\scriptsize\ttfamily#1}}}}
\def\cs#1{\texttt{\bslash#1}}
\def\EXCL{!}
\DeclareRobustCommand{\tmspace}[3]{%
  \ifmmode\mskip#1#2\else\kern#1#3\fi\relax}
\renewcommand{\,}{\tmspace+\thinmuskip{.1667em}}
\let\thinspace\,
\renewcommand{\!}{\tmspace-\thinmuskip{.1667em}}
\let\negthinspace\!
\renewcommand{\:}{\tmspace+\medmuskip{.2222em}}
\let\medspace\:
\newcommand{\negmedspace}{\tmspace-\medmuskip{.2222em}}
\renewcommand{\;}{\tmspace+\thickmuskip{.2777em}}
\let\thickspace\;
\newcommand{\negthickspace}{\tmspace-\thickmuskip{.2777em}}
\makeatletter
\renewcommand{\paragraph}
    {\@startsection{paragraph}{4}{0pt}{6pt}{-3pt}
    {\normalfont\normalsize\bfseries}}
\renewenvironment{quote}[1][]
   {\def\@rgi{#1}\ifx\@rgi\@empty
    \let\rghtm\@empty\else\def\rghtm{\rightmargin\leftmargin}\fi
    \list{}{\rghtm}%{\rightmargin\leftmargin}%
    \item\relax}
   {\endlist}
\makeatother
\InputIfFileExists{aebdocfmt.def}{\PackageInfo{artthreads}{Inputting aebdocfmt.def}}
    {\def\IndexOpt{\DescribeMacro}\def\IndexKey{\DescribeMacro}\let\setupFullwidth\relax
     \PackageInfo{artthreads}{aebdocfmt.def cannot be found}}
\begin{document}
\def\CMD#1{\textbackslash#1}
  \GetFileInfo{artthreads.sty}
  \title{\textsf{artthreads}: Support for article threads}
  \author{D. P. Story\\
    Email: \texttt{dpstory@acrotex.net}}
  \date{processed \today}
  \maketitle
  \tableofcontents
  \DocInput{artthreads.dtx}
\IfFileExists{\jobname.ind}{\newpage\setupFullwidth\PrintIndex}{\paragraph*{Index}
    The index goes here.\\Execute
    \texttt{makeindex -s gind.ist -o artthreads.ind artthreads.idx} on the command line
    and recompile \texttt{artthreads.dtx}.}
\IfFileExists{\jobname.gls}{\PrintChanges}{\paragraph*{Change History} The list of
    changes goes here.\\Execute
    \texttt{makeindex -s gglo.ist -o artthreads.gls artthreads.glo} on the command line
    and recompile \texttt{artthreads.dtx}.}
\end{document}
%</driver>
% \fi
%
% \MakeShortVerb{|}
% \InputIfFileExists{aebdonotindex.def}{\PackageInfo{artthreads}{Inputting aebdonotindex.def}}
%    {\PackageInfo{artthreads}{aebdonotindex.def cannot be found}}
%
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
% \changes{v1.2}{2016/05/02}{Modified documentation to reflect new \string\textsf{DC} thread icons.}
%
% \section{Introduction}
% This package is used to create \textit{article threads} around blocks of content. Generally,
% article threads are used with multi-column documents, such as newspapers or newsletters, or
% anything that uses a multi-column format.
%
% The creation of the article threads should occur as the final step of the document composition.
% There is nothing automatic about placing the threads, {\TeX} does not lend itself to the creation
% of the threads. For the purpose of placing the threads, the options \texttt{preview} and
% \texttt{viewMagWin} are integral.
%
% \section{Options and Required Packages}
%    \begin{macrocode}
\RequirePackage{xkeyval}
%    \end{macrocode}
% \paragraph*{Driver options.} These options are  \opt{dvips} (the default),
% \opt{pdftex}, \opt{luatex}, and \opt{xetex}
% are automatically detected, other drivers supported are \opt{dvipdfm} and
% \opt{dvipdfmx}.
%
% \paragraph*{Preview options.} The \texttt{preview}
% option is a carry over from \textsf{eforms}. When selected, all form fields are outlined; useful when
% setting the location of fields in a dvi previewer. The other option is \texttt{viewMagWin}
% will show the viewing windows surrounding the target. This is the rectangle
% that will be jumped to. Use this option to adjust the size of the window to your needs.
% When either of the last two options has an exclamation point prior, that means to
% turn off the switch. You can conveniently use \texttt{viewMagWin} to see the viewing window,
% then change it to \texttt{!viewMagWin} to remove the visible window. Cool.
% Similarly, you can turn off \texttt{preview} using \texttt{!preview}.
%    \begin{macrocode}
%    \end{macrocode}
% \leavevmode\IndexOpt{pdftex}^^A
% \IndexOpt{luatex}^^A
% All options are passed to the \pkg{fitr} package, which contains a lot of the code
% used in this package.
%    \begin{macrocode}
\DeclareOptionX{pdftex}{\PassOptionsToPackage{\CurrentOption}{fitr}}
\DeclareOptionX{luatex}{\PassOptionsToPackage{\CurrentOption}{fitr}}
%    \end{macrocode}
% \leavevmode\IndexOpt{dvips}^^A
% \IndexOpt{dvipsone}^^A
% Distiller based drivers.
%    \begin{macrocode}
\DeclareOptionX{dvips}{\PassOptionsToPackage{\CurrentOption}{fitr}}
\DeclareOptionX{dvipsone}{\PassOptionsToPackage{\CurrentOption}{fitr}}
%    \end{macrocode}
% \leavevmode\IndexOpt{xetex}^^A
% \IndexOpt{dvipdfm}^^A
% \IndexOpt{dvipdfmx}^^A
% \opt{xetex} and its variants.
%    \begin{macrocode}
\DeclareOptionX{dvipdfm}{\PassOptionsToPackage{\CurrentOption}{fitr}}
\DeclareOptionX{dvipdfmx}{\PassOptionsToPackage{\CurrentOption}{fitr}}
\DeclareOptionX{xetex}{\PassOptionsToPackage{\CurrentOption}{fitr}}
%    \end{macrocode}
% \leavevmode\IndexOpt{preview}^^A
% \IndexOpt[\protect\EXCL]{!preview}^^A
% \IndexOpt{viewMagWin}^^A
% \IndexOpt[\protect\EXCL]{!viewMagWin}^^A
% Preview preferences
%    \begin{macrocode}
\DeclareOptionX{preview}
  {\PassOptionsToPackage{\CurrentOption}{fitr}}
\DeclareOptionX{!preview}
  {\PassOptionsToPackage{\CurrentOption}{fitr}}
\DeclareOptionX{viewMagWin}
  {\PassOptionsToPackage{\CurrentOption}{fitr}}
\DeclareOptionX{!viewMagWin}
  {\PassOptionsToPackage{\CurrentOption}{fitr}}
%    \end{macrocode}
%    Any other options are passed on to \pkg{fitr}. One useful
%    option is \opt{gonative}, which creates no document JavaScript.
%    Consequently, the \texttt{latex\,->\,dvips\,->\,ps2pdf} workflow
%    is supported.
%    \begin{macrocode}
\DeclareOptionX*{\PassOptionsToPackage{\CurrentOption}{fitr}}
\ProcessOptionsX
%    \end{macrocode}
% \section{The Main Code}
% We require the package \textsf{fitr}, as we use many commands from that package.
% We pass all options to \textsf{fitr}.
% \changes{v1.3.1}{2020/07/09}{Require \string\pkg{fitr} package, dated 2020/07/09}
%    \begin{macrocode}
\RequirePackage{fitr}[2020/07/09]
%    \end{macrocode}
% Some scratch counters, lengths, boxes.
%    \begin{macrocode}
\newif\ifnewarticle
\newcounter{@rtBtnCnt}
\def\CntArt{0}\def\CntArtInfo{0}
\def\inc@CntMacro#1{{\@tempcnta#1\relax\advance\@tempcnta1\relax
    \xdef#1{\the\@tempcnta}}}
\def\artM@rk{[\space}
%    \end{macrocode}
% \subsection{\tops{\protect\cs{setThreadInfo}}{\textbackslash{setThreadInfo}} and its KV-pairs}
% We set up
% key-values\IndexKey{title}\IndexKey{author}\IndexKey{subject}^^A
% \IndexKey{keywords} for the thread \textsf{Info} dictionary. Only the title
% is required, that's why a default value of \texttt{thread-\ameta{num}} is otherwise provided.
% For \app{pdflatex} and \app{lualtex}, only \texttt{title} is supported.
%    \begin{macrocode}
\define@key{artthrd}{title}[]{\Hy@unicodefalse
  \pdfstringdef\threadTitle{#1}}
  \let\threadTitle\@empty
\define@key{artthrd}{author}[]{\pdfstringdef\threadAuthor{#1}}
  \let\threadAuthor\@empty
\define@key{artthrd}{keywords}[]{\pdfstringdef\threadKeywords{#1}}
  \let\threadKeywords\@empty
\define@key{artthrd}{subject}[]{\pdfstringdef\threadSubject{#1}}
  \let\threadSubject\@empty
%    \end{macrocode}
% Use \DescribeMacro{\setThreadInfo}\cmd{\setThreadInfo} prior to the opening of a
% new thread using \cs{cArticle}. Through its key-values, set the title, author,
% keywords, and subject of the thread. For \textsf{pdftex}, only title is supported.
%    \begin{macrocode}
\newcommand{\setThreadInfo}[1]{\inc@CntMacro\CntArtInfo
    \let\threadTitle\@empty\let\threadAuthor\@empty
    \let\threadKeywords\@empty\let\threadSubject\@empty
    \setkeys{artthrd}{#1}\ifx\threadTitle\@empty
        \def\threadTitle{thread-\CntArtInfo}\fi}
\def\bArtErrMsg{When starting a new article thread
    (\string\bArticle)\MessageBreak
    first use \string\setThreadInfo\space to set the title,\MessageBreak
    author, subject, and keywords}
%    \end{macrocode}
% \paragraph*{Additional key-values for threads} In addition to the key-values provided
% by \textsf{fitr}, we provide a few more. The two keys
% \IndexKey{addtow}\texttt{addtow} and \IndexKey{addtoh}\texttt{addtoh}
% adds to the reading border of the threads. These are set through the
% command \DescribeMacro{\setAddToBorder}\cs{setAddToBorder}. For the most part,
% choices for \texttt{addtow} (add to the width) and \texttt{addtoh} (add to the height)
% should be set for the whole document. Initially, \texttt{addtow=0,addtoh=0}.
%    \begin{macrocode}
\define@key{@rtthrd}{addtow}[0]{%
    \fitr@defaultbp{\artthrd@@addtow}{#1}}
\def\artthrd@@addtow{0}
\define@key{@rtthrd}{addtoh}[0]{%
    \fitr@defaultbp{\artthrd@@addtoh}{#1}}
\def\artthrd@@addtoh{0}
\newcommand{\setAddToBorder}[1]{\setkeys{@rtthrd}{#1}}
%    \end{macrocode}
% \subsection{The \tops{\protect\cs{bArticle} and \protect\cs{cArticle}}{\textbackslash{bArticle} and \textbackslash{cArticle}} commands}
% The \DescribeMacro{\bArticle}\cmd{\bArticle} is used to start an article thread. The thread
% may continue with \cs{cArticle}. Both commands have a required argument, consisting of
% key-values defined by \textsf{fitr}.
% The following is the syntax, with appropriate keys defined in \texttt{fitr}.
%\begin{Verbatim}[xleftmargin=\parindent,codes={\catcode`\%=9},commandchars={!()}]
%\cArticle{lift=!ameta(length),width=!ameta(length),height=!ameta(length)}
%\end{Verbatim}
%    \begin{macrocode}
\newcommand{\bArticle}{\begingroup\inc@CntMacro\CntArt
    \ifnum\CntArt=\CntArtInfo\relax\else
    \PackageError{artthreads}{\bArtErrMsg}{See package documentation
    for \string\setThreadInfo}\fi
    \newarticletrue\set@rectart}
%    \end{macrocode}
% The only difference between \DescribeMacro{\cArticle}\cmd{\cArticle} and
% \cmd{\bArticle} is the stepping of the counter \cmd{\CntArt}
%  and the setting of the switch \cmd{ifnewarticle}.
%    \begin{macrocode}
\newcommand{\cArticle}{\begingroup\newarticlefalse\set@rectart}
%    \end{macrocode}
% \cmd{\set@rectart} continues \cs{bArticle}/\cs{cArticle}.
%    \begin{macrocode}
\newcommand{\set@rectart}[1]{%\def\fitr@artrect@argi{#1}% dps
    \edef\temp@exp{\noexpand\setkeys{fitr}{#1}}\temp@exp
    \set@@rectart}
%    \end{macrocode}
% \cmd{\set@@rectart} is the main command for building the thread.
%    \begin{macrocode}
\def\set@@rectart{\def\fitr@setBL{0pt}%
  \@ifundefined{ef@Bbox}{\let\fitr@FLB@ction\Bbox}%
    {\let\fitr@FLB@ction\ef@Bbox}%
  \get@fitr@dimen{%
    \parbox[\fitr@@refPt][\fitr@@height]{\fitr@@width}%
    {\kern0pt\fitr@FLB@ction{\fitr@@width}{\fitr@@height}\kern0pt}%
  }%
  \makebox[0pt][l]{\hspace*{\fitr@@shift}\smash{%
    \raisebox{\fitr@@lift-\fitr@setBL}{%
%    \end{macrocode}
% Actually insert the thread code here by inserting \cs{setThre@d}.
%    \begin{macrocode}
      \setThre@d{\artthrd@@addtow}{\artthrd@@addtoh}%
      \unhbox\fitr@bbox
      \fitr@urxury@fixup{\artthrd@@addtow}{\artthrd@@addtoh}{}%
  }}}\setlength{\fboxsep}{0pt}%
%    \end{macrocode}
% Now place an extended border around the viewing area
%    \begin{macrocode}
  \ifviewMagWin
    \fitr@length=\artthrd@@addtow bp
    \fitr@length=2\fitr@length
    \addtolength{\fitr@length}{\fitr@@width}%
    \edef\fitr@@width{\the\fitr@length}%
    \fitr@length=\artthrd@@addtoh bp
    \fitr@length=2\fitr@length
    \addtolength{\fitr@length}{\fitr@@height}%
    \edef\fitr@@height{\the\fitr@length}%
    \setlength\fitr@length{-\artthrd@@addtow bp}%
    \addtolength\fitr@length{\fitr@@shift}%
    \makebox[0pt][l]{\hspace*{\fitr@length}\smash{%
      \setlength\fitr@length{\fitr@@lift-\fitr@setBL}%
      \if\fitr@@refPt b%
        \addtolength\fitr@length{-\artthrd@@addtoh bp}\else
      \if\fitr@@refPt t%
        \addtolength\fitr@length{\artthrd@@addtoh bp}%
      \fi\fi
      \raisebox{\fitr@length}%
      {\fbox{\parbox[\fitr@@refPt][\fitr@@height]%
      {\fitr@@width}{\kern0pt\hfill\vfill\kern0pt}}}}%
    }%
  \fi
\endgroup}
%    \end{macrocode}
% \subsection{The driver dependent commands}
% We begin with a required definition to enable \app{lualatex} to function correctly.
%    \begin{macrocode}
\ifluatex\protected\def\pdfthread{\pdfextension thread }\fi
%    \end{macrocode}
%    \DescribeMacro\AT@ThrBbox\nmpsep{\darg{\ameta{add-wd}\darg{\ameta{add-ht}}}} The definition
%    of \cmd{\set@rtThrd} depends on the driver. The arguments are dimensionless numbers, representing
%    Adobe points. The \cs{AT@ThrBbox} macros perform different tasks, one of which is to calculate the dimensions
%    of the bounding box for the viewing rectangle. It is used in \cs{set@rtThrd}, defined below.
% \changes{v1.3}{2020/07/03}{Add special definition for threads in the case of lualatex}
% \changes{v1.3}{2020/07/03}{Added \string\cs{Thread}}
%    \begin{macrocode}
\if@fitr@dvipdfm
%    \end{macrocode}
%    For the \app{xelatex} and friends
%    \begin{macrocode}
\def\AT@ThrBbox#1#2{%
  \fitr@length=#1bp
  \fitr@length=2\fitr@length
  \advance\fitr@length\wd\fitr@bbox
  \edef\fitr@xetex@view@width{\the\fitr@length}%
  \fitr@length=#2bp
  \advance\fitr@length\ht\fitr@bbox
  \edef\fitr@xetex@view@height{\the\fitr@length}%
  \fitr@length=#2bp
  \advance\fitr@length\dp\fitr@bbox
  \edef\fitr@xetex@view@depth{\the\fitr@length}%
}\else
\ifpdf
%    \end{macrocode}
%    For the \app{pdftex} and friends
%    \changes{v1.3}{2020/07/03}{Use \string\cs{ifpdf}}
%    \begin{macrocode}
\def\AT@ThrBbox#1#2{%
  \fitr@length=#1bp
  \fitr@length=2\fitr@length
  \advance\fitr@length\wd\fitr@bbox
  \edef\fitr@pdftex@view@width{\the\fitr@length}%
  \fitr@length=#2bp
  \advance\fitr@length\ht\fitr@bbox
  \edef\fitr@pdftex@view@height{\the\fitr@length}%
  \fitr@length=#2bp
  \advance\fitr@length\dp\fitr@bbox
  \edef\fitr@pdftex@view@depth{\the\fitr@length}%
}\else
\ifx\fitr@driver\fitr@dvipsone@driver
%    \end{macrocode}
%    For the \app{dvipsone} driver
%    \begin{macrocode}
\def\AT@ThrBbox#1#2{%
  currentpoint 2 copy %
  \the\fitr@depth\space add #2\space PDFtoTeX add      % y1
  exch #1\space PDFtoTeX sub exch                      % x1
  4 2 roll exch
  \the\fitr@width\space add #1\space PDFtoTeX add exch % x2
  \the\fitr@height\space sub #2\space PDFtoTeX sub}    % y2
\else
\ifx\fitr@driver\fitr@dvips@driver
%    \end{macrocode}
%    For the \app{dvips} driver
%    \begin{macrocode}
\def\AT@ThrBbox#1#2{% Uses \fitr@bbox
  currentpoint 2 copy %
  \the\fitr@depth\space SPtoDvips add
      #2\space BPToDvips add                  % y1
  exch #1\space BPToDvips sub exch            % x1
  4 2 roll exch
  \the\fitr@width\space SPtoDvips add
      #1\space BPToDvips add exch             % x2
  \the\fitr@height \space SPtoDvips sub
  #2\space BPToDvips sub}                     % y2
\fi\fi\fi\fi
%    \end{macrocode}
% \paragraph*{Code to set the thread} The \cs{setThre@d} macros are driver dependent.
% \medskip\par\noindent
% \DescribeMacro\setThre@d\nmpsep{\darg{\ameta{add-wd}\darg{\ameta{add-ht}}}} This macro
% strips out the dimensions of its arguments (10bp becomes 10) and passes these new arguments
% to \cmd{\set@rtThrd}.
%    \begin{macrocode}
\def\setThre@d#1#2{%
  \fitr@defaultbp{\aWd}{#1}\fitr@defaultbp{\aHt}{#2}%
  \edef\tmp@exp{\noexpand\set@rtThrd{\aWd}{\aHt}}\tmp@exp}
\if@fitr@dvipdfm
%    \end{macrocode}
%    \DescribeMacro\set@rtThrd\nmpsep{\darg{\ameta{add-wd}\darg{\ameta{add-ht}}}} The definition
%    of \cmd{\set@rtThrd} depends on the driver. The arguments are dimensionless numbers, representing
%    Adobe points.\medskip\par\noindent
%    For the \textsf{xelatex} and friends
%    \begin{macrocode}
\def\set@rtThrd#1#2{\AT@ThrBbox{#1}{#2}%
  \smash{\raisebox{-\fitr@xetex@view@height+#2bp}%
      {\makebox[0pt][l]{\hspace*{-#1bp}%
  \@pdfm@mark{thread @artthrd\CntArt\space
  width \fitr@xetex@view@width\space
  height \fitr@xetex@view@height\space
  depth \fitr@xetex@view@depth\space
  << /Title (\threadTitle)
  \ifnewarticle
  /Author (\threadAuthor)
  /Subject (\threadSubject)
  /Keywords (\threadKeywords)\fi >>}}}}}\else
\ifpdf
%    \end{macrocode}
%    For \app{pdftex} and friends
%    \changes{v1.3}{2020/07/03}{Use \string\cs{ifpdf}}
%    \begin{macrocode}
\def\set@rtThrd#1#2{\AT@ThrBbox{#1}{#2}%
  \makebox[0pt][l]{\hspace*{-#1bp}%
  \pdfthread
    width  \fitr@pdftex@view@width\space
    height \fitr@pdftex@view@height\space
    depth  \fitr@pdftex@view@depth\space
    name {\threadTitle}}}\else
%    \end{macrocode}
%    For drivers that use PostScript and the \textsf{\textbf{pdfmark}}.
%    \changes{v1.1}{2016/04/09}{Removed the Page key and dependence on the
%       \string\textsf{refcount} package}
%    \begin{macrocode}
\def\set@rtThrd#1#2{\literalps@out{\artM@rk
  /Rect [\AT@ThrBbox{\artthrd@@addtow}{\artthrd@@addtoh}]
  /Title (\threadTitle)
  \ifnewarticle
    /Author (\threadAuthor)
    /Subject (\threadSubject)
    /Keywords (\threadKeywords)\fi
    /ARTICLE pdfmark}}
\fi\fi
%    \end{macrocode}
% \subsection{Some navigation commands}
%    \begin{macrocode}
\let\threadTitle\@empty
%    \end{macrocode}
%    \DescribeMacro{\Thread}\nmpsep{\darg{\ameta{thread-title}}} The action to start
%    read a thread whose title is \ameta{thread-title}. For example,
%    |\setLink[\A{\Thread{Lipsum}}]{Read Lipsum}| \medskip
%    \begin{macrocode}
\providecommand{\Thread}[1]{/S/Thread/D(#1)}
%    \end{macrocode}
%    \DescribeMacro\shArticlesPaneActn\DescribeMacro\sArticlesPaneActn Actions for show/hid
%    articles pane and to just show articles pane (The named action \texttt{ArticleThreads} is
%    undocumented, don't remember show I got this name.) In addition to these two, we combine
%    them with read thread actions: \DescribeMacro\shArticlesPaneReadActn\DescribeMacro\sArticlesPaneReadActn
%    \begin{macrocode}
\def\shArticlesPaneActn{\Named{ShowHideArticles}}
\def\sArticlesPaneActn{\Named{ArticleThreads}}
\def\shArticlesPaneReadActn{\shArticlesPaneActn
  \Next{\Thread{\threadTitle}}}
\def\sArticlesPaneReadActn{\sArticlesPaneActn
  \Next{\Thread{\threadTitle}}}
%    \end{macrocode}
%    \DescribeMacro\readArticle\nmpsep{\darg{\ameta{thread-title}}} is a macro intended
%    to be passed to a push button action through the \cs{cmd} key. For example,\medskip
%\begin{Verbatim}[xleftmargin=\parindent,codes={\catcode`\%=9},commandchars={!()}]
%\showArticlePaneRead[!textbf(\cmd{\readArticle{more Lipsum}})]{}{11bp}
%\end{Verbatim}
%It should be used with \cs{toggleArticlePaneRead} and \cs{showArticlePaneRead} (push buttons). Alternatively,
%these actions can be done through a link:
%\begin{Verbatim}[xleftmargin=\parindent,codes={\catcode`\%=9},commandchars={!()}]
%\setLink[\cmd{\readArticle{Lipsum}}
%\A{\shArticlesPaneReadActn}]{Lipsum}
%\end{Verbatim}
%    \begin{macrocode}
\def\readArticle#1{\Hy@unicodefalse
  \pdfstringdef\AT@x{#1}\edef\threadTitle{\AT@x}}
\def\chkThreadName{%
  \ifx\threadTitle\@empty
    \global\let\isThrTtl\ef@NO
    \def\readArtPresets{\cmd{\let\Next\@gobble}}\else
    \global\let\isThrTtl\ef@YES
    \let\readArtPresets\@empty
  \fi
}
\def\readThreadMsg{\ifx\isThrTtl\ef@NO
  \PackageWarning{artthreads}{No thread title specified to read}\fi}
%    \end{macrocode}
%    \DescribeMacro\toggleArticlePane\nmpsep{[\ameta{KV-pairs}]\darg{\ameta{wd}}\darg{\ameta{ht}}}
%    A push button whose action toggles the Articles pane open and closed.
%    \begin{macrocode}
\newcommand{\toggleArticlePane}[3][]{\stepcounter{@rtBtnCnt}%
  \pushButton[\CA{Article}\TU{Toggle Articles Pane}#1
  \A{\shArticlesPaneActn}
]{TAPBtn\the@rtBtnCnt}{#2}{#3}}
%    \end{macrocode}
%    \DescribeMacro\toggleArticlePaneRead\nmpsep{[\ameta{KV-pairs}]\darg{\ameta{wd}}\darg{\ameta{ht}}}
%    A push button whose action us to toggle the Articles pane state (show/hide) and to begin reading the
%    thread titled \cs{threadTitle}. If this command is placed after the \cs{setThreadInfo}
%    command, then \cs{threadTitle} is the title set by the title key of \cs{setThreadInfo}.
%    \begin{macrocode}
\def\tooltipTogglePaneRead#1{\def\ttToggleP@neRead{#1}}
\tooltipTogglePaneRead{Toggle Articles pane and read
  the article \threadTitle}
\newcommand{\toggleArticlePaneRead}[3][]{\begingroup
  \stepcounter{@rtBtnCnt}\pushButton[\CA{Article}#1
  \TU{\ttToggleP@neRead}\cmd{\chkThreadName}
  \presets{\readArtPresets}\A{\shArticlesPaneReadActn}
]{TAPRBtn\the@rtBtnCnt}{#2}{#3}\readThreadMsg\endgroup}
%    \end{macrocode}
%    \DescribeMacro\showArticlePane\nmpsep{[\ameta{KV-pairs}]\darg{\ameta{wd}}\darg{\ameta{ht}}} A push button
%    whose action is to show the Articles pane.
%    \begin{macrocode}
\newcommand{\showArticlePane}[3][]{\stepcounter{@rtBtnCnt}%
  \pushButton[\CA{Article}\TU{Show Articles Pane}#1
  \A{\sArticlesPaneActn}
]{SAPBtn\the@rtBtnCnt}{#2}{#3}}
%    \end{macrocode}
%    \DescribeMacro\showArticlePaneRead\nmpsep{[\ameta{KV-pairs}]\darg{\ameta{wd}}\darg{\ameta{ht}}}
%    A push button whose action is to show the Articles and to begin reading the
%    thread titled \cs{threadTitle}. If this command is placed after the \cs{setThreadInfo}
%    command, then \cs{threadTitle} is the title set by the title key of \cs{setThreadInfo}.
%    \begin{macrocode}
\def\tooltipShowPaneRead#1{\def\ttShowP@neRead{#1}}
\tooltipShowPaneRead{Show Articles pane and read
  the article \threadTitle}
\newcommand{\showArticlePaneRead}[3][]{\begingroup
  \stepcounter{@rtBtnCnt}\pushButton[\CA{Article}#1
  \TU{\ttShowP@neRead}\cmd{\chkThreadName}
  \presets{\readArtPresets}\A{\sArticlesPaneReadActn}
]{SAPRBtn\the@rtBtnCnt}{#2}{#3}\readThreadMsg\endgroup}
%    \end{macrocode}
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%\Finale
\endinput
