ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Strange behavior with TikZ
@ 2017-10-05 17:26 Fabrice Couvreur
  2017-10-05 20:35 ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Fabrice Couvreur @ 2017-10-05 17:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2442 bytes --]

Hello,
If I put any image, there is no problem : the title of the section is in
color and the text in black.
With a graphic made with TikZ, the title and the text are in color.
Thank you for your help.
Fabrice

\usemodule[tikz]

\usemodule [graph]

\usemodule[pgfplots]

\pgfplotsset{compat=newest}

\definecolor[Mycolor][c=.6,m=0.8,y=0,k=0]

\unexpanded\def\interff#1#2{\math{\left[#1\,;#2\right]}}

\setuphead
   [section]
   [textcommand=,
    color=magenta,
    style=]


\starttext
\startsection[title={Résoudre graphiquement une équation
\math{f(x)=g(x)}},sectionsegments=section,color=magenta]

\placefigure[none,right]{}{
\hbox{\switchtobodyfont[8pt]
\starttikzpicture[/pgf/declare function={f(\x)=\x^2-3;},/pgf/declare
function={g(\x)=-\x^2+2*\x+1;}]
\startaxis[
 restrict x to domain=-3:3, xmax=3, xmin=-3,
 restrict y to domain=-5:4, ymax=4, ymin=-5,
 x=1cm,
 y=0.5cm,
 axis x line = middle,
 axis y line = middle,
 axis line style = thick,
 major grid style=Mycolor,
 minor grid style=Mycolor,
 grid=both,
 xtick={-2,...,2},
 ytick={-4,...,3},
 extra x ticks={-3,3},
 extra x tick label={\null},
 extra y ticks={-5,4},
 extra y tick label={\null},
 extra tick style={tick style={draw=none}},
 every tick/.style={
        black,
        thick,
      },
 y tick label style={
           /pgf/number format/1000 sep={}
       },
 xlabel=$x$,ylabel=$y$,
 every axis x label/.style={
    at={(ticklabel* cs:1.01)},
    anchor=west,
},
every axis y label/.style={
    at={(ticklabel* cs:1.01)},
    anchor=south,
},
 samples=2000,
 >=stealth,
  ]
\addplot[only marks,mark=x,color=black,mark options={scale=1.5},
    thick] table[x=Nombre,y=Valeur]{
           Nombre   Valeur
            -1       -2
             2       1
} ;
\addplot [smooth,domain=-1.5:2.5, thick,magenta] {f(x)} ;
\addplot [smooth,domain=-1.5:2.5, thick,green] {g(x)} ;

\node[above left,green] at (2,2) {\math{{\cal C}_g}} ;
\node[below right,magenta] at (1.5,-1) {\math{{\cal C}_f}} ;
\node[below left ] at (-0.1,-0.1) {\math{0}} ;

\node[fill=black,circle,scale=0.4,magenta] at (-1.5,{f(-1.5)}){} ;
\node[fill=black,circle,scale=0.4,magenta] at (2.5,{f(2.5)}){} ;

\node[fill=black,circle,scale=0.4,green] at (-1.5,{g(-1.5)}){} ;
\node[fill=black,circle,scale=0.4,green] at (2.5,{g(2.5)}){} ;

\stopaxis
\stoptikzpicture}}

\input knuth

\stopsection

\stoptext

