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

fix missing trailing "]" and italic opening brackets in doc #840

Closed
wants to merge 1 commit into from

Conversation

muzimuzhi
Copy link
Member

@muzimuzhi muzimuzhi commented Mar 18, 2020

Inside shortverb,

  1. If it contains "=" and ends with "]", this "]" is missing from output.
    E.g., "|[key=val]|" produces "[key=val".
    Change the input to "|[key=val||]|".

  2. If it contains "=", this bracket is typeset in italic.
    E.g., "|a={...}|" produces "a=<italic {>...}".
    Change the input to "|a=||{...}|".

The first kind of change is rather complete, but for the second kind,
I only checked contents of every quote environment.

There is already a case of second kind in the source code:

% (the double vertical bar after = is needed to avoid the two opening brackets
% being typeset in italics)
\begin{quote}
|label=||{[|\meta{options}|]|\meta{text}|}|
\end{quote}


Locally on my computer, I use a simplified pgfmanual.tex to test and compare:

\documentclass[a4paper]{ltxdoc}

\input{../pgfmanual-luatex.cfg}
\input{../../text-en/pgfmanual-en-main-preamble.tex}

\begin{document}
\parindent=0pt
\subsubsection*{First kind}
Before: |plot[yshift=3cm]| \par
After: |plot[yshift=3cm||]| 

\subsubsection*{Second kind}
Before
\begin{quote}
    |>-< /.tip = >[reversed]|
\end{quote}

After
\begin{quote}
    |>-< /.tip = ||>[reversed]|
\end{quote}

% pgfmanual-en-tikz-shapes.tex:2404
% (the double vertical bar after = is needed to avoid the two opening brackets
%  being typeset in italics)
Before
\begin{quote}
    |:some attribute = {|\meta{options}|}|
\end{quote}

After
\begin{quote}
    |:some attribute = ||{|\meta{options}|}|
\end{quote}
\end{document}

image

Inside shortverb,
1. If it contains "=" and ends with "]", this "]" is missing from output.
   E.g., "|[key=val]|" produces "[key=val".
   Change the input to "|[key=val||]|".

2. If it contains "=<opening bracket>", this bracket is typeset in italic.
   E.g., "|a={...}|" produces "a=<italic {>...}".
   Change the input to "|a=||{...}|".
@hmenke
Copy link
Member

hmenke commented Mar 18, 2020

Sorry, but I think I have to reject this pull request.

First of all, it seems that you are not using the latest master to compile your example, because for me it renders like this, without missing closing delimiters.

test

The fact that italics are not used for the closing delimiter is something that I am aware of and plan to fix in the future (cf. #831).

You propose to typeset the right-hand side of assignments in upright font, but you are not being consistent (3cm is still italics) and you do so by injecting some obscure custom markup into the manual source when this should really be fixed in the parser. Furthermore, since the beginning the right-hand sides of assignments in the PGF manual have been typeset in italics and I'm not going to change that now.

@muzimuzhi
Copy link
Member Author

First of all, it seems that you are not using the latest master to compile your example, because for me it renders like this, without missing closing delimiters.

Yes you are right. I used the latest master but didn't set pgf repo as a texlive usertree. Following the instructions in https://github.com/pgf-tikz/pgf#development, the missing trailing "]" problem disappears.

So sorry.


By the way, not directly related to this pr, there are still two typos I found in doc:

First one,

An important feature of the |circuits| library is that the appearance of a
circuit can be configured in general ways and that the labels are placed
automatically by default. Here is the graphic once more, generated from
\emph{exactly the same source code}, with only the options of the
|{tikzpicture}| environment replaced by
|[rotate=-90,circuit ee IEC,x=3.25cm,y=2.25cm]|:
%
\begin{tikzpicture}[rotate=-90,circuit ee IEC,x=3cm,y=2.25cm]
% Let us start with some contacts:
\foreach \contact/\y in {1/1,2/2,3/3.5,4/4.5,5/5.5}
{
\node [contact] (left contact \contact) at (0,\y) {};
\node [contact] (right contact \contact) at (1,\y) {};
}
\draw (right contact 1) -- (right contact 2) -- (right contact 3)
-- (right contact 4) -- (right contact 5);
\draw (left contact 1) to [diode] ++(down:1)
to [voltage source={near start,direction info={volt=3}},
resistor={near end,ohm=3}] ++(right:1)
to (right contact 1);
\draw (left contact 1) to [resistor={ohm=4}] (right contact 1);
\draw (left contact 1) to [resistor={ohm=3}] (left contact 2);
\draw (left contact 2) to [voltage source={near start,
direction info={<-,volt=8}},
resistor={ohm=2,near end}] (right contact 2);
\draw (left contact 2) to [resistor={near start,ohm=1},
make contact={near end,info'={[red]$S_1$}}] (left contact 3);
\draw (left contact 3) to [current direction'={near start,info=$\iota$},
resistor={near end,info={$R=4\Omega$}}]
(right contact 3);
\draw (left contact 4) to [voltage source={near start,
direction info={<-,volt=8}},
resistor={ohm=2,near end}] (right contact 4);
\draw (left contact 3) to [resistor={ohm=1}] (left contact 4);
\draw (left contact 4) to [resistor={ohm=3}] (left contact 5);
\draw (left contact 5) to [resistor={ohm=4}] (right contact 5);
\draw (left contact 5) to [diode] ++(up:1)
to [voltage source={near start,direction info={volt=3}},
resistor={near end,ohm=3}] ++(right:1)
to (right contact 5);
\end{tikzpicture}

This tikzpicture is so wide that produces a 200pt+ overfull \hbox

Overfull \hbox (226.97084pt too wide) in paragraph at lines 87--129

Second one,

\begin{codeexample}[preamble={\usetikzlibrary{scopes}}]
\begin{tikzpicture}
{ [ultra thick]
{ [red]
\draw (0mm,10mm) -- (10mm,10mm);
\draw (0mm,8mm) -- (10mm,8mm);
}
\draw (0mm,6mm) -- (10mm,6mm);
}
{ [green]
\draw (0mm,4mm) -- (10mm,4mm);
\draw (0mm,2mm) -- (10mm,2mm);
\draw[blue] (0mm,0mm) -- (10mm,0mm);
}
\end{tikzpicture}
\end{codeexample}
In the above example, |{ [thick]| actually causes a |\begin{scope}[thick]| to
be inserted, and the corresponding closing |}| causes an |\end{scope}| to be
inserted.

The example uses option ultra thick, but the following explanation mentioned option thick.

Mo-Gul added a commit to Mo-Gul/pgf that referenced this pull request Mar 23, 2020
@muzimuzhi muzimuzhi deleted the fix-doc branch October 3, 2020 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants