Difference between revisions of "LyX"

From Blue-IT.org Wiki

(Trouble Shooting)
(Convert all lyx files to pdflatex)
Line 16: Line 16:
 
= Helper Scripts =
 
= Helper Scripts =
 
== Convert all lyx files to pdflatex ==
 
== Convert all lyx files to pdflatex ==
 +
Converts ALL existing lyx files in a local path or recursively into pdf files (pdflatex).
 
  #!/bin/bash
 
  #!/bin/bash
 
   
 
   

Revision as of 20:22, 30 September 2010

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

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).

#!/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

#!/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)