更新1

更新1

我在 Ubuntu 14.04 上使用 MuseScore 1.3 來寫我的樂譜。然後我將它們儲存為 LilyPond 文件,並使用 將它們包含在我的 tex 文件中\lilypondfile,如下所示:

\documentclass[a4paper]{article}

\begin{document}

Larger examples can be put into a separate file, and introduced with \verb+\lilypondfile+.

\lilypondfile[quote,noindent]{scores/Exercise_1.05.ly}

\end{document}

然後,為了編譯,我這樣做:

$ lilypond-book --pdf solfeo.lytex
$ xelatex solfeo.tex

但是,插入的樂譜寬度不適合文檔,並且超出了頁面的限制。

分數不合適的截圖

另外,lilypond-book似乎忽略了我在 中傳遞給它的設定\lilypondfile[quote,noindent]{scores/Exercise_1.05.ly}。如果我理解得很好,quote請在樂譜之前列印音符並noindent刪除第一行的縮排。它既沒有引用註釋,也沒有刪除縮排。

我是 Lilypond 的新手,我嘗試過更改 MuseScore 中文件的邊距,並且我也嘗試了一些 tex 命令,但我找不到使其適合的方法。如果我用 PDF 編譯 ly 檔案lilypond看起來很完美(但在這種情況下我只能得到分數)。只有當我將ly文件嵌入lytex文件中時,樂譜才會超出頁邊距。非常感謝您的建議或更正。我究竟做錯了什麼?謝謝!

PD 這是 MuseScore 產生的 ly 程式碼:

%=============================================
%   created by MuseScore Version: 1.3
%=============================================

\version "2.12.0"



#(set-default-paper-size "a4")

\paper {
  line-width    = 190\mm
  left-margin   = 10\mm
  top-margin    = 10\mm
  bottom-margin = 20\mm
  %%indent = 0 \mm 
  %%set to ##t if your score is less than one page: 
  ragged-last-bottom = ##t 
  ragged-bottom = ##f  
  %% in orchestral scores you probably want the two bold slashes 
  %% separating the systems: so uncomment the following line: 
  %% system-separator-markup = \slashSeparator 
  }

\header {
    }

AvoiceAA = \relative c'{
    \set Staff.instrumentName = #""
    \set Staff.shortInstrumentName = #""
    \clef treble
    %staffkeysig
    \key c \major 
    %barkeysig: 
    \key c \major 
    %bartimesig: 
    \time 4/4 
    \tempo "Andante" 4 = 96  a'2 a      | % 1
    a r      | % 2
    r a      | % 3
    r a      | % 4
    a r      | % 5
    a a      | % 6
    a a4 a      | % 7
    a r a2      | % 8
    r4 a a2      | % 9
    a4 r2 a4      | % 10
    a2 r4 a \bar "|."     | % 11
    a2 r \bar "|." 
}% end of last bar in partorvoice


\score { 
    << 
        \context Staff = ApartA << 
            \context Voice = AvoiceAA \AvoiceAA
        >>




      \set Score.skipBars = ##t
      %%\set Score.melismaBusyProperties = #'()
      \override Score.BarNumber #'break-visibility = #end-of-line-invisible
     %%every bar is numbered.!!!
      %% remove previous line to get barnumbers only at beginning of system.
       #(set-accidental-style 'modern-cautionary)
      \set Score.markFormatter = #format-mark-box-letters %%boxed rehearsal-marks
       \override Score.TimeSignature #'style = #'() %%makes timesigs always numerical
      %% remove previous line to get cut-time/alla breve or common time 
      \set Score.pedalSustainStyle = #'mixed 
       %% make spanners comprise the note it end on, so that there is no doubt that this note is included.
       \override Score.TrillSpanner #'(bound-details right padding) = #-2
      \override Score.TextSpanner #'(bound-details right padding) = #-1
      %% Lilypond's normal textspanners are too weak:  
      \override Score.TextSpanner #'dash-period = #1
      \override Score.TextSpanner #'dash-fraction = #0.5
      %% lilypond chordname font, like mscore jazzfont, is both far too big and extremely ugly ([email protected]):
      \override Score.ChordName #'font-family = #'roman 
      \override Score.ChordName #'font-size =#0 
      %% In my experience the normal thing in printed scores is maj7 and not the triangle. (olagunde):
      \set Score.majorSevenSymbol = \markup {maj7}
  >>

  %% Boosey and Hawkes, and Peters, have barlines spanning all staff-groups in a score,
  %% Eulenburg and Philharmonia, like Lilypond, have no barlines between staffgroups.
  %% If you want the Eulenburg/Lilypond style, comment out the following line:
  \layout {\context {\Score \consists Span_bar_engraver}}
}%% end of score-block 

#(set-global-staff-size 20)

更新1

