Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'initially' should not be in typewriter family #1278

Open
SwitWu opened this issue Sep 18, 2023 · 1 comment
Open

'initially' should not be in typewriter family #1278

SwitWu opened this issue Sep 18, 2023 · 1 comment
Labels

Comments

@SwitWu
Copy link

SwitWu commented Sep 18, 2023

Version

3.1.10

Details

In page 191, 248, 285, 361 etc, the word 'initially' and the comma before it should be in \rmfamily instead of \ttfamily. See the following screenshot for example:

image
@SwitWu SwitWu added the manual label Sep 18, 2023
@muzimuzhi
Copy link
Member

muzimuzhi commented Sep 18, 2023

That's because \begin{key}{/path/to/key=value (default xxx, initially yyy)} is not supported yet. Currently the whole "xxx, initially yyy" is parsed as the default value, hence typeset in typewriter font family.

% \begin{key}{/path/x=value}
% \begin{key}{/path/x=value (initially XXX)}
% \begin{key}{/path/x=value (default XXX)}
\newenvironment{key}[1]{
\begin{pgfmanualentry}
\def\extrakeytext{}
%\def\altpath{\emph{\color{gray}or}}%
\extractkey#1\@nil%
\pgfmanualbody
}
{
\end{pgfmanualentry}
}

% This is https://github.com/pgf-tikz/pgf/blob/master/doc/generic/pgf/pgfmanual-test.tex
% modified in place
\documentclass[a4paper,doc2]{ltxdoc}

% pgf version is defined in \pgfversion in file
% generic/pgf/utilities/pgfrcs.code.tex 

\input{pgfmanual.cfg} % default engine is LuaTeX
\input{pgfmanual-en-main-preamble.tex}

\makeatletter
\def\extractkeyequal#1=#2\@nil{%
  \pgfutil@in@{(default}{#2}%
  \ifpgfutil@in@%
    \pgfutil@in@{, initial}{#2}% <<< added logic
    \ifpgfutil@in@%
      \extractdefaultinitial{#1}#2\@nil%
    \else
      \extractdefault{#1}#2\@nil%
    \fi
  \else%
    \pgfutil@in@{(initial}{#2}%
    \ifpgfutil@in@%
      \extractinitial{#1}#2\@nil%
    \else
      \pgfmanualentryheadline{%
        \def\mykey{#1}%
        \def\mypath{}%
        \gdef\myname{}%
        \firsttimetrue%
        \pgfmanualdecomposecount=0\relax%
        \decompose#1/\nil%
        {\ttfamily\declare{#1}=}#2\hfill(\extrakeytext no default)}%
    \fi%
  \fi%
}

\def\extractdefaultinitial#1#2(default #3, initially #4)\@nil{%
  \pgfmanualentryheadline{%
    \def\mykey{#1}%
    \def\mypath{}%
    \gdef\myname{}%
    \firsttimetrue%
    \pgfmanualdecomposecount=0\relax%
    \decompose#1/\nil%
    {\ttfamily\declare{#1}\opt{=}}\opt{#2}\hfill
    (\extrakeytext default {\ttfamily#3}, initially {\ttfamily#4})}%
}
\makeatother

\begin{document}

\begin{key}{/pgf/tips=\meta{value} (default true, initially on draw)}
        \keyalias{tikz}
    This key governs in what situations arrow tips are added to a path. The
    following \meta{values} are permissible:
\end{key}

\end{document}

Before
image
After
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants