!NuxCISwYQJuyWwNsEI:matrix.org

PGF/TikZ

56 Members
https://github.com/pgf-tikz13 Servers

Load older messages


SenderMessageTime
20 Jan 2024
@manis:matrix.orgManis Ah, I must not have any newlines in the optional argument to \plottable. But why are they ignored when directly passed to the \pgf... commands but not when they "go through" #1? 11:15:53
@marei:im.f3l.demarei
In reply to @manis:matrix.org
If I want to string replace*={ }{\,}, do I need to expand \, first?
If you typeset the table/ content it would be expanded later. In the cell itself it's not. and that's also what I would expect. To get the thinspace directly you would have to change the category code otherwhise it's just a space.
15:18:46
@marei:im.f3l.demarei
In reply to @manis:matrix.org
Ah, I must not have any newlines in the optional argument to \plottable. But why are they ignored when directly passed to the \pgf... commands but not when they "go through" #1?

and that's also an issue with spaces… as spaces are preserved in that setup. so

15:19:42
@marei:im.f3l.demarei
In reply to @manis:matrix.org
Ah, I must not have any newlines in the optional argument to \plottable. But why are they ignored when directly passed to the \pgf... commands but not when they "go through" #1?
*

and that's also an issue with spaces… as spaces are preserved in that setup. so

\plottable[
  columns/0/.append style={
    /pgfplots/table/string replace*={foo}{bar}
  }%
]{\mytable}

would work, or

\plottable[
  columns/0/.append style={
    /pgfplots/table/string replace*={foo}{bar}
  }]{\mytable}
15:21:12
@manis:matrix.orgManisI need to read up on the TeX parser. OK, so if I have a newline at the end of the optional argument to \plottable and a newline after the #1 inside \plottable it breaks. If I remove _either_ it works.18:56:12
7 Feb 2024
@aguiarphys:matrix.orgBean joined the room.23:07:49
@aguiarphys:matrix.orgBean changed their display name from Richard A to Bean.23:11:49
@aguiarphys:matrix.orgBean set a profile picture.23:11:52
1 Mar 2024
@andonome:matrix.orgMalin joined the room.17:48:28
3 Mar 2024
@brodulf:matrix.orgBrodulf joined the room.09:13:38
31 Mar 2024
@inkbottle:matrix.orgzebragI want to cut the plane in two parts through a straight line, then put a point in one of the half-plane, the consider a circle centered on this point with radius greater than the distance of the point to the straight line, and actually draw only the arc/part of the circle, that is on the half plane where the point (center of the circle) is not. What are the best options to do that?21:45:32
@inkbottle:matrix.orgzebrag * I want to cut the plane in two parts through a straight line, then put a point in one of the half-plane, then consider a circle centered on this point with radius greater than the distance of the point to the straight line, and actually draw only the arc/part of the circle, that is on the half plane where the point (center of the circle) is not. What are the best options to do that?21:46:40
2 Apr 2024
@inkbottle:matrix.orgzebrag

Btw, this is what I came with:

\documentclass[tikz,border=2mm]{article}
\usepackage{tikz}
\usetikzlibrary{intersections}
\usetikzlibrary{calc}
\usepackage{xfp}

% Define the new command for sign-related angle adjustment
\newcommand{\adjustangle}[1]{%
  \fpeval{(#1) < 0 ? 180 : 0}%
}

\begin{document}
\begin{tikzpicture}

% Define the line as a path to be reused
\coordinate (A) at (-4,0); 
\coordinate (B) at (4,1); 
\path[name path=line] (A) -- (B); 

% Place the point
\coordinate (P) at (1,1.5); 

% Circle with radius greater than distance to the line, choose arbitrary for this example
\def\radius{2cm}

% Define the circle path
\path[name path=circle] (P) circle (\radius);

% Calculate intersections
\path[name intersections={of=circle and line,by={C,D}}];

% Draw the straight line
\draw (A) -- (B); 

% Mark the point
\fill (P) circle (2pt) node[above] {$P$};
\fill (C) circle (2pt) node[above] {$C$};
\fill (D) circle (2pt) node[above] {$D$};

% Draw the part of the circle on the other half plane
\draw[very thick, blue] let \p1=(C), \p2=(D), \p3=(P) in (C)
arc[start angle={atan((\y1-\y3)/(\x1-\x3))-\adjustangle{\x1-\x3}},
end angle={atan((\y2-\y3)/(\x2-\x3))-\adjustangle{\x2-\x3}},
radius=\radius];

\end{tikzpicture}
\end{document}
22:47:49
6 Apr 2024
@inkbottle:matrix.orgzebrag

I'm trying to have something like that working:

\documentclass{article}
\usepackage{tikz}

\newcommand{\adjustangle}[1]{%
  \pgfmathparse{ifthenelse(#1 < 0, 180, 0)}
  \pgfmathresult
}

\begin{document}

\begin{tikzpicture}
  \draw
  (0,1) arc[start angle={45-\adjustangle{45}},
    end angle={60},
    radius=1];

\end{tikzpicture}

\end{document}
10:18:33
@inkbottle:matrix.orgzebrag

But whichever way I put it I always have something like that:

\pgfmath@catcodes ...`\|=12 \catcode `\&=12 \let "
                                                  \pgfmath@char@quote
10:19:22
@inkbottle:matrix.orgzebragIs there no other way than inlining?10:27:20
13 Apr 2024
@muzzi:matrix.orgmuzimuzhiWhat05:29:42
@muzzi:matrix.orgmuzimuzhi * What's "inlining"?05:29:52
@muzzi:matrix.orgmuzimuzhi

You can declare new pgfmath functions through /pgf/declare function key:

\tikzset{
  declare function={adjustangle(\a)=ifthenelse(\a < 0, 180, 0);}
}
05:34:52
@muzzi:matrix.orgmuzimuzhi *

You can declare new pgfmath functions through /pgf/declare function key:

\tikzset{
  declare function={adjustangle(\a)=ifthenelse(\a < 0, 180, 0);}
}

It's slower than \pgfmathdeclarefunction, but easier to use.

05:35:46
@muzzi:matrix.orgmuzimuzhi

Full example

\documentclass{article}
\usepackage{tikz}

\tikzset{
  declare function={adjustangle(\a)=ifthenelse(\a < 0, 180, 0);}
}

\begin{document}

\begin{tikzpicture}
  \draw
  (0,1) arc[start angle={45-adjustangle{45}},
    end angle={60},
    radius=1];

\end{tikzpicture}

\end{document}
05:37:09
@muzzi:matrix.orgmuzimuzhi
In reply to @inkbottle:matrix.org
I want to cut the plane in two parts through a straight line, then put a point in one of the half-plane, then consider a circle centered on this point with radius greater than the distance of the point to the straight line, and actually draw only the arc/part of the circle, that is on the half plane where the point (center of the circle) is not.
What are the best options to do that?
Have a look at tkz-euclide package? https://ctan.org/pkg/tkz-euclide
05:39:19
@inkbottle:matrix.orgzebragHi, tx, looking into that asap11:19:19
@inkbottle:matrix.orgzebrag
In reply to @muzzi:matrix.org
What's "inlining"?
In this context it would be inserting the body of the macro everywhere the macro should be called/expanded, in other words performing the macro expansion by hand.
11:21:28
29 Apr 2024
@ailin.nemui:matrix.orgNei joined the room.21:34:48
5 May 2024
@zmberber:matrix.orgZM Berber joined the room.19:26:30
12 May 2024
@sourcecodedeleted:matrix.orgsourcecodedeleted joined the room.18:24:15
@sourcecodedeleted:matrix.orgsourcecodedeletedGood evening everyone18:24:38
@sourcecodedeleted:matrix.orgsourcecodedeletedI was to ask about this library 18:24:50
@sourcecodedeleted:matrix.orgsourcecodedeletedIs there any javascript interfaces with this? 18:25:41

Show newer messages


Back to Room ListRoom Version: 6