我正在貼上 的編譯輸出lilypond-book,儘管我不確定它對您有多大用處,因為它是西班牙語的:

$ lilypond-book --pdf solfeo.lytex

lilypond-book(GNU LilyPond)2.18.2
正在閱讀 solfeo.lytex...
在檔案“/tmp/tmpN3IGhy.tex”上執行“pdflatex”以偵測預設頁面設定。

解剖...
寫片段...
加工...
奔跑的睡蓮池...
GNU LilyPond 2.18.2
Procesando «snippet-map-3001632500490555250.ly»
阿納利贊多...
Procesando «solfeo.lytex»
阿納利贊多...
Renombrando la entrada a: «scores/Exercise_1.05.ly»
音樂詮釋...[8]
圖形設計前的準備工作
線條計算...
迪布揚多洛斯系統...
Salida de la página hacia «ba/lily-399811ac.eps»...
Convirtiendo en «ba/lily-399811ac.pdf»...
Salida de la página hacia «ba/lily-399811ac-1.eps»...
Salida de la página hacia «ba/lily-399811ac-2.eps»...
Convirtiendo en «ba/lily-399811ac-1.pdf»...
Convirtiendo en «ba/lily-399811ac-2.pdf»...
寫入 «ba/lily-399811ac-systems.texi»...
寫入 «ba/lily-399811ac-systems.tex»...
寫入 «ba/lily-399811ac-systems.count»...
恩霍拉布埃納。 La compilación se ha completado satisfactoriamente.
正在連結檔案...
正在編譯 /media/admin/DATOS/Dropbox/code/solfeo-book/out/solfeo.tex...
寫入“/media/admin/DATOS/Dropbox/code/solfeo-book/out/solfeo.tex”...

我希望這有幫助

更新2

我嘗試過另一種方法。我已從 MuseScore 匯出到 MusicXML。然後我用過:

musicxml2ly Exercise_1.05.xml -o Exercise_1.05_.ly

.xml文件轉換為.ly文件,並再次編譯。寬度仍然不適合屏幕=(我已經沒有想法了。

答案1

lilypond-book只是一種複雜的方法,為每個範例產生裁剪後的 PDF 影像,然後自動將它們包含在 LaTeX 檔案中。

lilypond在我看來,您可以透過使用 EPS 後端來產生裁剪為音樂大小的圖像來手動完成相同的操作,這更簡單。

那麼唯一真正的 LaTeX 元件就是使用該套件包含 PDF 圖像graphicx重點是您可以在來源中設定圖像的寬度lilypond,然後將其以其自然大小包含在 LaTeX 文件中。

在下面的範例中,您可以在所有音樂範例原始檔中使用\include該文件,編譯後它們將產生裁剪後的 PDF。example.ly.ly


本範例的三個檔案:

    1. example.ly-- 裁切音樂範例的頁面佈局lilypond
    1. score.ly-- 您的音樂範例,\includes頁面佈局由其命令example.ly
    1. analysis.tex-- 範例 TeX 檔案顯示如何包含影像。

文件1,example.ly

% STYLE SHEET FOR IN-TEXT EXAMPLES

\version "2.18.2"

#( ly:set-option 'backend 'eps )

\paper{
  indent = 0.75\in
  line-width = 6.5\in
    top-margin = 1\in
    bottom-margin = 2\in
    ragged-bottom = ##t
    ragged-last-bottom = ##t
  oddFooterMarkup=##f
  oddHeaderMarkup=##f
  bookTitleMarkup = ##f
  scoreTitleMarkup = ##f
}

文件2——score.ly

\version "2.18.2"
\include "example.ly"

Music = { 
    \clef "tenor"
    \time 3/4
    c4 d4 e4 |
    f2 g4~ |
    g4 a2 |
    b2. |
    c'2. |
    \bar "||"
}

\score{
    <<
        \new Staff { \Music }
    >>
    \layout {}
}

文件 3 -analysis.tex

\documentclass{article}
\usepackage[letterpaper,margin=1in]{geometry}
\usepackage{graphicx}
\usepackage{lipsum}

\begin{document}

\section{Music Example}

\lipsum[1]
See example~\ref{fig:score1}.

%*******************
\begin{figure}
\includegraphics{score}\centering
\caption{Score example 1}
\label{fig:score1}
\end{figure}
%*******************

\lipsum[2]


\end{document}

在此輸入影像描述

答案2

我知道這個老問題,但我今天正在尋找解決方案,所以我想仍然相關。這是我正在使用的解決方案,我只是將其放在文件的序言中。

\usepackage{graphicx}
\setkeys{Gin}{width=\linewidth}

這是有效的,因為在幕後正在使用的是\includegraphics,我只是將這些圖像的預設寬度設定為一條線的寬度,這樣它就不會溢出頁面。

相關內容