Difference between revisions of "LyX"
From Blue-IT.org Wiki
(→Lyx Flavours) |
(→Fonts look ugly in PDF viewer) |
||
(18 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
This article not for introducing this superb wordprocessor for the LaTeX programming language, but for documententation of common solutions around running on linux operting system (mainly [http://www.ubuntu.com ubuntu]). | This article not for introducing this superb wordprocessor for the LaTeX programming language, but for documententation of common solutions around running on linux operting system (mainly [http://www.ubuntu.com ubuntu]). | ||
− | = | + | = Trouble Shooting = |
− | == | + | == Fonts look ugly in PDF viewer == |
− | + | The reason for this mostly is, that the fonts you are using are not embedded into the PDF-file. This mostly is due to licence issues. This can lead to serious problems if you e.g. are dealing with customers or official organisations with only use proprietary software to read PDF-documents: | |
+ | |||
+ | * https://www.sas.upenn.edu/computing/help/students/dissertation-pdf#embed | ||
+ | |||
+ | You can check, if your PDF-file has the necessary fonts embedded. | ||
+ | |||
+ | pdffonts your_file.pdf | ||
+ | |||
+ | The best way on Ubuntu (14.04 / 16.04) to get this fixed is to install the ''computer modern'' fonts package: | ||
+ | sudo apt-get install cm-super | ||
+ | |||
+ | * https://bugs.launchpad.net/ubuntu/+source/lyx/+bug/261312 | ||
+ | |||
+ | If you have plenty of space (app. 800 MB) you can install the package: | ||
+ | sudo apt-get install texlive-fonts-extra | ||
+ | |||
+ | And or another (free) font | ||
+ | sudo apt-get install ttf-bitstream-vera | ||
+ | |||
+ | Read: | ||
+ | |||
+ | * http://tex.stackexchange.com/questions/126806/font-problem-in-pdf-output-since-updating-lyx | ||
+ | * http://tex.stackexchange.com/questions/284519/texstudio-pdf-viewer-do-not-show-same-content-as-actual-pdf-font-issue | ||
+ | * http://tex.stackexchange.com/questions/149012/embed-all-the-fonts-during-compiling-with-pdflatex | ||
+ | |||
+ | == German UserGuide fails with pdflatex == | ||
There are [problems with the lack of the package ''lmodern'' (latin modern) in ubuntu, causing to fail pdflatex with teh error: | There are [problems with the lack of the package ''lmodern'' (latin modern) in ubuntu, causing to fail pdflatex with teh error: | ||
! Package textcomp Error: Symbol \textcurrency not provided by | ! Package textcomp Error: Symbol \textcurrency not provided by | ||
Line 15: | Line 40: | ||
sudo apt-get install lmodern | sudo apt-get install lmodern | ||
− | = | + | = Helper Scripts = |
− | == | + | == Convert all lyx files to pdflatex == |
− | + | Converts ALL existing lyx files in a local path or recursively into pdf files (pdflatex). | |
− | + | Usage: | |
+ | convert_all_lyx_files_to_pdflatex { -l | -r } | ||
− | + | #!/bin/bash | |
+ | |||
+ | [ "${1}" == "" ] && echo "Please specify -l (local path only) or -r (recursive) as parameter." && exit 1 | ||
+ | |||
+ | if [ "${1}" == "-r" ] | ||
+ | then | ||
+ | for myfile in "$(find . -name *.lyx | awk '{print $0}' | sed -e 's/ /\\ /g')" | ||
+ | do | ||
+ | echo "${myfile}" | awk '{system("lyx --export pdf2 -f " $0);}' | ||
+ | done | ||
+ | fi | ||
+ | |||
+ | if [ "${1}" == "-l" ] | ||
+ | then | ||
+ | for myfile in "$(ls *.lyx | awk '{print $0}' | sed -e 's/ /\\ /g')" | ||
+ | do | ||
+ | echo "${myfile}" | awk '{system("lyx --export pdf2 -f " $0);}' | ||
+ | done | ||
+ | fi | ||
− | sudo apt-get | + | == Pack all pdf files recursivly into a zip and tar.gz file == |
− | + | Searches the actual path for pdf files and packs them into a zip and tar.gz file. | |
+ | |||
+ | '''Requires 7z''' because there are a couple of problems zipping with "gnu zip" and using utf-8! | ||
+ | sudo apt-get install p7zip p7zip-full | ||
+ | |||
+ | Use without any parameters. | ||
+ | #!/bin/bash | ||
+ | |||
+ | [ "${1}" == "" ] && echo "Please apply a filename as parameter!" && exit 1 | ||
+ | [ -e /usr/bin/7z ] || echo "7z must be installed" || exit 1 | ||
+ | |||
+ | for myfile in "$(find . -name *.pdf | awk '{print $0}' | sed -e 's/ /\\ /g')" | ||
+ | do | ||
+ | #echo "${myfile}" | awk '{system("zip -u zipfile.zip " $0);}' | ||
+ | echo "${myfile}" | sed -e 's/.\///' | awk '{system("tar rvf tarfile.tar " $0);}' | ||
+ | echo "${myfile}" | sed -e 's/.\///' | awk '{system("7z u -tzip 7zipfile.zip " $0);}' | ||
+ | done | ||
+ | |||
+ | gzip -f tarfile.tar | ||
+ | #mv zipfile.zip "${1} - for Windows systems only.zip" | ||
+ | mv tarfile.tar.gz "${1}.tar.gz" | ||
+ | mv 7zipfile.zip "${1}.zip" | ||
+ | |||
+ | echo ---------------------------------- | ||
+ | echo "The following files where created:" | ||
+ | echo ---------------------------------- | ||
+ | #ls -lah "${1}"* | sed -e 's/ /\\ /g' | awk '{system("echo -n " $8";echo \" - size: \""$5);}' | ||
+ | ls -lah "${1}"* | ||
= Docbook = | = Docbook = | ||
Line 35: | Line 106: | ||
So I was able to use the lyx-template ''docbook_article'' that brings ''very limited'' support for editing documents. | So I was able to use the lyx-template ''docbook_article'' that brings ''very limited'' support for editing documents. | ||
+ | |||
+ | = LaTeX Specials = | ||
+ | == Hanging initials == | ||
+ | Thanks to [http://www.wiwi.hu-berlin.de/~zzd045/latex/tutorials/tutorials.html#yinit Initials with yinit - GER]. | ||
+ | |||
+ | The yinit fonts are fine granular fonts (old style). | ||
+ | |||
+ | === \usepackage{lettrine} === | ||
+ | \lettrine[lines=3]{H}{}auptaugenmerk bei der Softwareentwicklung ist eindeutig | ||
+ | eine fehlerfreie Implementierung zu erzielen. Ein Programm soll keine | ||
+ | Fehler produzieren und stabil laufen. | ||
+ | |||
+ | === \usepackage{dropping} === | ||
+ | Does '''NOT''' work with pdflatex ! | ||
+ | |||
+ | % mit latex übersetzen | ||
+ | |||
+ | \documentclass{article} | ||
+ | \usepackage [german] {babel} | ||
+ | \usepackage{dropping} | ||
+ | \usepackage[latin1]{inputenc} | ||
+ | |||
+ | \setlength{\parindent}{0pt} | ||
+ | \setlength{\parskip}{0.25cm} | ||
+ | |||
+ | \newcommand{\yinit}{\usefont{U}{yinit}{m}{n}} | ||
+ | |||
+ | \begin{document} | ||
+ | |||
+ | \dropping[1pt]{4}{\yinit{} E\hspace{3pt}}s war einmal ein Müller, der | ||
+ | hatte drei Söhne, seine Mühle, einen Esel und einen Kater; die Söhne | ||
+ | mußten mahlen, der Esel Getreide holen und Mehl forttragen, die Katze | ||
+ | dagegen die Mäuse wegfangen. Als der Müller starb, teilten sich die | ||
+ | drei Söhne in die Erbschaft: der älteste bekam die Mühle, der | ||
+ | zweite den Esel, der dritte den Kater; weiter blieb nichts für ihn übrig. | ||
+ | \end{document} | ||
+ | |||
+ | === Manual (buggy) === | ||
+ | One can also use the cmr17 fonts. | ||
+ | \newfont{\tmpfont}{cmr17 scaled 3000}{\tmpfont O} | ||
+ | \vspace*{-8ex} | ||
+ | |||
+ | \hangindent=3em \hangafter=-3 | ||
+ | |||
+ | nce upon a time ... | ||
+ | |||
+ | = LyX on Windows = | ||
+ | Under '''windows vista''' it is possible to export your linux default in ''~/.lyx''-directory. | ||
+ | |||
+ | (HINT: For other windows versions see the [http://wiki.lyx.org/LyX/UserDir Lyx Wiki - section UserDir].) | ||
+ | |||
+ | Now copy your '''layout''' and '''templates''' files in the corresponding directory under | ||
+ | c:\Users\Your Username\AppData\Roaming\LyX<VERSION>\templates | ||
+ | c:\Users\Your Username\AppData\Roaming\LyX<VERSION>\layouts | ||
+ | |||
+ | <Version> defaults to e.g. <16> for the Lyx 1.6.x series. | ||
+ | |||
+ | Since '''MikTeX''' is the default TeX distribution for windows - and is bundled with the an LyX installer package - you can also alter your TeX files locally. | ||
+ | |||
+ | MikTeX also has a local directory which defaults to | ||
+ | c:\Users\Your Username\AppData\Roaming\MiKTex\2.8\tex\latex | ||
+ | |||
+ | There you can pack all your packages into. | ||
+ | |||
+ | After that run the administration tool of MiKTeX, refresh and update the database and formats in the General tab (Maintenance section). | ||
+ | |||
+ | Start LxX, run the reconfiguration process and restart lyx (Tools->Reconfiguration). In my case I also had to review the installed tex-informations (Tools->Tex-Informations) and read them in again, then starting the reconfiguration process. | ||
+ | |||
+ | After a LyX restart you will be prompted with all the new layouts you created. | ||
+ | |||
+ | Hope I didn't miss anything ... | ||
+ | --[[User:Apos|Apos]] 14:08, 8 January 2010 (CET) | ||
+ | |||
+ | [[Category:LaTeX]] |
Latest revision as of 20:29, 16 May 2016
Contents
Introduction
LyX is a WHYSIWYM (what you see is what you mean) Texteditor. This article not for introducing this superb wordprocessor for the LaTeX programming language, but for documententation of common solutions around running on linux operting system (mainly ubuntu).
Trouble Shooting
Fonts look ugly in PDF viewer
The reason for this mostly is, that the fonts you are using are not embedded into the PDF-file. This mostly is due to licence issues. This can lead to serious problems if you e.g. are dealing with customers or official organisations with only use proprietary software to read PDF-documents:
You can check, if your PDF-file has the necessary fonts embedded.
pdffonts your_file.pdf
The best way on Ubuntu (14.04 / 16.04) to get this fixed is to install the computer modern fonts package:
sudo apt-get install cm-super
If you have plenty of space (app. 800 MB) you can install the package:
sudo apt-get install texlive-fonts-extra
And or another (free) font
sudo apt-get install ttf-bitstream-vera
Read:
- http://tex.stackexchange.com/questions/126806/font-problem-in-pdf-output-since-updating-lyx
- http://tex.stackexchange.com/questions/284519/texstudio-pdf-viewer-do-not-show-same-content-as-actual-pdf-font-issue
- http://tex.stackexchange.com/questions/149012/embed-all-the-fonts-during-compiling-with-pdflatex
German UserGuide fails with pdflatex
There are [problems with the lack of the package lmodern (latin modern) in ubuntu, causing to fail pdflatex with teh error:
! Package textcomp Error: Symbol \textcurrency not provided by
See
Solution for ubuntu:
sudo apt-get install lmodern
Helper Scripts
Convert all lyx files to pdflatex
Converts ALL existing lyx files in a local path or recursively into pdf files (pdflatex).
Usage:
convert_all_lyx_files_to_pdflatex { -l | -r }
#!/bin/bash [ "${1}" == "" ] && echo "Please specify -l (local path only) or -r (recursive) as parameter." && exit 1 if [ "${1}" == "-r" ] then for myfile in "$(find . -name *.lyx | awk '{print $0}' | sed -e 's/ /\\ /g')" do echo "${myfile}" | awk '{system("lyx --export pdf2 -f " $0);}' done fi if [ "${1}" == "-l" ] then for myfile in "$(ls *.lyx | awk '{print $0}' | sed -e 's/ /\\ /g')" do echo "${myfile}" | awk '{system("lyx --export pdf2 -f " $0);}' done fi
Pack all pdf files recursivly into a zip and tar.gz file
Searches the actual path for pdf files and packs them into a zip and tar.gz file.
Requires 7z because there are a couple of problems zipping with "gnu zip" and using utf-8!
sudo apt-get install p7zip p7zip-full
Use without any parameters.
#!/bin/bash [ "${1}" == "" ] && echo "Please apply a filename as parameter!" && exit 1 [ -e /usr/bin/7z ] || echo "7z must be installed" || exit 1 for myfile in "$(find . -name *.pdf | awk '{print $0}' | sed -e 's/ /\\ /g')" do #echo "${myfile}" | awk '{system("zip -u zipfile.zip " $0);}' echo "${myfile}" | sed -e 's/.\///' | awk '{system("tar rvf tarfile.tar " $0);}' echo "${myfile}" | sed -e 's/.\///' | awk '{system("7z u -tzip 7zipfile.zip " $0);}' done gzip -f tarfile.tar #mv zipfile.zip "${1} - for Windows systems only.zip" mv tarfile.tar.gz "${1}.tar.gz" mv 7zipfile.zip "${1}.zip" echo ---------------------------------- echo "The following files where created:" echo ---------------------------------- #ls -lah "${1}"* | sed -e 's/ /\\ /g' | awk '{system("echo -n " $8";echo \" - size: \""$5);}' ls -lah "${1}"*
Docbook
Docbook, Lyx and Ubuntu / Debian
To be able to use the default templates provides by lyx it is necessary to install the package sgmlutils-lite.
To be able to view and produce DVI / Postscript output you need the docbook-utils package.
sudo apt-get install sgmlutils-lite docbook-utils
So I was able to use the lyx-template docbook_article that brings very limited support for editing documents.
LaTeX Specials
Hanging initials
Thanks to Initials with yinit - GER.
The yinit fonts are fine granular fonts (old style).
\usepackage{lettrine}
\lettrine[lines=3]{H}{}auptaugenmerk bei der Softwareentwicklung ist eindeutig
eine fehlerfreie Implementierung zu erzielen. Ein Programm soll keine Fehler produzieren und stabil laufen.
\usepackage{dropping}
Does NOT work with pdflatex !
% mit latex übersetzen
\documentclass{article} \usepackage [german] {babel} \usepackage{dropping} \usepackage[latin1]{inputenc}
\setlength{\parindent}{0pt} \setlength{\parskip}{0.25cm}
\newcommand{\yinit}{\usefont{U}{yinit}{m}{n}}
\begin{document}
\dropping[1pt]{4}{\yinit{} E\hspace{3pt}}s war einmal ein Müller, der hatte drei Söhne, seine Mühle, einen Esel und einen Kater; die Söhne mußten mahlen, der Esel Getreide holen und Mehl forttragen, die Katze dagegen die Mäuse wegfangen. Als der Müller starb, teilten sich die drei Söhne in die Erbschaft: der älteste bekam die Mühle, der zweite den Esel, der dritte den Kater; weiter blieb nichts für ihn übrig. \end{document}
Manual (buggy)
One can also use the cmr17 fonts.
\newfont{\tmpfont}{cmr17 scaled 3000}{\tmpfont O} \vspace*{-8ex}
\hangindent=3em \hangafter=-3
nce upon a time ...
LyX on Windows
Under windows vista it is possible to export your linux default in ~/.lyx-directory.
(HINT: For other windows versions see the Lyx Wiki - section UserDir.)
Now copy your layout and templates files in the corresponding directory under
c:\Users\Your Username\AppData\Roaming\LyX<VERSION>\templates c:\Users\Your Username\AppData\Roaming\LyX<VERSION>\layouts
<Version> defaults to e.g. <16> for the Lyx 1.6.x series.
Since MikTeX is the default TeX distribution for windows - and is bundled with the an LyX installer package - you can also alter your TeX files locally.
MikTeX also has a local directory which defaults to
c:\Users\Your Username\AppData\Roaming\MiKTex\2.8\tex\latex
There you can pack all your packages into.
After that run the administration tool of MiKTeX, refresh and update the database and formats in the General tab (Maintenance section).
Start LxX, run the reconfiguration process and restart lyx (Tools->Reconfiguration). In my case I also had to review the installed tex-informations (Tools->Tex-Informations) and read them in again, then starting the reconfiguration process.
After a LyX restart you will be prompted with all the new layouts you created.
Hope I didn't miss anything ... --Apos 14:08, 8 January 2010 (CET)