From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: from cgl.ntg.nl (Cgl.ntg.nl [5.39.185.202]) by inbox.vuxu.org (Postfix) with ESMTP id 549BE23E7A for ; Tue, 9 Apr 2024 18:03:05 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id DF72848404C for ; Tue, 9 Apr 2024 18:00:18 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Authentication-Results: cgl.ntg.nl (amavisd-new); dkim=fail (2048-bit key) reason="fail (message has been altered)" header.d=gmail.com Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4uI3IAV9z8QR for ; Tue, 9 Apr 2024 18:00:17 +0200 (CEST) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id A593A484200 for ; Tue, 9 Apr 2024 17:59:13 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id D8A62483F73 for ; Tue, 9 Apr 2024 17:58:32 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5ua42m7wCzTi for ; Tue, 9 Apr 2024 17:58:32 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.208.46; helo=mail-ed1-f46.google.com; envelope-from=wolfgang.schuster.lists@gmail.com; receiver= Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cgl.ntg.nl (Postfix) with ESMTPS id 7BDE6483F72 for ; Tue, 9 Apr 2024 17:58:32 +0200 (CEST) Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-56e477db7fbso4824014a12.3 for ; Tue, 09 Apr 2024 08:58:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712678312; x=1713283112; darn=ntg.nl; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject:from:to:cc :subject:date:message-id:reply-to; bh=g7iLfdKIy8OaSQ/yBrptmdOseIPd/wybaC6SQfp6OmA=; b=Np8/TMmEKx35XdynBbEEMw5iNVNCmNkfO5qKQiYTJZHIxvGS+9eAFMizNqnAd26y80 A7WnfC86yvw3yEyh3vZUD0ceE9cWIjUMZ9UiJB/wHF4TH8yZrX0w1yqyU/y4T4SS8s8E s67Bp4wBRZKkreQs1i6kkOdqZWRvx+75ZqS/AoVpCOsaLKyUJmzT57DuctH5nusnyinY cxcUlWJ/HYuwNVBpsrW6kmV4TBPi/tgKXigl9sbfjcZoHmiX2GmQEVqe2r0F1ts0rmHZ kMJ5IIpvMBC8nIUTwe8iPp2dJ6p8pj3UwGVyfIJ9HDp8sGzyhw1bTzAnLlKmF7q3NSyz 3I6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712678312; x=1713283112; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=g7iLfdKIy8OaSQ/yBrptmdOseIPd/wybaC6SQfp6OmA=; b=YkD/PjNonUJs8WbGfIihxk2dUeOVTdFgLSe+OcyoWSx2r8J6aE7NhQ5YMAE6SoDEir ZDXKTC0C/r2N7EGEg2XB6k138BKjFlMc9EbzFTRrrUrd8CeeG6BMFsjGdnDYC9wj6NPb un8iqE62PqG1GNFTvLyyMCaSNiN68C3QqnMQ0hrf6EKcDLT4bDv7OhhDNwh7FkYK3AXx 6Rsx5+yILOdEVSQ1QmIsrmZeiomHFFX6mvfX1HpwP9uUgl8B/+w2TKP4Jlx1kVKnY3It s3YjRReoP+O/0kOiNLo6O7iGhu8r4aSVPhjEzUZYXsyXYmFZWlKQJcsIgupq3biKDAqO L4uw== X-Gm-Message-State: AOJu0YyLb+RyfCnifLjcQvT7PiGaApmIFvTZ0WzpwMd5OHuqLSJCCWRM GoNo5XF8P9pjeRjOHCwbgzv00fWfhH+OPhAZK9Dw+Gi5F4DZUx3N X-Google-Smtp-Source: AGHT+IGGNHoYdzpRfOIHHfLEM30UQcB62IcGdhRJ5p2CizTC2MQVElKSeRO/TpXkVarjF0YFjkUbsA== X-Received: by 2002:a50:999c:0:b0:56d:f637:451c with SMTP id m28-20020a50999c000000b0056df637451cmr7747879edb.32.1712678311796; Tue, 09 Apr 2024 08:58:31 -0700 (PDT) Received: from ?IPv6:2a02:810d:a8bf:dc10::a092? ([2a02:810d:a8bf:dc10::a092]) by smtp.gmail.com with ESMTPSA id k11-20020a056402048b00b0056bc0c44f02sm73527edv.96.2024.04.09.08.56.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2024 08:57:24 -0700 (PDT) To: mailing list for ConTeXt users , seyal.zavira@gmail.com References: <171266722269.3369327.8131443943302856031@cgl.ntg.nl> From: Wolfgang Schuster Message-ID: Date: Tue, 9 Apr 2024 17:56:51 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 PostboxApp/7.0.60 MIME-Version: 1.0 In-Reply-To: <171266722269.3369327.8131443943302856031@cgl.ntg.nl> Content-Language: en-US Message-ID-Hash: M2F5IZCBG3RYKKQ3TVC2T4DS2OFCAM4T X-Message-ID-Hash: M2F5IZCBG3RYKKQ3TVC2T4DS2OFCAM4T X-MailFrom: wolfgang.schuster.lists@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Re: how to apply metapost effects to section title? List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii"; format="flowed" Content-Transfer-Encoding: 7bit seyal.zavira@gmail.com schrieb am 09.04.2024 um 14:53: > i want to produce a gradient header > i tried this code but it does not produce any result: > > \startext > \def\Mystyle#1{\startMPcode > picture tt ; tt := lmt_outline [ > kind = "path", > text = "#1", > ] ; > fill > for i within tt : pathpart i && endfor cycle > withshademethod "linear" > withshadedirection up > withshadecolors (red, blue) ; > \stopMPcode > } > > \definehead[Myhead][section] > \setuphead[Myhead][ > style=\Mystyle, > ] > \startMyhead[title=sample] a sample text \stopMyhead > \stoptext You can't use commands with parameters as argument for the style key. To format single parts (number or title) of a section title you have to apply a command to the "deep...command" key but even then you have to make manual changes to the vertical alignment of the text. %%%% begin example \starttexdefinition spaces Mystyle #1 \setbox\scratchboxone\hbox{#1}% \setbox\scratchboxtwo\hbox\bgroup \startMPcode picture tt ; tt := lmt_outline [ kind = "path", text = "#1", ]; fill for i within tt : pathpart i && endfor cycle withshademethod "linear" withshadedirection up withshadecolors (red, blue) ; \stopMPcode \egroup \boxyoffset\scratchboxtwo-\dp\scratchboxone \box\scratchboxtwo \stoptexdefinition \starttext \setuphead [section] [ deeptextcommand=\Mystyle, % deepnumbercommand=\Mystyle, ] \startsection[title=Lorem ipsum] \samplefile{lorem} \stopsection \stoptext %%%% end example > and the code below works but does not colorize numbers of this heads: > \starttext > > \def\Mystyle#1{\startMPcode > picture tt ; tt := lmt_outline [ > kind = "path", > text = "#1", > ] ; > fill > for i within tt : pathpart i && endfor cycle > withshademethod "linear" > withshadedirection up > withshadecolors (red, blue) ; > \stopMPcode > } > > \def\startMysection#1{\startsection[title=\Mystyle{#1}]} > \def\stopMysection{\stopsection} > > \startMysection{hello} > what is best method? > \stopMysection > > \stoptext > > what is your suggestion? To apply the format the the complete section title you have to create your own style and apply it with the "command" key, to get the number and title for the current section use the \structurenumber and \structuretitle macros. %%%% begin example \starttexdefinition spaces protected Mystyle #1#2 \startMPcode picture tt ; tt := lmt_outline [ kind = "path", text = "\structurenumber\space\structuretitle", ]; fill for i within tt : pathpart i && endfor cycle withshademethod "linear" withshadedirection up withshadecolors (red, blue) ; \stopMPcode \stoptexdefinition \starttext \setuphead [section] [command=\Mystyle] \startsection[title=Lorem ipsum] \samplefile{lorem} \stopsection \stoptext %%%% end example Wolfgang ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________