小例子

什么是 “小例子”?

一个小例子 (tiny example) is an example from which nothing can be removed.

为什么要创建小例子?

  • The simpler the example is, the quicker potential helpers can understand it and help you.
  • A tiny example demonstrates that you have put effort towards solving the problem yourself. When people send huge portions of input, it looks like they don’t care if we help them or not.
  • Creating a tiny example helps you to understand what is happening. Many false problem reports can be avoided by attempting to create a tiny example; if you cannot replicate a “bug” in a tiny example, then the problem was probably an insufficient understanding of LilyPond, not an actual bug!

如何创建小例子?

  • Include the \version number.
  • Make it small! Examples about spacing or page layout might require many bars of music, but most issues can be reproduced using less than a single measure.
  • When trying to create an example, try commenting out (% or %{ … %}) sections of your file. If you can comment something while still demonstrating the main idea, then remove the commented-material.
  • Avoid using complicated notes, keys or time signatures, unless the bug is about the behavior of those items.
  • Do not use \override or \set commands unless the bug is about those specific commands.
  • Optionally, attach an image showing the desired graphical output.

How tiny should they be?

Is the code below a minimal example?

\version "2.14.1"
\include "english.ly"

\score {
  \new Staff {
    \key d \major
    \numericTimeSignature
    \time 2/4
    <cs' d'' b''>16 <cs' d'' b''>8.
    %% Here: the tie on the D's looks funny
    %% Too tall? Left-hand endpoint is not aligned with the B tie?
    ~
    <cs' d'' b''>8 [ <b d'' a''> ]
  }
}

Well, it is not very big, but a truly minimal example is here:

\version "2.14.1"
{
  % middle tie looks funny here:
  <c' d'' b''>8. ~ <c' d'' b''>8
}

Very few tiny examples exceed 10 lines of code - quite often 4 lines are enough to demonstrate the problem!


其他语言:English, česky, deutsch, español, français, magyar, italiano, 日本語, nederlands
About automatic language selection.

Validation

非常感谢 webdev.nl 提供 lilypond.org 的主机空间。 Valid HTML 4.01 Transitional