Skip to content

feat(web): 시험지 미리보기/PDF — 실제 한국 시험지 조판으로 재설계#24

Merged
smilebank7 merged 2 commits into
mainfrom
fix/exam-sheet-layout
Jun 11, 2026
Merged

feat(web): 시험지 미리보기/PDF — 실제 한국 시험지 조판으로 재설계#24
smilebank7 merged 2 commits into
mainfrom
fix/exam-sheet-layout

Conversation

@smilebank7

@smilebank7 smilebank7 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

문제

시험지 미리보기/PDF 출력이 시험지 같지 않았음:

  • 회색 카드에 문항을 세로로 나열한 웹 화면 축소판 (2단 괘선 없음)
  • 객관식 보기 ①~⑤ 가 문제 본문 끝에 인라인으로 뭉개짐
  • 정답이 본문 바로 아래 같은 면에 노출
  • 미리보기 폭 420px 고정 → 화면 가운데 거대한 공백
  • 인쇄 PDF 끝에 항상 빈 페이지 발생, 파일명이 탭 제목("PDF 출력 — OpenMath")으로 저장됨

변경

시험지 조판 (preview/print 동일 마크업·스타일 공유)

  • 제목 박스: 상단 굵은 괘선 + 과목·단원 라벨 + 명조 제목 + 날짜·문항수
  • 인적사항 기입란: 학년·반 / 번호 / 이름 / 점수 칸막이 표
  • 본문: 명조(Noto Serif KR) 2단 컬럼 + 가운데 세로 괘선, 문항 간 넉넉한 여백
  • 객관식: lib/exam-choices.tssplitChoices 가 ①~⑤ 전부·순서대로 있을 때만 본문/보기 분리 → 보기를 별도 행으로 조판 (길면 세로 스택)
  • 빠른 정답: 별지(인쇄 시 새 페이지)의 격자 표, 객관식 정답은 보기 번호(③)로 매핑 (answerChoiceIndex, 모호하면 원본 값)
  • 미리보기: 실제 A4(794px) 시트를 ScaledSheet(ResizeObserver)로 폭에 맞춰 축소 — 인쇄 결과와 1:1 동일

인쇄 경로 수정

  • 화면 UI(.sub-nav/.page-body/.action-bar-sticky)를 print 에서 display:none — visibility 만으로는 박스 높이가 남아 항상 마지막에 빈 페이지가 생기던 기존 버그 제거
  • column-fill: balance 유지 — 가득 찬 페이지는 순차 채움, 마지막 페이지만 좌우 균형 (auto 로 두면 1페이지 미만 분량이 왼단에만 쏠림)
  • 인쇄 동안 document.title 을 시험지 제목으로 교체 → PDF 파일명에 반영 (afterprint 에 복원)

segmentAuto (결과/검증 화면도 함께 개선)

  • 조사가 수식에 붙은 토큰(2a(b-c)+b^{2}+c^{2}+12와, b>c인)을 수식+조사로 분리 — ^{2} 중괄호 원문이 그대로 노출되던 찐빠 제거
  • 부등호 비교(b>c)를 수식 신호로 인식, 10명의/5곳에 같은 일반 단어는 그대로 텍스트

검증 (Playwright, 실서버 27182)

24/24 체크 통과 — 시트 2장 구조, 머리/인적사항, 2단+괘선, 보기 5개 분리·마커, 정답 ③ 매핑, 옵션 토글(정답표 포함/미포함·셔플·제목 반영), 뷰포트 축소 시 배율 재계산, 인쇄 PDF 정확히 2페이지(빈 페이지 없음), 8문항 케이스 3페이지(1면 가득 → 2면 이월 → 정답 별지) 흐름 확인.

vitest 43/43 (exam-choices 11 + segmentAuto 회귀 3 추가), tsc·next build 통과.

🤖 Generated with Claude Code


Summary by cubic

Redesigned the exam preview and PDF to match a real Korean exam sheet, with a true A4 layout and 1:1 parity between preview and print. This improves readability and fixes the extra blank page in exported PDFs.

  • New Features

    • Real sheet layout: header box (subject, title, date), personal info row, and 2-column serif body with a center rule.
    • Multiple-choice handling: splitChoices separates ①–⑤ from the body only when all markers are in order; long choices stack vertically.
    • Quick answers sheet: separate page with a grid; answerChoiceIndex maps answers to markers (e.g., ③) when unambiguous.
    • Preview = print: ScaledSheet renders actual A4 (794px) and scales to fit; preview and print share the same markup/styles.
    • segmentAuto UX: splits particles glued to math (e.g., b^{2}-c^{2}의), recognizes inequalities like b>c, leaves words like “10명의” as text.
    • Tests: added exam-choices unit tests; expanded latex-renderer cases.
  • Bug Fixes

    • Removed trailing blank PDF page by hiding app UI during print with display:none.
    • Kept column-fill: balance so only the last page is balanced; prevents left-column bias for short sheets.
    • PDF filenames now use the exam title by temporarily setting document.title during print (restored after).

Written for commit 9f33878. Summary will update on new commits.

Review in cubic

시험지 미리보기/PDF 가 실제 한국 시험지 조판으로 출력되도록 전면 재설계.

- ExamSheet 재설계: 제목 박스(과목 라벨·발행 정보) + 인적사항 표
  (학년·반/번호/이름/점수) + 2단 컬럼·가운데 괘선(명조 본문) 조판
- 객관식 ①~⑤ 보기를 본문에서 분리해 별도 행으로 배치 (lib/exam-choices),
  빠른 정답표에서 정답 값을 보기 번호(③)로 매핑
- 빠른 정답을 별지(인쇄 시 새 페이지)의 격자 표로 분리
- 미리보기 = 인쇄와 동일 마크업을 ScaledSheet 로 축소 렌더 (A4 794px)
- 인쇄: 화면 UI 를 display:none 처리해 잔여 빈 페이지 제거,
  column-fill 균형 유지로 한 페이지 미만 분량의 왼단 쏠림 해소,
  인쇄 중 document.title 을 시험지 제목으로 바꿔 PDF 파일명 적용
- segmentAuto: 조사가 붙은 수식 토큰(x+2인, b^{2}-c^{2}의) 을 수식+조사로
  분리해 ^{} 원문 노출 제거, 부등호 비교(b>c)도 수식으로 인식

검증: Playwright 24/24 (미리보기 구조·보기 분리·정답 매핑·옵션 토글·
배율 재계산·인쇄 2페이지 PDF·8문항 3페이지 흐름), vitest 43/43, build 통과

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 6 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/web/components/math/latex-renderer.tsx
@smilebank7 smilebank7 enabled auto-merge (squash) June 11, 2026 06:48
@smilebank7 smilebank7 merged commit 8a23d84 into main Jun 11, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant