1

I try to write a document with a background in lyx, I made sure it works on Texmaker, on Texmaker it needed to be built a couple of times and then it got it right but when I try to preview or export it on lyx it fails and I get blank pages, but when I put in ERT \newpage it's capable of showing only the page from above (but only one) but if I want it to show me all of the pages I need to check page by page when It needs to break. I add my Latex code, my lyx code and it's preamble. (It's easy for me to work with lyx because I need to put a lot of equations and other languages so keep doing stuff with latex alone is not an option for me) Thank You.

Latex code

\documentclass{article}
\usepackage{culmus}
\usepackage{ amssymb }
\usepackage{tikz}
\usepackage{lastpage}
\usetikzlibrary{calc}
\usepackage[placement=top,angle=0,color=black,scale=4,hshift=60,vshift=-5]{background}
\backgroundsetup{contents={\begin{tikzpicture}[overlay,remember picture] 
        \draw [xshift=4mm,color=black,line width=1pt,rounded corners=7pt]
        ($ (current page.north west) + (.5cm,-.5cm) $)
        rectangle
        ($ (current page.south east) + (-.5cm,.5cm) $);
    \end{tikzpicture}
    \begin{tikzpicture}[overlay]
    \draw[color=black] (0,-2.5) rectangle (-1.3,-0.7);
    \draw[color=black] (-0.9,-1.1) node {\large\thepage};
    \draw[color=black] (-0.4,-2.1) node {\large\pageref{LastPage}};
    \draw[color=black] (-0.2,-0.9) -- (-1.1,-2.3);
\end{tikzpicture}},placement=center,angle=0,opacity=1,scale=1,position =current page.north west }
\pagestyle{empty}

\begin{document}
Here the text
\end{document}

Lyx code

Preamble:
    \usepackage{tikz}
    \usepackage{lastpage}
    \date{}                
    \usepackage[placement=top,angle=0,color=black,scale=4,hshift=60,vshift=-5]{background}               
    \usepackage[a4paper,top=3cm,bottom=0.5cm,right=2cm,left=2cm,heightrounded]{geometry}

ERT:
\usetikzlibrary{calc}
\usetikzlibrary{backgrounds}
\backgroundsetup{contents={\begin{tikzpicture}[overlay,remember picture]
\draw [xshift=4mm,color=black,line width=1pt,rounded corners=7pt]($ (current page.north west) + (0.3cm,-0.3cm) $) rectangle ($ (current page.south east) + (-0.3cm,0.3cm) $);
        \end{tikzpicture} 
        \begin{tikzpicture}[overlay]
        \draw[color=black] (0,-2.5) rectangle (-1.3,-0.7); 
        \draw[color=black] (-0.9,-1.1) node {\large\thepage};
        \draw[color=black] (-0.4,-2.1) node {\large\pageref{LastPage}};
        \draw[color=black] (-0.2,-0.9) -- (-1.1,-2.3);
        \end{tikzpicture}},placement=center,angle=0,opacity=1,scale=1,position =current page.north west }
        \pagestyle{empty}
                some text out side ERT
        ERT: \newpage
  • I took your latex code and ran pdflatex directly on it (I had to remove loading of culmus though) three times and got what I believe to be what you expected as the output. I then opened LyX 2.1.1 on Ubuntu and went to file > import > LaTeX (plain) and viewed the output and it produced the same output as running pdflatex manually. Did you try importing the .tex file? In the future, when you post your .lyx example (which is indeed a great idea!) just post the entire .lyx file. It's just text, after all. – scottkosty Aug 21 '14 at 13:10
  • Sorry, I'm a newbie so I didn't know that I could just open the .lyx with a notepad as plain text (I only read some documantaions and it wasn't mentioned there). I'm amazed, I tried to add the ERT to the preamble and it didn't show and progress (I still needed to write \newpage every page), but when I imported it to LaTex and opened with Lyx it worked, I look at both of the files as text and I do see some differences. but know (of course) It won't work with hebrew (culums), I tried changing the language of the document but It didn't help. any Ideas of how to make it work? Thank You Very Much – eyesky Aug 21 '14 at 18:08
  • I'm a little confused. From what I understand you only care about your other question now and this one is irrelevant, right? If so, we should add a solution and carry discussion on over there. – scottkosty Aug 21 '14 at 20:12
  • This is ancient now, but in general always place \usetikzlibrary in the preamble, not the document. – Torbjørn T. Jun 5 '17 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.