<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: 川口晃世（Kosei Kawaguchi）</title>
    <description>The latest articles on DEV Community by 川口晃世（Kosei Kawaguchi） (@kktex).</description>
    <link>https://dev.to/kktex</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3730677%2Fb577cf2a-0014-48db-a1d4-e8aa238ef2b1.jpeg</url>
      <title>DEV Community: 川口晃世（Kosei Kawaguchi）</title>
      <link>https://dev.to/kktex</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kktex"/>
    <language>en</language>
    <item>
      <title>I Built a Read-Only MCP Server for Japanese LaTeX Documents</title>
      <dc:creator>川口晃世（Kosei Kawaguchi）</dc:creator>
      <pubDate>Fri, 14 Aug 2026 13:13:29 +0000</pubDate>
      <link>https://dev.to/kktex/i-built-a-read-only-mcp-server-for-japanese-latex-documents-4hk4</link>
      <guid>https://dev.to/kktex/i-built-a-read-only-mcp-server-for-japanese-latex-documents-4hk4</guid>
      <description>&lt;p&gt;I wanted to give an AI a source document and say something ordinary like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Turn this into a B5 Japanese lecture note. Keep the definitions precise, add two worked examples, compile it, and show me the finished pages.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The difficult part was not persuading the model to emit LaTeX. The difficult part was making the whole workflow repeatable: choosing a document structure, keeping Japanese typesetting stable, checking that every exercise has an answer, compiling locally, reading the log, and inspecting the rendered pages.&lt;/p&gt;

&lt;p&gt;So I built &lt;strong&gt;&lt;a href="https://github.com/Fermion-company/texmcp" rel="noopener noreferrer"&gt;TeX64&lt;/a&gt;&lt;/strong&gt;, a free, open-source MCP server that gives Claude and Codex a reusable Japanese LuaLaTeX document system. (The repository retains the project's original &lt;code&gt;texmcp&lt;/code&gt; name.)&lt;/p&gt;

&lt;p&gt;This is an example of the output produced from one natural-language request:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq0q86m2v4yrsgq22s1tj.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq0q86m2v4yrsgq22s1tj.jpg" alt="A Japanese mathematics lecture-note cover produced with TeX64" width="800" height="1136"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The design: guidance on the server, execution on your machine
&lt;/h2&gt;

&lt;p&gt;TeX64 is intentionally not a remote LaTeX compiler. Its six public tools are read-only. They return style files, document rules, scaffolds, checks, known issues, and compilation instructions as text. One of those tools, &lt;code&gt;check_document&lt;/code&gt;, receives the &lt;code&gt;.tex&lt;/code&gt; source for transient structural processing; the service does not persist it. Compilation and generated files stay on the client machine.&lt;/p&gt;

&lt;p&gt;The connected AI client does the stateful work on your machine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your request
    ↓
Claude or Codex
    ↓  reads styles, rules, and scaffolds through MCP
TeX64 (read-only, stateless)
    ↓
Claude or Codex writes .tex/.sty files locally
    ↓
Local TeX Live compiles the PDF
    ↓
The agent renders pages to images, inspects them, and repairs problems
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This split is important. A hosted service does not need permission to write into your project or run arbitrary TeX jobs. Meanwhile, the AI can use the tools it already has for editing files, running &lt;code&gt;latexmk&lt;/code&gt;, reading logs, and checking page images.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the MCP server provides
&lt;/h2&gt;

&lt;p&gt;TeX64 currently exposes six tools:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;What it returns&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;get_style_files&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Japanese study-note or report styles, an annotated skeleton, and design notes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;doc_types&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Six document structures and their editing rules&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;scaffold_document&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A compilable &lt;code&gt;.tex&lt;/code&gt; scaffold for the selected document type&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;check_document&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Structural checks, such as problem/answer pairing and numbering&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;known_issues&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A searchable list of troublesome LuaLaTeX, &lt;code&gt;jlreq&lt;/code&gt;, and LuaTeX-ja combinations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;compile_guide&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A local build, repair, and visual-inspection procedure for the AI agent&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The six document types are lecture notes, exam summaries, exercise sets, past-exam collections, language notes, and compact short-answer sheets. Each type defines an expected section order, editing rules, automatic checks, and items that still require visual or human review.&lt;/p&gt;

&lt;p&gt;For example, an exercise set is expected to place each solution immediately after its problem, number problems without gaps, state the relevant formulas before the questions, and include the important intermediate steps rather than only final answers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install it in one command
&lt;/h2&gt;

&lt;p&gt;You do not need to clone the repository or install an npm package to use the hosted server.&lt;/p&gt;

&lt;p&gt;For Claude Code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add &lt;span class="nt"&gt;--transport&lt;/span&gt; http tex64 https://mcp.tex64.com/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For Codex:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;codex mcp add tex64 &lt;span class="nt"&gt;--url&lt;/span&gt; https://mcp.tex64.com/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you prefer to edit the Codex configuration directly, add this to &lt;code&gt;~/.codex/config.toml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="nn"&gt;[mcp_servers.tex64]&lt;/span&gt;
&lt;span class="py"&gt;url&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"https://mcp.tex64.com"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The public endpoint does not require an account or API key.&lt;/p&gt;

&lt;p&gt;These commands were verified with Claude Code 2.1.227 and Codex CLI 0.145.0 on August 14, 2026. Check the current client documentation if a future CLI release changes its MCP syntax.&lt;/p&gt;

&lt;h2&gt;
  
  
  Local requirements
&lt;/h2&gt;

&lt;p&gt;The machine running your AI client needs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TeX Live with &lt;code&gt;lualatex&lt;/code&gt; and &lt;code&gt;latexmk&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;an agent that can write project files and run local commands&lt;/li&gt;
&lt;li&gt;optionally, Poppler's &lt;code&gt;pdftoppm&lt;/code&gt; for turning PDF pages into images for visual inspection&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;TeX64 uses LuaLaTeX because Japanese documents need more than a generic &lt;code&gt;pdflatex&lt;/code&gt; template. Its styles account for Japanese fonts, line breaking, page geometry, headings, boxes, and the interactions among &lt;code&gt;jlreq&lt;/code&gt;, LuaTeX-ja, TikZ, and related packages.&lt;/p&gt;

&lt;p&gt;Harano Aji is the safest font choice when portability matters because it is distributed with TeX Live. Other included profiles cover Hiragino, Yu, BIZ UD, Source Han, and IPAex fonts.&lt;/p&gt;

&lt;h2&gt;
  
  
  A complete first request
&lt;/h2&gt;

&lt;p&gt;After connecting the server, try a prompt like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Create a B5 Japanese lecture note titled
「リーマン積分の定義と可積分条件」 from the material I provide.

Use the TeX64 lecture-note structure and the Harano Aji font profile.
Include the definitions before they are used, two worked examples,
and a short review section.

Save the source in a new local project, run the structural checks,
compile it with LuaLaTeX, render the pages to images, inspect the cover,
Japanese glyphs, headings, boxes, margins, and page breaks, and repair
any problems before showing me the PDF and previews.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The wording is deliberately about the document you want, not about internal style commands. The MCP tools give the agent the specialized implementation details.&lt;/p&gt;

&lt;p&gt;Here is a content page from the resulting document:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F55hmk1mb27d6xf9g4efi.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F55hmk1mb27d6xf9g4efi.jpg" alt="A Japanese mathematics lecture-note page with definitions and structured headings" width="800" height="1136"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And here is a page combining a theorem-style box, a warning, and a worked exercise:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzk6sd7ey3wxiya0t7f10.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzk6sd7ey3wxiya0t7f10.jpg" alt="A Japanese mathematics page with a boxed criterion, note, problem, and solution" width="800" height="1136"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why structural checks matter
&lt;/h2&gt;

&lt;p&gt;A PDF can compile successfully and still be a bad study document.&lt;/p&gt;

&lt;p&gt;LaTeX will not tell you that problem 4 has no solution, that the numbering jumps from 6 to 8, that a formula is used before its variables are defined, or that an OCR-based language note no longer matches its sentence-by-sentence commentary.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;check_document&lt;/code&gt; treats those as document-structure problems. The check is separate from compilation because a TeX engine and an editorial rule checker answer different questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Compilation:&lt;/strong&gt; Is this valid TeX, and can it produce a PDF?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Structural checking:&lt;/strong&gt; Does the document follow the rules of its intended form?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Visual inspection:&lt;/strong&gt; Are glyphs, boxes, margins, headings, and page breaks actually correct on the rendered page?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;TeX64's workflow requires all three.&lt;/p&gt;

&lt;h2&gt;
  
  
  Privacy and security boundaries
&lt;/h2&gt;

&lt;p&gt;The public tools are annotated as read-only, non-destructive, and idempotent. The server does not write files, run LaTeX, or retain prompts, document source, generated files, or tool results. Infrastructure providers may still process transient network and security metadata needed to operate the service; see the &lt;a href="https://mcp.tex64.com/privacy" rel="noopener noreferrer"&gt;privacy policy&lt;/a&gt; and &lt;a href="https://mcp.tex64.com/terms" rel="noopener noreferrer"&gt;terms of use&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There is one boundary worth stating precisely: when the client calls &lt;code&gt;check_document&lt;/code&gt;, it sends the &lt;code&gt;.tex&lt;/code&gt; source to the server for transient structural processing. The service does not persist it, but you still should not submit secrets or sensitive personal information. Compilation and generated files remain on the client machine.&lt;/p&gt;

&lt;p&gt;You can also self-host the MIT-licensed server and enable bearer-token authentication if you need to control access.&lt;/p&gt;

&lt;h2&gt;
  
  
  Current limitations
&lt;/h2&gt;

&lt;p&gt;TeX64 is deliberately opinionated:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It focuses on Japanese study materials and simple academic reports.&lt;/li&gt;
&lt;li&gt;It requires a local TeX installation; the hosted server does not return a compiled PDF.&lt;/li&gt;
&lt;li&gt;Its automatic checks cover known structural rules, not mathematical correctness.&lt;/li&gt;
&lt;li&gt;Visual inspection is still required. A zero-error log is not proof of a good page.&lt;/li&gt;
&lt;li&gt;The quality of the result depends on the connected agent actually following the compile-and-review loop.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That narrow scope is useful. Instead of trying to be a general document generator, TeX64 supplies a concrete system for one difficult class of documents and leaves the final execution visible and editable on the user's machine.&lt;/p&gt;

&lt;p&gt;The source and self-hosting instructions are available on &lt;a href="https://github.com/Fermion-company/texmcp" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;. The hosted endpoint is &lt;code&gt;https://mcp.tex64.com/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you create Japanese notes with LaTeX, which document type should I add next?&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>mcp</category>
      <category>opensource</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Write Chemical Structural Formulas Faster in LaTeX with KKchemstruct</title>
      <dc:creator>川口晃世（Kosei Kawaguchi）</dc:creator>
      <pubDate>Mon, 03 Aug 2026 07:22:09 +0000</pubDate>
      <link>https://dev.to/kktex/write-chemical-structural-formulas-faster-in-latex-with-kkchemstruct-2j1h</link>
      <guid>https://dev.to/kktex/write-chemical-structural-formulas-faster-in-latex-with-kkchemstruct-2j1h</guid>
      <description>&lt;p&gt;Hi, I'm &lt;a href="https://x.com/KKTeX_LaTeX3" rel="noopener noreferrer"&gt;KKTeX&lt;/a&gt;. I build LaTeX tools for teaching materials.&lt;/p&gt;

&lt;p&gt;If you typeset chemical structural formulas in LaTeX, &lt;a href="https://ctan.org/pkg/chemfig" rel="noopener noreferrer"&gt;&lt;code&gt;chemfig&lt;/code&gt;&lt;/a&gt; is the standard choice. It is flexible enough to draw everything from benzene rings to reaction schemes, but repeating the same structures across a worksheet means repeatedly matching bond lengths, line widths, and double-bond spacing.&lt;/p&gt;

&lt;p&gt;I made &lt;strong&gt;&lt;a href="https://github.com/KKTeX/KKchemstruct" rel="noopener noreferrer"&gt;&lt;code&gt;KKchemstruct&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt; to package those recurring settings and structures into short commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\KKbenzene&lt;/span&gt;&lt;span class="na"&gt;[2=OH,3=COOH]&lt;/span&gt;                     &lt;span class="c"&gt;% salicylic acid&lt;/span&gt;
&lt;span class="k"&gt;\KKchemchain&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;H-O-S(&lt;span class="k"&gt;\KKdative&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;2&lt;span class="p"&gt;}&lt;/span&gt;O)(&lt;span class="k"&gt;\KKdative&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;6&lt;span class="p"&gt;}&lt;/span&gt;O)-O-H&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\KKscheme&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\KKsalicylicacid\arrow&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;-&amp;gt;[&lt;span class="k"&gt;\ck&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;CH&lt;span class="p"&gt;_&lt;/span&gt;3OH&lt;span class="p"&gt;}&lt;/span&gt;][Esterification]&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;\KKmethylsalicylate&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This article focuses on using the package rather than its implementation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftg1c375mzf5n753lmcd6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftg1c375mzf5n753lmcd6.png" alt="Basic examples made with KKchemstruct" width="800" height="637"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Draw substituted benzene rings by numbered positions&lt;/li&gt;
&lt;li&gt;Keep bond lengths and line widths consistent in condensed structural formulas&lt;/li&gt;
&lt;li&gt;Assemble reaction schemes, branching reactions, and compound names&lt;/li&gt;
&lt;li&gt;Add leaving-group marks, hydrogen bonds, and a cross for “no reaction”&lt;/li&gt;
&lt;li&gt;Insert common compounds with a single command&lt;/li&gt;
&lt;li&gt;Scale dimensions with the surrounding text by using &lt;code&gt;em&lt;/code&gt;-based settings&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The actual drawing is still handled by &lt;code&gt;chemfig&lt;/code&gt;. When a prepared command is not enough, you can use ordinary &lt;code&gt;chemfig&lt;/code&gt; syntax directly.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Install it
&lt;/h2&gt;

