From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id MKcsGnKN12EK6QAAgWs5BA (envelope-from ) for ; Fri, 07 Jan 2022 01:46:42 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id oGCnFnKN12H+MwEAauVa8A (envelope-from ) for ; Fri, 07 Jan 2022 01:46:42 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A636F390ED for ; Fri, 7 Jan 2022 01:46:41 +0100 (CET) Received: from localhost ([::1]:56320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5dOx-0005oX-OR for larch@yhetil.org; Thu, 06 Jan 2022 19:46:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5dJk-0005UD-8U for emacs-orgmode@gnu.org; Thu, 06 Jan 2022 19:41:18 -0500 Received: from mout02.posteo.de ([185.67.36.66]:48299) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5dJd-00017b-5O for emacs-orgmode@gnu.org; Thu, 06 Jan 2022 19:41:11 -0500 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 12739240101 for ; Fri, 7 Jan 2022 01:41:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1641516067; bh=8qiFQznxxA0WvRckbVr0BfDx+YWAhSPvymNnl9RDq0c=; h=From:To:Subject:Date:From; b=nHuJB6yHLJ6aqqWZeTjqpaHN9ruPpni6CuylFLdCXdKDlINKmwLh3uOd8QEnCW/2j opHUJRlJ+TiE3k3WgvwgFuZpAcHLYes9GawtfCfQXEJzLHF9Loa5n1/xfUl6Em+VCQ 34yuh1kHuvO5KVRH81fEu0hGkkk42vTQVHyFHz8Z8A/WXres/8PmyAcqwRpnHVb7UY r7fI7R2ilvJ8UN6U98Z1UMTvc1I1Qeguf+u3ZvLwjYWWPV1p90A7Twf12rMyrCNiM5 xR8/wq7+n+5h2lniIodv+su1Qh8IOdgWHaPW/9m2i7vn8q4ADUNwEz4URpkKfQOUya gHiWu3g8ICGDw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4JVPXf2tV7z9rwn for ; Fri, 7 Jan 2022 01:41:06 +0100 (CET) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: orgmode Subject: Filter to put decorative initial letters Date: Fri, 07 Jan 2022 00:41:03 +0000 Message-ID: <871r1kwf6o.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=maciaschain@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1641516402; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=xjv3zJ6H4tlhqwSQOFzDr1aNrHObA9K4MeVWIX2LE5w=; b=LtKwm7LTOZk0U6oig0jlz6PGnqHun/K1LAu72swlWDjNx+foQS8hTQ95bb2j+GFmrPlP/A GmZPJWApc4CchA3aUDSi3Dy0jT2mH0q2hkoQDobGvtbPO5dOxgB9kRKQXWaEB1vGxtWKFD qL2gdmuH02XMmT6gyAxdstDmRBd8GFQYmcyuz1DXJNdULjUVWoUUkpgaLdbo1KL0OBoP6U FYRqT4m510KCF5/pp8vrrNg0IPchGlhJZE7ahd25MLlHspkzztiNQ5Ff7kh9PiNNnMV7nN xW+41TKMJRQKszq2uJbQvi+A2AkRcdV7bfmmo89zHYhJzlw64uqs3lLSqapGNA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641516402; a=rsa-sha256; cv=none; b=mnDZtdP13h5GmBmy8FZS5FO0ucNtlds7lS9Df/6OgroeMXLU4O5btSfVKm5xzo2PT0U6a+ dPXpRmZEP8/Cu80wPiPtgNsSr2tFmcM3JR79oILoU+pEFZ/sUNDV8BH7xz9cZi82Qkz0T4 MROWCjSDQEiq4rwZmriTHCWYTmdlCN8GepjFymGo7jCHyXqnG9sA9aUvD0zKjd1aePNdi3 5vmqmyZo2W7n8MNJp1BDHYaFc6qy0eeU+3Z4cIE7QuAgfvYlx7CvxSNrEAHB4YEufbAD52 OlQIMOfPeTjbOUtXnFoUGxnvtfTDAZ9a/hIM2kgyhU/6s6evUQcAOoHzMew7fA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=nHuJB6yH; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -4.00 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=nHuJB6yH; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: A636F390ED X-Spam-Score: -4.00 X-Migadu-Scanner: scn1.migadu.com X-TUID: cG268Vizrt9n Hi, These past holidays I've been experimenting with some little useful, but fun stuff. This is an export filter to put a decorative initial letter in the first paragraphs of the first level sections, using the LaTeX package lettrine (https://www.ctan.org/pkg/lettrine). A screenshot: https://i.imgur.com/mLQVHFC.png #+BIND: org-export-filter-parse-tree-functions (lettrine) #+begin_src emacs-lisp :exports results :results none (defun lettrine (tree backend info) (when (org-export-derived-backend-p backend 'latex) (org-element-map tree 'headline (lambda (section) (when (eq 1 (org-element-property :level section)) (let* ((contents (org-element-interpret-data (org-element-contents section))) (lettrine-opt (org-export-get-node-property :LETTRINE_OPTIONS section t)) (contents-lettrine (with-temp-buffer (insert contents) (save-excursion (goto-char (point-min)) (re-search-forward "\\(\\b.\\)\\([^\s]+\\b\\)" nil t) (replace-match (concat "\\\\lettrine" (if lettrine-opt (format "[%s]" lettrine-opt) "") "{" "\\1" "}" "{" "\\2" "}") t nil) (org-element-parse-buffer))))) (apply #'org-element-set-contents section (list contents-lettrine))))) info) tree)) #+end_src Best regards, Juan Manuel