Posts

LaTeX, three packages for one document

Image
LaTeX, three packages for one document The standard version of LaTeX has a “state of the art” typographic quality, suitable for any type of document. For those who want to try different typographical solutions it is, however, possible to use packages that modify the basic settings. The result may be more or less preferable to the standard version but it is, however, interesting to make some comparative tests. In this article I compare the title page of an agreement document in the standard version, in the version named koma-script and in the further version named ArsClassica . At the end of every paragraph I report the relative preambles used for the generation of every version. The images of the three title pages were framed with the open-source software Digikam . LaTeX in standard version Below I report the title page of a agreement written in standard LaTeX The page layout is elegant, well-kept and well-proportioned: perfectly suited to the formal rig...

Vim: copy text directly to the operating system clipboard

Image
Cut and copy in Vim: introduction As an introduction to the topic regarding the Cut, Copy and Paste functions in Vim you can read a previous article of mine . The subject of the current article is, instead, a Vim functionality I discovered while reading this page and which is closely related to the previous topic. Vim can directly redirect cut and copy operations performed on texts to the system memory register ( clipboard ). Therefore, it is not necessary to select the text first, in order to copy it into the clipboard, as is the experience with other writing systems on digital devices. In short: you simply direct the operation (the same as normally used for the specific command) to the operating system memory ( clipboard ) (or, to be more precise to the + register). This feature saves you time when exchanging data from Vim to other applications in the operating system. Vim: examples of direct sending to system memory ( clipboard ) A few examples can make it clear. Fi...

Using Emacs to write scores in LilyPond

Image
About LilyPond LilyPond is a language for producing elegant musical scores, structurally similar to LaTeX with which it can integrate to generate documents containing text and music (for the integration between LilyPond and LaTeX you can read to this article of mine .) Also in LilyPond, as in LaTeX, you can write the content with various editors. Very useful, especially to learn the syntax, is the editor called Frescobaldi . For those who have already learned the syntax, it may be useful, instead, to use the endless potential of Emacs and Vim , This article is dedicated to Emacs. A similar article dedicated to Vim is published here . In the LilyPond user manual, currently at version 2.22, there are some specific indications for use with Emacs (see next paragraph). Here you will find some additional information about the configuration and interface of Emacs dedicated to LilyPond. All steps have been tested on two Linux distributions: Ubuntu 21.10 and Arch. The official Lil...

Using Vim to write scores in LilyPond

Image
About LilyPond LilyPond is a language for producing elegant musical scores, structurally similar to LaTeX with which it can integrate to generate documents containing text and music (for the integration between LilyPond and LaTeX you can read to this article of mine .) Also in LilyPond, as in LaTeX, you can write the content with various editors. Very useful, especially to learn the syntax, is the editor called Frescobaldi . For those who have already learned the syntax, it may be useful to use the infinite potential of Emacs and Vim , In the LilyPond user manual (2.22 release) , are reported some synthetic indications for Emacs mode as well as for Vim mode . In this article I only add some technical and practical data with regard to Vim (I will dedicate a following article to Emacs). Every step have been tested on two Linux distributions: Ubuntu 21.10 and Arch. “Vim mode” item from the official LilyPond User’s Guide Here are the indications from the User’s Manual, ...

Variables in LaTeX documents exported from Emacs Org Mode

Image
The usual introduction to Emacs, Org Mode and LaTeX This is the usual introduction to Emacs, Org Mode and LaTeX: if you already know everything you can skip it. Org Mode under GNU Emacs is a very powerful tool for organizing ideas. An excellent features of this tool is its ability to directly export documents from Org Mode to LaTeX , the absolute excellence for pagination, as well as to other languages such as Markdown and HTML. When exporting to LaTeX, you can add commands in the preliminary part of the documento in Org Mode, to customize the output in the final PDF document. Variables are useful commands that allow LaTeX to automatically replace placeholders fields with names, numerical strings or any other combination of text and numbers. You can find information on this topic in my previous article . In the actual article I suggest some solutions for generating variables when exporting documents from Org Mode to LaTeX. Preamble section in Org Mode for essential...

LilyPond, ties and voices (advanced)