&lt;p&gt;You need LuaLaTeX (recommended), or pLaTeX with &lt;code&gt;dvipdfmx&lt;/code&gt;. The dependencies—&lt;code&gt;chemfig&lt;/code&gt;, &lt;code&gt;etoolbox&lt;/code&gt;, and &lt;code&gt;xkeyval&lt;/code&gt;—are included in TeX Live.&lt;/p&gt;

&lt;p&gt;Download &lt;code&gt;KKchemstruct.sty&lt;/code&gt; from the &lt;a href="https://github.com/KKTeX/KKchemstruct" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt; and, for the simplest setup, put it next to your &lt;code&gt;.tex&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my-document/
├── main.tex
└── KKchemstruct.sty
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then add one line to the preamble:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;KKchemstruct&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is a minimal example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\documentclass&lt;/span&gt;&lt;span class="na"&gt;[a4paper,11pt]&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;article&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[margin=22mm]&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;geometry&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;KKchemstruct&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;\begin{document}&lt;/span&gt;

&lt;span class="nt"&gt;\begin{center}&lt;/span&gt;
  &lt;span class="k"&gt;\KKname&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\KKsalicylicacid&lt;/span&gt;&lt;span class="p"&gt;}{&lt;/span&gt;Salicylic acid&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;\end{center}&lt;/span&gt;

&lt;span class="nt"&gt;\end{document}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Compile it as usual:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lualatex &lt;span class="nt"&gt;-interaction&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;nonstopmode &lt;span class="nt"&gt;-halt-on-error&lt;/span&gt; main.tex
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Documents using &lt;code&gt;\KKchemmark&lt;/code&gt; or &lt;code&gt;\KKhbond&lt;/code&gt; need two runs so that TikZ can resolve the node positions.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Draw substituted benzene rings by number
&lt;/h2&gt;

&lt;p&gt;Use &lt;code&gt;\KKbenzene&lt;/code&gt; and assign substituents to numbered positions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\KKbenzene&lt;/span&gt;&lt;span class="na"&gt;[2=OH,3=COOH]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Position 1 is at the top, and the numbers continue clockwise:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;           1
       6       2
       5       3
           4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These three commands draw salicylic acid, terephthalic acid, and unsubstituted benzene:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\KKbenzene&lt;/span&gt;&lt;span class="na"&gt;[2=OH,3=COOH]&lt;/span&gt;
&lt;span class="k"&gt;\KKbenzene&lt;/span&gt;&lt;span class="na"&gt;[1=COOH,4=COOH]&lt;/span&gt;
&lt;span class="k"&gt;\KKbenzene&lt;/span&gt;&lt;span class="na"&gt;[]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg4foid32kdtb6u8swz3a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg4foid32kdtb6u8swz3a.png" alt="Substituted benzene rings and a condensed structural formula" width="800" height="1001"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Subscripts such as &lt;code&gt;COOCH_3&lt;/code&gt; work directly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\KKbenzene&lt;/span&gt;&lt;span class="na"&gt;[2=OH,3=COOCH_3]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use &lt;code&gt;angle&lt;/code&gt; to rotate a ring and &lt;code&gt;sep&lt;/code&gt; to change the side length for that ring only:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\KKbenzene&lt;/span&gt;&lt;span class="na"&gt;[2=OH,angle=30,sep=1.0em]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a substituent comes too close to an inner double bond, reverse the Kekulé pattern with &lt;code&gt;kekule=b&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\KKbenzene&lt;/span&gt;&lt;span class="na"&gt;[1=OH,kekule=b]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a horizontally connected ring inside a line of text, use one of these commands:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;\KKphenylring&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;An unsubstituted ring&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;\KKphenyl{COOH}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A substituent on the right&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;\KKphenylene{SO_3H}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Bonds on both sides, for inserting the ring into a chain&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Their baselines are adjusted so that they do not excessively increase the line spacing.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Write condensed structural formulas
&lt;/h2&gt;

&lt;p&gt;Pass chains of atom labels to &lt;code&gt;\KKchemchain&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\KKchemchain&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;CH&lt;span class="p"&gt;_&lt;/span&gt;2(-OH)-[6,1.15]CH(-OH)-[6,1.15]CH&lt;span class="p"&gt;_&lt;/span&gt;2-OH&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The angle numbers follow &lt;code&gt;chemfig&lt;/code&gt;'s 45-degree system. These four cover many classroom formulas:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Direction&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;[0]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;right&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;[2]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;up&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;[4]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;left&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;[6]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;down&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The number after the angle is a length multiplier, so &lt;code&gt;[6,1.15]&lt;/code&gt; means downward at 1.15 times the default length.&lt;/p&gt;

&lt;p&gt;Common fragments have shorter commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\KKchemchain&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;R&lt;span class="p"&gt;_&lt;/span&gt;1-C&lt;span class="k"&gt;\KKcarbonyl&lt;/span&gt;-OH&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\KKchemchain&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;H-O-S(&lt;span class="k"&gt;\KKdative&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;2&lt;span class="p"&gt;}&lt;/span&gt;O)(&lt;span class="k"&gt;\KKdative&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;6&lt;span class="p"&gt;}&lt;/span&gt;O)-O-H&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;\KKcarbonyl&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Upward C=O&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;\KKcarbonyldown&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Downward C=O&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;\KKdative{angle}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A coordinate bond such as S→O, P→O, or N→O&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Rings and chains have separate commands because they need different spacing rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;\KKbenzene&lt;/code&gt; and &lt;code&gt;\KKchemring&lt;/code&gt; keep atom-center distances constant to preserve regular polygons.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\KKchemchain&lt;/code&gt; keeps the visible bond lines consistent, even after a wide label such as &lt;code&gt;CH_2&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Choosing the appropriate command is often enough to make a page of formulas look much more uniform.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Insert common compounds with one command
&lt;/h2&gt;

