diff options
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/emo/README.md | 60 | ||||
-rwxr-xr-x | graphics/emo/config/emo.py | 305 | ||||
-rw-r--r-- | graphics/emo/emo-graphics/emo-YHWH.pdf (renamed from graphics/emo/emo-graphics/YHWH.pdf) | bin | 2244 -> 2244 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-balance-scale.pdf (renamed from graphics/emo/emo-graphics/balance-scale.pdf) | bin | 3499 -> 3499 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-biohazard.pdf (renamed from graphics/emo/emo-graphics/biohazard.pdf) | bin | 4271 -> 4271 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-busts.pdf (renamed from graphics/emo/emo-graphics/busts.pdf) | bin | 1935 -> 1935 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-check-mark.pdf (renamed from graphics/emo/emo-graphics/check-mark.pdf) | 0 | ||||
-rw-r--r-- | graphics/emo/emo-graphics/emo-classical-building.pdf (renamed from graphics/emo/emo-graphics/classical-building.pdf) | bin | 2758 -> 2758 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-collision.pdf | bin | 0 -> 1590 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-currency-exchange.pdf (renamed from graphics/emo/emo-graphics/currency-exchange.pdf) | bin | 3410 -> 3410 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-desert-island.pdf (renamed from graphics/emo/emo-graphics/desert-island.pdf) | bin | 4431 -> 4431 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-detective.pdf (renamed from graphics/emo/emo-graphics/detective.pdf) | bin | 20689 -> 20689 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-enraged-face.pdf (renamed from graphics/emo/emo-graphics/enraged-face.pdf) | bin | 3283 -> 3283 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-eu.pdf (renamed from graphics/emo/emo-graphics/eu.pdf) | bin | 2019 -> 2019 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-exploding-head.pdf | bin | 0 -> 6550 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-eye.pdf (renamed from graphics/emo/emo-graphics/eye.pdf) | bin | 1765 -> 1765 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-floppy-disk.pdf (renamed from graphics/emo/emo-graphics/floppy-disk.pdf) | 0 | ||||
-rw-r--r-- | graphics/emo/emo-graphics/emo-foggy.pdf (renamed from graphics/emo/emo-graphics/foggy.pdf) | 0 | ||||
-rw-r--r-- | graphics/emo/emo-graphics/emo-globe-africa-europe.pdf (renamed from graphics/emo/emo-graphics/globe-africa-europe.pdf) | bin | 12291 -> 12291 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-handshake.pdf (renamed from graphics/emo/emo-graphics/handshake.pdf) | bin | 3868 -> 3868 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-judge.pdf (renamed from graphics/emo/emo-graphics/judge.pdf) | bin | 35445 -> 35445 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-keycap-one.pdf (renamed from graphics/emo/emo-graphics/keycap-one.pdf) | bin | 1808 -> 1808 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-label.pdf (renamed from graphics/emo/emo-graphics/label.pdf) | bin | 2765 -> 2765 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-lingchi.pdf (renamed from graphics/emo/emo-graphics/lingchi.pdf) | bin | 3096 -> 3096 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-loupe-left.pdf (renamed from graphics/emo/emo-graphics/loupe-left.pdf) | bin | 5415 -> 5415 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-pager.pdf (renamed from graphics/emo/emo-graphics/pager.pdf) | bin | 12525 -> 12525 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-parrot.pdf (renamed from graphics/emo/emo-graphics/parrot.pdf) | bin | 3218 -> 3218 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-rainbow-flag.pdf (renamed from graphics/emo/emo-graphics/rainbow-flag.pdf) | bin | 12941 -> 12941 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-receipt.pdf (renamed from graphics/emo/emo-graphics/receipt.pdf) | bin | 1763 -> 1763 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-robot.pdf (renamed from graphics/emo/emo-graphics/robot.pdf) | bin | 6546 -> 6546 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-roll-of-paper.pdf (renamed from graphics/emo/emo-graphics/roll-of-paper.pdf) | bin | 2086 -> 2086 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-stadium.pdf (renamed from graphics/emo/emo-graphics/stadium.pdf) | bin | 4317 -> 4317 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-stop-sign.pdf (renamed from graphics/emo/emo-graphics/stop-sign.pdf) | bin | 1454 -> 1454 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-triangular-ruler.pdf (renamed from graphics/emo/emo-graphics/triangular-ruler.pdf) | bin | 13238 -> 13238 bytes | |||
-rw-r--r-- | graphics/emo/emo-graphics/emo-wastebasket.pdf (renamed from graphics/emo/emo-graphics/wastebasket.pdf) | bin | 4292 -> 4292 bytes | |||
-rw-r--r-- | graphics/emo/emo-lingchi.ttf | bin | 0 -> 2312 bytes | |||
-rw-r--r-- | graphics/emo/emo.def | 3 | ||||
-rw-r--r-- | graphics/emo/emo.dtx | 502 | ||||
-rw-r--r-- | graphics/emo/emo.pdf | bin | 201775 -> 212523 bytes | |||
-rw-r--r-- | graphics/emo/lingchi.otf | bin | 2716 -> 0 bytes | |||
-rw-r--r-- | graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-calendar-plus.tex | 10 | ||||
-rw-r--r-- | graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-misc.tex | 2 | ||||
-rw-r--r-- | graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-nodes.tex | 15 | ||||
-rw-r--r-- | graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-positioning-plus.tex | 4 | ||||
-rw-r--r-- | graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-body.tex | 13 | ||||
-rw-r--r-- | graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-preamble.tex | 65 | ||||
-rw-r--r-- | graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-arrows.tex | 268 | ||||
-rw-r--r-- | graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-shapes-circlearrow.tex | 6 | ||||
-rw-r--r-- | graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-trans.tex | 4 | ||||
-rw-r--r-- | graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.bib | 103 | ||||
-rw-r--r-- | graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.pdf | bin | 649739 -> 676321 bytes | |||
-rw-r--r-- | graphics/pgf/contrib/tikz-ext/tex/generic/pgfkeyslibraryext.pgfkeys-plus.code.tex | 2 | ||||
-rw-r--r-- | graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.arrows.code.tex | 288 | ||||
-rw-r--r-- | graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.pgfkeys-plus.code.tex | 11 | ||||
-rw-r--r-- | graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.misc.code.tex | 2 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-hsb/Changes | 5 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-hsb/README | 7 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-hsb/doc/pst-hsb-doc.pdf | bin | 200014 -> 225159 bytes | |||
-rw-r--r-- | graphics/pstricks/contrib/pst-hsb/doc/pst-hsb-doc.tex | 28 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-hsb/latex/pst-hsb.sty | 2 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-hsb/tex/pst-hsb.tex | 94 |
61 files changed, 1459 insertions, 340 deletions
diff --git a/graphics/emo/README.md b/graphics/emo/README.md index 34a7541a3a..a7c65083c8 100644 --- a/graphics/emo/README.md +++ b/graphics/emo/README.md @@ -1,42 +1,56 @@ -# Emo: emoji for all (LaTeX engines) +# emoโขji for all (LaTeX engines) This package defines the `\emo{<emoji-name>}` macro for including color emoji in -a document no matter the input encoding or LaTeX engine. It uses the Noto color -emoji font if the engine supports doing so and falls back onto PDF graphics -otherwise. I wrote this package to use emoji in an academic paper subject to -[The ACM Publishing -System](https://authors.acm.org/proceedings/production-information/accepted-latex-packages), -which prohibits the use of most LaTeX packages but has only minimal support for -non-Latin scripts. ๐ +a document no matter the LaTeX engine. It uses the Noto color emoji font if the +engine supports doing so and falls back onto PDF graphics otherwise. In either +case, `\emo{desert-island}` results in ๐ and `\emo{parrot}` results in ๐ฆ. Emo +may come in particularly handy when dealing with academic publishers that +provide only minimal support for non-Latin scripts (cough, +[ACM](https://www.acm.org), cough). + +Emo's source repository is <https://github.com/apparebit/emo>. It also is +available [through CTAN](https://ctan.org/pkg/emo). Emo supports conversion +to HTML [with LaTeXML](https://github.com/brucemiller/LaTeXML). + +## Package Options When emo is used with the `extra` option, this package also defines the `\lingchi` and `\YHWH` macros for ๅ้ฒ and ืืืื, respectively. Both macros -preserve a subsequent space as space, no backslash needed. When used with the -`index` option, this package also emits a raw index entry for each use of an -emoji into an emo index or `.edx` file. +preserve a subsequent space as space, no backslash needed. + +When used with the `index` option, this package also emits a raw index entry for +each use of an emoji into an emo index or `.edx` file. + +## Installation + +To **extract files** embedded in [emo.dtx](emo.dtx), run `pdftex emo.dtx`. Note +that plain old `tex` won't do, since it mangles this README. `pdflatex` works, +but also generates the package documentation. The embedded files are `build.sh`, +`emo.ins`, `emo.sty`, `emo.sty.ltxml`, and `README.md`. -To **extract files** embedded in [emo.dtx](emo.dtx) and also rebuild the -[documentation](emo.pdf), run `pdflatex emo.dtx`. +To **build the documentation** embedded in `emo.dtx`, run `source build.sh`. The +shell script invokes `pdflatex emo.dtx` thrice and `makeindex` once each for the +change and the symbol indices, resulting in [emo.pdf](emo.pdf). To **configure the emoji**, run `python3 config/emo.py` with appropriate arguments. The [package documentation](emo.pdf) explains the configuration tool in detail, but you may find the `-h` for help option sufficient to get started. -To **install this package**, place `emo.def`, `emo.sty`, `lingchi.otf`, and the -contents of the `emo-graphics` directory somewhere where LaTeX can find them. In -a pinch, your project directory will do just fine. +To **install this package**, place `emo.def`, `emo.sty`, `emo.sty.ltxml`, +`emo-lingchi.ttf`, and the `emo-graphics` directory with the fallback PDF files +somewhere where LaTeX can find them. In a pinch, your project directory will do. ## Supported Emoji By default, emo supports only a few emoji: -1๏ธโฃ โฃ๏ธ โ๏ธ โ๏ธ ๐ช๐บ ๐ ๐ ๐๏ธ ๐๏ธ ๐๏ธ ๐ณ๏ธโ๐ ๐ท๏ธ ๐๏ธ ๐ฅ ๐ฑ ๐พ ๐ ๐ ๐ ๐ต๏ธ ๐๏ธ ๐ก ๐ ๐ค ๐ค ๐ฆ ๐งโโ๏ธ ๐งป ๐งพ +1๏ธโฃ โฃ๏ธ โ๏ธ โ๏ธ ๐ช๐บ ๐ ๐ ๐๏ธ ๐๏ธ ๐๏ธ ๐ณ๏ธโ๐ ๐ท๏ธ ๐๏ธ ๐ฅ ๐ฅ ๐ฑ ๐พ ๐ ๐ ๐ ๐ต๏ธ ๐๏ธ ๐ก ๐ ๐ค ๐ค ๐คฏ ๐ฆ ๐งโโ๏ธ ๐งป ๐งพ Their names are keycap-one, biohazard, balance-scale, check-mark, eu, foggy, globe-africa-europe, classical-building, desert-island, stadium, rainbow-flag, -label, eye, busts, currency-exchange, floppy-disk, triangular-ruler, pager, -loupe-left, detective, wastebasket, enraged-face, stop-sign, robot, handshake, -parrot, judge, roll-of-paper, and receipt. +label, eye, busts, collision, currency-exchange, floppy-disk, triangular-ruler, +pager, loupe-left, detective, wastebasket, enraged-face, stop-sign, robot, +handshake, exploding-head, parrot, judge, roll-of-paper, and receipt. The [package's documentation](emo.pdf) explains the underlying naming scheme and also how to reconfigure which emoji are supported. The [emo.py](config/emo.py) @@ -45,8 +59,8 @@ into PDF files and generating an updated `emo.def` file. ## Copyright and Licensing -This package combines code written in LaTeX and Python with Unicode data about -emoji as well as graphics and fonts derived from Google's Noto fonts. As a +This package combines code written in LaTeX, Python, and Perl with Unicode data +about emoji as well as graphics and fonts derived from Google's Noto fonts. As a result, a number of different licenses apply, all of which are [OSI approved](https://opensource.org/licenses/) and non-copyleft: @@ -59,7 +73,7 @@ approved](https://opensource.org/licenses/) and non-copyleft: * The [emoji-test.txt](config/emoji-test.txt) configuration file is a data file from [Unicode TR-51](https://unicode.org/reports/tr51/) and hence subject to the [Unicode License](https://www.unicode.org/license.txt). - * The `lingchi.otf` font is a two-glyph subset of the serif traditional + * The `emo-lingchi.ttf` font is a two-glyph subset of the serif traditional Chinese version of Google's [Noto fonts](https://github.com/notofonts/noto-cjk) and hence subject to the [SIL Open Font License v1.1](https://scripts.sil.org/ofl). diff --git a/graphics/emo/config/emo.py b/graphics/emo/config/emo.py index 70fad3bc65..7d45b98307 100755 --- a/graphics/emo/config/emo.py +++ b/graphics/emo/config/emo.py @@ -13,8 +13,11 @@ if sys.version_info < (3,7): from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter from dataclasses import dataclass, field +from datetime import datetime from enum import Enum +from itertools import chain import json +import os from pathlib import Path import re import shutil @@ -26,8 +29,9 @@ from typing import ( from urllib.request import urlopen # -------------------------------------------------------------------------------------- +# Provide a simple console logger -class Log: +class Logger: def __init__(self, out: TextIO = sys.stderr) -> None: self._out = out self._first_header = True @@ -59,10 +63,154 @@ class Log: def info(self, text: str) -> None: self.pln(self.sgr('1;34', f'INFO: {text}', '0;39')) -log = Log() +logger = Logger() # -------------------------------------------------------------------------------------- -# Emoji Names +# Build a self-contained `demo.html` + +STYLE_LINK = re.compile( + f'<link rel="stylesheet" href="(?P<sheet>[^"]+)" type="text/css">' +) + +def make_demo(): + # Write extra styles to file. + logger.info('Writing auxiliary style sheet "demo.css"') + with open('demo.css', mode='w', encoding='utf8') as file: + file.write(""" +:root { + font-size: 300%; +} + """) + + # Convert to HTML and read in result. + logger.info('Converting LaTeX source in "demo.tex" to HTML in "demo.tmp.html"') + subprocess.run([ + 'latexmlc', + '--css=demo.css', + '--destination=demo.tmp.html', + 'demo.tex'] + ) + with open('demo.tmp.html', mode='r', encoding='utf8') as file: + content = file.read() + + # Find all links to style sheets and replace them with CSS content. + style_sheets = [] + fragments = [] + + last_index = 0 + for link in STYLE_LINK.finditer(content): + fragments.append(content[last_index:link.start()]) + + style_sheet = link.group('sheet') + style_sheets.append(style_sheet) + + logger.info(f'Loading style sheet "{style_sheet}"') + with open(style_sheet, mode='r', encoding='utf8') as file: + css = file.read() + if not css.startswith('\n'): + css = f'\n{css}' + + fragments.append(f'<style>{css}</style>') + last_index = link.end() + + fragments.append(content[last_index:]) + + # Write result and clean up. + logger.info(f'Writing self-contained HTML document "demo.html"') + with open('demo.html', mode='w', encoding='utf8') as file: + for fragment in fragments: + file.write(fragment) + + os.unlink('demo.tmp.html') + for style_sheet in style_sheets: + os.unlink(style_sheet) + +# -------------------------------------------------------------------------------------- +# Build an archive for release + +EMO_FILES = ( + 'emo.def', + 'emo.dtx', + 'emo.pdf', + 'emo-lingchi.ttf', + 'README.md', + 'config/emo.py', + 'config/emoji-test.txt' +) + +EMO_GRAPHICS = 'emo-graphics' + +EMO_METADATA = re.compile( + r""" + ^[ ]{4}\[ + (?P<date>\d{4}/\d{1,2}/\d{1,2}) + [ ] + v(?P<version>\d+\.\d+) + [ ] + (?P<info>[^\]]+) + \] + """, + re.VERBOSE | re.MULTILINE +) + +def make_release() -> None: + # Determine repository root. + source = Path(__file__).parent.parent + + # Determine package metadata. + metadata = EMO_METADATA.search((source / 'emo.dtx').read_text(encoding='utf8')) + if metadata is None: + raise ValueError(f'Package metadata missing from "{source / "emo.dtx"}"') + + version = metadata.group('version') + logger.info(f'Preparing release {version} for "{source}"') + + # Make sure no archive exists. + archive = source / f'emo-{version}.zip' + if archive.exists(): + raise ValueError( + f'Archive file "{archive}" already exists, please move out of way.' + ) + + # Set up staging directory. + staging = source / 'emo' + if staging.exists(): + raise ValueError( + f'Staging directory "{staging}" already exists, please move out of way.' + ) + logger.info(f'Creating staging directory "{staging}"') + staging.mkdir() + + # Process all files belonging into release. + for path in chain(map(Path, EMO_FILES), source.glob('emo-graphics/emo-*.pdf')): + path = source / path + + # To stage a file in the repository root, just copy it. + if path.parent == source: + logger.info(f'Staging "{path.name}"') + shutil.copy(path, staging) + continue + + # To stage a file in a subdirectory, get relative path and, if necessary, + # recreate path in staging area. Then copy into that subdirectory. + nested_staging = staging / path.parent.relative_to(source) + if not nested_staging.exists(): + logger.info(f'Creating nested staging directory "{nested_staging}"') + nested_staging.mkdir(parents=True) + + logger.info(f'Staging "{path.relative_to(source)}"') + shutil.copy(path, nested_staging) + + # Create archive. + shutil.make_archive( + str(archive.with_suffix('')), + 'zip', + root_dir=staging.parent, + base_dir=staging.name, + ) + +# -------------------------------------------------------------------------------------- +# Normalize emoji names PUNCTUATION = re.compile(r"""["'โโโ&!(),:]""") SEPARATORS = re.compile(r'[ _\-]+') @@ -135,7 +283,7 @@ def to_name(value: str) -> str: # -------------------------------------------------------------------------------------- -# Emoji Codepoints +# Handle emoji codepoints def to_codepoint(cp: Union[int, str]) -> int: if isinstance(cp, int): @@ -161,7 +309,7 @@ def regional_indicator_to_letter(cp: int) -> str: # -------------------------------------------------------------------------------------- -# Emoji Groups +# Normalize emoji group and subgroup names AMPERSAND = re.compile('[ ]*&[ ]*') @@ -198,7 +346,7 @@ def split_subgroup_selector(identifier: str) -> List[str]: # -------------------------------------------------------------------------------------- -# Emoji Status +# Define emoji status class Status(str, Enum): COMPONENT = 'component' @@ -208,7 +356,7 @@ class Status(str, Enum): # -------------------------------------------------------------------------------------- -# Emoji Descriptor +# Define emoji descriptor @dataclass(frozen=True, order=True) class Emoji: @@ -292,6 +440,10 @@ class Emoji: return f'svg/{self.svg_file}' @property + def pdf_file(self) -> str: + return f'emo-{self.name}.pdf' + + @property def latex_table_entry(self) -> str: if self.has_compound_name: prefix = f'\expandafter\def\csname emo@emoji@{self.name}\endcsname' @@ -302,7 +454,7 @@ class Emoji: # -------------------------------------------------------------------------------------- -# Parser for Unicode TR-51's 'emoji-test.txt' File +# Parse Unicode TR-51's `emoji-test.txt` NameTable = Mapping[str, Emoji] CodepointTable = Mapping[Tuple[int, ...], Emoji] @@ -478,7 +630,7 @@ class RegistryParser: # -------------------------------------------------------------------------------------- -# Emoji Registry +# Maintain emoji registry class Registry: def __init__( @@ -589,7 +741,7 @@ class Registry: # -------------------------------------------------------------------------------------- -# Noto Emoji Sources +# Download Noto emoji sources NOTO_REPOSITORY = 'https://github.com/googlefonts/noto-emoji/archive/refs/heads/main.zip' @@ -620,26 +772,26 @@ def is_valid_noto_emoji(noto_path: Path) -> bool: def ensure_local_noto_emoji(noto_path: Path, verbose: bool = False) -> None: if is_valid_noto_emoji(noto_path): if verbose: - log.info(f'Seemingly valid Noto emoji sources at "{noto_path}"') + logger.info(f'Seemingly valid Noto emoji sources at "{noto_path}"') return noto_zip = noto_path.with_name('noto-emoji.zip') if not noto_zip.exists(): if verbose: - log.info(f'Downloading Noto emoji sources from "{NOTO_REPOSITORY}"') + logger.info(f'Downloading Noto emoji sources from "{NOTO_REPOSITORY}"') with urlopen(NOTO_REPOSITORY) as response, open(noto_zip, mode='wb') as file: shutil.copyfileobj(response, file) # With archive representing main branch, it is unpacked into # noto-emoji-main. We fix that after unpacking. if verbose: - log.info(f'Unpacking Noto emoji sources into "{noto_path}"') + logger.info(f'Unpacking Noto emoji sources into "{noto_path}"') shutil.unpack_archive(noto_zip, noto_path.parent, 'zip') noto_path.with_name('noto-emoji-main').rename(noto_path) # -------------------------------------------------------------------------------------- -# SVG to PDF Conversion +# Convert SVG to PDF def remove_page_group_object(document: dict) -> Optional[dict]: """Remove the /Page /Group object from the document in qpdf's JSON format.""" @@ -733,18 +885,19 @@ class Converter: def __call__(self, emoji: 'Emoji', verbose: bool = False) -> Path: source = self.source_dir / emoji.svg_path - target = self.target_dir / f'{emoji.name}.pdf' + target = self.target_dir / emoji.pdf_file if not target.exists(): if verbose: - log.info(f'Converting "{source}" to "{target}"') + logger.info(f'Converting "{source}" to "{target}"') convert_svg_to_pdf(self.rsvg_convert, source, target) if verbose: - log.info(f'Fixing /Page /Group in "{target}"') + logger.info(f'Fixing /Page /Group in "{target}"') fix_pdf(self.qpdf, target) return target # -------------------------------------------------------------------------------------- +# Provide tool help and command line options DESCRIPTION = """ Generate emoji table and PDF files for the given selectors. A selector may be a @@ -761,33 +914,12 @@ but included in the emoji table. def resolved_path(path: str) -> Path: return Path(path).resolve() - def create_parser() -> ArgumentParser: parser = ArgumentParser( description=DESCRIPTION, formatter_class=ArgumentDefaultsHelpFormatter, ) parser.add_argument( - '--show-group-names', - action='store_true', - help='show supported group, subgroup names and exit', - ) - parser.add_argument( - '--show-emoji-names', - action='store_true', - help='show supported emoji names and exit', - ) - parser.add_argument( - '--show-special-names', - action='store_true', - help='show map from (simplified) Unicode names to emoji names and exit' - ) - parser.add_argument( - '--show-names', - action='store_true', - help='show group, emoji, as well as special names and exit' - ) - parser.add_argument( '--dry-run', action='store_true', help='do not write to file system' @@ -825,6 +957,39 @@ def create_parser() -> ArgumentParser: metavar='PATH', help='use path for file with LaTeX emoji table', ) + + group = parser.add_mutually_exclusive_group() + group.add_argument( + '--show-group-names', + action='store_true', + help='show supported group, subgroup names and exit', + ) + group.add_argument( + '--show-emoji-names', + action='store_true', + help='show supported emoji names and exit', + ) + group.add_argument( + '--show-special-names', + action='store_true', + help='show map from (simplified) Unicode names to emoji names and exit' + ) + group.add_argument( + '--show-names', + action='store_true', + help='show group, emoji, as well as special names and exit' + ) + group.add_argument( + '--make-demo', + action='store_true', + help='make the demo document and exit', + ) + group.add_argument( + '-r', '--make-release', + action='store_true', + help='make a release and exit', + ) + parser.add_argument( 'selectors', nargs='*', @@ -832,31 +997,36 @@ def create_parser() -> ArgumentParser: ) return parser +# -------------------------------------------------------------------------------------- +# Show group, emoji, and special names + def show_names(registry: Registry, options: Any) -> bool: showed_something = False if options.show_group_names or options.show_names: - log.header('Supported groups and subgroups:') + logger.header('Supported groups and subgroups:') for group in registry.group_names(): for subgroup in registry.subgroup_names(group): - log.detail(f'{group}::{subgroup}') + logger.detail(f'{group}::{subgroup}') showed_something = True if options.show_emoji_names or options.show_names: - log.header('Supported emoji names:') + logger.header('Supported emoji names:') names = list(registry.emoji_names()) names.sort() for name in names: - log.detail(f'{name}') + logger.detail(f'{name}') showed_something = True if options.show_special_names or options.show_names: - log.header('Map from (simplified) Unicode to (special) emoji names:') + logger.header('Map from (simplified) Unicode to (special) emoji names:') for unicode, selector in RENAMING.items(): - log.detail(f'{unicode:40s} โถ {selector}') + logger.detail(f'{unicode:40s} โถ {selector}') showed_something = True return showed_something +# -------------------------------------------------------------------------------------- +# Create emoji inventory -SPECIAL_FILES = ('lingchi.pdf', 'YHWH.pdf') +SPECIAL_FILES = ('emo-lingchi.pdf', 'emo-YHWH.pdf') def create_inventory(registry: Registry, options: Any) -> List[Emoji]: inventory: List[Emoji] = [] @@ -864,20 +1034,22 @@ def create_inventory(registry: Registry, options: Any) -> List[Emoji]: if options.graphics.exists() and options.graphics.is_dir(): for entry in options.graphics.iterdir(): if ( - not entry.is_file() or - entry.suffix != '.pdf' or - entry.name in SPECIAL_FILES + not entry.is_file() + or not entry.match('emo-*.pdf') + or entry.name in SPECIAL_FILES ): continue - emoji = registry.lookup(entry.stem) + emoji = registry.lookup(entry.stem[4:]) if emoji is not None: inventory.append(emoji) elif options.verbose: - log.warning(f'"{entry.name}" is not an emoji') + logger.warning(f'"{entry.name}" does not depict an emoji') return inventory +# -------------------------------------------------------------------------------------- +# Write emoji table def write_emoji_table( requested_emoji: List[Emoji], existing_emoji: List[Emoji], options: Any @@ -888,6 +1060,8 @@ def write_emoji_table( tmp_table = options.latex_table.with_suffix('.latest.def') if not options.dry_run: with open(tmp_table, mode='w', encoding='utf8') as file: + today = datetime.today().strftime('%Y-%m-%d') + file.write(f'\\ProvidesFile{{emo.def}}[{today}]\n') for emoji in all_emoji: file.write(emoji.latex_table_entry) file.write('\n') @@ -895,14 +1069,29 @@ def write_emoji_table( return all_emoji +# -------------------------------------------------------------------------------------- +# Run this script def main() -> None: - options = create_parser().parse_args() - registry = Registry.from_file(options.registry) - if show_names(registry, options): - return - try: + # Parse command line options. + options = create_parser().parse_args() + + # Create release. + if (options.make_release or options.make_demo) and options.dry_run: + raise ValueError('Unable to dry run selected build function') + elif options.make_release: + make_release() + return + elif options.make_demo: + make_demo() + return + + # Populate registry, maybe list names. + registry = Registry.from_file(options.registry) + if show_names(registry, options): + return + # Determine requested emoji. requested_emoji = registry.select(*options.selectors) @@ -914,7 +1103,7 @@ def main() -> None: # Create inventory of existing emoji. existing_emoji = create_inventory(registry, options) - # Noto emoji. + # Download Noto emoji sources if they haven't been before. if not options.dry_run: ensure_local_noto_emoji(options.noto_emoji, options.verbose) @@ -927,10 +1116,10 @@ def main() -> None: all_emoji = write_emoji_table(requested_emoji, existing_emoji, options) if options.verbose: - log.info('Supported emoji: ' + ' '.join(e.display for e in all_emoji)) + logger.info('Supported emoji: ' + ' '.join(e.display for e in all_emoji)) except Exception as x: - log.error(str(x)) + logger.error(str(x)) if __name__ == '__main__': diff --git a/graphics/emo/emo-graphics/YHWH.pdf b/graphics/emo/emo-graphics/emo-YHWH.pdf Binary files differindex cfa72b4865..cfa72b4865 100644 --- a/graphics/emo/emo-graphics/YHWH.pdf +++ b/graphics/emo/emo-graphics/emo-YHWH.pdf diff --git a/graphics/emo/emo-graphics/balance-scale.pdf b/graphics/emo/emo-graphics/emo-balance-scale.pdf Binary files differindex 612cfc69a2..612cfc69a2 100644 --- a/graphics/emo/emo-graphics/balance-scale.pdf +++ b/graphics/emo/emo-graphics/emo-balance-scale.pdf diff --git a/graphics/emo/emo-graphics/biohazard.pdf b/graphics/emo/emo-graphics/emo-biohazard.pdf Binary files differindex e994c0a97c..e994c0a97c 100644 --- a/graphics/emo/emo-graphics/biohazard.pdf +++ b/graphics/emo/emo-graphics/emo-biohazard.pdf diff --git a/graphics/emo/emo-graphics/busts.pdf b/graphics/emo/emo-graphics/emo-busts.pdf Binary files differindex a6aced9f0e..a6aced9f0e 100644 --- a/graphics/emo/emo-graphics/busts.pdf +++ b/graphics/emo/emo-graphics/emo-busts.pdf diff --git a/graphics/emo/emo-graphics/check-mark.pdf b/graphics/emo/emo-graphics/emo-check-mark.pdf index eb2e3dd30e..eb2e3dd30e 100644 --- a/graphics/emo/emo-graphics/check-mark.pdf +++ b/graphics/emo/emo-graphics/emo-check-mark.pdf diff --git a/graphics/emo/emo-graphics/classical-building.pdf b/graphics/emo/emo-graphics/emo-classical-building.pdf Binary files differindex d25e5679ab..d25e5679ab 100644 --- a/graphics/emo/emo-graphics/classical-building.pdf +++ b/graphics/emo/emo-graphics/emo-classical-building.pdf diff --git a/graphics/emo/emo-graphics/emo-collision.pdf b/graphics/emo/emo-graphics/emo-collision.pdf Binary files differnew file mode 100644 index 0000000000..5c2c036906 --- /dev/null +++ b/graphics/emo/emo-graphics/emo-collision.pdf diff --git a/graphics/emo/emo-graphics/currency-exchange.pdf b/graphics/emo/emo-graphics/emo-currency-exchange.pdf Binary files differindex a01a8b42a7..a01a8b42a7 100644 --- a/graphics/emo/emo-graphics/currency-exchange.pdf +++ b/graphics/emo/emo-graphics/emo-currency-exchange.pdf diff --git a/graphics/emo/emo-graphics/desert-island.pdf b/graphics/emo/emo-graphics/emo-desert-island.pdf Binary files differindex d1fb99c146..d1fb99c146 100644 --- a/graphics/emo/emo-graphics/desert-island.pdf +++ b/graphics/emo/emo-graphics/emo-desert-island.pdf diff --git a/graphics/emo/emo-graphics/detective.pdf b/graphics/emo/emo-graphics/emo-detective.pdf Binary files differindex 9a6eb934f9..9a6eb934f9 100644 --- a/graphics/emo/emo-graphics/detective.pdf +++ b/graphics/emo/emo-graphics/emo-detective.pdf diff --git a/graphics/emo/emo-graphics/enraged-face.pdf b/graphics/emo/emo-graphics/emo-enraged-face.pdf Binary files differindex 57a4ad3dd3..57a4ad3dd3 100644 --- a/graphics/emo/emo-graphics/enraged-face.pdf +++ b/graphics/emo/emo-graphics/emo-enraged-face.pdf diff --git a/graphics/emo/emo-graphics/eu.pdf b/graphics/emo/emo-graphics/emo-eu.pdf Binary files differindex a51b0c4378..a51b0c4378 100644 --- a/graphics/emo/emo-graphics/eu.pdf +++ b/graphics/emo/emo-graphics/emo-eu.pdf diff --git a/graphics/emo/emo-graphics/emo-exploding-head.pdf b/graphics/emo/emo-graphics/emo-exploding-head.pdf Binary files differnew file mode 100644 index 0000000000..a18108c654 --- /dev/null +++ b/graphics/emo/emo-graphics/emo-exploding-head.pdf diff --git a/graphics/emo/emo-graphics/eye.pdf b/graphics/emo/emo-graphics/emo-eye.pdf Binary files differindex 06f42101a7..06f42101a7 100644 --- a/graphics/emo/emo-graphics/eye.pdf +++ b/graphics/emo/emo-graphics/emo-eye.pdf diff --git a/graphics/emo/emo-graphics/floppy-disk.pdf b/graphics/emo/emo-graphics/emo-floppy-disk.pdf index f6bd1561f1..f6bd1561f1 100644 --- a/graphics/emo/emo-graphics/floppy-disk.pdf +++ b/graphics/emo/emo-graphics/emo-floppy-disk.pdf diff --git a/graphics/emo/emo-graphics/foggy.pdf b/graphics/emo/emo-graphics/emo-foggy.pdf index 73b594548c..73b594548c 100644 --- a/graphics/emo/emo-graphics/foggy.pdf +++ b/graphics/emo/emo-graphics/emo-foggy.pdf diff --git a/graphics/emo/emo-graphics/globe-africa-europe.pdf b/graphics/emo/emo-graphics/emo-globe-africa-europe.pdf Binary files differindex 3b7803cd6f..3b7803cd6f 100644 --- a/graphics/emo/emo-graphics/globe-africa-europe.pdf +++ b/graphics/emo/emo-graphics/emo-globe-africa-europe.pdf diff --git a/graphics/emo/emo-graphics/handshake.pdf b/graphics/emo/emo-graphics/emo-handshake.pdf Binary files differindex 339711e4c4..339711e4c4 100644 --- a/graphics/emo/emo-graphics/handshake.pdf +++ b/graphics/emo/emo-graphics/emo-handshake.pdf diff --git a/graphics/emo/emo-graphics/judge.pdf b/graphics/emo/emo-graphics/emo-judge.pdf Binary files differindex 4b61e53752..4b61e53752 100644 --- a/graphics/emo/emo-graphics/judge.pdf +++ b/graphics/emo/emo-graphics/emo-judge.pdf diff --git a/graphics/emo/emo-graphics/keycap-one.pdf b/graphics/emo/emo-graphics/emo-keycap-one.pdf Binary files differindex 8988600ff6..8988600ff6 100644 --- a/graphics/emo/emo-graphics/keycap-one.pdf +++ b/graphics/emo/emo-graphics/emo-keycap-one.pdf diff --git a/graphics/emo/emo-graphics/label.pdf b/graphics/emo/emo-graphics/emo-label.pdf Binary files differindex 5ad631f606..5ad631f606 100644 --- a/graphics/emo/emo-graphics/label.pdf +++ b/graphics/emo/emo-graphics/emo-label.pdf diff --git a/graphics/emo/emo-graphics/lingchi.pdf b/graphics/emo/emo-graphics/emo-lingchi.pdf Binary files differindex 273264dc1d..273264dc1d 100644 --- a/graphics/emo/emo-graphics/lingchi.pdf +++ b/graphics/emo/emo-graphics/emo-lingchi.pdf diff --git a/graphics/emo/emo-graphics/loupe-left.pdf b/graphics/emo/emo-graphics/emo-loupe-left.pdf Binary files differindex 49d2d0f36a..49d2d0f36a 100644 --- a/graphics/emo/emo-graphics/loupe-left.pdf +++ b/graphics/emo/emo-graphics/emo-loupe-left.pdf diff --git a/graphics/emo/emo-graphics/pager.pdf b/graphics/emo/emo-graphics/emo-pager.pdf Binary files differindex 42e47b5c44..42e47b5c44 100644 --- a/graphics/emo/emo-graphics/pager.pdf +++ b/graphics/emo/emo-graphics/emo-pager.pdf diff --git a/graphics/emo/emo-graphics/parrot.pdf b/graphics/emo/emo-graphics/emo-parrot.pdf Binary files differindex 6419b0792f..6419b0792f 100644 --- a/graphics/emo/emo-graphics/parrot.pdf +++ b/graphics/emo/emo-graphics/emo-parrot.pdf diff --git a/graphics/emo/emo-graphics/rainbow-flag.pdf b/graphics/emo/emo-graphics/emo-rainbow-flag.pdf Binary files differindex 0f67f2d2d4..0f67f2d2d4 100644 --- a/graphics/emo/emo-graphics/rainbow-flag.pdf +++ b/graphics/emo/emo-graphics/emo-rainbow-flag.pdf diff --git a/graphics/emo/emo-graphics/receipt.pdf b/graphics/emo/emo-graphics/emo-receipt.pdf Binary files differindex 8e9ddee62f..8e9ddee62f 100644 --- a/graphics/emo/emo-graphics/receipt.pdf +++ b/graphics/emo/emo-graphics/emo-receipt.pdf diff --git a/graphics/emo/emo-graphics/robot.pdf b/graphics/emo/emo-graphics/emo-robot.pdf Binary files differindex 33f9b91e75..33f9b91e75 100644 --- a/graphics/emo/emo-graphics/robot.pdf +++ b/graphics/emo/emo-graphics/emo-robot.pdf diff --git a/graphics/emo/emo-graphics/roll-of-paper.pdf b/graphics/emo/emo-graphics/emo-roll-of-paper.pdf Binary files differindex 27d21a0dde..27d21a0dde 100644 --- a/graphics/emo/emo-graphics/roll-of-paper.pdf +++ b/graphics/emo/emo-graphics/emo-roll-of-paper.pdf diff --git a/graphics/emo/emo-graphics/stadium.pdf b/graphics/emo/emo-graphics/emo-stadium.pdf Binary files differindex dc01d805c6..dc01d805c6 100644 --- a/graphics/emo/emo-graphics/stadium.pdf +++ b/graphics/emo/emo-graphics/emo-stadium.pdf diff --git a/graphics/emo/emo-graphics/stop-sign.pdf b/graphics/emo/emo-graphics/emo-stop-sign.pdf Binary files differindex cab7fa60b3..cab7fa60b3 100644 --- a/graphics/emo/emo-graphics/stop-sign.pdf +++ b/graphics/emo/emo-graphics/emo-stop-sign.pdf diff --git a/graphics/emo/emo-graphics/triangular-ruler.pdf b/graphics/emo/emo-graphics/emo-triangular-ruler.pdf Binary files differindex 062e896f28..062e896f28 100644 --- a/graphics/emo/emo-graphics/triangular-ruler.pdf +++ b/graphics/emo/emo-graphics/emo-triangular-ruler.pdf diff --git a/graphics/emo/emo-graphics/wastebasket.pdf b/graphics/emo/emo-graphics/emo-wastebasket.pdf Binary files differindex 5bd631e944..5bd631e944 100644 --- a/graphics/emo/emo-graphics/wastebasket.pdf +++ b/graphics/emo/emo-graphics/emo-wastebasket.pdf diff --git a/graphics/emo/emo-lingchi.ttf b/graphics/emo/emo-lingchi.ttf Binary files differnew file mode 100644 index 0000000000..3bae825582 --- /dev/null +++ b/graphics/emo/emo-lingchi.ttf diff --git a/graphics/emo/emo.def b/graphics/emo/emo.def index 61539c1e0b..8e578056b5 100644 --- a/graphics/emo/emo.def +++ b/graphics/emo/emo.def @@ -1,3 +1,4 @@ +\ProvidesFile{emo.def}[2023-04-01] \expandafter\def\csname emo@emoji@keycap-one\endcsname{1๏ธโฃ} \def\emo@emoji@biohazard{โฃ๏ธ} \expandafter\def\csname emo@emoji@balance-scale\endcsname{โ๏ธ} @@ -12,6 +13,7 @@ \def\emo@emoji@label{๐ท๏ธ} \def\emo@emoji@eye{๐๏ธ} \def\emo@emoji@busts{๐ฅ} +\def\emo@emoji@collision{๐ฅ} \expandafter\def\csname emo@emoji@currency-exchange\endcsname{๐ฑ} \expandafter\def\csname emo@emoji@floppy-disk\endcsname{๐พ} \expandafter\def\csname emo@emoji@triangular-ruler\endcsname{๐} @@ -23,6 +25,7 @@ \expandafter\def\csname emo@emoji@stop-sign\endcsname{๐} \def\emo@emoji@robot{๐ค} \def\emo@emoji@handshake{๐ค} +\expandafter\def\csname emo@emoji@exploding-head\endcsname{๐คฏ} \def\emo@emoji@parrot{๐ฆ} \def\emo@emoji@judge{๐งโโ๏ธ} \expandafter\def\csname emo@emoji@roll-of-paper\endcsname{๐งป} diff --git a/graphics/emo/emo.dtx b/graphics/emo/emo.dtx index 05fa1b155f..e6940d46c2 100644 --- a/graphics/emo/emo.dtx +++ b/graphics/emo/emo.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% emo: emoji for all (LaTeX engines) +% emoโขji for all (LaTeX engines) % (C) Copyright 2023 by Robert Grimm % Released under LPPL v1.3c or later % <https://github.com/apparebit/emo> @@ -8,61 +8,67 @@ % \fi % ^^A ---------------------------------------------------------------------------------- % \iffalse -% The option with date and version below applies to both \Provides<Something> -% declarations; see https://tug.org/TUGboat/tb29-2/tb92pakin.pdf. -%<*scaffold> -\ProvidesFile{emo.dtx} -%</scaffold> -%<package>\NeedsTeXFormat{LaTeX2e} -%<package>\ProvidesPackage{emo} -%<*package> - [2023/03/20 v0.1 emoji for all] -%</package> -% ====================================================================================== %<*scaffold> \iffalse %</scaffold> +% ====================================================================================== %<*readme> -# Emo: emoji for all (LaTeX engines) +# emoโขji for all (LaTeX engines) This package defines the `\emo{<emoji-name>}` macro for including color emoji in -a document no matter the input encoding or LaTeX engine. It uses the Noto color -emoji font if the engine supports doing so and falls back onto PDF graphics -otherwise. I wrote this package to use emoji in an academic paper subject to -[The ACM Publishing -System](https://authors.acm.org/proceedings/production-information/accepted-latex-packages), -which prohibits the use of most LaTeX packages but has only minimal support for -non-Latin scripts. ๐ +a document no matter the LaTeX engine. It uses the Noto color emoji font if the +engine supports doing so and falls back onto PDF graphics otherwise. In either +case, `\emo{desert-island}` results in ๐ and `\emo{parrot}` results in ๐ฆ. Emo +may come in particularly handy when dealing with academic publishers that +provide only minimal support for non-Latin scripts (cough, +[ACM](https://www.acm.org), cough). + +Emo's source repository is <https://github.com/apparebit/emo>. It also is +available [through CTAN](https://ctan.org/pkg/emo). Emo supports conversion +to HTML [with LaTeXML](https://github.com/brucemiller/LaTeXML). + + +## Package Options When emo is used with the `extra` option, this package also defines the `\lingchi` and `\YHWH` macros for ๅ้ฒ and ืืืื, respectively. Both macros -preserve a subsequent space as space, no backslash needed. When used with the -`index` option, this package also emits a raw index entry for each use of an -emoji into an emo index or `.edx` file. +preserve a subsequent space as space, no backslash needed. -To **extract files** embedded in [emo.dtx](emo.dtx) and also rebuild the -[documentation](emo.pdf), run `pdflatex emo.dtx`. +When used with the `index` option, this package also emits a raw index entry for +each use of an emoji into an emo index or `.edx` file. + + +## Installation + +To **extract files** embedded in [emo.dtx](emo.dtx), run `pdftex emo.dtx`. Note +that plain old `tex` won't do, since it mangles this README. `pdflatex` works, +but also generates the package documentation. The embedded files are `build.sh`, +`emo.ins`, `emo.sty`, `emo.sty.ltxml`, and `README.md`. + +To **build the documentation** embedded in `emo.dtx`, run `source build.sh`. The +shell script invokes `pdflatex emo.dtx` thrice and `makeindex` once each for the +change and the symbol indices, resulting in [emo.pdf](emo.pdf). To **configure the emoji**, run `python3 config/emo.py` with appropriate arguments. The [package documentation](emo.pdf) explains the configuration tool in detail, but you may find the `-h` for help option sufficient to get started. -To **install this package**, place `emo.def`, `emo.sty`, `lingchi.otf`, and the -contents of the `emo-graphics` directory somewhere where LaTeX can find them. In -a pinch, your project directory will do just fine. +To **install this package**, place `emo.def`, `emo.sty`, `emo.sty.ltxml`, +`emo-lingchi.ttf`, and the `emo-graphics` directory with the fallback PDF files +somewhere where LaTeX can find them. In a pinch, your project directory will do. ## Supported Emoji By default, emo supports only a few emoji: -1๏ธโฃ โฃ๏ธ โ๏ธ โ๏ธ ๐ช๐บ ๐ ๐ ๐๏ธ ๐๏ธ ๐๏ธ ๐ณ๏ธโ๐ ๐ท๏ธ ๐๏ธ ๐ฅ ๐ฑ ๐พ ๐ ๐ ๐ ๐ต๏ธ ๐๏ธ ๐ก ๐ ๐ค ๐ค ๐ฆ ๐งโโ๏ธ ๐งป ๐งพ +1๏ธโฃ โฃ๏ธ โ๏ธ โ๏ธ ๐ช๐บ ๐ ๐ ๐๏ธ ๐๏ธ ๐๏ธ ๐ณ๏ธโ๐ ๐ท๏ธ ๐๏ธ ๐ฅ ๐ฅ ๐ฑ ๐พ ๐ ๐ ๐ ๐ต๏ธ ๐๏ธ ๐ก ๐ ๐ค ๐ค ๐คฏ ๐ฆ ๐งโโ๏ธ ๐งป ๐งพ Their names are keycap-one, biohazard, balance-scale, check-mark, eu, foggy, globe-africa-europe, classical-building, desert-island, stadium, rainbow-flag, -label, eye, busts, currency-exchange, floppy-disk, triangular-ruler, pager, -loupe-left, detective, wastebasket, enraged-face, stop-sign, robot, handshake, -parrot, judge, roll-of-paper, and receipt. +label, eye, busts, collision, currency-exchange, floppy-disk, triangular-ruler, +pager, loupe-left, detective, wastebasket, enraged-face, stop-sign, robot, +handshake, exploding-head, parrot, judge, roll-of-paper, and receipt. The [package's documentation](emo.pdf) explains the underlying naming scheme and also how to reconfigure which emoji are supported. The [emo.py](config/emo.py) @@ -72,8 +78,8 @@ into PDF files and generating an updated `emo.def` file. ## Copyright and Licensing -This package combines code written in LaTeX and Python with Unicode data about -emoji as well as graphics and fonts derived from Google's Noto fonts. As a +This package combines code written in LaTeX, Python, and Perl with Unicode data +about emoji as well as graphics and fonts derived from Google's Noto fonts. As a result, a number of different licenses apply, all of which are [OSI approved](https://opensource.org/licenses/) and non-copyleft: @@ -86,7 +92,7 @@ approved](https://opensource.org/licenses/) and non-copyleft: * The [emoji-test.txt](config/emoji-test.txt) configuration file is a data file from [Unicode TR-51](https://unicode.org/reports/tr51/) and hence subject to the [Unicode License](https://www.unicode.org/license.txt). - * The `lingchi.otf` font is a two-glyph subset of the serif traditional + * The `emo-lingchi.ttf` font is a two-glyph subset of the serif traditional Chinese version of Google's [Noto fonts](https://github.com/notofonts/noto-cjk) and hence subject to the [SIL Open Font License v1.1](https://scripts.sil.org/ofl). @@ -99,30 +105,38 @@ approved](https://opensource.org/licenses/) and non-copyleft: %<*buildscript> pdflatex emo.dtx makeindex -s gind.ist -o emo.ind emo.idx -# makeindex -s gglo.ist -o emo.gls emo.glo # For tracking changes +makeindex -s gglo.ist -o emo.gls emo.glo +pdflatex emo.dtx pdflatex emo.dtx %</buildscript> +% ====================================================================================== %<*scaffold> \fi -% ====================================================================================== -\begingroup +\def\nameofplainTeX{plain} +\ifx\fmtname\nameofplainTeX\else + \expandafter\begingroup +\fi %</scaffold> +% -------------------------------------------------------------------------------------- %<*install> \input docstrip.tex \keepsilent \askforoverwritefalse \preamble -emo: emoji for all (LaTeX engines) +emoโขji for all (LaTeX engines) (C) Copyright 2023 by Robert Grimm Released under LPPL v1.3c or later <https://github.com/apparebit/emo> \endpreamble \usedir{tex/latex/emo} -\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}} +\generate{ + \file{\jobname.sty}{\from{\jobname.dtx}{package}}} +\generate{ + \nopreamble\nopostamble + \file{\jobname.sty.ltxml}{\from{\jobname.dtx}{latexml-binding}}} %</install> -% Don't stop processing the .dtx file; only stop processing the install file. %<install>\endbatchfile % -------------------------------------------------------------------------------------- %<*scaffold> @@ -133,27 +147,44 @@ Released under LPPL v1.3c or later \generate{\file{build.sh}{\from{\jobname.dtx}{buildscript}}} \usedir{doc/latex/emo} \generate{\file{README.md}{\from{\jobname.dtx}{readme}}} -\endgroup +\ifx\fmtname\nameofplainTeX + \expandafter\endbatchfile +\else + \expandafter\endgroup +\fi %</scaffold> % ====================================================================================== +% See https://tug.org/TUGboat/tb29-2/tb92pakin.pdf. +%<*scaffold> +\ProvidesFile{emo.dtx} +%</scaffold> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{emo} +%<*scaffold,package> + [2023/04/01 v0.2 emoโขji for all (LaTeX engines)] +%</scaffold,package> +% ====================================================================================== %<*driver> \PassOptionsToPackage{utf8}{inputenc} \documentclass{ltxdoc} -% Override the default \small, which looks odd with Inconsolata. +% Override the default \small, which looks odd typeset in Inconsolata. \renewcommand{\MacroFont}{\normalsize\ttfamily} \usepackage[extra]{\jobname} \usepackage{enumitem} \usepackage{parskip} \usepackage{inconsolata} -% Use BlackFoundry's Inria fonts; see <https://tug.org/FontCatalogue/inriaserifregular/> +% Use BlackFoundry's Inria <https://tug.org/FontCatalogue/inriaserifregular/> \usepackage[T1]{fontenc} \usepackage[lining]{InriaSerif} \renewcommand*\oldstylenums[1]{{\fontfamily{InriaSerif-OsF}\selectfont #1}} \let\oldnormalfont\normalfont \def\normalfont{\oldnormalfont\mdseries} +\usepackage{xcolor} \usepackage{hyperref} +\definecolor{spot}{HTML}{353598} +\hypersetup{allcolors=spot} \EnableCrossrefs \CodelineIndex \RecordChanges @@ -161,29 +192,34 @@ Released under LPPL v1.3c or later \DocInput{\jobname.dtx} \end{document} %</driver> +% ====================================================================================== % \fi % -% \newlist{inlinenum}{enumerate*}{1} -% \setlist[inlinenum]{label=(\alph{inlinenumi})} -% \newenvironment{verbaish}{% -% \ttfamily% -% \obeylines% -% \obeyspaces% -% \vspace{\the\parskip}% -% \setlength{\parskip}{0pt}% -% \setlength{\parindent}{2em}% -% }{} +% \changes{0.1}{}{Initial release} +% \changes{0.2}{}{Prefix PDF and font files with ``emo-''} +% \changes{0.2}{}{Support pdftex for extracting emo.dtx} % % \GetFileInfo{\jobname.dtx} % -% \DoNotIndex{\{,\}} +% \DoNotIndex{\{,\},\x,\\} % \DoNotIndex{\begingroup,\char,\csname,\def} % \DoNotIndex{\else,\endcsname,\endgroup,\expandafter} % \DoNotIndex{\fi,\ifcsname,\ifluatex,\index} % \DoNotIndex{\newcommand,\newif,\newindex} % \DoNotIndex{\relax,\string,\textbackslash,\textsf,\texttt} % -% \title{emo: emoji for all\\(LaTeX engines)} +% \newlist{inlinenum}{enumerate*}{1} +% \setlist[inlinenum]{label=(\alph{inlinenumi})} +% \newenvironment{verbatimish}{% +% \ttfamily% +% \obeylines% +% \obeyspaces% +% \vspace{\the\parskip}% +% \setlength{\parskip}{0pt}% +% \setlength{\parindent}{1em}% +% }{} +% +% \title{emoโขji for all\\(LaTeX engines)} % \author{\href{https://apparebit.com}{Robert Grimm}} % \date{Version \fileversion\ (\filedate)} % @@ -191,14 +227,14 @@ Released under LPPL v1.3c or later % % \begin{abstract} % \noindent{}Emo implements the |\emo|\marg{emoji-name} command for including -% color emoji such as \emo{desert-island} or \emo{parrot} in your documents -% independent of input encoding or LaTeX engine. The implementation uses the -% Noto color emoji font if the engine supports it and includes PDF graphics -% otherwise. The latter are automatically derived from Noto's SVG sources, so -% the visual appearance is very similar. The source repository is at -% \url{https://github.com/apparebit/emo}. Emo may come in particularly handy -% when dealing with academic publishers that provide only minimal support for -% non-Latin scripts (cough, +% color emoji such as |\emo{desert-island}| for \emo{desert-island} or +% |\emo{parrot}| for \emo{parrot} in your documents independent of LaTeX engine. +% The implementation uses the Noto color emoji font if the engine supports it +% and includes PDF graphics otherwise. The latter are automatically derived from +% Noto's SVG sources, so the visual appearance is very similar. The source +% repository is at \url{https://github.com/apparebit/emo}. Emo may come in +% particularly handy when dealing with academic publishers that provide only +% minimal support for non-Latin scripts (cough, % \href{https://authors.acm.org/proceedings/production-information/accepted-latex-packages}{ACM}, % cough). % \end{abstract} @@ -209,34 +245,52 @@ Released under LPPL v1.3c or later % ^^A ================================================================================== % \section{Installation} % -% Installation of the emo package is fairly straightforward, though it does -% involve a lot more files than usual. +% The emo package is available through its +% \href{https://github.com/apparebit/emo}{source repository} or through +% \href{https://ctan.org/pkg/emo}{CTAN}. Installation is fairly +% straightforward, though it does involve a lot more files than usual. % % \begin{enumerate} % \item Start by extracting this package's files from |emo.dtx| by running: -% \begin{verbaish} -% \$ pdflatex emo.dtx -% \end{verbaish} -% -% \item Build the package documentation with indices by running: -% \begin{verbaish} -% \$ source build.sh -% \end{verbaish} -% -% \item If you want to reconfigure the supported emoji, see \S\ref{sec:config} -% below. -% -% \item Put the following files somewhere LaTeX can find them. While your current -% project's directory will do, emo's installation potentially comprises -% thousands of files. Hence it may be preferrable to adhere to the -% \href{https://en.wikibooks.org/wiki/LaTeX/Installing_Extra_Packages}{TeX -% Directory Structure}, with dedicated directories for the following files: +% \begin{verbatimish} +% \$ pdftex emo.dtx +% \end{verbatimish} +% Do \emph{not} use |tex|; it mangles the embedded |README.md|. |pdflatex| also +% extracts the files and then builds the documentation. Embedded files are +% |build.sh|, |emo.ins|, |emo.sty|, |emo.sty.ltxml|, and |README.md|. Extraction +% will overwrite existing files with the same name without asking. +% +% \item Build the package documentation with change and symbol indices by +% running: +% \begin{verbatimish} +% \$ source build.sh +% \end{verbatimish} +% The shell script invokes |pdflatex emo.dtx| thrice and |makeindex| once each +% for the change and symbol indices to produce |emo.pdf|. +% +% \item Get started reconfiguring supported emoji by running: +% \begin{verbatimish} +% \$ python config/emo.py -h +% \end{verbatimish} +% For more detailed instructions, see \S\ref{sec:config} below. +% +% \item Put the following files somewhere LaTeX can find them. In a pinch, your +% current project's directory will do. However, emo's installation potentially +% comprises thousands of files. So, you probably want to use a dedicated +% directory and add that to the search path for LaTeX, e.g., by setting the +% |TEXINPUTS| environment variable. % \begin{enumerate} % \item |emo.sty| with the package implementation; +% \item |emo.sty.ltxml| with the binding for +% \href{https://github.com/brucemiller/LaTeXML}{LaTeXML}; % \item |emo.def| with the emoji table; -% \item |lingchi.otf| for |\lingchi|; -% \item \emph{all} PDF files in the |emo-graphics| directory. +% \item |emo-lingchi.ttf| with the two glyphs for |\lingchi|; +% \item |emo-graphics| with the fallback PDF graphics. % \end{enumerate} +% TeX Live requires that each package's files have unique names. For that +% reason, the PDF graphics in the |emo-graphics| directory start with the |emo-| +% prefix as well. +% % \end{enumerate} % % When running on the LuaLaTeX engine, the emo package also uses the Noto color @@ -244,9 +298,9 @@ Released under LPPL v1.3c or later % with the latter used for rendering |\YHWH| only. Neither file is included with % emo's distribution, since both of them are distributed with major TeX % distributions already. If they are not included with your LaTeX distribution, -% you can find them on CTAN. The |lingchi.otf| font distributed with emo is a -% two glyph subset of |NotoSerifTC-Regular.otf|, i.e., the serif traditional -% Chinese version of Noto. +% you can find them on CTAN. The |emo-lingchi.ttf| font distributed with emo is +% a two glyph subset of |NotoSerifTC-Regular.otf|, i.e., the traditional Chinese +% version of Noto serif. % % % ^^A ================================================================================== @@ -378,23 +432,25 @@ Released under LPPL v1.3c or later % \section{Configuration} % \label{sec:config} % -% Emo's implementation is split over two files, |emo.sty| and |emo.def|. The -% former file defines the substance of the package, its options, its helper -% macros, and the user-visible |\emo|, |\lingchi|, and |\YHWH| macros. The -% latter file defines the table of supported emoji. For each such emoji, the -% table contains a command |\emo@emoji@|\meta{emoji-name} with the emoji's -% codepoints as value. |emo.sty| includes the table during loading and -% thereafter relies on it for validating emoji names and rendering emoji in -% LuaLaTeX. It may be possible to combine the two files into one, but that -% avoids at most a few disc reads and hence doesn't seem worth the trouble. +% Emo's implementation is actually split over two files: |emo.sty| is extracted +% from |emo.dtx| and defines the substance of the package, its options, its +% helper macros, and the user-visible |\emo|, |\lingchi|, and |\YHWH| macros. +% Currently supported emoji are defined by the emoji table in the second file, +% |emo.def|. For every supported emoji, the file contains a command +% |\emo@emoji@|\meta{emoji-name} with the emoji's codepoints as value. % +% Configuration automates the regeneration of the emoji table for arbitrary +% numbers of emoji. |config/emo.py| is the script and |config/emoji-test.txt| is +% the list of all emoji from the Unicode standard. % -% \subsection{Update Configuration} % -% Invoke |config/emo.py| to automatically reconfigure emo's supported emoji: -% \begin{verbaish} -% \$ python3 config/emo.py \meta{selector} \meta{selector} $\ldots$ -% \end{verbaish} +% ^^A ---------------------------------------------------------------------------------- +% \subsection{Running the Configuration Script} +% +% To update emo's configuration, invoke the |config/emo.py| script: +% \begin{verbatimish} +% \$ python3 config/emo.py \meta{selector} \meta{selector} $\ldots$ +% \end{verbatimish} % % Each selector may be: % \begin{itemize} @@ -412,9 +468,9 @@ Released under LPPL v1.3c or later % either of the two nouns as a shortcut, e.g., ``smileys'' or ``emotion.'' % % For data safety, |emo.py| does not overwrite PDF graphics and hence can only -% add emoji to the configuration. To remove emoji, simply remove their PDF -% graphics from |emo-graphics| and then run |emo.py|, which updates the emoji -% table accordingly. +% \emph{add} emoji to the configuration. To remove emoji, simply remove their +% PDF graphics from |emo-graphics| and then run |emo.py| without selector +% arguments, which updates the emoji table accordingly. % % |emo.py| effectively treats |emoji-test.txt| as registry of all emoji and the % filenames of PDF graphics in |emo-graphics| as emo's current inventory. For @@ -433,18 +489,19 @@ Released under LPPL v1.3c or later % from Google's Noto project, a number of different licenses apply. All of them % are \href{https://opensource.org/licenses/}{OSI approved} and non-copyleft: % \begin{itemize} -% \item This package's LaTeX code is ยฉ Copyright 2023 by Robert Grimm and has -% been released under the -% \href{https://www.latex-project.org/lppl/lppl-1-3c/}{LPPL v1.3c} or later. +% \item This package's LaTeX and also Perl code extracted from |emo.dtx| +% is ยฉ Copyright 2023 by Robert Grimm and has been released +% under the \href{https://www.latex-project.org/lppl/lppl-1-3c/}{LPPL v1.3c} +% or later. % \item The |config/emo.py| script also is ยฉ Copyright 2023 by Robert Grimm but % has been released under the % \href{https://www.apache.org/licenses/LICENSE-2.0}{Apache 2.0 license}. % \item The [config/emoji-test.txt] configuration file is a data file from % \href{https://unicode.org/reports/tr51/}{Unicode TR-51} and hence subject % to the \href{https://www.unicode.org/license.txt}{Unicode License}. -% \item The |lingchi.otf| font is a two-glyph subset of the serif traditional +% \item The |emo-lingchi.ttf| font is a two-glyph subset of the traditional % Chinese version of Google's -% \href{https://github.com/notofonts/noto-cjk}{Noto fonts} and hence subject +% \href{https://github.com/notofonts/noto-cjk}{Noto serif} and hence subject % to the \href{https://scripts.sil.org/ofl}{SIL Open Font License v1.1}. % \item The PDF graphics in the |emo-graphics| directory are derived from the % sources for \href{https://github.com/googlefonts/noto-emoji}{Noto's color @@ -452,38 +509,42 @@ Released under LPPL v1.3c or later % \end{itemize} % % -% \StopEventually{\PrintIndex} +% \StopEventually{^^A +% \PrintChanges^^A +% \setcounter{IndexColumns}{2}^^A +% \columnsep = 20pt^^A +% \PrintIndex} % % % ^^A ================================================================================== % \section{Implementation} % -% Now that we understand how to configure emo, we are ready for exploring the -% implementation in detail. Let's get started: +% Let's get started with emo's implementation: % \begin{macrocode} %<*package> % \end{macrocode} % % Except, the package implementation started near the top of the |emo.dtx| file, -% so that version number and date are more visible and declared only once. But -% that's also well before the documentation preamble and hence cannot be -% included in the annotated implementation. Nonetheless, we can simulate the -% lines: +% before the documentation preamble. We repeat it here for completeness: % -% \begingroup\obeylines -% |\NeedsTeXFormat{LaTeX2e}|\setlength{\parskip}{0pt} -% |\ProvidesPackage{emo}[|\texttt{\filedate}| |\texttt{\fileversion}| emo for all]| -% \endgroup +% \begin{verbatimish} +% |\NeedsTeXFormat{LaTeX2e}| +% |\ProvidesPackage{emo}| +% | |[\filedate\space\fileversion\space\fileinfo] +% \end{verbatimish} % -% And no, I didn't repeat the version number and date. Check |emo.dtx|. +% And no, I didn't repeat the version number, date, or package information. +% Check |emo.dtx|. % % % ^^A ---------------------------------------------------------------------------------- % \subsection{Package Options} % -% Emo's \textsf{extra} and \textsf{index} options are simple flags. So, we -% declare a |\newif| for each option and, if the package use includes an option, -% it just toggles the conditional's state: +% \begin{macro}{\ifemo@extra} +% \begin{macro}{\ifemo@index} +% Emo's \textsf{extra} and \textsf{index} options are simple flags. So we +% declare a new conditional for each and, if |\usepackage| includes an option, +% toggle the conditional's state. % \begin{macrocode} \newif\ifemo@extra\emo@extrafalse \DeclareOption{extra}{\emo@extratrue} @@ -491,10 +552,12 @@ Released under LPPL v1.3c or later \DeclareOption{index}{\emo@indexingtrue} \ProcessOptions\relax % \end{macrocode} +% \end{macro} +% \end{macro} % % % ^^A ---------------------------------------------------------------------------------- -% \subsection{Dependencies} +% \subsection{Setup Including Dependencies} % % The dependency on |inputenc| effectively declares this file's encoding to be % UTF-8. The XeTeX and LuaTeX engines already expect files to be encoded that @@ -504,12 +567,23 @@ Released under LPPL v1.3c or later \RequirePackage[utf8]{inputenc} % \end{macrocode} % -% Depending on TeX engine, this package requires either |fontspec| or |graphicx| -% as the emoji-emitting backend. In turn, to tell the engines apart, it requires -% |iftex|. +% \begin{macro}{\ifemo@usefont} +% Define a third conditional for selecting the backend. Originally, I didn't +% bother with this, simply required |iftex|, and used |\ifluatex| throughout the +% package. But that unnecessarily complicates support for other LaTeX-like +% engines. +% \changes{0.2}{}{Abstract over backend selection} % \begin{macrocode} +\newif\ifemo@usefont\emo@usefontfalse \RequirePackage{iftex} -\ifluatex +\ifluatex\emo@usefonttrue\fi +% \end{macrocode} +% \end{macro} +% +% By now |\ifemo@usefont| should be correctly set up. So we use it for loading +% the right emoji-emitting backend, |fontspec| or |graphicx|: +% \begin{macrocode} +\ifemo@usefont \RequirePackage{fontspec} \else \RequirePackage{graphicx} @@ -540,6 +614,7 @@ Released under LPPL v1.3c or later % ^^A ---------------------------------------------------------------------------------- % \subsection{The Emoji Table} % +% \begin{macro}{\emo@emoji@<name>} % For each emoji with a PDF graphic in the |emo-graphics| directory, a macro % named |\emo@emoji@|\meta{emoji-name} expands to its Unicode sequence. With % over 3,000 distinct emoji in Unicode 15, emo relies on a Python script for @@ -552,14 +627,15 @@ Released under LPPL v1.3c or later % \begin{macrocode} \input{emo.def} % \end{macrocode} +% \end{macro} % % % ^^A ---------------------------------------------------------------------------------- % \subsection{Internal Macros} % -% \begin{macro}{emo@error@fg} -% \begin{macro}{emo@error@bg} -% \begin{macro}{emo@error} +% \begin{macro}{\emo@error@fg} +% \begin{macro}{\emo@error@bg} +% \begin{macro}{\emo@error} % Define two colors and a function that uses the two colors for formatting an % attention-grabbing error message. If you use an invalid emoji name and % overlook the warning in the console, you \emph{will} notice the error messsage @@ -579,7 +655,7 @@ Released under LPPL v1.3c or later % \end{macro} % \end{macro} % -% \begin{macro}{emo@ifdef} +% \begin{macro}{\emo@ifdef} % Validate the emoji name given as first argument. The macro expands to the % second argument if the name is valid and an error message otherwise. Its % implementation relies on the |emo@emoji| table. @@ -593,7 +669,7 @@ Released under LPPL v1.3c or later % \end{macrocode} % \end{macro} % -% \begin{macro}{emo@index} +% \begin{macro}{\emo@index} % If indexing is enabled, record the use of an emoji. Otherwise, do nothing. % \begin{macrocode} \ifemo@indexing @@ -609,7 +685,7 @@ Released under LPPL v1.3c or later % ^^A ---------------------------------------------------------------------------------- % \subsection{User Macros} % -% \begin{macro}{emo} +% \begin{macro}{\emo} % Emit the named color emoji. Both the font-based version for LuaTeX and the % graphics-based fallback validate the emoji name and then invoke the % |\emo@index| macro. But they differ in how they actually display the emoji. @@ -617,7 +693,7 @@ Released under LPPL v1.3c or later % that in a group that also uses the previously declared Noto color emoji font. % The fallback version instead includes a suitably sized PDF graphic. % \begin{macrocode} -\ifluatex +\ifemo@usefont \newfontface\emo@font[Renderer=Harfbuzz]{NotoColorEmoji.ttf} \newcommand\emo[1]{% \emo@ifdef{#1}{% @@ -629,15 +705,16 @@ Released under LPPL v1.3c or later \newcommand\emo[1]{% \emo@ifdef{#1}{% \emo@index{#1}% - \raisebox{-0.2ex}{\includegraphics[height=1em]{./emo-graphics/#1}}% + \raisebox{-0.2ex}{% + \includegraphics[height=1em]{emo-graphics/emo-#1}}% }% } \fi % \end{macrocode} % \end{macro} % -% \begin{macro}{lingchi} -% \begin{macro}{YHWH} +% \begin{macro}{\lingchi} +% \begin{macro}{\YHWH} % The definitions for the optional |\lingchi| and |\YHWH| macros follow from % that of |\emo|, except that % \begin{inlinenum} @@ -648,12 +725,12 @@ Released under LPPL v1.3c or later % \item subsequent space should be preserved and hence both macros end % with |\xspace|. % \end{inlinenum} -% While it would be nice to use Unicode inside the groups for the LuaTeX macros, -% doing so breaks the package documentation. So |\char| it is. +% While it would be nice to use Unicode inside the groups for font-using +% versions, this version is more robust given TeX pre-Unicode heritage. % \begin{macrocode} \ifemo@extra -\ifluatex -\newfontface\emo@chinese{lingchi.otf} +\ifemo@usefont +\newfontface\emo@chinese{emo-lingchi.ttf} \newfontface\emo@hebrew{LinLibertine_R.otf} \newcommand\lingchi{% \emo@index{lingchi}% @@ -661,16 +738,21 @@ Released under LPPL v1.3c or later \xspace} \newcommand\YHWH{% \emo@index{YHWH}% - \begingroup\textdir TRT\emo@hebrew \char"5D9\char"5D4\char"5D5\char"5D4\endgroup% + \begingroup% + \textdir TRT% + \emo@hebrew \char"5D9\char"5D4\char"5D5\char"5D4% + \endgroup% \xspace} \else \newcommand\lingchi{% \emo@index{lingchi}% - \raisebox{-0.2ex}{\includegraphics[height=1em]{./emo-graphics/lingchi}}% + \raisebox{-0.2ex}{% + \includegraphics[height=1em]{emo-graphics/emo-lingchi}}% \xspace} \newcommand\YHWH{% \emo@index{YHWH}% - \raisebox{-0.2ex}{\includegraphics[height=1em]{./emo-graphics/YHWH}}% + \raisebox{-0.2ex}{% + \includegraphics[height=1em]{emo-graphics/emo-YHWH}}% \xspace} \fi \fi @@ -684,34 +766,100 @@ Released under LPPL v1.3c or later %</package> % \end{macrocode} % -% \Finale % -% ^^A ---------------------------------------------------------------------------------- -% \obeyspaces -% \typeout{} -% \typeout{โโโโโโโโโโโโโโโโโโโโโโemoโโโฐ} -% \typeout{โ} -% \typeout{โ To extract build.sh, emo.ins, emo.sty, and README.md, run:} -% \typeout{โ} -% \typeout{โ $ pdflatex emo.dtx} -% \typeout{โ} -% \typeout{โ} -% \typeout{โ To build emo's documentation with indices, run:} -% \typeout{โ} -% \typeout{โ $ source build.sh} -% \typeout{โ} -% \typeout{โ} -% \typeout{โ To reconfigure supported emoji, run:} -% \typeout{โ} -% \typeout{โ $ python3 config/emo.py -h} -% \typeout{โ} -% \typeout{โ} -% \typeout{โ To install emo, put these files somewhere LaTeX can find them:} -% \typeout{โ} -% \typeout{โ emo.def} -% \typeout{โ emo.sty} -% \typeout{โ NotoSerifTC-Regular.otf} -% \typeout{โ emo-graphics/*.pdf} -% \typeout{โ} -% \typeout{โโโโโโโโโโโโโโโโโโโโโโemoโโโฐ} -% \typeout{} +% ^^A ================================================================================== +% \section{LaTeXML Binding} +% \changes{0.2}{}{Add LaTeXML binding} +% +% To support conversion from LaTeX to HTML, emo includes a so-called binding for +% \href{https://github.com/brucemiller/LaTeXML}{LaTeXML}. It effectively is a +% (much simplified) re-implementation of emo's core functionality, only written +% in Perl against LaTeXML's API. The binding ignores the \textsf{index} option +% and does not perform error checking on emoji names. If either is important to +% you, please compile the document with LaTeX first. Furthermore, the binding +% emits necessary Unicode codepoints only, without font annotations. If you want +% to specify fonts, please use a CSS fontstack. +% +% Asking package authors to reimplement their packages for LaTeXML seems +% unreasonable to me. It leads to code duplication and places the maintenance +% burden on package authors. Yet, right after announcing emo, the question of +% LaTeXML support came up. LaTeXML includes the |latexml.sty| package, which +% defines |\iflatexml|. I would have used that command to make the three-line +% change to |emo.sty| necessary for LaTeX support, except |latexml.sty| contains +% lots of other stuff that isn't needed. Always loading that only to detect +% LaTeXML seems like a bad idea. Since reimplementing |\iflatexml| would require +% a binding anyways, I just wrote a minimal binding. As I said, LaTeXML's +% approach is broken. +% +% With that out of the way, let's get started: +% \begin{macrocode} +%<*latexml-binding> +% \end{macrocode} +% +% The binding starts with an explicit preamble because |docstrip| does not +% alllow for a redefinition of the starting characters of a line comment. It is +% followed by the Perl dependencies. +% \begin{macrocode} +## emo's LaTeXML binding. +## (C) 2023 by Robert Grimm. +## Released under LPPL v1.3c or later. +use strict; +use warnings; +use LaTeXML::Package; +% \end{macrocode} +% +% \begin{macro}{\ifemo@extra} +% Next, we use raw TeX to declare the LaTeX package and define the |emo@extra| +% conditional. There is no need to define the |emo@indexing| conditional, since +% it corresponds to the unsupported \textsf{index} option. +% \begin{macrocode} +RawTeX(<<'EOTeX'); +\ProvidesPackage{emo} + [2023/03/21 v0.2a1 emoโขji for all (LaTeX engines)] +\newif\ifemo@extra\emo@extrafalse +EOTeX +% \end{macrocode} +% \end{macro} +% +% Option prcessing is almost trivial: +% \begin{macrocode} +DeclareOption('extra', '\emo@extratrue'); +DeclareOption('index', ''); +ProcessOptions(); +% \end{macrocode} +% +% \begin{macro}{\emo@emoji@<name>} +% \begin{macro}{\emo} +% Just like the actual package implementation, the binding reads the emoji table +% from |emo.def|. Similar to the actual implementation of the |\emo| macro when +% running under LuaLaTeX, the binding expands the named entry from the emoji +% table, producing the emoji's Unicode codepoints. +% \begin{macrocode} +InputDefinitions('emo', type => 'def', noltxml => 1); +DefMacro('\emo{}', '\csname emo@emoji@#1\endcsname'); +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\lingchi} +% \begin{macro}{\YHWH} +% If the |emo@extra| conditional is enabled, require the |xspace| package and then +% provide minimal re-definitions of the |\lingchi| and |\YHWH| macros. Both simply +% expand to the necessary Unicode codepoints. +% \begin{macrocode} +if (IfCondition(T_CS('\ifemo@extra'))) { + RequirePackage('xspace'); + DefMacro('\lingchi', "\x{51cc}\x{9072}\\xspace"); + DefMacro('\YHWH', "\x{05D9}\x{05D4}\x{05D5}\x{05D4}\\xspace"); +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% That's it for the binding, too. +% \begin{macrocode} +%</latexml-binding> +% \end{macrocode} +% +% +% \Finale diff --git a/graphics/emo/emo.pdf b/graphics/emo/emo.pdf Binary files differindex 5ac83c4240..74d69b83d5 100644 --- a/graphics/emo/emo.pdf +++ b/graphics/emo/emo.pdf diff --git a/graphics/emo/lingchi.otf b/graphics/emo/lingchi.otf Binary files differdeleted file mode 100644 index 568bee864b..0000000000 --- a/graphics/emo/lingchi.otf +++ /dev/null diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-calendar-plus.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-calendar-plus.tex index bdfd225f3c..a9b4802adc 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-calendar-plus.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-calendar-plus.tex @@ -69,10 +69,12 @@ The actual week number algorithm is implemented by the |pgfcalendar-ext| package % \begin{codeexample}[preamble={\usetikzlibrary{ext.calendar-plus}}] \tikz - \calendar [week list, month label above centered, - dates=2022-07-01 to 2022-07-31, - week label left, - every week/.append style={gray!50!black,font=\sffamily}]; + \calendar[ + week list, month label above centered, + dates=2022-07-01 to 2022-07-31, + week label left, + every week/.append style={ + gray!50!black, font=\sffamily}]; \end{codeexample} % \end{stylekey} diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-misc.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-misc.tex index 227317e765..87891a3dc2 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-misc.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-misc.tex @@ -294,7 +294,7 @@ not all of them are. \begin{multicols}{2} \begin{key}{/tikz/reverse clip=\meta{direction} (default counter clockwise)} This key installs a very big rectangle which is either constructed -|counter clockwise| (like the \referencePathOperationandIndexO{circle} +\texttt{counter clockwise} (like the \referencePathOperationandIndexO{circle} path operation) or |clockwise|. \end{key} \begin{key}{/tikz/clip rule=\meta{direction} (default even odd)} diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-nodes.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-nodes.tex index 37d4f79de6..e30accfdae 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-nodes.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-nodes.tex @@ -22,13 +22,14 @@ This key allows one to use a pic where usually only nodes are accepted, for example as a label. \begin{codeexample}[preamble=\usetikzlibrary{ext.nodes, ext.misc}] \begin{tikzpicture}[ - slsl/.pic={\draw (-2pt, 1.5pt) -- (2pt, .5pt) - (2pt, -1.5pt) -- (-2pt, -.5pt);}] -\node[draw, minimum width=3cm, minimum height=1cm, - label={[pic ] east:slsl}, - label={[pic, rotate=90] north:slsl}, - label={[pic ] west:slsl}, - label={[pic, rotate=-90]south:slsl}]{}; + slsl/.pic={\draw(-2pt, 1.5pt)--( 2pt, .5pt) + ( 2pt,-1.5pt)--(-2pt,-.5pt);}] +\node[ + draw, minimum width=3cm, minimum height=1cm, + label={[pic ] east:slsl}, + label={[pic, rotate= 90]north:slsl}, + label={[pic ] west:slsl}, + label={[pic, rotate=-90]south:slsl}]{}; \end{tikzpicture} \end{codeexample} \end{key} diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-positioning-plus.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-positioning-plus.tex index 56c81376aa..a44041c02d 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-positioning-plus.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-positioning-plus.tex @@ -164,12 +164,12 @@ This functionality is also available without the placement: \end{stylekey} \begin{stylekey}{/tikz/span vertical=\meta{list of coordinates}} Creates a rectangular node with the name |fit bounding box| that encompasses - the \meta{list of coordinates} \emph{and} sets the \referenceKeyandIndexO[/pgf]{minimum height} to + the \meta{list of coordinates} \emph{and} sets the \referenceKeyandIndexO[/pgf/]{minimum height} to the height of this bounding box. \end{stylekey} \begin{stylekey}{/tikz/span horizontal=\meta{list of coordinates}} Creates a rectangular node with the name |fit bounding box| that encompasses - the \meta{list of coordinates} \emph{and} sets the \referenceKeyandIndexO[/pgf]{minimum width} to + the \meta{list of coordinates} \emph{and} sets the \referenceKeyandIndexO[/pgf/]{minimum width} to the width of this bounding box. \end{stylekey} \begin{stylekey}{/tikz/span=\meta{list of coordinates}} diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-body.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-body.tex index 12d96ca7c5..198245b277 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-body.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-body.tex @@ -8,10 +8,11 @@ % 2. under the GNU Free Documentation License. % \newcommand*\tikzextname{Ti\textit kZ-Extensions} -\newcommand*\tikzextversion{0.5} +\newcommand*\tikzextversion{0.5.1} %\includeonly{ -% tikz-ext-manual-en-library-misc, -% tikz-ext-manual-en-library-nodes, +%% tikz-ext-manual-en-library-misc, +%% tikz-ext-manual-en-library-nodes, +% tikz-ext-manual-en-pgf-arrows, %} \begin{document} {\colorlet{blue}{black}% links shall be black @@ -126,6 +127,7 @@ These libraries (should) work with both \pgfname\space and \tikzname. \end{codeexample} \end{center} +\tikzsetfigurename{PGF.arrows}\include{tikz-ext-manual-en-pgf-arrows} \tikzsetfigurename{PGF.trans}\include{tikz-ext-manual-en-pgf-trans} \tikzsetfigurename{PGF.shapes}% \include{tikz-ext-manual-en-pgf-shapes-circlearrow} @@ -180,6 +182,11 @@ These libraries (should) work with both \pgfname\space and \tikzname. \section*{Changelog}\addcontentsline{toc}{section}{Changelog} \begin{multicols}{2}\raggedright \noindent +Version 0.5.1 +\begin{itemize} +\item \addPGF{arrows} +\item Bugfix to |ext.pgfkeys-plus|. \cite{GH6} +\end{itemize} Version 0.5 \begin{itemize} \item \addPackage{pgffor} diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-preamble.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-preamble.tex index 30b21dee6a..91b9565b97 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-preamble.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-main-preamble.tex @@ -41,21 +41,6 @@ \tracinglostchars=3 \input{pgfmanual-en-macros} -\newenvironment{pgfkeyslibrary}[1]{% from pgfmanual-en-macros - \begin{pgfmanualentry}% - \pgfmanualentryheadline{% - \pgfmanualpdflabel{#1}{}% - \textbf{pgfkeys Library} \texttt{\declare{#1}}}% - \index{#1@\protect\texttt{#1} pgfkeys library}% - \index{pgfkeys Libraries!#1@\protect\texttt{#1}}% - \vskip.25em - {{\ttfamily\char`\\usepgfkeyslibrary\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX\space and plain \TeX}}\\ - {{\ttfamily\char`\\usepgfkeyslibrary[\declare{#1}]\space \char`\%\space\space Con\TeX t}}\\[.5em]% - \pgfmanualbody -}% -{% - \end{pgfmanualentry}% -} \usepackage{unicode-math} \setmathfont[Scale=MatchUppercase]{libertinusmath-regular.otf} @@ -104,8 +89,9 @@ \@tempswatrue \fi} \makeatother - +\usepgfkeyslibrary{ext.pgfkeys-plus} \usetikzlibrary{ + ext.arrows, ext.calendar-plus, ext.misc, ext.node-families, @@ -408,6 +394,12 @@ \index{#1@\originalprefix\protect\texttt{\original{#1}} environment\originalsuffix}% \index{Environments!#1@\originalprefix\protect\texttt{\original{#1}}\originalsuffix}% } + +\newcommand*{\indexArrowtipO}[1]{% + \index{#1@\originalprefix\protect\texttt{\original{#1}} arrow tip\originalsuffix}% + \index{Arrow tips!#1@\originalprefix\protect\texttt{\original{#1}}\originalsuffix}% +} +\newcommand*{\referenceArrowtipandIndexO}[1]{\texttt{#1}\indexArrowtipO{#1}} \newcommand*{\referenceEnvironmentandIndexO}[1]{\texttt{#1}\indexEnvironmentO{#1}} \newcommand*{\referenceDecorationandIndexO}[1]{\texttt{#1}\indexDecorationO{#1}} \newcommand*{\referenceKeyandIndexO}[2][/tikz/]{\texttt{#1#2}\indexKeyO[#1]{#2}} @@ -500,4 +492,43 @@ } { \end{pgfmanualentry} -}
\ No newline at end of file +} + +\usepackage{booktabs} + +\renewenvironment{arrowtip}[4]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{\textbf{Arrow Tip Kind} {\ttfamily#1}} + \index{#1@\protect\texttt{#1} arrow tip}% + \index{Arrow tips!#1@\protect\texttt{#1}}% + \pgfmanualbody + \def\currentarrowtype{#1} + \begin{minipage}[t]{\dimexpr\linewidth-5cm\relax} + #2 + \end{minipage}\hskip5mm\begin{minipage}[t]{4.75cm} + \leavevmode\vskip-2em + \tikz{ + \draw [black!50,line width=5mm,-{#1[#3,color=black]}] (-4,0) -- (0,0); + \foreach \action in {#4} + { \expandafter\processaction\action\relax } + } + \end{minipage}\par\smallskip + } +{ + \end{pgfmanualentry} +} +\makeatletter +\def\arrowexample@#1[#2]{% + {\sfcode`\.1000\scriptsize\texttt{#1[#2]}} \> + \tikz [baseline,>={#1[#2]}] \draw [line + width=0.4pt,->] (0,.5ex) -- (2em,.5ex); thin \> + \tikz [baseline,>={#1[#2]}] \draw [line + width=0.8pt,->] (0,.5ex) -- (2em,.5ex); \textbf{thick} \> + \tikz [baseline,>={#1[#2]}] \draw [line + width=1.6pt,->] (0,.5ex) -- (3em,.5ex); \\ +} +\def\manual@action@radius#1/#2/#3\relax{% + \draw [red,|<->|,semithick] ([xshift=-#1,yshift=#1]current bounding + box.north east) -- node [above, overlay] {\texttt{radius}} ++(-#1,0); +} +\makeatother
\ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-arrows.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-arrows.tex new file mode 100644 index 0000000000..d330360ed6 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-arrows.tex @@ -0,0 +1,268 @@ +% !TeX spellcheck = en_US +% !TeX root = tikz-ext-manual.tex +% Copyright 2023 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\section{Arrow Tips} +\label{pgflibrary:arrows} +\tikzset{external/export/.try=false}% +\begin{pgflibrary}{ext.arrows} + This library adds arrows to \pgfname/\tikzname. + + \inspiration{ArrowLoop-Q,ArrowHug-Q,ArrowUntipped1-Q,ArrowUntipped2-Q} + {ArrowLoop-A,ArrowHug-A,ArrowUntipped1-A,ArrowUntipped2-A} +\end{pgflibrary} +\begin{multicols}{2} +The arrow tips of the \referenceLibraryandIndexO{arrows.meta} library always +just touch the end of original line -- which is usually +what you want. + +But for some arrow tips (and when they lie along a path) it makes sense +that these tips shoot a bit over the end of the line. +This is why these arrow tips exist. +They can be categorized into three groups: +\begin{enumerate} +\item Centered +\item Untipped +\item Overtipped\footnote{The Overtipped arrow tips aren't yet implemented.} +\end{enumerate} +Not all original arrow tips got all variants. +For a summary, refer to table on the right side. +As with the original tips of the \referenceLibraryandIndexO{arrows.meta} library +these can be organized in the following categories. +\newcolumn +\begin{center} +\newcommand*\tip[2][]{% + \tikzset{external/export/.try=false}% + \tikz[arrows={#2 \arrowtiprow[reversed] - \arrowtiprow[sep] . #2 \arrowtiprow[]}, baseline=+-.5ex, + trim left=+-3mm, trim right=+13mm] + \draw[line width=+.5mm, postaction={draw, gray, thin,-}] (0,0) -- + (right:1);% +}% +\def\tiprow#1 &{#1\gdef\arrowtiprow{#1} &}% +\def\Tiprow#1 &{\quad#1\gdef\arrowtiprow{#1} &}% +%\centering +%\caption{Variants of the original \texttt{arrows.meta} arrow tips. +% For each example, the order is 1. reversed variant, 2. original, 3. variant. +% They gray line shows where the path actually ends. +%}\label{tab:tips} +\begin{tabular}{ll ccc} + \toprule + Group & Original & Centered & Untipped & Overtipped \\ \midrule + Barbed & \tiprow Arc Barb & \tip{Centered} & \tip{Untipped} & -- \\ + & \Tiprow Parenthesis & \tip{Centered} & \tip{Untipped} & -- \\ + & \tiprow Hooks & \tip{Centered} & -- & -- \\ + & \tiprow Straight Barb & \tip{Centered} & -- & -- \\ + & \tiprow Tee Barb & \tip{Centered} & \tip{Untipped} & -- \\ + & \Tiprow Bar & \tip{Centered} & \tip{Untipped} & -- \\ + & \Tiprow Bracket & \tip{Centered} & \tip{Untipped} & -- \\ \midrule +% Mathematical & Classical TikZ Rightarrow & -- & -- & -- \\ +% & Computer Modern Rightarrow & -- & -- & -- \\ +% & \quad To & -- & -- & -- \\ +% & Implies & -- & -- & -- \\ \midrule + Geometric & \tiprow Circle & \tip{Centered} & \tip{Untipped} & -- \\ + & \Tiprow Ellipse & \tip{Centered} & \tip{Untipped} & -- \\ + & \tiprow Kite & \tip{Centered} & -- & -- \\ + & \Tiprow Diamond & \tip{Centered} & -- & -- \\ + & \Tiprow Turned Square & \tip{Centered} & -- & -- \\ + & \tiprow LaTeX & -- & -- & -- \\ + & \tiprow Square & \tip{Centered} & -- & -- \\ + & \Tiprow Rectangle & \tip{Centered} & -- & -- \\ + & \tiprow Stealth & \tip{Centered} & -- & -- \\ + & \Tiprow Triangle & \tip{Centered} & -- & -- \\ \midrule +% Caps & & -- & -- & -- \\ + Rays & \tiprow Rays & \tip{Centered} & -- & -- \\ \bottomrule +\end{tabular} +\end{center} +\newcolumn + +\subsection{Centered} +\subsubsection{Barbed Arrow Tips} +\begin{arrowtipsimple}{Centered Arc Barb} + This is a variant of the \referenceArrowtipandIndexO{Arc Barb} tip. + The center of the arc lies on the original end of the path. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Centered Bar} + A variant of the simple \referenceArrowtipandIndexO{Bar} tip. + This is a simple instance of |Centered Tee Barb| for length zero. + + The middle of the line will lie on original end of the path. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Centered Bracket} + This is a variant of the \referenceArrowtipandIndexO{Bracket} tip and + therefore an instance of the |Centered Tee Barb| arrow tip that results in something + resembling a bracket. + + The middle of the vertical part will lie on the original end of the path. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Centered Hooks} + A variant of the \referenceArrowtipandIndexO{Hooks} tip. + The starting point of the hooks will lie on the original end of the path. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Centered Parenthesis} + This is a variant of the \referenceArrowtipandIndexO{Parenthesis} tip and + thus an instance of the |Centered Arc Barb| arrow tip. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Centered Straight Barb} + A variant of the \referenceArrowtipandIndexO{Straight Barb} tip. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Centered Tee Barb} + A variant of the \referenceArrowtipandIndexO{Tee Barb} tip. + + The middle of the vertical part will lie on the original end of the path. +\end{arrowtipsimple} + +\subsubsection{Geometric Arrow Tips} +\begin{arrowtipsimple}{Centered Circle} + A variant of the \referenceArrowtipandIndexO{Circle} tip. + The center of the circle will lie on the original end of the path. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Centered Diamond} + This is a variant of the \referenceArrowtipandIndexO{Diamond} tip and + thus an instance of |Centered Kite| where the length is larger than the width. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Centered Ellipse} + This is a variant of the \referenceArrowtipandIndexO{Ellipse} tip + and thus another name for the |Centered Circle| tip + that is twice as wide as high. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Centered Kite} + A variant of the \referenceArrowtipandIndexO{Kite} tip. + + The widest part will lie on the original end of the path. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Centered Rectangle} + A variant of the \referenceArrowtipandIndexO{Rectangle} tip. + By default, it is twice as long as high. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Centered Square} + A variant of the \referenceArrowtipandIndexO{Square} tip. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Centered Stealth} + This is a variant of the \referenceArrowtipandIndexO{Stealth} tip. + + The weighted center will lie at the original end of the path. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Centered Triangle} + This is a variant of the \referenceArrowtipandIndexO{Triangle} tip and + thus an instance of the |Centered Kite| tip with zero inset. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Centered Turned Square} + This is a variant of the \referenceArrowtipandIndexO{Turned Square} tip and + thus an instance of the |Centered Kite| tip with identical width and height and mid-inset. +\end{arrowtipsimple} + +\subsubsection{Special Arrow Tips} +\begin{arrowtipsimple}{Centered Rays} + A variant of the \referenceArrowtipandIndexO{Rays} tip. + The origin of the rays will lie on the original end of the path. +\end{arrowtipsimple} + +\subsection{Untipped} +\subsubsection{Barbed Arrow Tips} +\begin{arrowtipsimple}{Centered Arc Barb} + This is a variant of the \referenceArrowtipandIndexO{Arc Barb} tip. + The arrow tip will protrude half its line width over the original end of the path. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Untipped Bar} + A variant of the simple \referenceArrowtipandIndexO{Bar} tip. + This is a simple instance of |Untipped Tee Barb| for length zero. + + The middle of the line will lie on original end of the path. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Untipped Bracket} + This is a variant of the \referenceArrowtipandIndexO{Bracket} tip and + therefore an instance of the |Untipped Tee Barb| arrow tip that results in something + resembling a bracket. + + The arrow tip will protrude half its line width over the original end of the path. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Untipped Parenthesis} + This is a variant of the \referenceArrowtipandIndexO{Parenthesis} tip and + thus an instance of the |Untipped Arc Barb| arrow tip. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Untipped Tee Barb} + A variant of the \referenceArrowtipandIndexO{Tee Barb} tip. + + The middle of the vertical part will lie on the original end of the path. +\end{arrowtipsimple} + +\subsubsection{Geometric Arrow Tips} +\begin{arrowtipsimple}{Untipped Circle} + A variant of the \referenceArrowtipandIndexO{Circle} tip. + This tip will protrude half its line width over the original end of the path. +\end{arrowtipsimple} + +\begin{arrowtipsimple}{Untipped Ellipse} + This is a variant of the \referenceArrowtipandIndexO{Ellipse} tip + and thus another name for the |Untipped Circle| tip + that is twice as wide as high. +\end{arrowtipsimple} + +\subsection{Original Arrow Tips} +\begin{arrowtipsimple}{Hug Cap} +This arrow tips will hug a circle that would touch the end of the path. + +Use the \referenceKeyandIndexO[/pgf/arrow keys/]{length} key to set up the radius of that circle. + +\begin{codeexample}[preamble=\usepgflibrary{ext.arrows}] +\begin{tikzpicture}[ + dot/.style 2 args={ + shape=circle, outer sep=+0pt, fill={#1}, minimum size={#2}}] +\node[dot={red} {2cm}] (A) {}; +\node[dot={blue}{3cm}] (B) at (6,0) {}; +\draw[ + line width=1.5cm, + arrows={Hug Cap[length=1cm]-Hug Cap[length=1.5cm]} +] (A) to[out=45, in=180] (B); +\end{tikzpicture} +\end{codeexample} +\end{arrowtipsimple} + +\begin{arrowtip}{Loop}{ + This arrow tip attaches a one-sided loop to the end of the line. + The |length| refers to the length of the whole tip while the |radius| + specifies the radius of the three rounded corners. + The width of the tip is twice the |length| (but can't specified independently). +}{length=1.5cm,radius=3.5mm}{length=1.5cm,radius=3.5mm} + \begin{arrowexamples} + \arrowexample[] + \arrowexampledup[sep] + \arrowexampledupdot[sep] + \arrowexample[open] + \arrowexample[open, swap] + \arrowexample[length=5pt,radius=0pt] + \arrowexample[reversed] + \arrowexample[slant=.3] + \arrowexample[red] + \end{arrowexamples} + % + The following options have no effect: |harpoon|, |round|, |line width|. + + On |double| lines, the arrow tip will not look correct. +\end{arrowtip} +\end{multicols} +\tikzset{external/export/.try=true}% +\endinput diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-shapes-circlearrow.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-shapes-circlearrow.tex index e26711bb35..0d6340a75a 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-shapes-circlearrow.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-shapes-circlearrow.tex @@ -79,11 +79,13 @@ circle arrow turn left west, shape example] {Circle Arrow\vrule width 1pt height 2cm}; \foreach \anchor/\placement in - {north west/above left, north/above, north east/above right, + {north west/above left, north/above, + north east/above right, west/left, center/above, east/right, mid west/right, mid/above, mid east/left, base west/left, base/below, base east/right, - south west/below left, south/below, south east/below right, + south west/below left, south/below, + south east/below right, text/left, 10/right, 130/above} \draw[shift=(s.\anchor)] plot[mark=x] coordinates{(0,0)} node[\placement] {\scriptsize\texttt{(s.\anchor)}}; diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-trans.tex b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-trans.tex index ccd378a6e7..1250fd8216 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-trans.tex +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-pgf-trans.tex @@ -61,7 +61,7 @@ only the |m| in |mirror| is capitalized. \begin{codeexample}[preamble=\usepgflibrary{transformations.mirror}] \begin{tikzpicture} -\draw[help lines] (-0.25, -.25) grid (3.25, 1.25); +\draw[help lines] (-.25, -.25) grid (3.25, 1.25); \draw[-latex] (0,0) .. controls (.5,1) .. (1,1); \draw[dashed] (1.5, -.25) -- (1.5, 1.25); @@ -79,7 +79,7 @@ only the |m| in |mirror| is capitalized. \begin{codeexample}[preamble=\usepgflibrary{transformations.mirror}] \begin{tikzpicture} -\draw[help lines] (-0.25, -.25) grid (3.25, 1.25); +\draw[help lines] (-.25, -.25) grid (3.25, 1.25); \draw[-latex] (0,0) .. controls (.5,1) .. (1,1); \draw[dashed] (1.5, -.25) -- (1.5, 1.25); diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.bib b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.bib index 25c736c7cd..721837bbea 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.bib +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.bib @@ -494,4 +494,107 @@ year = {2022}, } +' +@Software{GH6, + abstract = {{Latest version of ext.misc on CTAN appears to have a typo}}, + author = {marmotghost}, + month = mar, + title = {Latest version of ext.misc on CTAN appears to have a typo}, + url = {https://github.com/Qrrbrbirlbel/tikz-extensions/issues/6}, + urldate = {2023-04-01}, + year = {2023}, +} + +' +@Online{ArrowLoop-Q, + author = {{IV}, Edgar A. Bering}, + file = {Snapshot:https\://tex.stackexchange.com/questions/565010/set-the-color-of-a-tikz-cd-glyph-arrow-tip-with-xelatex/681474#681474:text/html}, + month = oct, + title = {Set the color of a tikz-cd Glyph arrow tip with xelatex}, + titleaddon = {{TeX} - {LaTeX} Stack Exchange}, + url = {https://tex.stackexchange.com/q/565010/16595}, + urldate = {2023-04-01}, + year = {2020}, +} + +@Online{ArrowLoop-A, + author = {Qrrbrbirlbel}, + file = {Snapshot:https\://tex.stackexchange.com/questions/565010/set-the-color-of-a-tikz-cd-glyph-arrow-tip-with-xelatex/681474#681474:text/html}, + month = apr, + title = {Answer to \enquote{Set the color of a tikz-cd Glyph arrow tip with xelatex}}, + titleaddon = {{TeX} - {LaTeX} Stack Exchange}, + url = {https://tex.stackexchange.com/a/681474/16595}, + urldate = {2023-04-01}, + year = {2023}, +} + +' +@Online{ArrowHug-Q, + author = {{DC}, Alejandro}, + file = {Snapshot:https\://tex.stackexchange.com/questions/241074/better-fitting-line-to-node-in-tikz/241303#241303:text/html}, + month = apr, + title = {Better fitting line to node in {TiKZ}}, + titleaddon = {{TeX} - {LaTeX} Stack Exchange}, + url = {https://tex.stackexchange.com/q/241074/16595}, + urldate = {2023-04-01}, + year = {2015}, +} + +@Online{ArrowHug-A, + author = {Qrrbrbirlbel}, + file = {Snapshot:https\://tex.stackexchange.com/questions/241074/better-fitting-line-to-node-in-tikz/241303#241303:text/html}, + month = apr, + title = {Answer to \enquote{Better fitting line to node in {TiKZ}}}, + titleaddon = {{TeX} - {LaTeX} Stack Exchange}, + url = {https://tex.stackexchange.com/a/241303/16595}, + urldate = {2023-04-01}, + year = {2015}, +} + +' +@Online{ArrowUntipped1-Q, + author = {Christian}, + file = {Snapshot:https\://tex.stackexchange.com/questions/111051/tikz-arrow-tip-is-displaced?noredirect=1&lq=1:text/html}, + month = apr, + title = {{TikZ} arrow tip is displaced}, + titleaddon = {{TeX} - {LaTeX} Stack Exchange}, + url = {https://tex.stackexchange.com/q/111051/16595}, + urldate = {2023-04-02}, + year = {2013}, +} + +@Online{ArrowUntipped1-A, + author = {Qrrbrbirlbel}, + file = {Snapshot:https\://tex.stackexchange.com/questions/111051/tikz-arrow-tip-is-displaced?noredirect=1&lq=1:text/html}, + month = apr, + title = {Answer to \enquote{{TikZ} arrow tip is displaced}}, + titleaddon = {{TeX} - {LaTeX} Stack Exchange}, + url = {https://tex.stackexchange.com/a/111053/16595}, + urldate = {2023-04-02}, + year = {2013}, +} + +' +@Online{ArrowUntipped2-Q, + author = {Hlavacek, Jan}, + file = {Snapshot:https\://tex.stackexchange.com/questions/11871/modifying-and-o-style-tikz-arrows-so-that-they-are-centered-at-the-end-of?noredirect=1&lq=1:text/html}, + month = feb, + title = {Modifying \texttt{*} and \texttt{o} style tikz arrows so that they are centered at the end of line}, + titleaddon = {{TeX} - {LaTeX} Stack Exchange}, + url = {https://tex.stackexchange.com/q/11871/16595}, + urldate = {2023-04-02}, + year = {2011}, +} + +@Online{ArrowUntipped2-A, + author = {Qrrbrbirlbel}, + file = {Snapshot:https\://tex.stackexchange.com/questions/11871/modifying-and-o-style-tikz-arrows-so-that-they-are-centered-at-the-end-of?noredirect=1&lq=1:text/html}, + month = sep, + title = {Answer to \enquote{Modifying \texttt{*} and \texttt{o} style tikz arrows so that they are centered at the end of line}}, + titleaddon = {{TeX} - {LaTeX} Stack Exchange}, + url = {https://tex.stackexchange.com/a/656241/16595}, + urldate = {2023-04-02}, + year = {2022}, +} + @Comment{jabref-meta: databaseType:bibtex;} diff --git a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.pdf b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.pdf Binary files differindex c04e209f81..57ac4faf19 100644 --- a/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.pdf +++ b/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual.pdf diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/pgfkeyslibraryext.pgfkeys-plus.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/pgfkeyslibraryext.pgfkeys-plus.code.tex index 50cbe7a60c..b78bc60f2c 100644 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/pgfkeyslibraryext.pgfkeys-plus.code.tex +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/pgfkeyslibraryext.pgfkeys-plus.code.tex @@ -103,7 +103,7 @@ {\the\numexpr\pgfkeysvalueof{\pgfkeyscurrentpath}+1\relax}, .value/.code=% copies the value of one key to another w/o expanding it \pgfkeysgetvalue{#1}\pgfkeys@temp - \expandafter\pgfkeys@exp@call\expandafter{\pgfkeys@temp}} + \expandafter\pgfkeys@exp@call\expandafter{\pgfkeys@temp}% } \pgfqkeys{/utils}{ diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.arrows.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.arrows.code.tex new file mode 100644 index 0000000000..f1181e9f86 --- /dev/null +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.arrows.code.tex @@ -0,0 +1,288 @@ +% Copyright 2023 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% + +\usepgflibrary{arrows.meta} + +\pgfqkeys{/pgf/@arrows decl}{ + clone/.code={% + \pgfutil@namelet{pgf@decl@arrow@code}{pgf@ar@code@#1}% + \pgfutil@namelet{pgf@decl@arrow@defaults}{pgf@ar@defaults@#1}% + \pgfutil@namelet{pgf@decl@arrow@setup}{pgf@ar@setup@#1}% + \pgfutil@namelet{pgf@decl@arrow@bending@mode}{pgf@ar@bending@mode@#1}% + \pgfutil@namelet{pgf@decl@arrow@par}{pgf@ar@par@#1}% + \pgfutil@namelet{pgf@decl@arrow@cache}{pgf@ar@do@cache@#1}% + }, + append setup code/.code= + \begingroup + \pgfutil@toks@\expandafter{\pgf@decl@arrow@setup#1}% + \expandafter\endgroup + \expandafter\def\expandafter\pgf@decl@arrow@setup\expandafter + {\the\pgfutil@toks@ }, + % append parameters/.code= + % \begingroup + % \show\pgf@decl@arrow@par + % \pgfutil@toks@\expandafter{\pgf@decl@arrow@par#1}% + % \expandafter\endgroup + % \expandafter\def\expandafter\pgf@decl@arrow@par\expandafter + % {\the\pgfutil@toks@ } +} +% \pgfkeyssetvalue{/pgf/arrow keys/weight}{true} + +%%% Barbed +% Arc Barb, Parenthesis +\pgfdeclarearrow{ + clone = Arc Barb, + name = Centered Arc Barb, + append setup code = + \ifpgfarrowreversed + \pgfarrowssetbackend{0pt} + \else + \pgfarrowssettipend{0pt} + \fi +} +\pgfdeclarearrow{ + clone = Arc Barb, + name = Untipped Arc Barb, + append setup code = + \ifpgfarrowreversed + \pgfarrowssetbackend{\pgfarrowlength} + \else + \pgfarrowssettipend{\pgfarrowlength} + \fi +} + +% Hooks +\pgfdeclarearrow{ + clone = Hooks, + name = Centered Hooks, + append setup code = + \ifpgfarrowreversed + \pgfarrowssetbackend{0pt} + \else + \pgfarrowssettipend{0pt} + \fi +} + +% Straight Barb +\pgfdeclarearrow{ + clone = Straight Barb, + name = Centered Straight Barb, + append setup code = + \ifpgfarrowreversed + \pgfarrowssetbackend{.5\pgfarrowlength} + \else + \pgfarrowssettipend{.5\pgfarrowlength} + \fi +} + +% Tee Barb, Bar, Bracket +\pgfdeclarearrow{ + clone = Tee Barb, + name = Centered Tee Barb, + append setup code = + \ifpgfarrowreversed + \pgfarrowssetbackend{0pt} + \else + \pgfarrowssettipend{0pt} + \fi +} +\pgfdeclarearrow{ + clone = Tee Barb, + name = Untipped Tee Barb, + append setup code = + \ifpgfarrowreversed\expandafter\pgfarrowssetbackend\else\expandafter\pgfarrowssettipend\fi + {\pgfutil@tempdima + \ifpgfutil@tempswa % does it not extend to the right? + \advance\pgf@x-.5\pgfarrowlinewidth + \else + \ifpgfutil@tempswb + \else + \pgf@x=.5\pgfarrowlength + \fi + \ifpgfarrowroundcap\else + \advance\pgf@x-.5\pgfarrowlinewidth + \fi + \fi + } +} +%%% Mathematical +% Classical TikZ Rightarrow +% Computer Modern Rightarrow, To +% Implies + +%%% Geometric +% Circle, Ellipse +\pgfdeclarearrow{ + clone = Circle, + name = Centered Circle, + append setup code = + \ifpgfarrowreversed + \pgfarrowssetbackend{.5\pgfarrowlength} + \else + \pgfarrowssettipend{.5\pgfarrowlength} + \fi +} +\pgfdeclarearrow{ + clone = Circle, + name = Untipped Circle, + append setup code = + \ifpgfarrowreversed + \pgfarrowssetbackend{\pgfarrowlength \advance\pgf@x -.5\pgfarrowlinewidth} + \else + \pgfarrowssettipend{\pgfarrowlength \advance\pgf@x -.5\pgfarrowlinewidth} + \fi +} + +% Kite, Diamond, Turned Square +\pgfdeclarearrow{ + clone = Kite, + name = Centered Kite, + append setup code = + \ifpgfarrowreversed + \pgfarrowssetbackend{\pgfarrowinset} + \else + \pgfarrowssettipend{\pgfarrowinset} + \fi +} + +% LaTeX +% Square, Rectangle +\pgfdeclarearrow{ + clone = Square, + name = Centered Square, + append setup code = + \ifpgfarrowreversed + \pgfarrowssetbackend{.5\pgfarrowlength} + \else + \pgfarrowssettipend{.5\pgfarrowlength} + \fi +} + +% Stealth, Triangle +\pgfdeclarearrow{ + clone = Stealth, + name = Centered Stealth, + append setup code = + % \pgfkeysgetvalue{/pgf/arrow keys/weight}\pgf@temp + % \ifx\pgf@temp\pgf@truetext + \ifpgfarrowreversed + \pgfarrowssetbackend{.25\pgfarrowlength \advance\pgf@x .25\pgfarrowinset} + \else + \pgfarrowssettipend{.25\pgfarrowlength \advance\pgf@x .25\pgfarrowinset} + \fi + % \else + % \ifpgfarrowreversed + % \pgfarrowssetbackend{\pgf@temp\pgfarrowlength} + % \else + % \pgfarrowssettipend{\pgf@temp\pgfarrowlength} + % \fi + % \fi + , + % append parameters = {,\pgfkeysvalueof{/pgf/arrow keys/weight}}, + % parameters = { + % \the\pgfarrowlinewidth,% + % \the\pgfarrowlength,% + % \the\pgfarrowwidth,% + % \the\pgfarrowinset,% + % \pgfkeysvalueof{/pgf/arrow keys/weight},% + % \ifpgfarrowharpoon h\fi% + % \ifpgfarrowopen o\fi% + % \ifpgfarrowroundjoin j\fi% + % }, +} +%%% Caps + +%%% Rays +\pgfdeclarearrow{ + clone = Rays, + name = Centered Rays, + append setup code = + \ifpgfarrowreversed + \pgfarrowssetbackend{0pt} + \else + \pgfarrowssettipend{0pt}%\pgfarrowssetvisualtipend{\pgf@xa} + \fi +} + +%%% Variants +\pgfkeys{ + Centered Ellipse /.tip = {Centered Circle[length=+3.3pt +4.95, width'=+0pt +0.5]}, + Centered Parenthesis /.tip = {Centered Arc Barb[arc=+120,length=+1.725pt +2.3]}, + Centered Bar /.tip = {Centered Tee Barb[length=+0pt]}, + Centered Bracket /.tip = {Centered Tee Barb[inset'=+0pt +1,length=+0.75pt +1]}, + Centered Diamond /.tip = {Centered Kite[inset'=+0pt .5]}, + Centered Turned Square /.tip = {Centered Kite[length=+3pt 4,width'= +0pt 1,inset'= +0pt 0.5]}, + Centered Rectangle /.tip = {Centered Square[length=+3pt +4.5,width'=+0pt +.5]}, + Centered Triangle /.tip = {Centered Stealth[inset=+0pt, angle=+60:+2.7pt +3.6]}, + Untipped Ellipse /.tip = {Untipped Circle[length=+3.3pt +4.95, width'=+0pt +0.5]}, + Untipped Parenthesis /.tip = {Untipped Arc Barb[arc=+120,length=+1.725pt +2.3]}, + Untipped Bar /.tip = {Untipped Tee Barb[length=+0pt]}, + Untipped Bracket /.tip = {Untipped Tee Barb[inset'=+0pt +1,length=+0.75pt +1]}, +} + +%%% New Arrows +\pgfdeclarearrow{ + name = Hug Cap, + parameters = \the\pgfarrowlength, + defaults = { + length = +0pt +1 + }, + setup code={ + % h = r - .5 sqrt(4 r^2 - s^2) + \ifdim2\pgfarrowlength<\pgflinewidth + \pgfarrowlength=.51\pgflinewidth + \fi + \pgfmathsetlengthmacro\pgfarrowh{\pgfarrowlength-.5*sqrt(4*\pgfarrowlength*\pgfarrowlength-\pgflinewidth*\pgflinewidth} + % a = asin(s / (2 r)) + \pgfmathsetmacro\pgfarrowangle{asin(\the\pgflinewidth/(2*\the\pgfarrowlength))} + \pgfarrowssavethe\pgfarrowlength % radius + \pgfarrowssave\pgfarrowh % h + \pgfarrowssave\pgfarrowangle % a + \pgfarrowsupperhullpoint{0pt}{.5\pgflinewidth} + \pgfarrowsupperhullpoint{\pgfarrowh}{.5\pgflinewidth} + }, + drawing code={ + \pgfpathmoveto{\pgfqpoint{\pgfarrowh}{-.5\pgflinewidth}} + \pgfpatharc{180+\pgfarrowangle}{180-\pgfarrowangle}{\pgfarrowlength} + \pgfpathlineto{\pgfqpoint{-.1pt}{.5\pgflinewidth}} + \pgfpathlineto{\pgfqpoint{-.1pt}{-.5\pgflinewidth}} + \pgfpathclose + \pgfusepathqfill + } +} + +\pgfqkeys{/pgf/arrow keys}{radius/.style={/pgf/arrow keys/inset={#1}}} +\pgfdeclarearrow{ + name = Loop, + parameters = {\the\pgfarrowlength,\the\pgfarrowinset,\ifpgfarrowopen o\fi}, + defaults = {length = +3pt +1 +0, inset = +.75pt +1 +0}, + setup code = + \ifdim\pgfarrowlength<\dimexpr2\pgfarrowinset+\pgflinewidth\relax + \pgfarrowlength\dimexpr2\pgfarrowinset+\pgflinewidth\relax + \fi + \pgfarrowssettipend{\pgfarrowlength}% + \pgfarrowssetlineend{.5\pgflinewidth}% + \pgfarrowssavethe\pgfarrowlength + \pgfarrowssavethe\pgfarrowinset, + drawing code={% + \pgfsetroundcap + \pgfpathmoveto{\pgfqpoint{.5\pgflinewidth}{0pt}}% + \pgfpathlineto{\pgfqpoint{\dimexpr\pgfarrowlength-.5\pgflinewidth-\pgfarrowinset} + {0pt}}% + \pgfpatharc{+-90}{+0}{+\pgfarrowinset}% + \pgfpathlineto{\pgfqpoint{\dimexpr\pgfarrowlength-.5\pgflinewidth} + {\dimexpr\pgfarrowlength-.5\pgflinewidth-\pgfarrowinset}}% + \pgfpatharc{+0}{+90}{+\pgfarrowinset}% + \pgfpathlineto{\pgfqpoint{\dimexpr\pgfarrowinset+.5\pgflinewidth} + {\dimexpr\pgfarrowlength-.5\pgflinewidth}}% + \pgfpatharc{+90}{+180}{+\pgfarrowinset}% + \pgfpathlineto{\pgfqpoint{\dimexpr\pgfarrowinset+.5\pgflinewidth-\pgfarrowinset} + {\dimexpr-\pgfarrowlength+.5\pgflinewidth}}% + \ifpgfarrowopen\pgfusepathqstroke\else\pgfusepathqfillstroke\fi + } +}
\ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.pgfkeys-plus.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.pgfkeys-plus.code.tex deleted file mode 100644 index 6101ca8cad..0000000000 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/pgflibraryext.pgfkeys-plus.code.tex +++ /dev/null @@ -1,11 +0,0 @@ -% Copyright 2022 by Qrrbrbirlbel -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Free Documentation License. -% - -\input pgfkeyslibraryext.pgfkeys-plus.code.tex - -\endinput
\ No newline at end of file diff --git a/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.misc.code.tex b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.misc.code.tex index 0f06079e74..5b020751df 100644 --- a/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.misc.code.tex +++ b/graphics/pgf/contrib/tikz-ext/tex/generic/tikzlibraryext.misc.code.tex @@ -5,7 +5,7 @@ % 1. under the LaTeX Project Public License and/or % 2. under the GNU Free Documentation License. % -\usepgflibrary{ext.pgfkeys-plus}% +\usepgfkeyslibrary{ext.pgfkeys-plus}% %% full arc %% https://tex.stackexchange.com/a/144297/16595 diff --git a/graphics/pstricks/contrib/pst-hsb/Changes b/graphics/pstricks/contrib/pst-hsb/Changes index 8a38b6c68a..23c89e48a1 100644 --- a/graphics/pstricks/contrib/pst-hsb/Changes +++ b/graphics/pstricks/contrib/pst-hsb/Changes @@ -1,5 +1,8 @@ ..... pst-hsb.tex -0.02 2017-12-17 - small fixes +0.03 2023-04-02 - added saturation and brightness options + for the macros +0.02 2021-12-16 - small fixes + - updated doc 0.01 2012-01-01 - first version diff --git a/graphics/pstricks/contrib/pst-hsb/README b/graphics/pstricks/contrib/pst-hsb/README index cd130d90cc..5ad999238d 100644 --- a/graphics/pstricks/contrib/pst-hsb/README +++ b/graphics/pstricks/contrib/pst-hsb/README @@ -1,3 +1,7 @@ +pst-hsb is a PSTricks related package for plotting lines and +curves with continous colors. Only colors in the hsb modell +are supported. + If you have one of the official TeX distribution installed, then all files are still present or can be installed by using the file manager. Otherwise save the files pst-hsb.sty|tex in a directory, which is part of your @@ -15,5 +19,6 @@ with pdftex, use the sequence latex->dvips->ps2pdf or simply lualatex. %% of the LaTeX Project Public License Distributed from CTAN archives %% in directory macros/latex/base/lppl.txt. +hvoss@tug.org -%% $Id: README 350 2021-12-16 10:20:18Z herbert $ +%% $Id: README 380 2021-12-29 15:23:25Z herbert $ diff --git a/graphics/pstricks/contrib/pst-hsb/doc/pst-hsb-doc.pdf b/graphics/pstricks/contrib/pst-hsb/doc/pst-hsb-doc.pdf Binary files differindex 013dc6d181..883546606e 100644 --- a/graphics/pstricks/contrib/pst-hsb/doc/pst-hsb-doc.pdf +++ b/graphics/pstricks/contrib/pst-hsb/doc/pst-hsb-doc.pdf diff --git a/graphics/pstricks/contrib/pst-hsb/doc/pst-hsb-doc.tex b/graphics/pstricks/contrib/pst-hsb/doc/pst-hsb-doc.tex index 08bbc20527..62b5c0073f 100644 --- a/graphics/pstricks/contrib/pst-hsb/doc/pst-hsb-doc.tex +++ b/graphics/pstricks/contrib/pst-hsb/doc/pst-hsb-doc.tex @@ -1,7 +1,7 @@ -%% $Id: pst-hsb-doc.tex 351 2021-12-16 10:37:40Z herbert $ +%% $Id: pst-hsb-doc.tex 686 2023-04-02 13:03:12Z herbert $ \RequirePackage{pdfmanagement-testphase} \DeclareDocumentMetadata{} -% $Id: pst-hsb-doc.tex 351 2021-12-16 10:37:40Z herbert $ +% $Id: pst-hsb-doc.tex 686 2023-04-02 13:03:12Z herbert $ \documentclass[11pt,english,BCOR=10mm,DIV=12,bibliography=totoc,parskip=false,headings=small, headinclude=false,footinclude=false,twoside]{pst-doc} \usepackage{pst-hsb} @@ -26,7 +26,7 @@ \title{\texttt{pst-hsb}} \subtitle{Curves with continoues color; v.\psthsbFV} -\author{Denis Girout\\Manuel Luque\\Herbert Voร} +\author{Denis Girou\\Manuel Luque\\Herbert Voร} \docauthor{} %\date{\today} \settitle @@ -48,6 +48,20 @@ Thanks to: \newpage +\section{Options} +The macros uses the hsb color model for the continuing setting of the +colors. hsb is Hue, Saturation and Brightness. All three can be defined by the +beginning and end value of the sequence. If the values for beginning and end are the +same then the value will be constant for the whole line and/or curve. The options +are preset to + +\begin{verbatim} + HueBegin=0,HueEnd=1, + SaturationBegin=1, SaturationEnd=1, + BrightnessBegin=1, BrightnessEnd=1, +\end{verbatim} + + \section{Examples} @@ -56,9 +70,11 @@ Thanks to: \begin{pspicture}(-0.5,-0.5)(11,5) % \psgrid(0,-4)(10,4) \psaxes{->}(0,0)(11,5) -\pslineHSB[linewidth=1mm,HueBegin=0,HueEnd=0.5](0,0)(10,1) -\pslineHSB[linewidth=1mm,HueBegin=0.5,HueEnd=0.7](0,1)(10,3) -\pslineHSB[linewidth=1mm,HueBegin=0.8,HueEnd=1](0,2)(10,5) +\pslineHSB[linewidth=1mm,HueBegin=0,HueEnd=0.5](0,0)(10,1)\rput[l](10,1){ 1} +\pslineHSB[linewidth=1mm,HueBegin=0,HueEnd=0.5,SaturationBegin=0](0,0.5)(10,2)\rput[l](10,2){ 2} +\pslineHSB[linewidth=1mm,HueBegin=0.5,HueEnd=0.7](0,1)(10,3)\rput[l](10,3){ 3} +\pslineHSB[linewidth=1mm,HueBegin=0.5,HueEnd=0.7,BrightnessBegin=0](0,1.5)(10,4)\rput[l](10,4){ 4} +\pslineHSB[linewidth=1mm,HueBegin=0.8,HueEnd=1](0,2)(10,5)\rput[l](10,5){ 5} \end{pspicture} \end{LTXexample} diff --git a/graphics/pstricks/contrib/pst-hsb/latex/pst-hsb.sty b/graphics/pstricks/contrib/pst-hsb/latex/pst-hsb.sty index 0a8996be21..a5a398fb74 100644 --- a/graphics/pstricks/contrib/pst-hsb/latex/pst-hsb.sty +++ b/graphics/pstricks/contrib/pst-hsb/latex/pst-hsb.sty @@ -8,4 +8,4 @@ % \@addtofilelist{pst-hsb.pro}}{}% \endinput -%% $Id: pst-hsb.sty 350 2021-12-16 10:20:18Z herbert $ +%% $Id: pst-hsb.sty 352 2021-12-16 17:14:59Z herbert $ diff --git a/graphics/pstricks/contrib/pst-hsb/tex/pst-hsb.tex b/graphics/pstricks/contrib/pst-hsb/tex/pst-hsb.tex index 975e054fc2..fe889cda45 100644 --- a/graphics/pstricks/contrib/pst-hsb/tex/pst-hsb.tex +++ b/graphics/pstricks/contrib/pst-hsb/tex/pst-hsb.tex @@ -1,4 +1,4 @@ -%% $Id: pst-hsb.tex 350 2021-12-16 10:20:18Z herbert $ +%% $Id: pst-hsb.tex 686 2023-04-02 13:03:12Z herbert $ %% %% This is file `pst-hsb.tex', %% @@ -6,7 +6,7 @@ %% %% Package `pst-hsb.tex' %% -%% Denis Girout +%% Denis Girou %% Manuel Luque %% Herbert Voss <hvoss@tug.org> %% @@ -29,16 +29,26 @@ % interface to the `xkeyval' package \pst@addfams{pst-hsb} % -\def\fileversion{0.02} -\def\filedate{2021/12/16} +\def\fileversion{0.03} +\def\filedate{2023/04/02} \message{`PST-hsb' v\fileversion, \filedate\space (hv)} % -\define@key[psset]{pst-hsb}{HueBegin}{\def\psparametricplotHSB@HueBegin{#1}}% Between 0 and 1 -\define@key[psset]{pst-hsb}{HueEnd}{\def\psparametricplotHSB@HueEnd{#1}}% Between 0 and 1 +\define@key[psset]{pst-hsb}{HueBegin}{\def\psHSB@HueBegin{#1}}% 0..1 H +\define@key[psset]{pst-hsb}{HueEnd}{\def\psHSB@HueEnd{#1}}% 0..1 H +\define@key[psset]{pst-hsb}{SaturationBegin}{\def\psHSB@SaturationBegin{#1}}% 0..1 S +\define@key[psset]{pst-hsb}{SaturationEnd}{\def\psHSB@SaturationEnd{#1}}% 0..1 S +\define@key[psset]{pst-hsb}{BrightnessBegin}{\def\psHSB@BrightnessBegin{#1}}% 0..1 B +\define@key[psset]{pst-hsb}{BrightnessEnd}{\def\psHSB@BrightnessEnd{#1}}% 0..1 B +\define@key[psset]{pst-hsb}{ColorBegin}{\pst@getcolor{#1}\ps@ColorBegin} +\define@key[psset]{pst-hsb}{ColorEnd}{\pst@getcolor{#1}\ps@ColorEnd} \define@boolkey[psset]{pst-hsb}[Pst@]{HSB}[true]{} % Default values -\psset[pst-hsb]{HueBegin=0,HueEnd=1,HSB=true} -\psset{dimen=outer} +\psset[pst-hsb]{ + HueBegin=0,HueEnd=1, + SaturationBegin=1, SaturationEnd=1, + BrightnessBegin=1, BrightnessEnd=1, + HSB=true,ColorBegin=white,ColorEnd=black} +\psset{dimen=outer,variableColor=false} \def\psparametricplotHSB{\pst@object{psparametricplotHSB}} \def\psparametricplotHSB@i#1#2#3{{% @@ -69,11 +79,23 @@ {\ifPst@HSB % Other points than the first one /PointY exch def /PointX exch def - Counter \psk@plotpoints\space div - \psparametricplotHSB@HueEnd\space - \psparametricplotHSB@HueBegin\space sub mul - \psparametricplotHSB@HueBegin\space add - 1 1 sethsbcolor + Counter \psk@plotpoints\space div /Factor ED + \psHSB@HueEnd\space + \psHSB@HueBegin\space sub % HueEnd-HueBegin + dup 0 eq { pop \psHSB@HueBegin\space } + { Factor mul \psHSB@HueBegin\space add } ifelse + /H_hsb ED + \psHSB@SaturationEnd\space + \psHSB@SaturationBegin\space sub + dup 0 eq { pop \psHSB@SaturationBegin\space } + { Factor mul \psHSB@SaturationBegin\space add } ifelse + /S_hsb ED + \psHSB@BrightnessEnd\space + \psHSB@BrightnessBegin\space sub + dup 0 eq { pop \psHSB@BrightnessBegin\space } + { Factor mul \psHSB@BrightnessBegin\space add } ifelse + /B_hsb ED + H_hsb S_hsb B_hsb sethsbcolor % H S B was on stack OldX OldY PointX PointY lineto lineto stroke PointX PointY moveto @@ -88,6 +110,12 @@ \begin@OpenObj \pst@getcoor{#1}\pst@tempA \pst@getcoor{#2}\pst@tempB +% \typeout{\psHSB@HueEnd~ +% \psHSB@HueBegin~ +% \psHSB@SaturationBegin~ +% \psHSB@SaturationEnd~ +% \psHSB@BrightnessBegin~ +% \psHSB@BrightnessEnd}% \addto@pscode{% \pst@tempA /y0 ED /x0 ED @@ -97,6 +125,11 @@ /m y1 y0 sub x1 x0 sub div def /t x0 dx sub def /Counter 0 def + \ifPst@variableColor + /startWave + lambda dColor add dup /lambda ED + tx@addDict begin wavelengthToRGB Red Green Blue end setrgbcolor + \fi gsave x0 y0 translate \psk@plotpoints { @@ -105,20 +138,37 @@ t dup m mul 1 Counter eq { moveto currentpoint /OldY ED /OldX ED } % First point - {\ifPst@HSB % Other points than the first one + {\ifPst@HSB % Other points than the first one /PointY exch def /PointX exch def - Counter \psk@plotpoints\space div - \psparametricplotHSB@HueEnd\space - \psparametricplotHSB@HueBegin\space sub mul - \psparametricplotHSB@HueBegin\space add - 1 1 sethsbcolor + Counter \psk@plotpoints\space div /Factor ED + \psHSB@HueEnd\space + \psHSB@HueBegin\space sub % HueEnd-HueBegin + dup 0 eq { pop \psHSB@HueBegin\space } + { Factor mul \psHSB@HueBegin\space add } ifelse + /H_hsb ED + \psHSB@SaturationEnd\space + \psHSB@SaturationBegin\space sub + dup 0 eq { pop \psHSB@SaturationBegin\space } + { Factor mul \psHSB@SaturationBegin\space add } ifelse + /S_hsb ED + \psHSB@BrightnessEnd\space + \psHSB@BrightnessBegin\space sub + dup 0 eq { pop \psHSB@BrightnessBegin\space } + { Factor mul \psHSB@BrightnessBegin\space add } ifelse + /B_hsb ED + H_hsb S_hsb B_hsb sethsbcolor % H S B was on stack OldX OldY PointX PointY lineto lineto stroke PointX PointY moveto - /OldX PointX def /OldY PointY def - \else lineto \fi - } ifelse + /OldX PointX def /OldY PointY def + \else + \ifPst@variableColor + \else + lineto + \fi + \fi + } ifelse } repeat grestore }% |