타임라인 커넥터 조정

타임라인 커넥터 조정

저는 Arne Meier의 패키지를 사용하고 timeline있으며 다음에서 사용할 수 있는 타임라인 커넥터의 높이를 제어하고 싶습니다.GitHub. 타임라인 커넥터의 색상을 사용자 정의하는 옵션을 사용할 수 있습니다. 첨부된 그림을 조판하려면 다음 코드를 고려하십시오.


\documentclass{article}

\usepackage{timeline}

\definecolor{Wyellow}{cmyk}{0.15,0.05,0.84,0}
\definecolor{WrandomI}{cmyk}{0.66,0.07,0.13,0.0}
\definecolor{WrandomII}{cmyk}{0.33,0.04,0.44,0.05}
\definecolor{WrandomIII}{cmyk}{0.55,0.15,0.54,0.0}
\definecolor{WrandomIV}{cmyk}{0.44,0.65,0.14,0.1}

\begin{document}

For changing the height of the timeline connectors by using the \verb|timeline| package.\\

\begin{timeline}[Wyellow][WrandomI][WrandomII][WrandomIII][WrandomIV] %where WrandomIV is the color of the timeline connectors.
 \timebar[3]{|}{0}{2000}{2013}{1}{|}
  \entry{2002}{entry}{no opacity}
  \entryshift{2003}{entryshift}{no opacity}{4mm}
  \flipentry{2004}{flipentry}{no opacity}
%  \flipentry{2005}{Anotherflipentry}{no opacity}
%   \flipentry{2005}{Anotherflipentry-I}{no opacity}
   \flipentry{2005}{NoOverlapIsExpected}{no opacity}
  \flipentryshift{2005}{flipentryshift}{no opacity}{4mm}
  \entry[0.5]{2008}{entry}{opacity}
  \entryshift[0.5]{2009}{entryshift}{opacity}{4mm}
  \flipentry[0.5]{2010}{flipentry}{opacity}
  \flipentryshift[0.2]{2011}{flipentryshift}{opacity}{4mm}
\end{timeline}

\end{document}

다음과 같은 결과가 생성됩니다.

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

사진이 손으로 쓰여진 타임라인을 얻는 것이 기대됩니다.

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

타임라인 커넥터의 높이를 제어할 수 있으면 겹치는 것을 방지할 수 있습니다. 연결선은 동일한 아이디어를 나타내기 때문에 점(손으로 쓴 그림에서 연결선으로)은 반드시 점일 필요는 없습니다. 타임라인을 가져오는 데 사용되는 스타일 파일은 다음과 같습니다.

%This package is under the MIT License. Copyright (c) 2018 Arne Meier.
%
%Permission is hereby granted, free of charge, to any person obtaining a copy
%of this software and associated documentation files (the "Software"), to deal
%in the Software without restriction, including without limitation the rights
%to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%copies of the Software, and to permit persons to whom the Software is
%furnished to do so, subject to the following conditions:
%
%The above copyright notice and this permission notice shall be included in all
%copies or substantial portions of the Software.
%
%THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%SOFTWARE.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{timeline}[2018/04/03 timeline LaTeX package]

\RequirePackage{pgf}
\RequirePackage{tikz}
\RequirePackage{xparse}
\RequirePackage{ifthen}
\RequirePackage{calc} % for length maxof

\usetikzlibrary{arrows,shapes.misc,calc}

\definecolor{uniblue}{rgb}{0.29,0.45,0.72}
\colorlet{timeline-what}{orange!75!white}
\colorlet{timeline-what-fg}{black}
\colorlet{timeline-who}{uniblue!75!white}
\colorlet{timeline-who-fg}{white}
\colorlet{timeline-connector}{orange!75!white}