&lt;p&gt;Frequently used compounds already have named commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\KKsalicylicacid&lt;/span&gt;
&lt;span class="k"&gt;\KKmethylsalicylate&lt;/span&gt;
&lt;span class="k"&gt;\KKaspirin&lt;/span&gt;
&lt;span class="k"&gt;\KKphthalicanhydride&lt;/span&gt;
&lt;span class="k"&gt;\KKmaleicacid&lt;/span&gt;
&lt;span class="k"&gt;\KKfumaricacid&lt;/span&gt;
&lt;span class="k"&gt;\KKnitricacid&lt;/span&gt;
&lt;span class="k"&gt;\KKsulfuricacid&lt;/span&gt;
&lt;span class="k"&gt;\KKphosphoricacid&lt;/span&gt;
&lt;span class="k"&gt;\KKglycerol&lt;/span&gt;
&lt;span class="k"&gt;\KKtriglyceride&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;R&lt;span class="p"&gt;_&lt;/span&gt;1&lt;span class="p"&gt;}{&lt;/span&gt;R&lt;span class="p"&gt;_&lt;/span&gt;2&lt;span class="p"&gt;}{&lt;/span&gt;R&lt;span class="p"&gt;_&lt;/span&gt;3&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Benzoic acid, phenol, all three phthalic-acid isomers, maleic anhydride, and more are also included. See the &lt;a href="https://github.com/KKTeX/KKchemstruct/blob/main/doc/KKchemstruct-manual-en.pdf" rel="noopener noreferrer"&gt;English manual&lt;/a&gt; for the full list.&lt;/p&gt;

&lt;p&gt;Use &lt;code&gt;\KKname&lt;/code&gt; to place a name below a structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\KKname&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\KKaspirin&lt;/span&gt;&lt;span class="p"&gt;}{&lt;/span&gt;Acetylsalicylic acid&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Build reaction schemes
&lt;/h2&gt;

&lt;p&gt;Inside &lt;code&gt;\KKscheme&lt;/code&gt;, arrange structures with &lt;code&gt;chemfig&lt;/code&gt;'s &lt;code&gt;\arrow&lt;/code&gt; command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\KKscheme&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\KKname&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\KKsalicylicacid&lt;/span&gt;&lt;span class="p"&gt;}{&lt;/span&gt;Salicylic acid&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;\arrow&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;-&amp;gt;[&lt;span class="k"&gt;\ck&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;CH&lt;span class="p"&gt;_&lt;/span&gt;3OH&lt;span class="p"&gt;}&lt;/span&gt;][Esterification]&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;\KKname&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\KKmethylsalicylate&lt;/span&gt;&lt;span class="p"&gt;}{&lt;/span&gt;Methyl salicylate&lt;span class="p"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbbhfzsmf0zpfbuxtuz58.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbbhfzsmf0zpfbuxtuz58.png" alt="Linear and branching reaction schemes" width="800" height="943"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Arrow labels are not in math mode. Wrap formulas such as &lt;code&gt;CH_3OH&lt;/code&gt; in &lt;code&gt;\ck{...}&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\arrow&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;-&amp;gt;[&lt;span class="k"&gt;\ck&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;CH&lt;span class="p"&gt;_&lt;/span&gt;3OH&lt;span class="p"&gt;}&lt;/span&gt;][Esterification]&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The longer alias &lt;code&gt;\KKchemformula{...}&lt;/code&gt; does the same thing.&lt;/p&gt;

&lt;p&gt;For one substrate branching into two reactions, &lt;code&gt;\KKbranchscheme&lt;/code&gt; takes seven arguments:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\KKbranchscheme&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\KKname&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\KKsalicylicacid&lt;/span&gt;&lt;span class="p"&gt;}{&lt;/span&gt;Salicylic acid&lt;span class="p"&gt;}}&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ck&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;CH&lt;span class="p"&gt;_&lt;/span&gt;3OH&lt;span class="p"&gt;}}{&lt;/span&gt;Esterification&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\KKname&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\KKmethylsalicylate&lt;/span&gt;&lt;span class="p"&gt;}{&lt;/span&gt;Methyl salicylate&lt;span class="p"&gt;}}&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ck&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;(CH&lt;span class="p"&gt;_&lt;/span&gt;3CO)&lt;span class="p"&gt;_&lt;/span&gt;2O&lt;span class="p"&gt;}}{&lt;/span&gt;Acetylation&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\KKname&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\KKaspirin&lt;/span&gt;&lt;span class="p"&gt;}{&lt;/span&gt;Acetylsalicylic acid&lt;span class="p"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The order is: substrate, upper reagent, upper reaction name, upper product, lower reagent, lower reaction name, lower product.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Add annotations
&lt;/h2&gt;

&lt;p&gt;To outline a leaving group, mark two atoms with &lt;code&gt;@{name}&lt;/code&gt; and pass the names to &lt;code&gt;\KKchemmark&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\KKchemchain&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;R-C&lt;span class="k"&gt;\KKcarbonyl&lt;/span&gt;-@&lt;span class="p"&gt;{&lt;/span&gt;s&lt;span class="p"&gt;}&lt;/span&gt;OH&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;\ &lt;/span&gt;+&lt;span class="k"&gt;\
\KKchemchain&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;@&lt;span class="p"&gt;{&lt;/span&gt;e&lt;span class="p"&gt;}&lt;/span&gt;H-O-R'&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
&lt;span class="k"&gt;\KKchemmark&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;s&lt;span class="p"&gt;}{&lt;/span&gt;e&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To draw an intramolecular hydrogen bond:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\KKbenzene&lt;/span&gt;&lt;span class="na"&gt;[2=@{oh}OH,3=C@{co}OOH]&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
&lt;span class="k"&gt;\KKhbond&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;oh&lt;span class="p"&gt;}{&lt;/span&gt;co&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To place a cross over a structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\KKchemcross&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\KKphenol&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh916aelbhgq5daevnmv2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh916aelbhgq5daevnmv2.png" alt="Leaving-group marks, a hydrogen bond, a cross, and size adjustments" width="800" height="788"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Because &lt;code&gt;\KKchemmark&lt;/code&gt; and &lt;code&gt;\KKhbond&lt;/code&gt; refer to TikZ nodes, compile twice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lualatex &lt;span class="nt"&gt;-interaction&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;nonstopmode &lt;span class="nt"&gt;-halt-on-error&lt;/span&gt; main.tex
lualatex &lt;span class="nt"&gt;-interaction&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;nonstopmode &lt;span class="nt"&gt;-halt-on-error&lt;/span&gt; main.tex
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  7. Adjust bond lengths and line widths together
&lt;/h2&gt;

&lt;p&gt;Change global dimensions with &lt;code&gt;\KKchemsetup&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\KKchemsetup&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  ring sep=2.0em,
  bond width=0.09em,
  double bond sep=0.4em
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Put the setup in a group when you want a local change:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\begingroup&lt;/span&gt;
  &lt;span class="k"&gt;\KKchemsetup&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;ring sep=2.0em,bond width=0.09em&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;\KKsalicylicacid&lt;/span&gt;
&lt;span class="k"&gt;\endgroup&lt;/span&gt;

&lt;span class="c"&gt;% Back to the defaults here&lt;/span&gt;
&lt;span class="k"&gt;\KKsalicylicacid&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The dimensions are primarily expressed in &lt;code&gt;em&lt;/code&gt;, so the structures follow surrounding size changes such as &lt;code&gt;\small&lt;/code&gt; and &lt;code&gt;\large&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Draw rings that do not have a prepared command
&lt;/h2&gt;

&lt;p&gt;For fused rings and other special cases, pass raw &lt;code&gt;chemfig&lt;/code&gt; syntax to &lt;code&gt;\KKchemring&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\KKchemring&lt;/span&gt;&lt;span class="na"&gt;[atom sep=1.75em]&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  *6(=-*5(-C(=O)-O-C(=O)-)=-=-)&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;KKchemstruct&lt;/code&gt; is not meant to hide &lt;code&gt;chemfig&lt;/code&gt;. Its purpose is to standardize common settings and components: use short commands for repeated structures, and drop down to &lt;code&gt;chemfig&lt;/code&gt; syntax only for the unusual parts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common pitfalls
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Parentheses create branches
&lt;/h3&gt;

&lt;p&gt;In &lt;code&gt;chemfig&lt;/code&gt;, &lt;code&gt;(&lt;/code&gt; and &lt;code&gt;)&lt;/code&gt; are structural branch syntax. If you only want to display a molecular formula such as &lt;code&gt;CH_3(CH_2)_{11}&lt;/code&gt;, use &lt;code&gt;\ck{...}&lt;/code&gt; rather than passing it directly to &lt;code&gt;\KKchemchain&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Wrap formulas in arrow labels with &lt;code&gt;\ck&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Unlike atom labels in a structure, reaction-arrow labels are not automatically typeset in math mode:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\arrow&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;-&amp;gt;[&lt;span class="k"&gt;\ck&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;H&lt;span class="p"&gt;_&lt;/span&gt;2SO&lt;span class="p"&gt;_&lt;/span&gt;4&lt;span class="p"&gt;}&lt;/span&gt;][Heat]&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Compile annotations twice
&lt;/h3&gt;

&lt;p&gt;The positions used by &lt;code&gt;\KKchemmark&lt;/code&gt; and &lt;code&gt;\KKhbond&lt;/code&gt; are not final on the first run. If an annotation is displaced even though compilation succeeds, run LaTeX again.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use the ring and chain commands for their intended geometry
&lt;/h3&gt;

&lt;p&gt;Use &lt;code&gt;\KKbenzene&lt;/code&gt; or &lt;code&gt;\KKchemring&lt;/code&gt; when a regular polygon matters, and &lt;code&gt;\KKchemchain&lt;/code&gt; for a condensed structural formula. Some inputs compile with either command, but the spacing will differ.&lt;/p&gt;

&lt;h2&gt;
  
  
  License and dependencies
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;KKchemstruct&lt;/code&gt; is released under the MIT License. It uses the LPPL 1.3c-licensed &lt;code&gt;chemfig&lt;/code&gt; for drawing, plus the LPPL-licensed &lt;code&gt;etoolbox&lt;/code&gt; and &lt;code&gt;xkeyval&lt;/code&gt; packages. These dependencies are loaded from your TeX installation; their code is not copied into &lt;code&gt;KKchemstruct&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/KKTeX/KKchemstruct" rel="noopener noreferrer"&gt;&lt;code&gt;KKchemstruct&lt;/code&gt; source and manuals&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ctan.org/pkg/chemfig" rel="noopener noreferrer"&gt;&lt;code&gt;chemfig&lt;/code&gt; on CTAN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ctan.org/pkg/etoolbox" rel="noopener noreferrer"&gt;&lt;code&gt;etoolbox&lt;/code&gt; on CTAN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ctan.org/pkg/xkeyval" rel="noopener noreferrer"&gt;&lt;code&gt;xkeyval&lt;/code&gt; on CTAN&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Start with four commands
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;KKchemstruct&lt;/code&gt; keeps &lt;code&gt;chemfig&lt;/code&gt;'s flexibility while making repeated classroom structures shorter and more consistent. These four commands are enough to get started:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\KKbenzene&lt;/span&gt;&lt;span class="na"&gt;[2=OH,3=COOH]&lt;/span&gt;  &lt;span class="c"&gt;% substituted benzene&lt;/span&gt;
&lt;span class="k"&gt;\KKchemchain&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;...&lt;span class="p"&gt;}&lt;/span&gt;        &lt;span class="c"&gt;% condensed structural formula&lt;/span&gt;
&lt;span class="k"&gt;\KKscheme&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;...&lt;span class="p"&gt;}&lt;/span&gt;           &lt;span class="c"&gt;% reaction scheme&lt;/span&gt;
&lt;span class="k"&gt;\KKchemsetup&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;...&lt;span class="p"&gt;}&lt;/span&gt;        &lt;span class="c"&gt;% dimensions&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you need a structure that is not predefined, use &lt;code&gt;chemfig&lt;/code&gt; syntax through &lt;code&gt;\KKchemring&lt;/code&gt; or &lt;code&gt;\KKchemchain&lt;/code&gt;. If the same structure keeps appearing, that is the right time to turn it into your own command.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>chemistry</category>
      <category>opensource</category>
      <category>academic</category>
    </item>
    <item>
      <title>How Classical Chinese Is Traditionally Annotated in Japan</title>
      <dc:creator>川口晃世（Kosei Kawaguchi）</dc:creator>
      <pubDate>Sat, 01 Aug 2026 16:44:12 +0000</pubDate>
      <link>https://dev.to/kktex/how-classical-chinese-is-traditionally-annotated-in-japan-2m18</link>
      <guid>https://dev.to/kktex/how-classical-chinese-is-traditionally-annotated-in-japan-2m18</guid>
      <description>&lt;p&gt;Hi, I'm &lt;a href="https://x.com/KKTeX_LaTeX3" rel="noopener noreferrer"&gt;KKTeX&lt;/a&gt;. I maintain TeX packages on &lt;a href="https://ctan.org/author/kktex" rel="noopener noreferrer"&gt;CTAN&lt;/a&gt;, including &lt;a href="https://ctan.org/pkg/gckanbun" rel="noopener noreferrer"&gt;&lt;code&gt;gckanbun&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In Japan, Classical Chinese can be read through a traditional annotation system called &lt;em&gt;kanbun kundoku&lt;/em&gt;. The Chinese text remains in place while tiny marks encode a Japanese reading.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmn7sjqum8k3tdcs5dsd4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmn7sjqum8k3tdcs5dsd4.png" alt="Three layers of kanbun kundoku: original Classical Chinese, Japanese annotations, and Japanese reading order" width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What are the tiny marks?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Furigana&lt;/strong&gt; are small kana showing Japanese pronunciation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Okurigana&lt;/strong&gt; add Japanese verb endings and grammatical particles.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kaeriten&lt;/strong&gt;, or "return marks," tell the reader when to reverse the order of characters.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;rereading character&lt;/strong&gt; is read twice, with a different Japanese form each time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F19rrom4o87sns9z5a1t4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F19rrom4o87sns9z5a1t4.png" alt="Four kinds of kanbun annotations: furigana, okurigana, kaeriten, and a rereading character" width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The annotations are not decoration. Together they carry pronunciation, grammar, and reading order without rewriting the original text.&lt;/p&gt;

&lt;h2&gt;
  
  
  Typesetting it with TeX
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;gckanbun&lt;/code&gt; keeps the source editable while handling the delicate placement of all those marks. It supports LuaLaTeX and (u)pLaTeX, is included in TeX Live, and is released under the MIT License.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4mnq035649ozruxq9jk5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4mnq035649ozruxq9jk5.png" alt="A short gckanbun source example beside its compiled output" width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://ctan.org/pkg/gckanbun" rel="noopener noreferrer"&gt;gckanbun on CTAN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/munepi/gckanbun" rel="noopener noreferrer"&gt;Source on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Two tools from the same desk
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;📘 &lt;strong&gt;&lt;a href="https://evolton.jp/" rel="noopener noreferrer"&gt;Evolton&lt;/a&gt;&lt;/strong&gt; turns a photo or screenshot of a mathematics problem into a polished, reference-book-style solution PDF.&lt;/p&gt;

&lt;p&gt;✍️ &lt;strong&gt;&lt;a href="https://mathhover.com/" rel="noopener noreferrer"&gt;MathHover&lt;/a&gt;&lt;/strong&gt; opens a LaTeX panel beside your cursor and pastes the finished formula into the app you are already using. It is free and requires no account.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What is the most unusual writing or annotation system you have typeset with TeX?&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>latex</category>
      <category>opensource</category>
      <category>japanese</category>
    </item>
    <item>
      <title>Engineering a Japanese Exam-Prep Handout with LuaLaTeX and tcolorbox</title>
      <dc:creator>川口晃世（Kosei Kawaguchi）</dc:creator>
      <pubDate>Thu, 30 Jul 2026 01:06:18 +0000</pubDate>
      <link>https://dev.to/kktex/engineering-a-japanese-exam-prep-handout-with-lualatex-and-tcolorbox-3o53</link>
      <guid>https://dev.to/kktex/engineering-a-japanese-exam-prep-handout-with-lualatex-and-tcolorbox-3o53</guid>
      <description>&lt;p&gt;&lt;em&gt;Measured headers, drawing layers, and page-break states for a dense three-page mathematics booklet.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Hi, I'm &lt;a href="https://x.com/KKTeX_LaTeX3" rel="noopener noreferrer"&gt;KKTeX&lt;/a&gt;. I publish LaTeX packages on &lt;a href="https://ctan.org/author/kktex" rel="noopener noreferrer"&gt;CTAN&lt;/a&gt; and maintain a private toolkit for producing books and teaching materials.&lt;/p&gt;