Image
The object of this article The object of the article is the same as my this previous article but now I have composed, using the LilyPond language, a short score for piano with a little bit more complex voices and ties combinations. I have also created a colour image highlighting the points of interest. You can also listen to the audio version of the short composition at the end of the article. The following terms from the LilyPond lexicon must, of course, be regarded: oneVoice: a single voice line voiceOne: the upper melody line of a polyphonic composition voiceTwo: the lower melody line of a polyphonic composition And now let’s have a look at the LilyPond code Here’s the complete LilyPond code in which you will find each line commented and, in particular, the crossing points shown in the score below.: \version "2.22.0" \layout { \context { \Voice \remove Tie_engraver } \context { \Staff \consists Tie_engraver } } global = { \key g...

LilyPond, ties and voices

Image
LilyPond: ties and voices In the default LilyPond configuration, it is not possible to tie a note in a single-voice with the same note but belonging to a contextual multi-voices environment. I recently had to resolve an author’s passage involving just such a problem and asked for help to the amazing LilyPond community. So I learned a new “trick” that I would like to share with everyone: you can change the context in which ties operate. More in particular: it is possible to make ties work from the voices context to the scores context. In this way, ties can also be engraved switching from single voice to a multiple voice. An easy example: tie from a single voice to multiple voices not engraved In the following example I report a very simple code fragment with an “unterminated tie” warning: \version "2.22.1" \relative c' {\key c \major \time 4/4 c d e f~ % implicit oneVoice % start multiple voices << { f g8 a b4 c } % implicit v...

LilyPond: anacrusis, tuplets, multiple voices

Image
A very short introduction LilyPond is an incredible and powerful language for writing music scores. Every musician should learn it. But writing code is more suitable for programmers than for musicians and many attempts have to be made to write complete scores. In this post I show you some coding snippets regarding anacrusis, tuplets and multiple voices (If you’re reading this article you know what they are). Here is the basic patterns for each of them in LilyPond language: Musical item LilyPond pattern Anacrusis \partial x followed by a x duration note Tuplets \tuplet x/y {n1 n2 n3} : n(1, 2, 3) are the notes with “x” total duration instead of “y” Multiple voices << {musical expression 1} \\ {musical expession 2} , that’s the double backslash construct Colored items in a real score In the image shown at the top of the page you can see a fragment of a real score, limited to the first two measures, from the Piano Sonata No. 2 op. 19 , Sona...

Vim: some modalities to open single or multiple documents

Image
Synthesis table Some Vim commands we’ll talk about: I write To get vim document_name To run Vim and open a document gvim document_name To run Graphical Vim and open a document vim file-1 file-2 file-n To run Vim and open multiple documents vim -p file-1 file-2 file-n To run Vim and open multiple documents in tabs vim -o file-1 file-2 file-n To run Vim and open multiple documents in separate windows with horizontal rows vim -O file-1 file-2 file-n To run Vim and open multiple documents in separate windows with vertical rows sp doc_name To split a new file while Vim is running vs doc_name To vertical split a new file while Vim is running tabe doc_name To open a new file in a dedicated tab while Vim is running Vim offers a lot of options to open or create single or multiple files from the command line or while the application is running. Here is a brief review, with a few video clips, of the commands I use most frequently, under ...

Vim, Markdown, Snippets, UltiSnips: how to get a well-formatted link with a single command

Image
Vim, Markdown, Snippets, UltiSnips: how to get a well-formatted link with a single command Table of Contents 1. Objective of this post 2. An interesting solution found on the net 3. My solution 4. A simple animation 1 Objective of this post The objective of this post is to get a correctly formatted link in Markdown by merging in a single command a fragment of text and an Internet address previously saved in the Vim clipboard. Of course I assume that everybody that's reading this post knows how to create a well formatted link in Markdown, i.e. text in square brackets and URL in round brackets. Why did I ask myself this question? Very simple: I noticed that in "the-other-side-of-the-moon-called-Emacs" the link construction from a region (i. e. a selected text) is immediately available (markdown-mode, C-c C-l ) whereas in the honza list, which is used by Vim UltiSnips plugin, the same function is not among the presets. ...

Emacs, Expand-region and LaTeX

Image
Emacs, Expand-region and LaTeX Table of Contents 1. Emacs and text objects 2. Expand-region and LaTeX 3. Video clips about LaTeX and expand-region 4. Evil: i.e. Vim within Emacs 1 Emacs and text objects In composite documents there are often text fragments within well-defined semantic elements: parentheses of various kinds, single or double inverted commas, trailing commas, etc. In some text editors (Vim, in particular) they're called " text objects ". Emacs can handle these text blocks with a package called Expand-region that " increases the selected region by semantic units (original definition from the programmer's GitHub page): parenthesis, brackets, quotes, sentences and other objects ". To install the package, please read the programmer's instructions . Although the package also works in generic text documents, it must be used, for optimal performance, inside one of the language modes listed in the...