편집 가능한 달력 생성기

편집 가능한 달력 생성기

LaTeX에서 다음과 같이 달력 페이지를 생성하는 간단한 방법을 찾고 있습니다.http://www.latextemplates.com/template/monthly-calendar- 그러나 달력 정렬에 대한 "올바른" 요일에 대해 생각할 필요가 없습니다. 날짜(예: 2017년 2월)를 지정하여 페이지를 자동으로 올바르게 레이아웃하는 것이 가능해야 합니다.

더욱이, 그것은가능하다편집하다LaTeX에서 쉽게 달력의 텍스트를그래서 이것은 단지 인쇄하고 잉크를 채우는 용도가 아닙니다. 제 생각에는 2단계 프로세스가 가장 좋을 것 같습니다.LaTeX 파일을 생성합니다매일 항목을 입력한 다음 특정 날짜의 일정을 편집할 수 있습니다. 또 다른 가능성은 캘린더 항목을 더 간단한 텍스트 형식으로 갖는 것입니다(git 버전 제어에서 이를 갖는 것이 가능해야 함).구문 분석 및 삽입라텍스 파일에서 올바르게 가져옵니다.

답변1

취득내 대답다른 질문에서 다음을 사용하여 조정합니다.

\newcommand*\events{%
  \month-\day / Today,
  2023-04-10 / A very long text with math $e = mc^2$ and so much text that the whole box and its five lines are needed,
  12-31 / New Year's Eve,
  2023-04-11 / A B C D E F G H I J K L M N O P Q R S T U V W X Y Z A B C D E F G H I J K L M N O P Q R S T U V W X Y
}
\tikzset{
  day event/.style={
    node contents={%
      \parshape 5 0pt \dimexpr\textwidth-1.9em 0pt \dimexpr\textwidth-1.9em
      0pt \textwidth 0pt \textwidth 0pt \textwidth #1\par},
    text height=+1em,
    text depth=\pgfkeysvalueof{/pgf/minimum height}-2*(\pgfkeysvalueof{/pgf/inner ysep})-1em,
    text width=\pgfkeysvalueof{/pgf/minimum width}-2*(\pgfkeysvalueof{/pgf/inner xsep}),
    align=left,
  },
  events/.style args={#1/#2}{
    if = {(equals=#1) [every day/.append style={day event={#2}}]}
  }
}

어디에 텍스트 부분을 요일 노드에 추가하는 \events노드 상자 안에 조판하려는 항목의 목록이 있습니다. 여기서 솔루션을 사용하여 오른쪽(요일 번호가 있는 곳) 영역을 잘라냅니다. .events\parshape

지금 필요한 것은 \events매크로를 채우는 것뿐입니다.

이것을 zjr 접근 방식과 결합할 수 있습니다.다른 대답으로여기에서는 다양한 매크로를 사용하고 다양한 스타일을 허용하여 다양한 유형의 이벤트를 캘린더에 추가할 수 있도록 했습니다.

하지만 하루에 하나의 이벤트만 갖도록 하십시오. 그렇지 않으면 다음과 같은 것이 필요합니다.[1]또는[2].

해결 방법도 있습니다.달력이 늘어납니다항상 페이지를 채우도록 말이죠.


구현 은 오른쪽의 추가 패딩으로 \parshape사용하기 때문에 다소 초보적입니다 . 모서리에 있는 요일 텍스트의 너비를 측정하여 사용하는 것이 더 현명할 것입니다.1.9em

또한 메인 루프를 조정하고 과도한 hbox 경고를 억제하기 위해 trim left및 추가했습니다.trim right

암호

\documentclass[a4paper,landscape]{article}
\usepackage[margin={1cm},noheadfoot]{geometry}
\renewcommand*\thepage{}
\usepackage{libertine}
\usepackage{tikz}
\usetikzlibrary{calendar}
\tikzset{
  every weekday/.style={
    anchor=south west, black,
    name=weekday-\pgfcalendarcurrentmonth-\pgfcalendarcurrentweekday,
    node contents=\%wt},
  weekday above/.style={
    if = {(day of month=1) [days={append after command={
          node [at={(\tikzlastnode.north west)},
                alias=@firstweekday,
                every weekday]}}]},
    if = {(day of month=2, day of month=3, day of month=4, day of month=5, day of month=6, day of month=7) [
          days={append after command={
          node [at={(@firstweekday.south west-|\tikzlastnode.south west)}, every weekday]}}]}},
  wall calendar/.style={
    week list, weekday above, day text=,
    day and weekday/.style={
      draw, outer sep=+0pt,
      minimum width=\linewidth/7,
      minimum height=+.125\textheight},
    day xshift=\linewidth/7,
    day yshift=\textheight/8,
    every day label/.style={
      anchor=north east,
      font=\Large\itshape,
      node contents={\%d=},
      inner sep=+.7em},
    every day/.append style={
      day and weekday,
      anchor=center,
      label={[every day label]north east:}},
    every weekday/.append style={
      day and weekday,
      minimum height=+2em}}}
\newcommand*\Year{2023}
\newcommand*\events{%
  \month-\day / Today,
  2023-04-10 / A very long text with math $e = mc^2$ and so much text that the whole box and its five lines are needed,
  12-31 / New Year's Eve,
  2023-04-11 / A B C D E F G H I J K L M N O P Q R S T U V W X Y Z A B C D E F G H I J K L M N O P Q R S T U V W X Y
}
\tikzset{
  day event/.style={
    node contents={%
      \parshape 5 0pt \dimexpr\textwidth-1.9em 0pt \dimexpr\textwidth-1.9em
      0pt \textwidth 0pt \textwidth 0pt \textwidth #1\par},
    text height=+1em,
    text depth=\pgfkeysvalueof{/pgf/minimum height}-2*(\pgfkeysvalueof{/pgf/inner ysep})-1em,
    text width=\pgfkeysvalueof{/pgf/minimum width}-2*(\pgfkeysvalueof{/pgf/inner xsep}),
    align=left,
  },
  events/.style args={#1/#2}{
    if = {(equals=#1) [every day/.append style={day event={#2}}]}
  }
}
\begin{document}\sffamily
\centering
\foreach \mon in {01,0...,09,10,11,12}{% leading zero for trim left/right
  {\Huge \pgfcalendarmonthname{\mon}\par}
  {\huge \Year\par}
  \vspace{2em}
  \tikz[trim left=(weekday-\mon-0.west), trim right=(weekday-\mon-6.east)]
    \calendar[
      dates=\Year-\mon-01 to \Year-\mon-last,
      wall calendar,
      events/.list/.expand once=\events,
    ];

\pagebreak}
\end{document}

산출

여기에 이미지 설명을 입력하세요

관련 정보