[-- Attachment #1.2: Type: text/html, Size: 3057 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Strange behavior with TikZ
  2017-10-05 17:26 Strange behavior with TikZ Fabrice Couvreur
@ 2017-10-05 20:35 ` Hans Hagen
  2017-10-05 20:51   ` Fabrice Couvreur
  0 siblings, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2017-10-05 20:35 UTC (permalink / raw)
  To: ntg-context

On 10/5/2017 7:26 PM, Fabrice Couvreur wrote:

> If I put any image, there is no problem : the title of the section is in 
> color and the text in black.
> With a graphic made with TikZ, the title and the text are in color.

looks ok here

> \placefigure[none,right]{}{
> \hbox{\switchtobodyfont[8pt]

add a % after the above line (otherwise you get a space)

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Strange behavior with TikZ
  2017-10-05 20:35 ` Hans Hagen
@ 2017-10-05 20:51   ` Fabrice Couvreur
  2017-10-07 10:17     ` Fabrice Couvreur
  0 siblings, 1 reply; 9+ messages in thread
From: Fabrice Couvreur @ 2017-10-05 20:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1486 bytes --]

HI Hans,

like this ?

\placefigure[none,right]{}{
\hbox{\switchtobodyfont[8pt]%

Fabrice

2017-10-05 22:35 GMT+02:00 Hans Hagen <pragma@wxs.nl>:

> On 10/5/2017 7:26 PM, Fabrice Couvreur wrote:
>
> If I put any image, there is no problem : the title of the section is in
>> color and the text in black.
>> With a graphic made with TikZ, the title and the text are in color.
>>
>
> looks ok here
>
> \placefigure[none,right]{}{
>> \hbox{\switchtobodyfont[8pt]
>>
>
> add a % after the above line (otherwise you get a space)
>
> -----------------------------------------------------------------
>                                           Hans Hagen | PRAGMA ADE
>               Ridderstraat 27 | 8061 GH Hasselt | The N
> <https://maps.google.com/?q=Ridderstraat+27+%7C+8061+GH+Hasselt+%7C+The+N&entry=gmail&source=g>
> etherlands
>        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------
> ____________________________________________________________
> _______________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/list
> info/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ____________________________________________________________
> _______________________

[-- Attachment #1.2: Type: text/html, Size: 3122 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Strange behavior with TikZ
  2017-10-05 20:51   ` Fabrice Couvreur
@ 2017-10-07 10:17     ` Fabrice Couvreur
  2017-10-07 12:40       ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: Fabrice Couvreur @ 2017-10-07 10:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1902 bytes --]

Hi Hans
Sorry to insist, but I need to correct this anomaly for my documents that I
give to students. If I compile with Context Standalone, it does not work,
but maybe I do not do what you are suggesting :


\placefigure[none,right]{}{%
\hbox{\switchtobodyfont[8pt]

Thanks
Fabrice

2017-10-05 22:51 GMT+02:00 Fabrice Couvreur <fabrice1.couvreur@gmail.com>:

> HI Hans,
>
> like this ?
>
> \placefigure[none,right]{}{
> \hbox{\switchtobodyfont[8pt]%
>
> Fabrice
>
> 2017-10-05 22:35 GMT+02:00 Hans Hagen <pragma@wxs.nl>:
>
>> On 10/5/2017 7:26 PM, Fabrice Couvreur wrote:
>>
>> If I put any image, there is no problem : the title of the section is in
>>> color and the text in black.
>>> With a graphic made with TikZ, the title and the text are in color.
>>>
>>
>> looks ok here
>>
>> \placefigure[none,right]{}{
>>> \hbox{\switchtobodyfont[8pt]
>>>
>>
>> add a % after the above line (otherwise you get a space)
>>
>> -----------------------------------------------------------------
>>                                           Hans Hagen | PRAGMA ADE
>>               Ridderstraat 27 | 8061 GH Hasselt | The N
>> <https://maps.google.com/?q=Ridderstraat+27+%7C+8061+GH+Hasselt+%7C+The+N&entry=gmail&source=g>
>> etherlands
>>        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
>> -----------------------------------------------------------------
>> ____________________________________________________________
>> _______________________
>> If your question is of interest to others as well, please add an entry to
>> the Wiki!
>>
>> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/list
>> info/ntg-context
>> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki     : http://contextgarden.net
>> ____________________________________________________________
>> _______________________
>
>
>

[-- Attachment #1.2: Type: text/html, Size: 4787 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Strange behavior with TikZ
  2017-10-07 10:17     ` Fabrice Couvreur
@ 2017-10-07 12:40       ` Aditya Mahajan
  2017-10-07 12:44         ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2017-10-07 12:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, 7 Oct 2017, Fabrice Couvreur wrote:

> Hi Hans
> Sorry to insist, but I need to correct this anomaly for my documents that I
> give to students. If I compile with Context Standalone, it does not work,
> but maybe I do not do what you are suggesting :

I can confirm that color leakage. It happens due to pgfplots (and not 
tikz). Here is the smallest example I could come up with that shows the 
color leakage (the text is also colored magenta).

\usemodule[pgfplots]

\setuphead
    [section]
    [color=magenta]

\starttext
\startsection[title={Test}]

\startplacefigure[location={none,right}]
   \hbox{\starttikzpicture
     \startaxis
         [
           xmax=3, xmin=-3,
           ymax=4, ymin=-5,
         ]
     \stopaxis
   \stoptikzpicture}
\stopplacefigure

\input knuth

\stopsection
\stoptext

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Strange behavior with TikZ
  2017-10-07 12:40       ` Aditya Mahajan
@ 2017-10-07 12:44         ` Aditya Mahajan
  2017-10-07 13:59           ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2017-10-07 12:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, 7 Oct 2017, Aditya Mahajan wrote:

> On Sat, 7 Oct 2017, Fabrice Couvreur wrote:
>
>> Hi Hans
>> Sorry to insist, but I need to correct this anomaly for my documents that 
> I
>> give to students. If I compile with Context Standalone, it does not work,
>> but maybe I do not do what you are suggesting :
>
> I can confirm that color leakage. It happens due to pgfplots (and not 
> tikz).

I use tikz/pgfplots extensively and started wondering why I don't see this 
error. Then I realized that I use a modified definition of 
starttikzpicture in my code:

\define\starttikzpicture
     {\hbox\bgroup\forcecolorhack\tikzpicture}

\define\stoptikzpicture
     {\endtikzpicture\egroup}


With this definition, you code works correctly.

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Strange behavior with TikZ
  2017-10-07 12:44         ` Aditya Mahajan
@ 2017-10-07 13:59           ` Hans Hagen
  2017-10-07 21:48             ` Fabrice Couvreur
  2017-10-10  7:03             ` luigi scarso
  0 siblings, 2 replies; 9+ messages in thread
From: Hans Hagen @ 2017-10-07 13:59 UTC (permalink / raw)
  To: ntg-context

On 10/7/2017 2:44 PM, Aditya Mahajan wrote:
> On Sat, 7 Oct 2017, Aditya Mahajan wrote:
> 
>> On Sat, 7 Oct 2017, Fabrice Couvreur wrote:
>>
>>> Hi Hans
>>> Sorry to insist, but I need to correct this anomaly for my documents 
>>> that 
>> I
>>> give to students. If I compile with Context Standalone, it does not 
>>> work,
>>> but maybe I do not do what you are suggesting :
>>
>> I can confirm that color leakage. It happens due to pgfplots (and not 
>> tikz).
> 
> I use tikz/pgfplots extensively and started wondering why I don't see 
> this error. Then I realized that I use a modified definition of 
> starttikzpicture in my code:
> 
> \define\starttikzpicture
>      {\hbox\bgroup\forcecolorhack\tikzpicture}
> 
> \define\stoptikzpicture
>      {\endtikzpicture\egroup}
> 
> 
> With this definition, you code works correctly.
yes, i thought that was already done so someone needs to get that into 
the official code base

(btw, it seems that there is also a \stopmodule done without 
\startmodule when tikz is loaded)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Strange behavior with TikZ
  2017-10-07 13:59           ` Hans Hagen
@ 2017-10-07 21:48             ` Fabrice Couvreur
  2017-10-10  7:03             ` luigi scarso
  1 sibling, 0 replies; 9+ messages in thread
From: Fabrice Couvreur @ 2017-10-07 21:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2152 bytes --]

Hi,
Thank you so much for this help, I would not have found it.
Fabrice

2017-10-07 15:59 GMT+02:00 Hans Hagen <pragma@wxs.nl>:

> On 10/7/2017 2:44 PM, Aditya Mahajan wrote:
>
>> On Sat, 7 Oct 2017, Aditya Mahajan wrote:
>>
>> On Sat, 7 Oct 2017, Fabrice Couvreur wrote:
>>>
>>> Hi Hans
>>>> Sorry to insist, but I need to correct this anomaly for my documents
>>>> that
>>>>
>>> I
>>>
>>>> give to students. If I compile with Context Standalone, it does not
>>>> work,
>>>> but maybe I do not do what you are suggesting :
>>>>
>>>
>>> I can confirm that color leakage. It happens due to pgfplots (and not
>>> tikz).
>>>
>>
>> I use tikz/pgfplots extensively and started wondering why I don't see
>> this error. Then I realized that I use a modified definition of
>> starttikzpicture in my code:
>>
>> \define\starttikzpicture
>>      {\hbox\bgroup\forcecolorhack\tikzpicture}
>>
>> \define\stoptikzpicture
>>      {\endtikzpicture\egroup}
>>
>>
>> With this definition, you code works correctly.
>>
> yes, i thought that was already done so someone needs to get that into the
> official code base
>
> (btw, it seems that there is also a \stopmodule done without \startmodule
> when tikz is loaded)
>
> Hans
>
> -----------------------------------------------------------------
>                                           Hans Hagen | PRAGMA AD
> <https://maps.google.com/?q=Hans+Hagen+%7C+PRAGMA+AD&entry=gmail&source=g>
> E
>               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------
> ____________________________________________________________
> _______________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/list
> info/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ____________________________________________________________
> _______________________
>

[-- Attachment #1.2: Type: text/html, Size: 4020 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Strange behavior with TikZ
  2017-10-07 13:59           ` Hans Hagen
  2017-10-07 21:48             ` Fabrice Couvreur
@ 2017-10-10  7:03             ` luigi scarso
  1 sibling, 0 replies; 9+ messages in thread
From: luigi scarso @ 2017-10-10  7:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, Oct 7, 2017 at 3:59 PM, Hans Hagen <pragma@wxs.nl> wrote:
> (btw, it seems that there is also a \stopmodule done without \startmodule
> when tikz is loaded)
>
> Hans

I am surprised that \loggingall  before \starttext
produces 2.3GByte of log.


\usemodule[tikz]

\usemodule [graph]

\usemodule[pgfplots]

\pgfplotsset{compat=newest}

\definecolor[Mycolor][c=.6,m=0.8,y=0,k=0]

\unexpanded\def\interff#1#2{\math{\left[#1\,;#2\right]}}

\setuphead
   [section]
   [textcommand=,
    color=red, %magenta,
    style=]

\loggingall
\starttext
\startsection[title={Résoudre graphiquement une équation
\math{f(x)=g(x)}},sectionsegments=section,color=magenta]


\placefigure[none,right]{}{
:
:
\stopsection

\stoptext



-- 
luigi
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-10-10  7:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-05 17:26 Strange behavior with TikZ Fabrice Couvreur
2017-10-05 20:35 ` Hans Hagen
2017-10-05 20:51   ` Fabrice Couvreur
2017-10-07 10:17     ` Fabrice Couvreur
2017-10-07 12:40       ` Aditya Mahajan
2017-10-07 12:44         ` Aditya Mahajan
2017-10-07 13:59           ` Hans Hagen
2017-10-07 21:48             ` Fabrice Couvreur
2017-10-10  7:03             ` luigi scarso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).