垂直诗歌定位的黄金比例

垂直诗歌定位的黄金比例

在一页纸上,是否可以将一首诗垂直放置在黄金比例中?看看草图就知道我的意思了。黄金比例中的诗歌

垂直红线是按照黄金比例划分的。诗歌边界框的垂直中心应该是垂直红线划分的点。

您能给出一个可行的 LaTeX 示例吗?除了技术可行性之外,将诗歌放在黄金比例中是个好主意吗?

编辑:

黄金比例 2 中的诗歌

除了使用诗歌的中心之外,诗歌的边界框也可以用黄金分割率来划分。

答案1

以下代码显示了您的第一个问题的答案(编辑之前):

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\def\Poem#1#2#3#4{ % width, title, content, author
\begin{tikzpicture}[overlay, remember picture]
\node[text width=#1] (poem) 
    at ($(current page.south)!.61803399!(current page.north)$)
    {#3};
\node[below=of poem.south east, left] {\emph{#4}};
\node[above=of poem.north west, right] {\textbf{\textsf{{\Large#2}}}};
\end{tikzpicture}
\newpage
}

\def\ShowMarks{ % draws frame around page, and horizontal rule at golden ratio
\begin{tikzpicture}[overlay, remember picture,red]
\draw (current page.south west) rectangle (current page.north east);
\draw ($(current page.south west)!.61803399!(current page.north west)$) --
      ($(current page.south east)!.61803399!(current page.north east)$);
\end{tikzpicture}
}


\begin{document}
\ShowMarks{}%
\Poem{7cm}{Abendlied}{%
    Über allen Gipfeln\\
    Its Ruh,\\
    In allen Wipfeln\\
    Spürest du\\
    Kaum einen Hauch;\\
    Die Vögelein schweigen im Walde\\
    Warte nur, balde\\
    Ruhest Du auch.\\
}{Johan Wolfgang von Goethe}
\end{document}

结果是(你必须编译两次,这是绝对 TikZ 定位的工作方式):

输出

更新 要回答第二个问题,应该定义一个新的锚点,使其位于诗歌内部的“黄金比例”点,而不是诗歌的中心。这很棘手,但可以做到。但是,请注意,必须事先指定诗歌的宽度,如果您指定的宽度不紧,则所有黄金比例计算都毫无意义。

这是我的解决方案(我添加了一个蓝色阴影来查看诗歌框,您可以禁用它并删除该fill=blue!20选项):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\makeatletter
\pgfdeclareshape{golden anchored}
{
  \inheritsavedanchors[from=rectangle] % this is nearly a rectangle 
  \inheritanchorborder[from=rectangle]
  \inheritanchor[from=rectangle]{center}
  \inheritanchor[from=rectangle]{north}
  \inheritanchor[from=rectangle]{north east}
  \inheritanchor[from=rectangle]{north west}
  \inheritanchor[from=rectangle]{south}
  \inheritanchor[from=rectangle]{south east}
  \inheritanchor[from=rectangle]{south west}
  \inheritanchor[from=rectangle]{west}
  \inheritanchor[from=rectangle]{east}
  \inheritbackgroundpath[from=rectangle]
  \savedanchor{\goldenpoint}{
    \pgf@y=1\ht\pgfnodeparttextbox
    \advance\pgf@y by 1\dp\pgfnodeparttextbox
    \pgf@y=.61803399\pgf@y
    \advance\pgf@y by -1\dp\pgfnodeparttextbox
    \pgf@x=.381966011\wd\pgfnodeparttextbox
  }
  \anchor{golden}{ \goldenpoint }
  \anchor{text}{\pgfpoint{0}{0}}
}
\makeatother

\def\Poem#1#2#3#4{ % width, title, content, author
\begin{tikzpicture}[overlay, remember picture]
\node[text width=#1, golden anchored, anchor=golden, fill=blue!20] (poem)
    at ($(current page.south)!.61803399!(current page.north)$)
    {#3};
\node[below=of poem.south east, left] {\emph{#4}};
\node[above=of poem.north west, right] {\textbf{\textsf{{\Large#2}}}};
\end{tikzpicture}
\newpage
}

\def\ShowMarks{ % draws frame around page, and horizontal rule at golden ratio
\begin{tikzpicture}[overlay, remember picture,red]
\draw (current page.south west) rectangle (current page.north east);
\draw ($(current page.south west)!.61803399!(current page.north west)$) --
      ($(current page.south east)!.61803399!(current page.north east)$);
\draw (current page.south) -- (current page.north);
\end{tikzpicture}
}
\begin{document}
\Poem{5.5cm}{Abendlied}{%
    Über allen Gipfeln\\
    Its Ruh,\\
    In allen Wipfeln\\
    Spürest du\\
    Kaum einen Hauch;\\
    Die Vögelein schweigen im Walde\\
    Warte nur, balde\\
    Ruhest Du auch.\\
\ShowMarks{}%
}{Johan Wolfgang von Goethe}
\end{document}

结果(记住编译两次):

输出

答案2

我找到了一个似乎更简单的解决方案。也可以看看如何删除 \vspace*{0em} 和 \section 之间的多余空格?

\documentclass{scrbook}

\KOMAoptions{fontsize=10pt, paper=14cm:21cm, DIV=calc, pagesize=auto, BCOR=5mm, twoside=true, titlepage=true}

\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage{calc}
\usepackage{verse}
% shows frames of type area (good for debugging)
\usepackage{showframe}

\makeatletter
% change definition of \section; remove space before
\renewcommand{\section}{\@startsection{section}{1}{\z@}%
  {-0.01ex}%
  {2.3ex \@plus.2ex}%
  {\ifnum \scr@compatibility>\@nameuse{scr@[email protected]}\relax
    \setlength{\parfillskip}{\z@ plus 1fil}\fi
    \raggedsection\normalfont\sectfont\nobreak\size@section}%
}
\makeatother


\begin{document}

% create a sample poem
\newcommand{\testPoem}{%
\addtokomafont{section}{\centering}%
\addsec{Abendlied}%
\settowidth{\versewidth}{Kaum einen Hauch;}%
\begin{verse}[\versewidth]%
Über allen Gipfeln\\*
Ist Ruh,\\*
In allen Wipfeln\\*
Spürest du\\*
Kaum einen Hauch;\\*
Die Vögelein schweigen im Walde.\\*
Warte nur, balde\\*
Ruhest du auch.
\end{verse}%
\unskip\vspace{1em}\hfill\hbox{Johann Wolfgang von Goethe}\hspace*{1em}%
}

% get the hight of the poem
\newlength{\heightOfPoem}
\settoheight{\heightOfPoem}{\vbox{\testPoem}}

% calculate distance from type area with Golden Ratio
\newlength{\poemSpaceBefore}
\setlength{\poemSpaceBefore}{0.38196601\textheight{}-0.38196601\heightOfPoem{}-\topskip}

% create golden space
\vspace*{\poemSpaceBefore}

% output poem
\testPoem

\clearpage

Poem hight: \the\heightOfPoem{}, Space before Poem: \the\poemSpaceBefore{}

\end{document}

结果如下:

黄金比例的诗歌位置

相关内容