&lt;p&gt;In the shorter companion article, I treated a Japanese exam-preparation handout as information design. This article opens the implementation.&lt;/p&gt;

&lt;p&gt;The result is a three-page LuaLaTeX document:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0pe8zwdzf905ics8k3aq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0pe8zwdzf905ics8k3aq.png" alt="Page 1 of the technical handout" width="800" height="1131"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl7smepsrgmjb0tmtrqph.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl7smepsrgmjb0tmtrqph.png" alt="Page 2 of the technical handout" width="800" height="1131"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6gy2ife8jp8c41bs7nw2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6gy2ife8jp8c41bs7nw2.png" alt="Page 3 of the technical handout" width="800" height="1131"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The design is original. Tetsuryokukai is a useful public reference point for Japan's highly selective &lt;em&gt;juku&lt;/em&gt;—private after-school education—culture, but this is not a reproduction of its material, and I am not claiming that it uses TeX. The organization publicly describes itself as a University of Tokyo preparation school for students in six-year secondary programs (&lt;a href="https://www.tetsuryokukai.co.jp/index.html" rel="noopener noreferrer"&gt;official profile&lt;/a&gt;). The wider social context is also substantial: the OECD describes private after-school lessons as a pervasive part of Japanese education (&lt;a href="https://www.oecd.org/en/publications/education-policy-in-japan_9789264302402-en/full-report/component-5.html" rel="noopener noreferrer"&gt;OECD overview&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;The technical problem is independent of any one institution:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;How do we build a compact visual language that remains stable when titles change, solutions grow, and boxes cross pages?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The frame grammar grows from two families in my private toolkit: &lt;code&gt;ascolorbox4&lt;/code&gt;, which cuts a rule with its title and combines different rail styles, and later ornate-frame experiments with explicit corner geometry. I call this production variant the &lt;strong&gt;Rinceau Frame / 唐草額&lt;/strong&gt;. It keeps the dotted outer boundary, title interruption, inward quarter-circle corners, and four terminals of &lt;code&gt;ascolorbox4&lt;/code&gt;, then rebuilds the terminals as compact C-scroll and palmette ornaments. The result deliberately looks like a Western book frame, but the ornament remains outside the mathematics.&lt;/p&gt;

&lt;p&gt;I will focus on four implementation decisions, followed by two editorial ones.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Model pedagogical roles, not appearances
&lt;/h2&gt;

&lt;p&gt;The document does not contain a generic &lt;code&gt;FancyBox&lt;/code&gt;. It contains components named after their jobs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\LessonHeading&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;11&lt;span class="p"&gt;}{&lt;/span&gt;LECTURE&lt;span class="p"&gt;}{&lt;/span&gt;A Moving Minimum&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;\begin{DrillBox}&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;PROBLEM 18&lt;span class="p"&gt;}{&lt;/span&gt;Quadratic Optimization&lt;span class="p"&gt;}&lt;/span&gt;[3]
  ...
&lt;span class="nt"&gt;\end{DrillBox}&lt;/span&gt;

&lt;span class="nt"&gt;\begin{StrategyBox}&lt;/span&gt;
  ...
&lt;span class="nt"&gt;\end{StrategyBox}&lt;/span&gt;

&lt;span class="nt"&gt;\begin{SolutionBox}&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;SOLUTION&lt;span class="p"&gt;}&lt;/span&gt;
  ...
&lt;span class="nt"&gt;\end{SolutionBox}&lt;/span&gt;

&lt;span class="nt"&gt;\begin{KeyPointBox}&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;STRUCTURAL MAP / 見通し&lt;span class="p"&gt;}&lt;/span&gt;
  ...
&lt;span class="nt"&gt;\end{KeyPointBox}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This matters when a book grows.&lt;/p&gt;

&lt;p&gt;If an editor later decides that every strategy should use a left rule instead of a filled background, the content files do not change. If every problem needs a difficulty marker, the &lt;code&gt;DrillBox&lt;/code&gt; interface already has one.&lt;/p&gt;

&lt;p&gt;The markup carries semantics; the style file carries the visual system.&lt;/p&gt;

