From 7c0f811414c28bf309f4d572c005710350a655b0 Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 24 Jan 2025 22:20:14 -0800 Subject: [PATCH] Convert "Painting" to typst --- src/Warm-Ups/Painting/main.tex | 80 --------------------------------- src/Warm-Ups/Painting/main.typ | 82 ++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 80 deletions(-) delete mode 100755 src/Warm-Ups/Painting/main.tex create mode 100644 src/Warm-Ups/Painting/main.typ diff --git a/src/Warm-Ups/Painting/main.tex b/src/Warm-Ups/Painting/main.tex deleted file mode 100755 index 93f0bd4..0000000 --- a/src/Warm-Ups/Painting/main.tex +++ /dev/null @@ -1,80 +0,0 @@ -\documentclass[ - solutions, - singlenumbering, - nopagenumber -]{../../../lib/tex/ormc_handout} -\usepackage{../../../lib/tex/macros} - -\title{Warm-Up: The Painting} -\uptitler{\smallurl{}} -\subtitle{Prepared by Mark on \today.} - -\begin{document} - - \maketitle - - \problem{} - You have a painting on a string. \par - Hang the painting on two nails so that if either is removed, the painting falls. \par - - \vspace{2mm} - You may detach the string as you hang the painting, but it must be re-attached once you're done. - - \note{The solution to this problem isn't a \say{think outside the box} trick, it's a clever wrapping of the string.} - - - \begin{center} - \begin{tikzpicture}[scale=2.0] - \draw[line width = 0.5mm] - (0, 1) -- - (2, 1) -- - (2, 0) -- - (0, 0) -- - cycle - ; - - \draw[line width = 0.5mm, dotted] - (0.1, 1) -- - (1, 1.5) -- - (1.9, 1) - ; - - \fill (1, 1.5) circle[radius = 0.25mm]; - - - \draw[line width = 0.2mm] - (0.66, 0.66) -- - (0.66, 0.35) -- - (0.60, 0.1) - (0.72, 0.1)--(0.66, 0.35) - ; - - \draw[line width = 0.2mm] - (0.66, 0.575) -- - (0.6, 0.475) -- - (0.525, 0.575) - (0.66, 0.575) -- - (0.72, 0.475) -- - (0.795, 0.575) - ; - - \fill[color=white] (0.66, 0.66) circle[radius = 0.8mm]; - \draw (0.66, 0.66) circle[radius = 0.8mm]; - \end{tikzpicture} - \end{center} - - - \begin{solution} - - Say we have a left nail and a right nail. The path of the string is as follows: - \begin{itemize} - \item Start on the left - \item Move over both nails, wrap right nail cw - \item Wrap left nail ccw - \item Wrap right nail ccw - \item Exit downwards, in between both nails - \end{itemize} - - \end{solution} - -\end{document} \ No newline at end of file diff --git a/src/Warm-Ups/Painting/main.typ b/src/Warm-Ups/Painting/main.typ new file mode 100644 index 0000000..83461b1 --- /dev/null +++ b/src/Warm-Ups/Painting/main.typ @@ -0,0 +1,82 @@ +#import "@local/handout:0.1.0": * +#import "@preview/cetz:0.3.1" + +#show: handout.with( + title: [Warm-Up: What's an AST?], + by: "Mark", + subtitle: "Based on a true story.", +) + +#problem() +Say we have a painting on a string. \ +Hang the painting on two nails so that if either is removed, the painting falls. \ + +#v(2mm) +You may detach the string as you hang the painting, but it must be re-attached once you're done. \ +#hint[The solution to this problem isn't a "think outside the box" trick, it's a clever wrapping of the string.] + + +#v(2mm) + +#align( + center, + cetz.canvas({ + import cetz.draw: * + let s = 2.5 + + + line( + (0 * s, 1 * s), + (2 * s, 1 * s), + (2 * s, 0 * s), + (0 * s, 0 * s), + close: true, + stroke: (thickness: 0.8mm), + ) + + line( + (0.1 * s, 1 * s), + (0.5 * s, 1.5 * s), + (1.5 * s, 1.5 * s), + (1.9 * s, 1 * s), + stroke: (thickness: 0.5mm, dash: "dotted"), + ) + + circle((0.5 * s, 1.5 * s), radius: 0.04 * s, fill: black, stroke: none) + circle((1.5 * s, 1.5 * s), radius: 0.04 * s, fill: black, stroke: none) + + line( + (0.66 * s, 0.66 * s), + (0.66 * s, 0.35 * s), + (0.60 * s, 0.1 * s), + ) + + line( + (0.72 * s, 0.1 * s), + (0.66 * s, 0.35 * s), + ) + + line( + (0.66 * s, 0.575 * s), + (0.6 * s, 0.475 * s), + (0.525 * s, 0.575 * s), + ) + + line( + (0.66 * s, 0.575 * s), + (0.72 * s, 0.475 * s), + (0.795 * s, 0.575 * s), + ) + + circle((0.66 * s, 0.66 * s), radius: 0.07 * s, fill: white) + }), +) + +#solution([ + Say we have a left nail and a right nail. The path of the string is as follows: + - Start on the left + - Move over both nails, wrap right nail cw + - Wrap left nail ccw + - Wrap right nail ccw + - Exit downwards, in between both nails +])