\newcommand{\timelineInnerBG}[1]{\colorlet{timeline-what}{#1}}
\newcommand{\timelineInnerFG}[1]{\colorlet{timeline-what-fg}{#1}}
\newcommand{\timelineOuterBG}[1]{\colorlet{timeline-who}{#1}}
\newcommand{\timelineOuterFG}[1]{\colorlet{timeline-who-fg}{#1}}
\newcommand{\timelineConnector}[1]{\colorlet{timeline-connector}{#1}}
\newlength\timelineEntryMinHeight

%\setlength\timelineEntryMinHeight{.4cm}

\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}


\newlength\boxheightright
\newlength\boxheightleft



%%%% This part of the code (until the end marker) is licensed under cc by-sa 3.0, Paul Gaborit (https://tex.stackexchange.com/users/14500/paul-gaborit)
%%%% It appeared as an answer to my question (https://tex.stackexchange.com/questions/424785/tikz-get-current-unit-length-of-x-coordinate) on TeX.StackExchange.
\def\getxlengthincm#1{
  \path let \p{x}=(1,0), \n{xlencm}={scalar(veclen(\x{x},\y{x})/1cm)}
  in \pgfextra{\xdef#1{\n{xlencm}}};
}
%%% End Marker


\NewDocumentEnvironment{timeline}{O {orange!75!white} O {black} O {uniblue!75!white} O {white} O {orange!75!white}}{%
\begin{tikzpicture}%
\timelineInnerBG{#1}%
\timelineInnerFG{#2}%
\timelineOuterBG{#3}%
\timelineOuterFG{#4}%
\IfNoValueTF{#5}{
    \timelineConnector{#1}%
}{
    \timelineConnector{#5}%
}
}{\end{tikzpicture}}

% \entrytemplate*type{year}{what}{where}{shift}
\NewDocumentCommand{\entrytemplate}{s m m m m o}{`
\pgfmathsetmacro{\yshiftval}{\IfBooleanTF{#1}{-0.4cm}{0.3cm}\IfValueT{#6}{-#6}}
\pgfmathsetmacro{\xshiftval}{\IfBooleanTF{#1}{-0.3cm}{0.2cm}\IfValueT{#6}{+#6}}
\setlength{\timelineEntryMinHeight}{\maxof{\heightof{#4}}{\heightof{#5}}+1.5mm}
    % label
    \begin{pgfonlayer}{main}

        % back ground white
        \node[anchor=\IfBooleanTF{#1}{east}{west},
          rotate=45,
          rounded rectangle,
          rounded rectangle \IfBooleanTF{#1}{west}{east} arc=none,
          font=\color{white}\footnotesize,
          fill=white,
          inner sep=.25mm,
          yshift=\yshiftval,
          xshift=\xshiftval,
          minimum height=\timelineEntryMinHeight,
          align=left] (#3-label) at (#3) {#4};
        \node[anchor=\IfBooleanTF{#1}{east}{west},
          rotate=45,
          rounded rectangle,
          rounded rectangle \IfBooleanTF{#1}{east}{west} arc=none,
          fill=white,
          inner sep=.25mm,
          font=\color{white}\footnotesize,
          minimum height=\timelineEntryMinHeight,
          align=left] at (#3-label.\IfBooleanTF{#1}{west}{east}) {#5};

        % first arg
        \node[anchor=\IfBooleanTF{#1}{east}{west},
          rotate=45,
          rounded rectangle,
          rounded rectangle \IfBooleanTF{#1}{west}{east} arc=none,
          font=\color{timeline-what-fg}\footnotesize,
          opacity = #2,
          fill=timeline-what,
          inner sep=.25mm,
          yshift=\yshiftval,
          xshift=\xshiftval,
          minimum height=\timelineEntryMinHeight,
          align=left] (#3-label) at (#3) {#4};
        % second arg
        \node[anchor=\IfBooleanTF{#1}{east}{west},
          rotate=45,
          rounded rectangle,
          rounded rectangle \IfBooleanTF{#1}{east}{west} arc=none,
          fill=timeline-who,
          opacity = #2,
          inner sep=.25mm,
          font=\color{timeline-who-fg}\footnotesize,
          minimum height=\timelineEntryMinHeight,
          align=left] at (#3-label.\IfBooleanTF{#1}{west}{east}) {#5};
    \end{pgfonlayer}
    % connector
    \begin{pgfonlayer}{background}
        \node[circle,inner sep=0mm,minimum width=1mm,fill=timeline-connector, opacity = #2] at (#3) {};
        \path let \p1 = (#3) in node (#3-goal) at (\x1,\IfBooleanTF{#1}{-1.15}{.85}) {};
        \draw[ultra thick,timeline-connector, opacity = #2] (#3.center) 
            \IfNoValueTF{#6}%
            { -- (#3.center|-#3-label.\IfBooleanTF{#1}{south east}{north west})}%
            { |- ([xshift=1mm]#3-label.\IfBooleanTF{#1}{north east}{west})};
    \end{pgfonlayer}
}

\newcommand{\entry}[4][1]{
    \entrytemplate{#1}{#2}{#3}{#4}
}

\newcommand{\flipentry}[4][1]{
    \entrytemplate*{#1}{#2}{#3}{#4}
}

\newcommand{\entryshift}[5][1]{
    \entrytemplate{#1}{#2}{#3}{#4}[#5]
}

\newcommand{\flipentryshift}[5][1]{
    \entrytemplate*{#1}{#2}{#3}{#4}[#5]
}


% \timeline{intervalyear}{startsymbol}{startX}{fromyear}{toyear}{intervallength}{endsymbol}
\newcommand{\timebar}[7][5]{
    \pgfmathsetmacro{\timelineIntervalLength}{(#5-#4)+1} % length of interval with 1x at the end
    \ifthenelse{\equal{#2}{|}}{\pgfmathsetmacro{\timelineOffset}{-.25}}{\pgfmathsetmacro{\timelineOffset}{0}}
    \draw[#2-#7] (#3+\timelineOffset,0) -- (#3+#6*\timelineIntervalLength,0);
    \foreach \l [count=\li] in {#4,...,#5}{
        \pgfmathsetmacro{\timelineX}{#3+(\li-1)*#6} % counter \li starts at 1, thus '-1' required. 
        \pgfmathsetmacro{\timelineLengthY}{mod(\l,#1)==0?2:1} % if its divisible by 5 
        \draw (\timelineX,.\timelineLengthY) -- (\timelineX,-.\timelineLengthY) node[font=\footnotesize,yshift=-1.15mm]  {\ifthenelse{\timelineLengthY=2}{\l}{}};
        \node (\l) at (\timelineX,0) {};
    }

    \getxlengthincm{\myxlength}


    \pgfmathsetmacro{\timebarunit}{#6/12}
    \foreach \y in {#4,...,#5}{
        \foreach \m in {1,...,12}{
            \node[xshift=1cm*\myxlength*\timebarunit*(\m-1)] (\y-\m) at (\y) {};
        }
    }
}

% \timelinezigzag{start-x-coordinate}
\newcommand{\zigzag}[1]{
    \draw[-] (#1,0) -- (#1+0.1,-.4) -- (#1+0.2,.4) -- (#1+0.3,0) -- (#1+0.4,0);
}

\endinput

타임라인의 양쪽(위쪽과 아래쪽)에 레이블을 지정하는 측면은 이미 고려되었습니다. 그러나 손으로 쓴 그림에는 존재하지 않습니다. 레이블 각도를 변경하려면 스타일 파일을 변경해야 합니다.

이 질문을 게시하는 주된 이유는 레이블이 겹치는 것을 피하기 위해 타임라인 커넥터의 높이 조정에 대한 권장 사항을 얻기 위한 것입니다(예를 들어 이 패키지를 사용하면 같은 연도에 같은 위치에서 두 개의 이벤트를 생성할 수 없습니다). 패키지에는 컴파일할 수 있는 매뉴얼도 있으며 매뉴얼에는 관련 있는 것으로 보이는 명령이 표시됩니다. 그러나 이 명령을 사용하여 레이블 높이를 제어하는 ​​작업은 아직 완료되지 않았습니다.

\maxof{\heightof{#3}}{\heightof{#4}}+1.5mm

'커넥터'라는 단어의 철자를 사용하는 것과 같이 timeline의 스타일 파일에 몇 가지 변경 사항이 적용되었습니다. 원하는 결과를 얻기 위해 파일 을 수정하라는 제안을 주시면 timeline.sty감사하겠습니다.

건배!

관련 정보