&lt;p&gt;The implementation uses &lt;code&gt;\DeclareTColorBox&lt;/code&gt; rather than a collection of copied &lt;code&gt;\newtcolorbox&lt;/code&gt; definitions. Its xparse-style argument specification gives each component a small, explicit interface:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\DeclareTColorBox&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;DrillBox&lt;span class="p"&gt;}{&lt;/span&gt;m m O&lt;span class="p"&gt;{&lt;/span&gt;2&lt;span class="p"&gt;}&lt;/span&gt; O&lt;span class="p"&gt;{}}{&lt;/span&gt;
  ...
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the first mandatory argument is the problem number;&lt;/li&gt;
&lt;li&gt;the second is the topic;&lt;/li&gt;
&lt;li&gt;the first optional argument selects the &lt;code&gt;基礎&lt;/code&gt; / &lt;code&gt;標準&lt;/code&gt; / &lt;code&gt;発展&lt;/code&gt; level;&lt;/li&gt;
&lt;li&gt;the final optional argument accepts ordinary &lt;code&gt;tcolorbox&lt;/code&gt; overrides.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Preserve a grammar, not a screenshot
&lt;/h2&gt;

&lt;p&gt;The design started by treating &lt;code&gt;ascolorbox4&lt;/code&gt; as a set of invariants:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;the title cuts the top rail;&lt;/li&gt;
&lt;li&gt;a dotted boundary sits outside a solid rail;&lt;/li&gt;
&lt;li&gt;every corner turns through an inward quarter-circle;&lt;/li&gt;
&lt;li&gt;every corner has a visible terminal.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For the Western vocabulary, I studied public-domain museum material rather than tracing a modern border. The Metropolitan Museum's ornamental designs show scrolling acanthus, palmettes, garlands, and pearl strips; Cooper Hewitt's catalog describes frame designs built from &lt;em&gt;rinceaux&lt;/em&gt;, flowers, scrolls, shells, rosettes, and bead-like rails (&lt;a href="https://www.metmuseum.org/art/collection/search/746162" rel="noopener noreferrer"&gt;Met example&lt;/a&gt;, &lt;a href="https://www.si.edu/object/ornamental-frame-design%3Achndm_1921-6-267-12" rel="noopener noreferrer"&gt;Cooper Hewitt frame design&lt;/a&gt;, &lt;a href="https://www.si.edu/object/album-ornanment-designs%3Achndm_1921-6-213" rel="noopener noreferrer"&gt;Cooper Hewitt ornament album&lt;/a&gt;). I reduced that vocabulary to one mirrored C-scroll and a three-leaf palmette small enough for a study booklet.&lt;/p&gt;

&lt;p&gt;The title is attached to the frame instead of positioned with an absolute coordinate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;attach boxed title to top left=&lt;span class="p"&gt;{&lt;/span&gt;
  xshift=10mm,
  yshift=-&lt;span class="k"&gt;\tcboxedtitleheight&lt;/span&gt;/2
&lt;span class="p"&gt;}&lt;/span&gt;,
boxed title style=&lt;span class="p"&gt;{&lt;/span&gt;
  colback=white,
  colframe=white,
  boxrule=0pt,
  left=2mm,
  right=2mm
&lt;span class="p"&gt;}&lt;/span&gt;,
borderline=&lt;span class="p"&gt;{&lt;/span&gt;.55pt&lt;span class="p"&gt;}{&lt;/span&gt;2.7pt&lt;span class="p"&gt;}{&lt;/span&gt;ehBlue,dotted&lt;span class="p"&gt;}&lt;/span&gt;,
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The white title field is not a badge pasted over the frame. It is a controlled interruption: the solid and dotted rails disappear behind it, then resume at &lt;code&gt;title.east&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The main rail is a single path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\draw&lt;/span&gt;[ehAccent,line width=.72pt,
      line cap=round,line join=round]
  ([xshift=2mm]title.east|-frame.north east)
  --([xshift=-7mm]frame.north east)
  arc[start angle=180,end angle=270,radius=7mm]
  --([yshift=7mm]frame.south east)
  arc[start angle=90,end angle=180,radius=7mm]
  --([xshift=7mm]frame.south west)
  arc[start angle=0,end angle=90,radius=7mm]
  --([yshift=-7mm]frame.north west)
  arc[start angle=270,end angle=360,radius=7mm]
  --([xshift=-2mm]title.west|-frame.north west);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A second, thinner antique-gold path is inset by 2 mm. That pair reads as picture-frame molding. The outer dotted &lt;code&gt;borderline&lt;/code&gt; preserves the lighter rail contrast of &lt;code&gt;ascolorbox4&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This follows a principle I use throughout my Japanese Qiita articles:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If an ornament depends on a box, derive it from the box. If it depends on a title, derive it from the title.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The geometry can therefore survive a new title, a taller solution, or a different page width.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Put each line on the correct drawing layer
&lt;/h2&gt;

&lt;p&gt;An advanced &lt;code&gt;tcolorbox&lt;/code&gt; is easier to reason about as a layer stack:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;finish
overlay
content
underlay
interior
frame
shadow
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The title box has its own corresponding layers.&lt;/p&gt;

&lt;p&gt;The navy rail, gold inset molding, and four ornaments belong in the &lt;code&gt;underlay&lt;/code&gt;: they must sit below the mathematics. The difficulty marker belongs in an &lt;code&gt;overlay&lt;/code&gt;, because its white field intentionally knocks out a small portion of the top rail.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\DeclareTColorBox&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;DrillBox&lt;span class="p"&gt;}{&lt;/span&gt;m m O&lt;span class="p"&gt;{&lt;/span&gt;2&lt;span class="p"&gt;}&lt;/span&gt; O&lt;span class="p"&gt;{}}{&lt;/span&gt;
  enhanced,
  breakable,
  empty,
  sharp corners,
  title=&lt;span class="p"&gt;{&lt;/span&gt;#1&lt;span class="k"&gt;\hspace&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;2.2mm&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\color&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;ehGold&lt;span class="p"&gt;}&lt;/span&gt;/&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;\hspace&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;2.2mm&lt;span class="p"&gt;}&lt;/span&gt;#2&lt;span class="p"&gt;}&lt;/span&gt;,
  left=9mm,
  right=9mm,
  top=5mm,
  bottom=5mm,
  borderline=&lt;span class="p"&gt;{&lt;/span&gt;.55pt&lt;span class="p"&gt;}{&lt;/span&gt;2.7pt&lt;span class="p"&gt;}{&lt;/span&gt;ehBlue,dotted&lt;span class="p"&gt;}&lt;/span&gt;,
  underlay unbroken=&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ehFrameUnbroken&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;,
  underlay first=&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ehFrameFirst&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;,
  underlay middle=&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ehFrameMiddle&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;,
  underlay last=&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ehFrameLast&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;,
  overlay unbroken and first=&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;% the 基礎 / 標準 / 発展 marker&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;empty&lt;/code&gt; removes the default skin. The component then draws only the parts of the selected grammar:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;one rounded solid rail;&lt;/li&gt;
&lt;li&gt;one thinner inset molding;&lt;/li&gt;
&lt;li&gt;one dotted offset boundary;&lt;/li&gt;
&lt;li&gt;one title interruption;&lt;/li&gt;
&lt;li&gt;four C-scroll and palmette terminals;&lt;/li&gt;
&lt;li&gt;a &lt;code&gt;基礎&lt;/code&gt; / &lt;code&gt;標準&lt;/code&gt; / &lt;code&gt;発展&lt;/code&gt; level chip.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This avoids a common failure mode: drawing a custom frame on top of a default frame and then chasing tiny disagreements in corner radius and line position.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. A breakable box has four drawings
&lt;/h2&gt;

&lt;p&gt;The solution box is allowed to grow. Therefore it cannot have one frame path.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tcolorbox&lt;/code&gt; exposes four states:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;unbroken  one-page box
first     first fragment of a broken box
middle    intermediate fragment
last      final fragment
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The fragment drawings are assigned accordingly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;underlay unbroken=&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ehFrameUnbroken&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;,
underlay first=&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ehFrameFirst&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;,
underlay middle=&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ehFrameMiddle&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;,
underlay last=&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ehFrameLast&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;,
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first fragment draws the title, top corners, and vertical continuations. A middle fragment draws only two pairs of vertical rails. The last fragment draws the bottom corners and closes the frame.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\newcommand&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ehFrameLast&lt;/span&gt;&lt;span class="p"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\draw&lt;/span&gt;[ehAccent,line width=.72pt,
        line cap=round,line join=round]
    (frame.north east)
    --([yshift=7mm]frame.south east)
    arc[start angle=90,end angle=180,radius=7mm]
    --([xshift=7mm]frame.south west)
    arc[start angle=0,end angle=90,radius=7mm]
    --(frame.north west);
  &lt;span class="k"&gt;\ehFrameBottomCorners&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The direction of those arcs matters. The last fragment is traced from the right edge to the left edge, matching the angle sequence used by the original &lt;code&gt;ascolorbox4&lt;/code&gt;. Reversing the path without also reversing the angles makes the bottom rail leave the corner diagonally—a defect that can hide in a one-page test and appear only after a forced page break.&lt;/p&gt;

&lt;p&gt;On the middle fragment, there are no fake corners and no repeated ornament. Treating the four states as separate drawings is not an optimization. It is the correct model.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Keep visual weight scarce
&lt;/h2&gt;

&lt;p&gt;The page uses eight named colors, each with a narrow role:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;ehInk&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;202428&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;ehMuted&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;667085&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;ehLine&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;AEB5BF&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;ehPale&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;F3F4F6&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;ehAccent&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;34435F&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;ehBlue&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;8292AE&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;ehGold&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;A37B3C&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;ehVermilion&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;B4442E&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ehInk&lt;/code&gt; carries mathematics and hard structure;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ehAccent&lt;/code&gt; carries navigation and the main frame rail;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ehBlue&lt;/code&gt; carries the dotted offset boundary;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ehGold&lt;/code&gt; carries the inset molding and palmette leaves;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ehLine&lt;/code&gt; remains available for quiet separators;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ehPale&lt;/code&gt; is limited to secondary label fields.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ehMuted&lt;/code&gt; carries running metadata;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ehVermilion&lt;/code&gt; appears only in advanced-level and answer signals.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The point is not to make every component visibly different. The point is to make different components recognizable without making the page compete with itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Design the return visit
&lt;/h2&gt;

&lt;p&gt;The third PDF page is a review page, not another full solution.&lt;/p&gt;

&lt;p&gt;Its prompts ask:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What does “for every real &lt;em&gt;x&lt;/em&gt;” become?&lt;/li&gt;
&lt;li&gt;Which variable is currently being optimized?&lt;/li&gt;
&lt;li&gt;Do strict inequalities exclude the endpoints?&lt;/li&gt;
&lt;li&gt;Is the claimed maximum attained?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is a typesetting decision as much as a teaching decision. A weekly booklet is a retrieval system. Numbering, labels, and stable component shapes help a student find a previous method quickly.&lt;/p&gt;

&lt;p&gt;That is why a dense handout can benefit from stronger visual structure than a conventional textbook chapter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Compilation environment
&lt;/h2&gt;

&lt;p&gt;I compiled the specimen with LuaLaTeX and &lt;code&gt;ltjsarticle&lt;/code&gt;. When recreating the example from these excerpts, place the component definitions in &lt;code&gt;exam-handout.sty&lt;/code&gt; beside &lt;code&gt;technical-handout.tex&lt;/code&gt;, then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lualatex &lt;span class="nt"&gt;-interaction&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;nonstopmode &lt;span class="nt"&gt;-halt-on-error&lt;/span&gt; technical-handout.tex
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The example uses &lt;code&gt;ltjsarticle&lt;/code&gt;, matching my Japanese material workflow. The visible content is mostly English, but the component labels can contain Japanese micro-labels such as &lt;code&gt;要点&lt;/code&gt; and &lt;code&gt;見通し&lt;/code&gt; without changing the geometry.&lt;/p&gt;

&lt;p&gt;The box system is built on &lt;a href="https://ctan.org/pkg/tcolorbox" rel="noopener noreferrer"&gt;&lt;code&gt;tcolorbox&lt;/code&gt;&lt;/a&gt;, whose current CTAN release supports framed boxes, split content, and breakable material.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two tools from the same desk
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Disclosure: these are my projects.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://evolton.jp/" rel="noopener noreferrer"&gt;Evolton&lt;/a&gt;&lt;/strong&gt; converts a photographed mathematics problem into a polished solution PDF. It is useful when the finished explanation needs the visual discipline of a reference book.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxsrxnj4j1n0mbqfsn94x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxsrxnj4j1n0mbqfsn94x.png" alt="Evolton interface and solution-PDF examples" width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://mathhover.com/" rel="noopener noreferrer"&gt;MathHover&lt;/a&gt;&lt;/strong&gt; keeps formula entry close to the cursor, so mathematical writing does not have to pause for a separate editor.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe45gsspz3q59z7x8emxy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe45gsspz3q59z7x8emxy.png" alt="MathHover formula panel showing a completed limit and integral" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The deeper lesson is simple: a teaching-material style should not be a collection of attractive boxes. It should be a small visual language whose components survive the text ranges and page lengths they were designed for—and expose clear guard rails when content exceeds them.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>design</category>
      <category>academic</category>
      <category>japan</category>
    </item>
    <item>
      <title>What Japan's Elite Cram-School Handouts Teach Us About Page Design</title>
      <dc:creator>川口晃世（Kosei Kawaguchi）</dc:creator>
      <pubDate>Thu, 30 Jul 2026 01:03:44 +0000</pubDate>
      <link>https://dev.to/kktex/what-japans-elite-cram-school-handouts-teach-us-about-page-design-5h6</link>
      <guid>https://dev.to/kktex/what-japans-elite-cram-school-handouts-teach-us-about-page-design-5h6</guid>
      <description>&lt;p&gt;&lt;em&gt;A one-page mathematics handout can tell a student what to do before the teacher says a word.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Hi, I'm &lt;a href="https://x.com/KKTeX_LaTeX3" rel="noopener noreferrer"&gt;KKTeX&lt;/a&gt;. I publish LaTeX packages on &lt;a href="https://ctan.org/author/kktex" rel="noopener noreferrer"&gt;CTAN&lt;/a&gt; and build typesetting tools for education in Japan.&lt;/p&gt;

&lt;p&gt;Japan has a large system of private after-school education known as &lt;em&gt;juku&lt;/em&gt;. One unusually intensive public example is Tetsuryokukai. According to its official profile, it is a six-year secondary-school program specializing in preparation for the University of Tokyo and was founded in 1983 by students and graduates of the university's medical and law faculties (&lt;a href="https://www.tetsuryokukai.co.jp/index.html" rel="noopener noreferrer"&gt;official profile&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;The institution is interesting. But for a typesetter, the more interesting question is smaller:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What does an intensive mathematics handout ask the page itself to do?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is my answer, built from scratch in LuaLaTeX:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsz8imh187zo7o3xru916.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsz8imh187zo7o3xru916.png" alt="An original one-page Japanese exam-prep-style mathematics handout" width="800" height="1131"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is not a reproduction of a Tetsuryokukai handout, and I am not claiming that the organization uses TeX. It is an original reconstruction of the broader visual grammar surrounding high-density Japanese exam preparation.&lt;/p&gt;

&lt;h2&gt;
  
  
  The page gives instructions
&lt;/h2&gt;

&lt;p&gt;Look at the page before reading the mathematics.&lt;/p&gt;

&lt;p&gt;The dark &lt;code&gt;07&lt;/code&gt; badge answers: &lt;strong&gt;Where am I?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The segmented header answers: &lt;strong&gt;What kind of object is this?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The right-hand &lt;code&gt;標準&lt;/code&gt; (&lt;em&gt;standard&lt;/em&gt;) chip answers: &lt;strong&gt;How demanding is it?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;STRATEGY&lt;/code&gt; answers: &lt;strong&gt;What should I notice before calculating?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SOLUTION&lt;/code&gt; answers: &lt;strong&gt;How do I verify the argument?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;KEY POINT / 要点&lt;/code&gt; answers: &lt;strong&gt;What should I retain for the next problem?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;QUICK RETRIEVAL&lt;/code&gt; answers: &lt;strong&gt;Can I rebuild it later without rereading?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;None of these elements is merely decorative. Together they turn a page into a sequence of learning actions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;locate;&lt;/li&gt;
&lt;li&gt;classify;&lt;/li&gt;
&lt;li&gt;calibrate;&lt;/li&gt;
&lt;li&gt;choose a method;&lt;/li&gt;
&lt;li&gt;verify;&lt;/li&gt;
&lt;li&gt;remember;&lt;/li&gt;
&lt;li&gt;retrieve.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That sequence is especially useful in a weekly booklet. Students do not read such material once from beginning to end. They return to it before a test, search for a familiar problem type, cover the solution, and try again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dense does not have to mean noisy
&lt;/h2&gt;

&lt;p&gt;An intensive handout needs to carry a great deal of information, but visual weight must remain scarce.&lt;/p&gt;

&lt;p&gt;In this design:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;black is reserved for mathematics and the main structure;&lt;/li&gt;
&lt;li&gt;blue-slate identifies navigation;&lt;/li&gt;
&lt;li&gt;a dotted outer boundary and a solid inner rail establish each teaching object;&lt;/li&gt;
&lt;li&gt;a thin antique-gold inset reads like the molding inside a picture frame;&lt;/li&gt;
&lt;li&gt;compact C-scrolls and shell-like palmettes terminate the four corners;&lt;/li&gt;
&lt;li&gt;pale gray is reserved for secondary labels.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The result is dense, but it still has a reading order. I call this production variant the &lt;strong&gt;Rinceau Frame / 唐草額&lt;/strong&gt;. Its structure comes directly from my &lt;code&gt;ascolorbox4&lt;/code&gt; experiments: the title interrupts the top rail, a dotted boundary sits outside it, and inward quarter-circles turn all four corners. I then rebuilt those corner terminals with the grammar of a Western picture frame—C-scrolls, a small palmette, and a second molding line—without letting the ornament enter the reading column.&lt;/p&gt;

&lt;p&gt;The most important design decision is not the color. It is placing the strategy &lt;em&gt;before&lt;/em&gt; the full solution. A student first receives a way into the problem, not an answer to copy.&lt;/p&gt;

&lt;h2&gt;
  
  
  The TeX idea
&lt;/h2&gt;

&lt;p&gt;The page uses one reusable component for each pedagogical role:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\LessonHeading&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;07&lt;span class="p"&gt;}{&lt;/span&gt;LESSON&lt;span class="p"&gt;}{&lt;/span&gt;A Parameter and a Quadratic&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;\begin{DrillBox}&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;EXAMPLE 12&lt;span class="p"&gt;}{&lt;/span&gt;Positive for Every Real &lt;span class="k"&gt;\textit&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;x&lt;span class="p"&gt;}}&lt;/span&gt;[2]
  ...
&lt;span class="nt"&gt;\end{DrillBox}&lt;/span&gt;

&lt;span class="nt"&gt;\begin{StrategyBox}&lt;/span&gt;
  ...
&lt;span class="nt"&gt;\end{StrategyBox}&lt;/span&gt;

&lt;span class="nt"&gt;\begin{SolutionBox}&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;SOLUTION&lt;span class="p"&gt;}&lt;/span&gt;
  ...
&lt;span class="nt"&gt;\end{SolutionBox}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The content says what an object &lt;em&gt;means&lt;/em&gt;. The style file decides how that meaning should look.&lt;/p&gt;

