DEV Community

Build a Chamfered Key-Point Box in LaTeX

Hi, I'm KKTeX. I publish LaTeX packages on CTAN and build typesetting tools for education in Japan.

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

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

A chamfered KeyPointBox showing the AM-GM inequality

The small locator above the box is page context from my figure source, not part of the component.
The gray closing sentence and right-aligned Japanese tag are ordinary box content, not generated automatically by KeyPointBox.

The component

\usepackage[most]{tcolorbox}

\definecolor{qink}{HTML}{0F172A}         % slate-900
\definecolor{qline}{HTML}{CBD5E1}        % slate-300
\definecolor{qaccentDark}{HTML}{0369A1}  % sky-700
\definecolor{qaccentPale}{HTML}{E0F2FE}  % sky-100

\DeclareTColorBox{KeyPointBox}{ m o O{} }{%
  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={xshift=0mm,yshift=0mm},
  boxed title style={
    empty,
    arc=0pt,
    outer arc=0pt,
    boxrule=0pt,
    top=1.4mm, bottom=1.4mm,
    left=3mm, right=3mm,
  },
  fonttitle=\sffamily\bfseries\fontsize{8.5}{10}\selectfont,
  coltitle=white,
  title={%
    #1%
    \IfValueT{#2}{%
      \hspace{2mm}\textcolor{white}{\rule{.4pt}{2.2mm}}%
      \hspace{2mm}{\fontsize{6}{7}\selectfont
        \textcolor{qaccentPale}{#2}}%
    }%
  },
  underlay boxed title={%
    \fill[qink]
      (title.north west) rectangle (title.south east);
    \fill[qaccentDark]
      (title.north east)
      -- +(\dimexpr\tcboxedtitleheight-.6mm\relax,
           -\dimexpr\tcboxedtitleheight-.6mm\relax)
      -- (title.south east)
      -- cycle;
    \draw[qink,line width=.5pt]
      ([xshift=\dimexpr\tcboxedtitleheight-.6mm\relax]
        title.south east)
      -- (title.south east-|frame.east);
  },
  underlay unbroken={%
    \draw[qink,line width=.5pt]
      (title.south west-|frame.west)
      -- (frame.south west)
      -- (frame.south east)
      -- (title.south east-|frame.east);
    \draw[qline,line width=.3pt]
      ([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);
  },
  #3
}
Enter fullscreen mode Exit fullscreen mode

The portable call contains only Latin text:

\begin{KeyPointBox}{KEY PRINCIPLE}
For positive reals \(a,b\), the arithmetic mean is at least
the geometric mean.
\[
  \frac{a+b}{2}\geq\sqrt{ab}
  \qquad (a>0,\ b>0)
\]
Equality holds if and only if \(a=b\).
\end{KeyPointBox}
Enter fullscreen mode Exit fullscreen mode

With LuaLaTeX and luatexja, add the optional Japanese micro-label:

\begin{KeyPointBox}{KEY PRINCIPLE}[要点]
  ...
\end{KeyPointBox}
Enter fullscreen mode Exit fullscreen mode

The useful trick

Inside underlay boxed title, \tcboxedtitleheight is the measured title height. I use \tcboxedtitleheight-.6mm 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.

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 (Tokyo Shoseki, PDF).

The engineering idea grew from ascolorbox patterns in my private kkbookmaker 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.

Two tools from the same desk

Disclosure: I'm promoting both projects in this section.

Evolton interface and solution-PDF examples

Evolton 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.

MathHover LaTeX input panel

MathHover 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.

Next: a worked-example header that measures its own segments.

Top comments (0)