The Lyx “What You See is What You Mean” editor is available at Lyx and from your package manager. Citations

Lyx nicely integrates with a bibtex bibliography. You can create a shortcut such as CTRL+SHIFT+C to insert a reference. A small menu will pop-up to choose from the references.

Unfortunately “BibTeX does not support files encoded in UTF-8”. To get characters such as “é” encoded correctly latin1 has to be used.This can be set as the database property in Jabref.

Shortcuts

Under Tools / preferences / Editing / Shortcuts / Stackoverflow question on how to find the command name for a shortcut. I mapped:

citation-insert to Ctrl+Alt+C 
href-insert to Ctrl+K
label-insert to Ctrl+Alt+L
statistics to Ctrl+Alt+T

See also the Lyx wiki page on shortcuts.

Lyx shortcuts are storred in bind files. The default bind file is called cua. To restore default bind file, one can simply delete the user directory, as explained on this forum post

See also the setup directory where I saved a bind file.

Bibliography

Encoding

bib file have an old encoding format. It’s possible to use utf8 in bibtex, but for compatibility reason I stick with the old format.

How to write “ä” and other umlauts and accented letters in bibliography?

{\"a} {\aa} 
{\c c}
{\^e} {\`e} {\'e} 
{\u g}
{\`i} {\.I} 
{\l}
{\~n}
{\o} {\H o}
{\'u}
{\v r} {\ss}

Merge and filter bibliographies

Answers to a question on merging 2 bibtex file recommend using Jabref file / import into current database.

Create a shorter bibliography with only cited documents from another bibliography Extracting only the BibTex records relevant to the paper. Answers recommend using bibtool or bibexport.

I have written an article in Lyx which cites 2 bibliographies and a colleague asked to have a .tex version of this article. Here is my recipe:

Use Jabref to merge two bibliographies. 
Export Lyx file to LaTeX (PDFLaTeX).
Edit the .tex file to insert a link to the merged bibliographies. 
    \phantomsection\addcontentsline{toc}{section}{\refname}\bibliography{long.bib} 
Compile the .tex with TeXstudio. 
Used bibexport to extract a short bibliography corresponding only to the citations used in one article.

bibexport -o short.bib article.aux 

Replace long.bib by short.bib in the .tex file.

I have done it 3 times already. Could I create a script that does all this automatically?

Install dependencies

Tex packages

Tex packages are located at CTAN. Most of the time it’s sufficient to install them from the Debian repository. Some times the debian repository version is outdated. In that case you can try to install the packages from the backports:

sudo vim /etc/apt/sources.list
# Add deb http://ftp.debian.org/debian stretch-backports main 
# Or a mirror, for example
# deb http://ftp.it.debian.org/debian stretch-backports main
sudo apt update
sudo apt-get -t stretch-backports install texlive-bibtex-extra

Spell checker

A spell checker can be activated under Tools / preferences / language settings / spellchecker. On my system the only spell check engine available is Enchant, “a wrapper that provides automatic access to many spell checking libraries (ispell, aspell, hspell, hunspell, etc.)”.

The button displaying a red-underlined A can be activated to spell check continuously. Language of document

Under Document / Settings / Language, it’s possible to change the document language, which will have an impact on the language used for spell checking. In my system compiling a document in French returned an error:

“Package babel Error: Unknown option `french’.”

This stackexchange post suggest installing the texlive-lang-french Debian package. This fixed the error. Math mode

Encoding

This question on “how do I prevent Lyx from loading inputenc?” explains where this part of the Latex preamble is defined.

In Document > Settings…, under Language > Encoding, choose “Other” and select “Language Default (no inputenc)”.

Instead I replaced Latin1 by utf8 as input encoding. This works for the moment.

Instead I replaced Latin1 by utf8 as input encoding. This works for the moment.

Math

Press CTRL+M at the cursor or on highlighted text to enter math mode. Latex syntax “”, “x_t” can be used to enter equations and is displayed directly as math symbols. Change input encoding

How to enter a column vector Has recommendations on how to enter matrix operations with sub-variables.

Fonts

Icons

Font-awesome is available in the Debian Package “texlive-fonts-extra”. It can be used in Lyx by insterting \usepackage{fontawesome} in the Latex preamble. Then insert an icon with:

\faComments
\faWrench

Encoding issues and Greek symbols used outside math mode

“Encoding file ‘lgrenc.def’ not found” was fixed by installing the debian package texlive-lang-greek (as explained here on stackoverflow). Other errors appeared related to the use of beta signs outside math mode. As one user explained on stackoverflow, placing signs in math mode usually fixes the issue. Hyperlinks in PDF

Elsevier article template

Elsevier provides a latex template for articles called elsarticle which is usable in Lyx. However compiling with this template doesn’t seem to work when using the hyperref package with the general option “automatically fill header”. After deactivating this option, compilation works again.

The elsarticle template uses numerical references by default. it is possible to activate author year reference according to this stack exchange answer. Tips

CTRL+D uses yap, a faster (on windows) previewer than the default PDF one. There is no noticeable difference on Linux.

Other templates

To produce a meeting report with a wider template than the default article.

I would have liked to find an overview of the templates with screenshots of PDF results. But I couldn't find such overview online. LyX wiki has a list of examples and a list of layouts. 
In fact all that was needed was to edit the Document \ Settings \ Page margins, I set the inner and out margins to 2 cm and was happy with the result.

knitr and Lyx

Yihui Xie: Using knitr and Lyx
 Krishna Devulapalli: Creation of research papers with embedded R results using LyX

My Lyx file uses many packages and formatting options. Export to RTF didn’t work and returned the error:

"An error occurred while running: latex2rtf" 

I made a copy in a temporary directory (/tmp) and removed external packages and options in the latex preamble, before performing the conversion. Then the conversion to RTF worked.

Compare different versions of a document

Use Tools/Compare to highlight differences between a new and an old document. Then show changes in output to show changes in red and blue in the PDF output.

Alternatively, you can export the Lyx files to Latex and use Latexdiff as such:

latexdiff draft.tex revision.tex > diff.tex

Avoid complex tables or figures in the diff, as they can cause issues. I had to create a fake old documents with final figures and table for latexdiff to return a usable output.