&lt;p&gt;That separation is what makes TeX unusually well suited to systematic teaching materials: the visual language can remain stable across hundreds of pages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two tools from the same desk
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Disclosure: these are my projects.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://evolton.jp/" rel="noopener noreferrer"&gt;Evolton&lt;/a&gt;&lt;/strong&gt; turns a photograph or screenshot of a mathematics problem into a polished solution PDF. It treats the answer as a teaching object, not merely a block of correct text.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxsrxnj4j1n0mbqfsn94x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxsrxnj4j1n0mbqfsn94x.png" alt="Evolton interface and solution-PDF examples" width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://mathhover.com/" rel="noopener noreferrer"&gt;MathHover&lt;/a&gt;&lt;/strong&gt; opens a LaTeX panel beside the cursor and inserts the finished formula into the application you are already using.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe45gsspz3q59z7x8emxy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe45gsspz3q59z7x8emxy.png" alt="MathHover formula panel showing a completed limit and integral" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The next article opens the same component system and explains the engineering behind title-cut rails, ornamental corner geometry, and page-break states in a longer specimen.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>design</category>
      <category>academic</category>
      <category>japan</category>
    </item>
    <item>
      <title>Build a Ghost-Number Section Heading in LaTeX</title>
      <dc:creator>川口晃世（Kosei Kawaguchi）</dc:creator>
      <pubDate>Tue, 28 Jul 2026 11:24:22 +0000</pubDate>
      <link>https://dev.to/kktex/build-a-ghost-number-section-heading-in-latex-ki9</link>
      <guid>https://dev.to/kktex/build-a-ghost-number-section-heading-in-latex-ki9</guid>
      <description>&lt;p&gt;Hi, I'm &lt;a href="https://x.com/KKTeX_LaTeX3" rel="noopener noreferrer"&gt;KKTeX&lt;/a&gt;. I publish LaTeX packages on &lt;a href="https://ctan.org/author/kktex" rel="noopener noreferrer"&gt;CTAN&lt;/a&gt; and build typesetting tools for education in Japan.&lt;/p&gt;

&lt;p&gt;In many Japanese mathematics books, a section heading is not merely larger text. It is page architecture: number, hierarchy, and reading rhythm.&lt;/p&gt;

&lt;p&gt;This article makes one heading with a pale “ghost number” and a restrained blue rule.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd3t2mjerh8lkik4ub1j0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd3t2mjerh8lkik4ub1j0.png" alt="Preview of the ghost-number section heading" width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The drawing
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;tikz&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;qink&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;0F172A&lt;span class="p"&gt;}&lt;/span&gt;         &lt;span class="c"&gt;% slate-900&lt;/span&gt;
&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;qline&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;CBD5E1&lt;span class="p"&gt;}&lt;/span&gt;        &lt;span class="c"&gt;% slate-300&lt;/span&gt;
&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;qaccent&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;38BDF8&lt;span class="p"&gt;}&lt;/span&gt;      &lt;span class="c"&gt;% sky-400&lt;/span&gt;
&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;qaccentDark&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;0369A1&lt;span class="p"&gt;}&lt;/span&gt;  &lt;span class="c"&gt;% sky-700&lt;/span&gt;

&lt;span class="k"&gt;\newcounter&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;booksection&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;\NewDocumentCommand&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\BookSection&lt;/span&gt;&lt;span class="p"&gt;}{&lt;/span&gt;m&lt;span class="p"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\refstepcounter&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;booksection&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\par\medskip\noindent&lt;/span&gt;
  &lt;span class="nt"&gt;\begin{tikzpicture}&lt;/span&gt;
    &lt;span class="k"&gt;\useasboundingbox&lt;/span&gt;
      (0,0) rectangle (&lt;span class="k"&gt;\linewidth&lt;/span&gt;,-2.7&lt;span class="k"&gt;\baselineskip&lt;/span&gt;);

    &lt;span class="k"&gt;\node&lt;/span&gt;[
      anchor=base west,text=qline,
      font=&lt;span class="k"&gt;\sffamily\bfseries&lt;/span&gt;
            &lt;span class="k"&gt;\fontsize&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;40pt&lt;span class="p"&gt;}{&lt;/span&gt;40pt&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;\selectfont&lt;/span&gt;
    ] at (0,-1.55&lt;span class="k"&gt;\baselineskip&lt;/span&gt;)
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ifnum\value&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;booksection&lt;span class="p"&gt;}&lt;/span&gt;&amp;lt;10 0&lt;span class="k"&gt;\fi&lt;/span&gt;
       &lt;span class="k"&gt;\arabic&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;booksection&lt;span class="p"&gt;}}&lt;/span&gt;;

    &lt;span class="k"&gt;\node&lt;/span&gt;[
      anchor=base west,text=qaccentDark,
      font=&lt;span class="k"&gt;\sffamily\scriptsize\bfseries&lt;/span&gt;
    ] at (26mm,-.55&lt;span class="k"&gt;\baselineskip&lt;/span&gt;) &lt;span class="p"&gt;{&lt;/span&gt;LESSON&lt;span class="p"&gt;}&lt;/span&gt;;

    &lt;span class="k"&gt;\node&lt;/span&gt;[
      anchor=base west,text=qink,
      font=&lt;span class="k"&gt;\sffamily\Large\bfseries&lt;/span&gt;
    ] at (26mm,-1.45&lt;span class="k"&gt;\baselineskip&lt;/span&gt;) &lt;span class="p"&gt;{&lt;/span&gt;#1&lt;span class="p"&gt;}&lt;/span&gt;;

    &lt;span class="k"&gt;\draw&lt;/span&gt;&lt;span class="na"&gt;[qaccent,line width=.8pt]&lt;/span&gt;
      (26mm,-2.2&lt;span class="k"&gt;\baselineskip&lt;/span&gt;)
      -- (.78&lt;span class="k"&gt;\linewidth&lt;/span&gt;,-2.2&lt;span class="k"&gt;\baselineskip&lt;/span&gt;);
    &lt;span class="k"&gt;\draw&lt;/span&gt;&lt;span class="na"&gt;[qline,line width=.8pt]&lt;/span&gt;
      (.78&lt;span class="k"&gt;\linewidth&lt;/span&gt;,-2.2&lt;span class="k"&gt;\baselineskip&lt;/span&gt;)
      -- (&lt;span class="k"&gt;\linewidth&lt;/span&gt;,-2.2&lt;span class="k"&gt;\baselineskip&lt;/span&gt;);

    &lt;span class="k"&gt;\foreach&lt;/span&gt; &lt;span class="k"&gt;\x&lt;/span&gt; in &lt;span class="p"&gt;{&lt;/span&gt;0,1,2&lt;span class="p"&gt;}{&lt;/span&gt;
      &lt;span class="k"&gt;\fill&lt;/span&gt;&lt;span class="na"&gt;[qaccentDark]&lt;/span&gt;
        ([xshift=-&lt;span class="k"&gt;\x*&lt;/span&gt;3.4mm]&lt;span class="k"&gt;\linewidth&lt;/span&gt;,
          -.55&lt;span class="k"&gt;\baselineskip&lt;/span&gt;)
        circle[radius=1.2pt];
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;\end{tikzpicture}&lt;/span&gt;
  &lt;span class="k"&gt;\par\smallskip&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use it once per section:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\BookSection&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;Completing the Square&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Compilation note: my figure source uses &lt;code&gt;ltjsarticle&lt;/code&gt; with LuaLaTeX, matching my Japanese material workflow. The heading itself also works inside an ordinary &lt;code&gt;article&lt;/code&gt; document.&lt;/p&gt;

&lt;p&gt;The page gets a clear hierarchy, ordered here by visual importance:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The dark title carries meaning.&lt;/li&gt;
&lt;li&gt;The small &lt;code&gt;LESSON&lt;/code&gt; label identifies the component.&lt;/li&gt;
&lt;li&gt;The pale number helps navigation without competing for attention.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The component-system idea comes from my private book-production toolkit, &lt;code&gt;kkbookmaker&lt;/code&gt;, but the ghost-number design is new for this article.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the number is large but pale
&lt;/h2&gt;

&lt;p&gt;Japanese reference books often expose structure more aggressively than ordinary prose books. A student may jump between an example, its solution, a related exercise, and a later review page. Strong numbering helps that movement, but a dark oversized number would compete with the mathematics.&lt;/p&gt;

&lt;p&gt;The ghost number solves both problems: it is large enough to find quickly and light enough to sit behind the reading hierarchy. The title remains the darkest element, while the small &lt;code&gt;LESSON&lt;/code&gt; label tells the reader what kind of marker this is. This is navigation, not decoration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two tools from the same desk
&lt;/h2&gt;

&lt;p&gt;Disclosure: I'm promoting both projects in this section.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmvwj7cbyzrxjld0stngh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmvwj7cbyzrxjld0stngh.png" alt="Evolton interface and solution-PDF examples" width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://evolton.jp/" rel="noopener noreferrer"&gt;Evolton&lt;/a&gt;&lt;/strong&gt; turns a photo or screenshot of a mathematics problem into a reference-book-style worked-solution PDF. Its database lets you browse university entrance-exam material by university, faculty, and year.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpf4zpo8tdl26ap1fw8x2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpf4zpo8tdl26ap1fw8x2.png" alt="MathHover LaTeX input panel" width="800" height="357"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://mathhover.com/" rel="noopener noreferrer"&gt;MathHover&lt;/a&gt;&lt;/strong&gt; opens a LaTeX input panel beside your cursor, then pastes the finished formula into your current app. It is free to use and requires no account.&lt;/p&gt;

&lt;p&gt;Next in the series: Japanese-born CTAN packages for answer fields, Kanbun, underlining, and more.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>design</category>
      <category>academic</category>
      <category>japan</category>
    </item>
    <item>
      <title>Build a Star-Rated Example Box in LaTeX</title>
      <dc:creator>川口晃世（Kosei Kawaguchi）</dc:creator>
      <pubDate>Tue, 28 Jul 2026 11:22:56 +0000</pubDate>
      <link>https://dev.to/kktex/build-a-star-rated-example-box-in-latex-3818</link>
      <guid>https://dev.to/kktex/build-a-star-rated-example-box-in-latex-3818</guid>
      <description>&lt;p&gt;Hi, I'm &lt;a href="https://x.com/KKTeX_LaTeX3" rel="noopener noreferrer"&gt;KKTeX&lt;/a&gt;. I publish LaTeX packages on &lt;a href="https://ctan.org/author/kktex" rel="noopener noreferrer"&gt;CTAN&lt;/a&gt; and build typesetting tools for education in Japan.&lt;/p&gt;

&lt;p&gt;A Japanese exam-prep page often tells you three things before the problem begins: its number, its topic, and its difficulty. That compact metadata turns a dense booklet into something students can scan and revisit.&lt;/p&gt;

&lt;p&gt;Today we will make one component: a worked-example box with two measured header segments and a three-star difficulty scale.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc7gpvxdcqf0s40bmae4k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc7gpvxdcqf0s40bmae4k.png" alt="A measured ExampleBox for a quadratic-inequality problem" width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The locator above the box and the bold problem statement are page content from my figure source, not automatic parts of &lt;code&gt;ExampleBox&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Measure first, then draw
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[most]&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;tcolorbox&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\usetikzlibrary&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;shapes.geometric&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;qink&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;0F172A&lt;span class="p"&gt;}&lt;/span&gt;         &lt;span class="c"&gt;% slate-900&lt;/span&gt;
&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;qline&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;CBD5E1&lt;span class="p"&gt;}&lt;/span&gt;        &lt;span class="c"&gt;% slate-300&lt;/span&gt;
&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;qaccentDark&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;0369A1&lt;span class="p"&gt;}&lt;/span&gt;  &lt;span class="c"&gt;% sky-700&lt;/span&gt;
&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;qaccentPale&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;E0F2FE&lt;span class="p"&gt;}&lt;/span&gt;  &lt;span class="c"&gt;% sky-100&lt;/span&gt;

