スタンドアロンクラスで chronosys パッケージを使用する

スタンドアロンクラスで chronosys パッケージを使用する

Beamer プレゼンテーションにタイムラインを含めたいです。そのために、次のコードを書きました:

\documentclass{article}

\usepackage{chronosys}
\usepackage{xcolor}

\definecolor{first-period}{HTML}{b3e2cd}
\definecolor{second-period}{HTML}{fdcdac}
\definecolor{third-period}{HTML}{cbd5e8}

\begin{document}

\fontfamily{cmss}\selectfont
\definechronoevent{MySmallerEvent}[textstyle=\footnotesize,datestyle=\footnotesize]

\startchronology[startyear=1980,
  stopyear=2020,
  dates=false,
  color=third-period,
  height=7ex]

\chronoperiode[color=first-period, dates=false]{1980}{2000}{}
\chronoperiode[color=second-period, dates=false]{2000}{2010}{}
\chronoperiode[color=third-period, dates=false]{2010}{2020}{}

\chronoMySmallerEvent[textwidth=5ex]{1990}{First event}
\chronoMySmallerEvent[textwidth=8ex]{2005}{Second event}
\chronoMySmallerEvent[textwidth=5ex]{2015}{Third event}

\stopchronology

\end{document}

出力

タイムライン 次に、適切なフレームにこれを配置します。

\includegraphics[width=0.8\textwidth, keepaspectratio, trim = 45mm 210mm 45mm 40mm, clip]{timeline.pdf}

このアプローチの問題点は、トリム値を手動で調整する必要があり、時間がかかることです。

standaloneの代わりにを使用してタイムラインを作成することで、図をトリミングする必要を回避できると考えましたarticleが、次のような結果になりました。

! Missing \endgroup inserted.
<inserted text> 
                \endgroup 
l.29 \stopchronology
                    
? 
! Missing \endgroup inserted.
<inserted text> 
                \endgroup 
l.29 \stopchronology
                    
? 
! Missing } inserted.
<inserted text> 
                }
l.29 \stopchronology
                    
? 
! Extra \endgroup.
<recently read> \endgroup 
                          
l.29 \stopchronology
                    
? 
! Extra \endgroup.
\color@endgroup ->\endgraf \endgroup 
                                     
l.31 \end{document}
                   
? 
! Too many }'s.
\endsa@boxit ...dvarwidth \color@endgroup \egroup 
                                                  
l.31 \end{document}
                   
? 

この問題を解決する方法について何かアイデアはありますか?

答え1

まず、chronology はタイムラインにフィットするようです\textwidth。そのため、ミニページ内に配置する必要があります。次に、境界ボックスが作成されないため、スタンドアロンでは右側の一部が切り取られます。そのため、\hrule高さを変更せずに幅を変更するために を使用しました (\ruleは余分な空白行を追加します)。

\documentclass{standalone}

\usepackage{chronosys}
\usepackage{xcolor}

\definecolor{first-period}{HTML}{b3e2cd}
\definecolor{second-period}{HTML}{fdcdac}
\definecolor{third-period}{HTML}{cbd5e8}

\begin{document}
\begin{minipage}[t][1in][s]{4in}% set height to 1 in, width to 4 in
\hrule width\textwidth height0pt%bounding box?
\fontfamily{cmss}\selectfont
\definechronoevent{MySmallerEvent}[textstyle=\footnotesize,datestyle=\footnotesize]
%
\startchronology[startyear=1980,
  stopyear=2020,
  dates=false,
  color=third-period,
  height=7ex]
%
\chronoperiode[color=first-period, dates=false]{1980}{2000}{}
\chronoperiode[color=second-period, dates=false]{2000}{2010}{}
\chronoperiode[color=third-period, dates=false]{2010}{2020}{}
%
\chronoMySmallerEvent[textwidth=5ex]{1990}{First event}
\chronoMySmallerEvent[textwidth=8ex]{2005}{Second event}
\chronoMySmallerEvent[textwidth=5ex]{2015}{Third event}
%
\stopchronology
\vss% shrink bottom
\end{minipage}
\end{document}

関連情報