&lt;span class="k"&gt;\newlength&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ExampleHeadHeight&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\newlength&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ExampleTitleWidth&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\newlength&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ExampleTopicWidth&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\newlength&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ExampleTopicX&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;\setlength&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ExampleHeadHeight&lt;/span&gt;&lt;span class="p"&gt;}{&lt;/span&gt;6.2mm&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;\newcommand&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ExampleSegmentFont&lt;/span&gt;&lt;span class="p"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="k"&gt;\sffamily\bfseries\fontsize&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;8.5&lt;span class="p"&gt;}{&lt;/span&gt;10&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;\selectfont&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;\DeclareTColorBox&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;ExampleBox&lt;span class="p"&gt;}{&lt;/span&gt; m m o O&lt;span class="p"&gt;{&lt;/span&gt;2&lt;span class="p"&gt;}&lt;/span&gt; O&lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="p"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  enhanced,
  empty,
  sharp corners,
  before=&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
    &lt;span class="k"&gt;\def\ExampleTitleText&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
      #1&lt;span class="c"&gt;%&lt;/span&gt;
      &lt;span class="k"&gt;\IfValueT&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;#3&lt;span class="p"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
        &lt;span class="k"&gt;\hspace&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;1.5mm&lt;span class="p"&gt;}{&lt;/span&gt;&lt;span class="k"&gt;\fontsize&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;6&lt;span class="p"&gt;}{&lt;/span&gt;7&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;\selectfont&lt;/span&gt; #3&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
    &lt;span class="k"&gt;\settowidth&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ExampleTitleWidth&lt;/span&gt;&lt;span class="p"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
      &lt;span class="k"&gt;\ExampleSegmentFont\ExampleTitleText&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
    &lt;span class="k"&gt;\settowidth&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ExampleTopicWidth&lt;/span&gt;&lt;span class="p"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
      &lt;span class="k"&gt;\ExampleSegmentFont&lt;/span&gt; #2
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
    &lt;span class="k"&gt;\setlength&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ExampleTopicX&lt;/span&gt;&lt;span class="p"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
      &lt;span class="k"&gt;\dimexpr\ExampleTitleWidth&lt;/span&gt;+7.7mm&lt;span class="k"&gt;\relax&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
    &lt;span class="k"&gt;\par\noindent&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;,
  enlarge top by=&lt;span class="k"&gt;\ExampleHeadHeight&lt;/span&gt;,
  left=5mm, right=3mm, top=3.5mm, bottom=3.5mm,
  underlay unbroken=&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
    &lt;span class="c"&gt;% Measured title segment&lt;/span&gt;
    &lt;span class="k"&gt;\fill&lt;/span&gt;&lt;span class="na"&gt;[qaccentDark]&lt;/span&gt;
      ([yshift=&lt;span class="k"&gt;\ExampleHeadHeight&lt;/span&gt;]frame.north west)
      -- ([xshift=&lt;span class="k"&gt;\dimexpr\ExampleTitleWidth&lt;/span&gt;+6.5mm&lt;span class="k"&gt;\relax&lt;/span&gt;,
           yshift=&lt;span class="k"&gt;\ExampleHeadHeight&lt;/span&gt;]frame.north west)
      -- ([xshift=&lt;span class="k"&gt;\dimexpr\ExampleTitleWidth&lt;/span&gt;+6.5mm
                         -.5&lt;span class="k"&gt;\ExampleHeadHeight\relax&lt;/span&gt;]
           frame.north west)
      -- (frame.north west)
      -- cycle;
    &lt;span class="k"&gt;\node&lt;/span&gt;[anchor=west,inner sep=0pt,text=white,
          font=&lt;span class="k"&gt;\ExampleSegmentFont&lt;/span&gt;]
      at ([xshift=2.5mm,yshift=.5&lt;span class="k"&gt;\ExampleHeadHeight&lt;/span&gt;]
          frame.north west)
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;\ExampleTitleText&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;;

    &lt;span class="c"&gt;% Measured topic segment with the same shear&lt;/span&gt;
    &lt;span class="k"&gt;\fill&lt;/span&gt;&lt;span class="na"&gt;[qaccentPale]&lt;/span&gt;
      ([xshift=&lt;span class="k"&gt;\ExampleTopicX&lt;/span&gt;,yshift=&lt;span class="k"&gt;\ExampleHeadHeight&lt;/span&gt;]
        frame.north west)
      -- ([xshift=&lt;span class="k"&gt;\dimexpr\ExampleTopicX&lt;/span&gt;+&lt;span class="k"&gt;\ExampleTopicWidth&lt;/span&gt;
                         +5mm&lt;span class="k"&gt;\relax&lt;/span&gt;,
           yshift=&lt;span class="k"&gt;\ExampleHeadHeight&lt;/span&gt;]frame.north west)
      -- ([xshift=&lt;span class="k"&gt;\dimexpr\ExampleTopicX&lt;/span&gt;+&lt;span class="k"&gt;\ExampleTopicWidth&lt;/span&gt;
                         +5mm-.5&lt;span class="k"&gt;\ExampleHeadHeight\relax&lt;/span&gt;]
           frame.north west)
      -- ([xshift=&lt;span class="k"&gt;\dimexpr\ExampleTopicX&lt;/span&gt;
                         -.5&lt;span class="k"&gt;\ExampleHeadHeight\relax&lt;/span&gt;]
           frame.north west)
      -- cycle;
    &lt;span class="k"&gt;\node&lt;/span&gt;[anchor=west,inner sep=0pt,text=qink,
          font=&lt;span class="k"&gt;\ExampleSegmentFont&lt;/span&gt;]
      at ([xshift=&lt;span class="k"&gt;\dimexpr\ExampleTopicX&lt;/span&gt;+2.5mm
                         -.25&lt;span class="k"&gt;\ExampleHeadHeight\relax&lt;/span&gt;,
           yshift=.5&lt;span class="k"&gt;\ExampleHeadHeight&lt;/span&gt;]frame.north west)
      &lt;span class="p"&gt;{&lt;/span&gt;#2&lt;span class="p"&gt;}&lt;/span&gt;;

    &lt;span class="c"&gt;% Right-anchored stars; #4 is the filled count.&lt;/span&gt;
    &lt;span class="k"&gt;\foreach&lt;/span&gt; &lt;span class="k"&gt;\i&lt;/span&gt; in &lt;span class="p"&gt;{&lt;/span&gt;1,2,3&lt;span class="p"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
      &lt;span class="k"&gt;\ifnum\i&lt;/span&gt;&amp;gt;#4&lt;span class="k"&gt;\relax&lt;/span&gt;
        &lt;span class="k"&gt;\node&lt;/span&gt;[star,star points=5,star point ratio=2.2,
          minimum size=2.6mm,inner sep=0pt,
          fill=white,draw=qline,line width=.4pt]
          at ([xshift=&lt;span class="p"&gt;{&lt;/span&gt;-2.3mm-(3-&lt;span class="k"&gt;\i&lt;/span&gt;)*3.4mm&lt;span class="p"&gt;}&lt;/span&gt;,
               yshift=.5&lt;span class="k"&gt;\ExampleHeadHeight&lt;/span&gt;]
               frame.north east) &lt;span class="p"&gt;{}&lt;/span&gt;;
      &lt;span class="k"&gt;\else&lt;/span&gt;
        &lt;span class="k"&gt;\node&lt;/span&gt;[star,star points=5,star point ratio=2.2,
          minimum size=2.6mm,inner sep=0pt,
          fill=qaccentDark,draw=qaccentDark,line width=.4pt]
          at ([xshift=&lt;span class="p"&gt;{&lt;/span&gt;-2.3mm-(3-&lt;span class="k"&gt;\i&lt;/span&gt;)*3.4mm&lt;span class="p"&gt;}&lt;/span&gt;,
               yshift=.5&lt;span class="k"&gt;\ExampleHeadHeight&lt;/span&gt;]
               frame.north east) &lt;span class="p"&gt;{}&lt;/span&gt;;
      &lt;span class="k"&gt;\fi&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;

    &lt;span class="c"&gt;% Open frame: a strong spine and three quiet rules.&lt;/span&gt;
    &lt;span class="k"&gt;\draw&lt;/span&gt;&lt;span class="na"&gt;[qink,line width=1.5pt]&lt;/span&gt;
      ([xshift=.75pt,yshift=&lt;span class="k"&gt;\ExampleHeadHeight&lt;/span&gt;]
        frame.north west)
      -- ([xshift=.75pt]frame.south west);
    &lt;span class="k"&gt;\draw&lt;/span&gt;&lt;span class="na"&gt;[qink,line width=.5pt]&lt;/span&gt;
      ([yshift=&lt;span class="k"&gt;\ExampleHeadHeight&lt;/span&gt;]frame.north west)
      -- ([yshift=&lt;span class="k"&gt;\ExampleHeadHeight&lt;/span&gt;]frame.north east);
    &lt;span class="k"&gt;\draw&lt;/span&gt;&lt;span class="na"&gt;[qink,line width=.5pt]&lt;/span&gt;
      (frame.north west) -- (frame.north east);
    &lt;span class="k"&gt;\draw&lt;/span&gt;&lt;span class="na"&gt;[qink,line width=.5pt]&lt;/span&gt;
      (frame.south west) -- (frame.south east);
  &lt;span class="p"&gt;}&lt;/span&gt;,
  #5
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The normal call is portable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="nt"&gt;\begin{ExampleBox}&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;EXAMPLE 07&lt;span class="p"&gt;}{&lt;/span&gt;Quadratic Inequalities&lt;span class="p"&gt;}&lt;/span&gt;
Find all real &lt;span class="p"&gt;\(&lt;/span&gt;&lt;span class="nb"&gt;a&lt;/span&gt;&lt;span class="p"&gt;\)&lt;/span&gt; such that
&lt;span class="p"&gt;\[&lt;/span&gt;&lt;span class="nb"&gt;
  x&lt;/span&gt;&lt;span class="p"&gt;^&lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nb"&gt;ax&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nb"&gt;a&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="nb"&gt;&amp;gt;&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="nb"&gt;
&lt;/span&gt;&lt;span class="p"&gt;\]&lt;/span&gt;
for every real &lt;span class="p"&gt;\(&lt;/span&gt;&lt;span class="nb"&gt;x&lt;/span&gt;&lt;span class="p"&gt;\)&lt;/span&gt;.
&lt;span class="nt"&gt;\end{ExampleBox}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first optional argument adds a LuaLaTeX Japanese label; the second sets the filled-star count:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="nt"&gt;\begin{ExampleBox}&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;EXAMPLE 07&lt;span class="p"&gt;}{&lt;/span&gt;Quadratic Inequalities&lt;span class="p"&gt;}&lt;/span&gt;[例題][2]
  ...
&lt;span class="nt"&gt;\end{ExampleBox}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important rule is simple: measure with the exact font used to draw. Both polygons then grow with their text, while &lt;code&gt;\ExampleHeadHeight&lt;/code&gt; controls the band and both parallel shears.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the strategy appears before the answer
&lt;/h2&gt;

&lt;p&gt;Japanese self-study books often separate the &lt;em&gt;way in&lt;/em&gt; from the full solution. For example, the exam-prep series described by Suken Publishing places a &lt;code&gt;指針&lt;/code&gt; (strategy) before each solution and uses side notes for formulas and extra explanation (&lt;a href="https://prtimes.jp/main/html/rd/p/000000013.000056817.html" rel="noopener noreferrer"&gt;publisher release&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;That is why the preview says &lt;code&gt;STRATEGY&lt;/code&gt; before calculating (D&amp;lt;0). The line is ordinary content inside the same box—not a second component.&lt;/p&gt;

&lt;p&gt;This measured-header pattern grew from &lt;code&gt;KKfbox11&lt;/code&gt; and &lt;code&gt;KKfbox8&lt;/code&gt; in my private &lt;code&gt;kkbookmaker&lt;/code&gt; toolkit. I kept the genre's information hierarchy but replaced its proportions, colors, glyph stars, and frame construction.&lt;/p&gt;

&lt;p&gt;This design and its proportions are new for this series. It is not affiliated with, and does not copy, Suken Publishing, a particular textbook series, or any school.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two tools from the same desk
&lt;/h2&gt;

&lt;p&gt;Disclosure: I'm promoting both projects in this section.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmvwj7cbyzrxjld0stngh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmvwj7cbyzrxjld0stngh.png" alt="Evolton interface and solution-PDF examples" width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://evolton.jp/" rel="noopener noreferrer"&gt;Evolton&lt;/a&gt;&lt;/strong&gt; turns a photo or screenshot of a mathematics problem into a polished, reference-book-style solution PDF. Its database is browsable by university, faculty, and year.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpf4zpo8tdl26ap1fw8x2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpf4zpo8tdl26ap1fw8x2.png" alt="MathHover LaTeX input panel" width="800" height="357"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://mathhover.com/" rel="noopener noreferrer"&gt;MathHover&lt;/a&gt;&lt;/strong&gt; opens a LaTeX panel beside your cursor and pastes the finished formula into the app you are already using. It is free and requires no account.&lt;/p&gt;

&lt;p&gt;Next: a section heading with a ghost number.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>design</category>
      <category>academic</category>
      <category>japan</category>
    </item>
    <item>
      <title>Build a Chamfered Key-Point Box in LaTeX</title>
      <dc:creator>川口晃世（Kosei Kawaguchi）</dc:creator>
      <pubDate>Tue, 28 Jul 2026 11:21:41 +0000</pubDate>
      <link>https://dev.to/kktex/build-a-chamfered-key-point-box-in-latex-38j4</link>
      <guid>https://dev.to/kktex/build-a-chamfered-key-point-box-in-latex-38j4</guid>
      <description>&lt;p&gt;Hi, I'm &lt;a href="https://x.com/KKTeX_LaTeX3" rel="noopener noreferrer"&gt;KKTeX&lt;/a&gt;. I publish LaTeX packages on &lt;a href="https://ctan.org/author/kktex" rel="noopener noreferrer"&gt;CTAN&lt;/a&gt; and build typesetting tools for education in Japan.&lt;/p&gt;

&lt;p&gt;Japanese study guides use small, repeated labels—&lt;code&gt;要点&lt;/code&gt; (key point), &lt;code&gt;例題&lt;/code&gt; (worked example), &lt;code&gt;指針&lt;/code&gt; (strategy)—as navigation. The frame is not merely decoration: it tells the learner what kind of reading to do.&lt;/p&gt;

&lt;p&gt;Today we will make one component: a print-friendly key-principle box with a title tab whose chamfer stays at 45 degrees.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6ago4tbt8x750rd8rziw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6ago4tbt8x750rd8rziw.png" alt="A chamfered KeyPointBox showing the AM-GM inequality" width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The small locator above the box is page context from my figure source, not part of the component.&lt;br&gt;
The gray closing sentence and right-aligned Japanese tag are ordinary box content, not generated automatically by &lt;code&gt;KeyPointBox&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  The component
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="k"&gt;\usepackage&lt;/span&gt;&lt;span class="na"&gt;[most]&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;tcolorbox&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;qink&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;0F172A&lt;span class="p"&gt;}&lt;/span&gt;         &lt;span class="c"&gt;% slate-900&lt;/span&gt;
&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;qline&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;CBD5E1&lt;span class="p"&gt;}&lt;/span&gt;        &lt;span class="c"&gt;% slate-300&lt;/span&gt;
&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;qaccentDark&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;0369A1&lt;span class="p"&gt;}&lt;/span&gt;  &lt;span class="c"&gt;% sky-700&lt;/span&gt;
&lt;span class="k"&gt;\definecolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;qaccentPale&lt;span class="p"&gt;}{&lt;/span&gt;HTML&lt;span class="p"&gt;}{&lt;/span&gt;E0F2FE&lt;span class="p"&gt;}&lt;/span&gt;  &lt;span class="c"&gt;% sky-100&lt;/span&gt;

&lt;span class="k"&gt;\DeclareTColorBox&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;KeyPointBox&lt;span class="p"&gt;}{&lt;/span&gt; m o O&lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="p"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  enhanced,
  empty,
  sharp corners,
  arc=0pt,
  outer arc=0pt,
  left=5mm, right=5mm, top=4mm, bottom=4mm,
  enlarge top by=6mm,
  attach boxed title to top left=&lt;span class="p"&gt;{&lt;/span&gt;xshift=0mm,yshift=0mm&lt;span class="p"&gt;}&lt;/span&gt;,
  boxed title style=&lt;span class="p"&gt;{&lt;/span&gt;
    empty,
    arc=0pt,
    outer arc=0pt,
    boxrule=0pt,
    top=1.4mm, bottom=1.4mm,
    left=3mm, right=3mm,
  &lt;span class="p"&gt;}&lt;/span&gt;,
  fonttitle=&lt;span class="k"&gt;\sffamily\bfseries\fontsize&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;8.5&lt;span class="p"&gt;}{&lt;/span&gt;10&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;\selectfont&lt;/span&gt;,
  coltitle=white,
  title=&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
    #1&lt;span class="c"&gt;%&lt;/span&gt;
    &lt;span class="k"&gt;\IfValueT&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;#2&lt;span class="p"&gt;}{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
      &lt;span class="k"&gt;\hspace&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;2mm&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;\textcolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;white&lt;span class="p"&gt;}{&lt;/span&gt;&lt;span class="k"&gt;\rule&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;.4pt&lt;span class="p"&gt;}{&lt;/span&gt;2.2mm&lt;span class="p"&gt;}}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
      &lt;span class="k"&gt;\hspace&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;2mm&lt;span class="p"&gt;}{&lt;/span&gt;&lt;span class="k"&gt;\fontsize&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;6&lt;span class="p"&gt;}{&lt;/span&gt;7&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;\selectfont&lt;/span&gt;
        &lt;span class="k"&gt;\textcolor&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;qaccentPale&lt;span class="p"&gt;}{&lt;/span&gt;#2&lt;span class="p"&gt;}}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;,
  underlay boxed title=&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
    &lt;span class="k"&gt;\fill&lt;/span&gt;&lt;span class="na"&gt;[qink]&lt;/span&gt;
      (title.north west) rectangle (title.south east);
    &lt;span class="k"&gt;\fill&lt;/span&gt;&lt;span class="na"&gt;[qaccentDark]&lt;/span&gt;
      (title.north east)
      -- +(&lt;span class="k"&gt;\dimexpr\tcboxedtitleheight&lt;/span&gt;-.6mm&lt;span class="k"&gt;\relax&lt;/span&gt;,
           -&lt;span class="k"&gt;\dimexpr\tcboxedtitleheight&lt;/span&gt;-.6mm&lt;span class="k"&gt;\relax&lt;/span&gt;)
      -- (title.south east)
      -- cycle;
    &lt;span class="k"&gt;\draw&lt;/span&gt;&lt;span class="na"&gt;[qink,line width=.5pt]&lt;/span&gt;
      ([xshift=&lt;span class="k"&gt;\dimexpr\tcboxedtitleheight&lt;/span&gt;-.6mm&lt;span class="k"&gt;\relax&lt;/span&gt;]
        title.south east)
      -- (title.south east-|frame.east);
  &lt;span class="p"&gt;}&lt;/span&gt;,
  underlay unbroken=&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="c"&gt;%&lt;/span&gt;
    &lt;span class="k"&gt;\draw&lt;/span&gt;&lt;span class="na"&gt;[qink,line width=.5pt]&lt;/span&gt;
      (title.south west-|frame.west)
      -- (frame.south west)
      -- (frame.south east)
      -- (title.south east-|frame.east);
    &lt;span class="k"&gt;\draw&lt;/span&gt;&lt;span class="na"&gt;[qline,line width=.3pt]&lt;/span&gt;
      ([xshift=-1.2pt]title.south east-|frame.east)
      -- ([xshift=-1.2pt,yshift=1.2pt]frame.south east)
      -- ([xshift=1.2pt,yshift=1.2pt]frame.south west);
  &lt;span class="p"&gt;}&lt;/span&gt;,
  #3
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The portable call contains only Latin text:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="nt"&gt;\begin{KeyPointBox}&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;KEY PRINCIPLE&lt;span class="p"&gt;}&lt;/span&gt;
For positive reals &lt;span class="p"&gt;\(&lt;/span&gt;&lt;span class="nb"&gt;a,b&lt;/span&gt;&lt;span class="p"&gt;\)&lt;/span&gt;, the arithmetic mean is at least
the geometric mean.
&lt;span class="p"&gt;\[&lt;/span&gt;&lt;span class="nb"&gt;
  &lt;/span&gt;&lt;span class="nv"&gt;\frac&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;a&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nb"&gt;b&lt;/span&gt;&lt;span class="p"&gt;}{&lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="nv"&gt;\geq\sqrt&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;ab&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="nb"&gt;
  &lt;/span&gt;&lt;span class="nv"&gt;\qquad&lt;/span&gt;&lt;span class="nb"&gt; &lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;a&amp;gt;&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="nb"&gt;,&lt;/span&gt;&lt;span class="nv"&gt;\ &lt;/span&gt;&lt;span class="nb"&gt;b&amp;gt;&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="nb"&gt;
&lt;/span&gt;&lt;span class="p"&gt;\]&lt;/span&gt;
Equality holds if and only if &lt;span class="p"&gt;\(&lt;/span&gt;&lt;span class="nb"&gt;a&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;b&lt;/span&gt;&lt;span class="p"&gt;\)&lt;/span&gt;.
&lt;span class="nt"&gt;\end{KeyPointBox}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With LuaLaTeX and &lt;code&gt;luatexja&lt;/code&gt;, add the optional Japanese micro-label:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;&lt;span class="nt"&gt;\begin{KeyPointBox}&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;KEY PRINCIPLE&lt;span class="p"&gt;}&lt;/span&gt;[要点]
  ...
&lt;span class="nt"&gt;\end{KeyPointBox}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The useful trick
&lt;/h2&gt;

&lt;p&gt;Inside &lt;code&gt;underlay boxed title&lt;/code&gt;, &lt;code&gt;\tcboxedtitleheight&lt;/code&gt; is the measured title height. I use &lt;code&gt;\tcboxedtitleheight-.6mm&lt;/code&gt; for both the horizontal run and vertical drop of the blue tail. Equal run and drop give a 45-degree chamfer even when the title font changes.&lt;/p&gt;

&lt;p&gt;The rest stays quiet: white paper, one dark frame, one pale inner rule, and a single accent. Japanese publishers explicitly describe using frames to separate important material while limiting dark colors and the total number of colors to reduce visual stimulation (&lt;a href="https://ten.tokyo-shoseki.co.jp/text/shou_current/sansu/data/sansu_kento.pdf" rel="noopener noreferrer"&gt;Tokyo Shoseki, PDF&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;The engineering idea grew from &lt;code&gt;ascolorbox&lt;/code&gt; patterns in my private &lt;code&gt;kkbookmaker&lt;/code&gt; toolkit. This design is not affiliated with Tokyo Shoseki; its proportions are new for this series and do not copy any particular publisher or school.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two tools from the same desk
&lt;/h2&gt;

&lt;p&gt;Disclosure: I'm promoting both projects in this section.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmvwj7cbyzrxjld0stngh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmvwj7cbyzrxjld0stngh.png" alt="Evolton interface and solution-PDF examples" width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://evolton.jp/" rel="noopener noreferrer"&gt;Evolton&lt;/a&gt;&lt;/strong&gt; turns a photo or screenshot of a mathematics problem into a polished, reference-book-style solution PDF—useful when you want the answer to look teachable, not merely correct.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpf4zpo8tdl26ap1fw8x2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpf4zpo8tdl26ap1fw8x2.png" alt="MathHover LaTeX input panel" width="800" height="357"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://mathhover.com/" rel="noopener noreferrer"&gt;MathHover&lt;/a&gt;&lt;/strong&gt; opens a LaTeX panel beside your cursor and pastes the finished formula into the app you are already using. It is free and requires no account.&lt;/p&gt;

&lt;p&gt;Next: a worked-example header that measures its own segments.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>design</category>
      <category>academic</category>
      <category>japan</category>
    </item>
  </channel>
</rss>
