Adding my own format to lyx











up vote
3
down vote

favorite












I have written a LaTeX math document with lyx (using document ams class), but now my teacher sent me some LaTeX code which should make the style as he wants it.



I tried a few options to insert the LaTeX code, none worked:



1) add (through lyx) the LaTeX code itself - This didn't work, since there were double definitions, both in the lyx default generated LaTeX code, and the LaTeX code I inserted.



2) through MiKTeX TeXworks- I exported my lyx document to LaTeX, and tried to change all the definitions before begin{document} to the ones my teacher sent me - This didn't compile, complained about missing definitions, xtra, xtra.



3) through bakoma - i tried opening my exported lyx code, and then inserting the code my teacher sent me at the beginning - This actually worked, but the bibliography and figure placement got ruined - the figures were put at the end, and the bibliography disappeared.



Anyone has any ideas ? What should be the right way to tackle my problem? Attached is the code my teacher sent me



%&latex
documentclass[11pt]{article}
usepackage{amssymb}
usepackage{amsfonts}
usepackage{amsmath}
usepackage{bm}
usepackage{latexsym}
usepackage{epsfig}
usepackage{hyperref}
%usepackage[normalem]{ulem} %usepackage[top=80pt,bottom=80pt, left=85pt, right=85pt]{geometry} %usepackage{setspace} %onehalfspacing

setlength{evensidemargin}{.25in} setlength{textwidth}{6in} setlength{topmargin}{-0.4in}
setlength{textheight}{8.5in}

newcommand{handout}[5]{
renewcommand{thepage}{#1-arabic{page}}
noindent
begin{center}
framebox{
vbox{
hbox to 5.78in {{sf Randomized Algorithms}
hfill sf #2 }
vspace{4mm}
hbox to 5.78in { {Large hfill #5 hfill} }
vspace{2mm}
hbox to 5.78in { {em #3 hfill #4} }
}
}
end{center}
vspace*{4mm}
}

newcommand{lecture}[4]{handout{#1}{#2}{Lecture date: #3}{Scribe: #4}{Lecture #1}}


textwidth=6in oddsidemargin=0.25in evensidemargin=0.25in topmargin=-0.1in footskip=0.8in
parindent=0.0cm
parskip=0.3cm
textheight=8.00in setcounter{tocdepth} {3} setcounter{secnumdepth} {2} sloppy


newtheorem{theorem}{Theorem}
newtheorem{lemma}[theorem]{Lemma}
newtheorem{claim}[theorem]{Claim}
newtheorem{proposition}[theorem]{Proposition}
newtheorem{corollary}[theorem]{Corollary}
newtheorem{fact}[theorem]{Fact}
newtheorem{definition}[theorem]{Definition}
newtheorem{remark}[theorem]{Remark}
newtheorem{conjecture}[theorem]{Conjecture}
newtheorem{question}[theorem]{Question}
newtheorem{answer}[theorem]{Answer}
%newtheorem{exercise}[theorem]{Exercise}
newtheorem{example}[theorem]{Example}
newtheorem{algorithm}[theorem]{Algorithm}
%newtheorem{exercise}[theorem]{Exercise}
newenvironment{exercise}{noindent textbf{Exercise}}{}%[theorem]{Exercise}
newenvironment{challenge}{noindent textbf{Challenge}}{}%[theorem]{Exercise}
newenvironment{kitbag}{noindent textbf{Kitbag Exercise}}{}
newenvironment{proof}{noindent textbf{Proof}}{$Box$}
newenvironment{proof-sketch}{noindent textbf{Sketch of Proof}}{$Box$}

newcommand{ignore}[1]{}

renewcommand{Pr}{{textup{Pr}}}
renewcommand{P}{{bf P}}
newcommand{Px}{mathop{bf P/}}
newcommand{E}{{bf E}}
newcommand{Ex}{mathop{bf E/}}

newcommand{Var}{{bf Var}}
newcommand{Cov}{{bf Cov}}
newcommand{Varx}{mathop{bf Var/}}

newcommand{bits}{{-1,1}}

newcommand{nsmaja}{textstyle{frac{2}{pi}} arcsin rho}

newcommand{Inf}{mathrm{Inf}}
newcommand{I}{mathrm{I}}
newcommand{J}{mathrm{J}}

newcommand{eps}{epsilon}
newcommand{lam}{lambda}
newcommand{N}{mathbb N}
newcommand{R}{mathbb R}
newcommand{Z}{mathbb Z}
newcommand{C}{mathbb C}
newcommand{CalE}{{mathcal{E}}}

newcommand{CalU}{{mathcal{U}}}
newcommand{F}{{mathcal{F}}}
newcommand{CalC}{{mathcal{C}}}
newcommand{CalM}{{mathcal{M}}}
newcommand{CalR}{{mathcal{R}}}
newcommand{CalS}{{mathcal{S}}}
newcommand{CalV}{{mathcal{V}}}
newcommand{CalX}{{boldsymbol{mathcal{X}}}}
newcommand{CalG}{{boldsymbol{mathcal{G}}}}
newcommand{CalY}{{boldsymbol{mathcal{Y}}}}
newcommand{CalZ}{{boldsymbol{mathcal{Z}}}}
newcommand{CalF}{{mathcal{Z}}}
newcommand{boldG}{{boldsymbol G}}
newcommand{boldQ}{{boldsymbol Q}}
newcommand{boldR}{{boldsymbol R}}
newcommand{boldS}{{boldsymbol S}}
newcommand{boldX}{{boldsymbol X}}
newcommand{bfX}{{boldsymbol X}}
newcommand{boldB}{{boldsymbol B}}
newcommand{boldY}{{boldsymbol Y}}
newcommand{boldZ}{{boldsymbol Z}}
newcommand{boldV}{{boldsymbol V}}
newcommand{boldsigma}{{boldsymbol sigma}}
newcommand{boldupsilon}{{boldsymbol upsilon}}
newcommand{hone}{{boldsymbol{H1}}}
newcommand{htwo}{boldsymbol{H2}}
newcommand{hthree}{boldsymbol{H3}}
newcommand{hfour}{boldsymbol{H4}}
newcommand{poly}{boldsymbol{poly}}


newcommand{sgn}{mathrm{sgn}}
newcommand{Maj}{mathrm{Maj}}
newcommand{Thr}{mathrm{Thr}}
newcommand{littlesum}{{textstyle sum}}

newcommand{half}{{textstyle frac12}}

newcommand{Stab}{mathbb{S}}
newcommand{StabThr}[2]{Gamma_{#1}(#2)}
newcommand{TestFcn}{Psi}

renewcommand{phi}{varphi}
def la {langle}
def ra {rangle}

newcommand{x}{mathbf{x}}
renewcommand{o}{mbox{o}}
renewcommand{O}{mbox{O}}
newcommand{h}{mathbf{H}}
newcommand{va}{mbox{var}}
renewcommand{d}{mbox{d}}
renewcommand{C}{mathcal C}
newcommand{qed}{hfill $square$}
begin{document}

lecture{10}{Moni Naor}{Jan 2, 2011}{Itay Gonshorovitz}



end{document}









share|improve this question
























  • Welcome to tex.sx! It's not necessary to sign your questions (as there is already a box with your username below it) or to begin them with a greeting. A tip: if you change 1) to 1. etc. the enumeration is automatically formatted.
    – Martin Scharrer
    Mar 13 '11 at 22:04








  • 2




    It is very complicated to say what's going on if we don't have your teachers code. E.g. if he uses documentclass in his template it will clash with the one defined in lyx or your exported document. To say something is "ruined" is not a good problem description either. If you want to have a good answer, you have to show some code here.
    – Martin H
    Mar 13 '11 at 22:14










  • Okay, i edited the question and added some code - I was just trying before to be concise so as to not put too much information in the question. Hope now it will be more clear.
    – user4165
    Mar 13 '11 at 22:56















up vote
3
down vote

favorite












I have written a LaTeX math document with lyx (using document ams class), but now my teacher sent me some LaTeX code which should make the style as he wants it.



I tried a few options to insert the LaTeX code, none worked:



1) add (through lyx) the LaTeX code itself - This didn't work, since there were double definitions, both in the lyx default generated LaTeX code, and the LaTeX code I inserted.



2) through MiKTeX TeXworks- I exported my lyx document to LaTeX, and tried to change all the definitions before begin{document} to the ones my teacher sent me - This didn't compile, complained about missing definitions, xtra, xtra.



3) through bakoma - i tried opening my exported lyx code, and then inserting the code my teacher sent me at the beginning - This actually worked, but the bibliography and figure placement got ruined - the figures were put at the end, and the bibliography disappeared.



Anyone has any ideas ? What should be the right way to tackle my problem? Attached is the code my teacher sent me



%&latex
documentclass[11pt]{article}
usepackage{amssymb}
usepackage{amsfonts}
usepackage{amsmath}
usepackage{bm}
usepackage{latexsym}
usepackage{epsfig}
usepackage{hyperref}
%usepackage[normalem]{ulem} %usepackage[top=80pt,bottom=80pt, left=85pt, right=85pt]{geometry} %usepackage{setspace} %onehalfspacing

setlength{evensidemargin}{.25in} setlength{textwidth}{6in} setlength{topmargin}{-0.4in}
setlength{textheight}{8.5in}

newcommand{handout}[5]{
renewcommand{thepage}{#1-arabic{page}}
noindent
begin{center}
framebox{
vbox{
hbox to 5.78in {{sf Randomized Algorithms}
hfill sf #2 }
vspace{4mm}
hbox to 5.78in { {Large hfill #5 hfill} }
vspace{2mm}
hbox to 5.78in { {em #3 hfill #4} }
}
}
end{center}
vspace*{4mm}
}

newcommand{lecture}[4]{handout{#1}{#2}{Lecture date: #3}{Scribe: #4}{Lecture #1}}


textwidth=6in oddsidemargin=0.25in evensidemargin=0.25in topmargin=-0.1in footskip=0.8in
parindent=0.0cm
parskip=0.3cm
textheight=8.00in setcounter{tocdepth} {3} setcounter{secnumdepth} {2} sloppy


newtheorem{theorem}{Theorem}
newtheorem{lemma}[theorem]{Lemma}
newtheorem{claim}[theorem]{Claim}
newtheorem{proposition}[theorem]{Proposition}
newtheorem{corollary}[theorem]{Corollary}
newtheorem{fact}[theorem]{Fact}
newtheorem{definition}[theorem]{Definition}
newtheorem{remark}[theorem]{Remark}
newtheorem{conjecture}[theorem]{Conjecture}
newtheorem{question}[theorem]{Question}
newtheorem{answer}[theorem]{Answer}
%newtheorem{exercise}[theorem]{Exercise}
newtheorem{example}[theorem]{Example}
newtheorem{algorithm}[theorem]{Algorithm}
%newtheorem{exercise}[theorem]{Exercise}
newenvironment{exercise}{noindent textbf{Exercise}}{}%[theorem]{Exercise}
newenvironment{challenge}{noindent textbf{Challenge}}{}%[theorem]{Exercise}
newenvironment{kitbag}{noindent textbf{Kitbag Exercise}}{}
newenvironment{proof}{noindent textbf{Proof}}{$Box$}
newenvironment{proof-sketch}{noindent textbf{Sketch of Proof}}{$Box$}

newcommand{ignore}[1]{}

renewcommand{Pr}{{textup{Pr}}}
renewcommand{P}{{bf P}}
newcommand{Px}{mathop{bf P/}}
newcommand{E}{{bf E}}
newcommand{Ex}{mathop{bf E/}}

newcommand{Var}{{bf Var}}
newcommand{Cov}{{bf Cov}}
newcommand{Varx}{mathop{bf Var/}}

newcommand{bits}{{-1,1}}

newcommand{nsmaja}{textstyle{frac{2}{pi}} arcsin rho}

newcommand{Inf}{mathrm{Inf}}
newcommand{I}{mathrm{I}}
newcommand{J}{mathrm{J}}

newcommand{eps}{epsilon}
newcommand{lam}{lambda}
newcommand{N}{mathbb N}
newcommand{R}{mathbb R}
newcommand{Z}{mathbb Z}
newcommand{C}{mathbb C}
newcommand{CalE}{{mathcal{E}}}

newcommand{CalU}{{mathcal{U}}}
newcommand{F}{{mathcal{F}}}
newcommand{CalC}{{mathcal{C}}}
newcommand{CalM}{{mathcal{M}}}
newcommand{CalR}{{mathcal{R}}}
newcommand{CalS}{{mathcal{S}}}
newcommand{CalV}{{mathcal{V}}}
newcommand{CalX}{{boldsymbol{mathcal{X}}}}
newcommand{CalG}{{boldsymbol{mathcal{G}}}}
newcommand{CalY}{{boldsymbol{mathcal{Y}}}}
newcommand{CalZ}{{boldsymbol{mathcal{Z}}}}
newcommand{CalF}{{mathcal{Z}}}
newcommand{boldG}{{boldsymbol G}}
newcommand{boldQ}{{boldsymbol Q}}
newcommand{boldR}{{boldsymbol R}}
newcommand{boldS}{{boldsymbol S}}
newcommand{boldX}{{boldsymbol X}}
newcommand{bfX}{{boldsymbol X}}
newcommand{boldB}{{boldsymbol B}}
newcommand{boldY}{{boldsymbol Y}}
newcommand{boldZ}{{boldsymbol Z}}
newcommand{boldV}{{boldsymbol V}}
newcommand{boldsigma}{{boldsymbol sigma}}
newcommand{boldupsilon}{{boldsymbol upsilon}}
newcommand{hone}{{boldsymbol{H1}}}
newcommand{htwo}{boldsymbol{H2}}
newcommand{hthree}{boldsymbol{H3}}
newcommand{hfour}{boldsymbol{H4}}
newcommand{poly}{boldsymbol{poly}}


newcommand{sgn}{mathrm{sgn}}
newcommand{Maj}{mathrm{Maj}}
newcommand{Thr}{mathrm{Thr}}
newcommand{littlesum}{{textstyle sum}}

newcommand{half}{{textstyle frac12}}

newcommand{Stab}{mathbb{S}}
newcommand{StabThr}[2]{Gamma_{#1}(#2)}
newcommand{TestFcn}{Psi}

renewcommand{phi}{varphi}
def la {langle}
def ra {rangle}

newcommand{x}{mathbf{x}}
renewcommand{o}{mbox{o}}
renewcommand{O}{mbox{O}}
newcommand{h}{mathbf{H}}
newcommand{va}{mbox{var}}
renewcommand{d}{mbox{d}}
renewcommand{C}{mathcal C}
newcommand{qed}{hfill $square$}
begin{document}

lecture{10}{Moni Naor}{Jan 2, 2011}{Itay Gonshorovitz}



end{document}









share|improve this question
























  • Welcome to tex.sx! It's not necessary to sign your questions (as there is already a box with your username below it) or to begin them with a greeting. A tip: if you change 1) to 1. etc. the enumeration is automatically formatted.
    – Martin Scharrer
    Mar 13 '11 at 22:04








  • 2




    It is very complicated to say what's going on if we don't have your teachers code. E.g. if he uses documentclass in his template it will clash with the one defined in lyx or your exported document. To say something is "ruined" is not a good problem description either. If you want to have a good answer, you have to show some code here.
    – Martin H
    Mar 13 '11 at 22:14










  • Okay, i edited the question and added some code - I was just trying before to be concise so as to not put too much information in the question. Hope now it will be more clear.
    – user4165
    Mar 13 '11 at 22:56













up vote
3
down vote

favorite









up vote
3
down vote

favorite











I have written a LaTeX math document with lyx (using document ams class), but now my teacher sent me some LaTeX code which should make the style as he wants it.



I tried a few options to insert the LaTeX code, none worked:



1) add (through lyx) the LaTeX code itself - This didn't work, since there were double definitions, both in the lyx default generated LaTeX code, and the LaTeX code I inserted.



2) through MiKTeX TeXworks- I exported my lyx document to LaTeX, and tried to change all the definitions before begin{document} to the ones my teacher sent me - This didn't compile, complained about missing definitions, xtra, xtra.



3) through bakoma - i tried opening my exported lyx code, and then inserting the code my teacher sent me at the beginning - This actually worked, but the bibliography and figure placement got ruined - the figures were put at the end, and the bibliography disappeared.



Anyone has any ideas ? What should be the right way to tackle my problem? Attached is the code my teacher sent me



%&latex
documentclass[11pt]{article}
usepackage{amssymb}
usepackage{amsfonts}
usepackage{amsmath}
usepackage{bm}
usepackage{latexsym}
usepackage{epsfig}
usepackage{hyperref}
%usepackage[normalem]{ulem} %usepackage[top=80pt,bottom=80pt, left=85pt, right=85pt]{geometry} %usepackage{setspace} %onehalfspacing

setlength{evensidemargin}{.25in} setlength{textwidth}{6in} setlength{topmargin}{-0.4in}
setlength{textheight}{8.5in}

newcommand{handout}[5]{
renewcommand{thepage}{#1-arabic{page}}
noindent
begin{center}
framebox{
vbox{
hbox to 5.78in {{sf Randomized Algorithms}
hfill sf #2 }
vspace{4mm}
hbox to 5.78in { {Large hfill #5 hfill} }
vspace{2mm}
hbox to 5.78in { {em #3 hfill #4} }
}
}
end{center}
vspace*{4mm}
}

newcommand{lecture}[4]{handout{#1}{#2}{Lecture date: #3}{Scribe: #4}{Lecture #1}}


textwidth=6in oddsidemargin=0.25in evensidemargin=0.25in topmargin=-0.1in footskip=0.8in
parindent=0.0cm
parskip=0.3cm
textheight=8.00in setcounter{tocdepth} {3} setcounter{secnumdepth} {2} sloppy


newtheorem{theorem}{Theorem}
newtheorem{lemma}[theorem]{Lemma}
newtheorem{claim}[theorem]{Claim}
newtheorem{proposition}[theorem]{Proposition}
newtheorem{corollary}[theorem]{Corollary}
newtheorem{fact}[theorem]{Fact}
newtheorem{definition}[theorem]{Definition}
newtheorem{remark}[theorem]{Remark}
newtheorem{conjecture}[theorem]{Conjecture}
newtheorem{question}[theorem]{Question}
newtheorem{answer}[theorem]{Answer}
%newtheorem{exercise}[theorem]{Exercise}
newtheorem{example}[theorem]{Example}
newtheorem{algorithm}[theorem]{Algorithm}
%newtheorem{exercise}[theorem]{Exercise}
newenvironment{exercise}{noindent textbf{Exercise}}{}%[theorem]{Exercise}
newenvironment{challenge}{noindent textbf{Challenge}}{}%[theorem]{Exercise}
newenvironment{kitbag}{noindent textbf{Kitbag Exercise}}{}
newenvironment{proof}{noindent textbf{Proof}}{$Box$}
newenvironment{proof-sketch}{noindent textbf{Sketch of Proof}}{$Box$}

newcommand{ignore}[1]{}

renewcommand{Pr}{{textup{Pr}}}
renewcommand{P}{{bf P}}
newcommand{Px}{mathop{bf P/}}
newcommand{E}{{bf E}}
newcommand{Ex}{mathop{bf E/}}

newcommand{Var}{{bf Var}}
newcommand{Cov}{{bf Cov}}
newcommand{Varx}{mathop{bf Var/}}

newcommand{bits}{{-1,1}}

newcommand{nsmaja}{textstyle{frac{2}{pi}} arcsin rho}

newcommand{Inf}{mathrm{Inf}}
newcommand{I}{mathrm{I}}
newcommand{J}{mathrm{J}}

newcommand{eps}{epsilon}
newcommand{lam}{lambda}
newcommand{N}{mathbb N}
newcommand{R}{mathbb R}
newcommand{Z}{mathbb Z}
newcommand{C}{mathbb C}
newcommand{CalE}{{mathcal{E}}}

newcommand{CalU}{{mathcal{U}}}
newcommand{F}{{mathcal{F}}}
newcommand{CalC}{{mathcal{C}}}
newcommand{CalM}{{mathcal{M}}}
newcommand{CalR}{{mathcal{R}}}
newcommand{CalS}{{mathcal{S}}}
newcommand{CalV}{{mathcal{V}}}
newcommand{CalX}{{boldsymbol{mathcal{X}}}}
newcommand{CalG}{{boldsymbol{mathcal{G}}}}
newcommand{CalY}{{boldsymbol{mathcal{Y}}}}
newcommand{CalZ}{{boldsymbol{mathcal{Z}}}}
newcommand{CalF}{{mathcal{Z}}}
newcommand{boldG}{{boldsymbol G}}
newcommand{boldQ}{{boldsymbol Q}}
newcommand{boldR}{{boldsymbol R}}
newcommand{boldS}{{boldsymbol S}}
newcommand{boldX}{{boldsymbol X}}
newcommand{bfX}{{boldsymbol X}}
newcommand{boldB}{{boldsymbol B}}
newcommand{boldY}{{boldsymbol Y}}
newcommand{boldZ}{{boldsymbol Z}}
newcommand{boldV}{{boldsymbol V}}
newcommand{boldsigma}{{boldsymbol sigma}}
newcommand{boldupsilon}{{boldsymbol upsilon}}
newcommand{hone}{{boldsymbol{H1}}}
newcommand{htwo}{boldsymbol{H2}}
newcommand{hthree}{boldsymbol{H3}}
newcommand{hfour}{boldsymbol{H4}}
newcommand{poly}{boldsymbol{poly}}


newcommand{sgn}{mathrm{sgn}}
newcommand{Maj}{mathrm{Maj}}
newcommand{Thr}{mathrm{Thr}}
newcommand{littlesum}{{textstyle sum}}

newcommand{half}{{textstyle frac12}}

newcommand{Stab}{mathbb{S}}
newcommand{StabThr}[2]{Gamma_{#1}(#2)}
newcommand{TestFcn}{Psi}

renewcommand{phi}{varphi}
def la {langle}
def ra {rangle}

newcommand{x}{mathbf{x}}
renewcommand{o}{mbox{o}}
renewcommand{O}{mbox{O}}
newcommand{h}{mathbf{H}}
newcommand{va}{mbox{var}}
renewcommand{d}{mbox{d}}
renewcommand{C}{mathcal C}
newcommand{qed}{hfill $square$}
begin{document}

lecture{10}{Moni Naor}{Jan 2, 2011}{Itay Gonshorovitz}



end{document}









share|improve this question















I have written a LaTeX math document with lyx (using document ams class), but now my teacher sent me some LaTeX code which should make the style as he wants it.



I tried a few options to insert the LaTeX code, none worked:



1) add (through lyx) the LaTeX code itself - This didn't work, since there were double definitions, both in the lyx default generated LaTeX code, and the LaTeX code I inserted.



2) through MiKTeX TeXworks- I exported my lyx document to LaTeX, and tried to change all the definitions before begin{document} to the ones my teacher sent me - This didn't compile, complained about missing definitions, xtra, xtra.



3) through bakoma - i tried opening my exported lyx code, and then inserting the code my teacher sent me at the beginning - This actually worked, but the bibliography and figure placement got ruined - the figures were put at the end, and the bibliography disappeared.



Anyone has any ideas ? What should be the right way to tackle my problem? Attached is the code my teacher sent me



%&latex
documentclass[11pt]{article}
usepackage{amssymb}
usepackage{amsfonts}
usepackage{amsmath}
usepackage{bm}
usepackage{latexsym}
usepackage{epsfig}
usepackage{hyperref}
%usepackage[normalem]{ulem} %usepackage[top=80pt,bottom=80pt, left=85pt, right=85pt]{geometry} %usepackage{setspace} %onehalfspacing

setlength{evensidemargin}{.25in} setlength{textwidth}{6in} setlength{topmargin}{-0.4in}
setlength{textheight}{8.5in}

newcommand{handout}[5]{
renewcommand{thepage}{#1-arabic{page}}
noindent
begin{center}
framebox{
vbox{
hbox to 5.78in {{sf Randomized Algorithms}
hfill sf #2 }
vspace{4mm}
hbox to 5.78in { {Large hfill #5 hfill} }
vspace{2mm}
hbox to 5.78in { {em #3 hfill #4} }
}
}
end{center}
vspace*{4mm}
}

newcommand{lecture}[4]{handout{#1}{#2}{Lecture date: #3}{Scribe: #4}{Lecture #1}}


textwidth=6in oddsidemargin=0.25in evensidemargin=0.25in topmargin=-0.1in footskip=0.8in
parindent=0.0cm
parskip=0.3cm
textheight=8.00in setcounter{tocdepth} {3} setcounter{secnumdepth} {2} sloppy


newtheorem{theorem}{Theorem}
newtheorem{lemma}[theorem]{Lemma}
newtheorem{claim}[theorem]{Claim}
newtheorem{proposition}[theorem]{Proposition}
newtheorem{corollary}[theorem]{Corollary}
newtheorem{fact}[theorem]{Fact}
newtheorem{definition}[theorem]{Definition}
newtheorem{remark}[theorem]{Remark}
newtheorem{conjecture}[theorem]{Conjecture}
newtheorem{question}[theorem]{Question}
newtheorem{answer}[theorem]{Answer}
%newtheorem{exercise}[theorem]{Exercise}
newtheorem{example}[theorem]{Example}
newtheorem{algorithm}[theorem]{Algorithm}
%newtheorem{exercise}[theorem]{Exercise}
newenvironment{exercise}{noindent textbf{Exercise}}{}%[theorem]{Exercise}
newenvironment{challenge}{noindent textbf{Challenge}}{}%[theorem]{Exercise}
newenvironment{kitbag}{noindent textbf{Kitbag Exercise}}{}
newenvironment{proof}{noindent textbf{Proof}}{$Box$}
newenvironment{proof-sketch}{noindent textbf{Sketch of Proof}}{$Box$}

newcommand{ignore}[1]{}

renewcommand{Pr}{{textup{Pr}}}
renewcommand{P}{{bf P}}
newcommand{Px}{mathop{bf P/}}
newcommand{E}{{bf E}}
newcommand{Ex}{mathop{bf E/}}

newcommand{Var}{{bf Var}}
newcommand{Cov}{{bf Cov}}
newcommand{Varx}{mathop{bf Var/}}

newcommand{bits}{{-1,1}}

newcommand{nsmaja}{textstyle{frac{2}{pi}} arcsin rho}

newcommand{Inf}{mathrm{Inf}}
newcommand{I}{mathrm{I}}
newcommand{J}{mathrm{J}}

newcommand{eps}{epsilon}
newcommand{lam}{lambda}
newcommand{N}{mathbb N}
newcommand{R}{mathbb R}
newcommand{Z}{mathbb Z}
newcommand{C}{mathbb C}
newcommand{CalE}{{mathcal{E}}}

newcommand{CalU}{{mathcal{U}}}
newcommand{F}{{mathcal{F}}}
newcommand{CalC}{{mathcal{C}}}
newcommand{CalM}{{mathcal{M}}}
newcommand{CalR}{{mathcal{R}}}
newcommand{CalS}{{mathcal{S}}}
newcommand{CalV}{{mathcal{V}}}
newcommand{CalX}{{boldsymbol{mathcal{X}}}}
newcommand{CalG}{{boldsymbol{mathcal{G}}}}
newcommand{CalY}{{boldsymbol{mathcal{Y}}}}
newcommand{CalZ}{{boldsymbol{mathcal{Z}}}}
newcommand{CalF}{{mathcal{Z}}}
newcommand{boldG}{{boldsymbol G}}
newcommand{boldQ}{{boldsymbol Q}}
newcommand{boldR}{{boldsymbol R}}
newcommand{boldS}{{boldsymbol S}}
newcommand{boldX}{{boldsymbol X}}
newcommand{bfX}{{boldsymbol X}}
newcommand{boldB}{{boldsymbol B}}
newcommand{boldY}{{boldsymbol Y}}
newcommand{boldZ}{{boldsymbol Z}}
newcommand{boldV}{{boldsymbol V}}
newcommand{boldsigma}{{boldsymbol sigma}}
newcommand{boldupsilon}{{boldsymbol upsilon}}
newcommand{hone}{{boldsymbol{H1}}}
newcommand{htwo}{boldsymbol{H2}}
newcommand{hthree}{boldsymbol{H3}}
newcommand{hfour}{boldsymbol{H4}}
newcommand{poly}{boldsymbol{poly}}


newcommand{sgn}{mathrm{sgn}}
newcommand{Maj}{mathrm{Maj}}
newcommand{Thr}{mathrm{Thr}}
newcommand{littlesum}{{textstyle sum}}

newcommand{half}{{textstyle frac12}}

newcommand{Stab}{mathbb{S}}
newcommand{StabThr}[2]{Gamma_{#1}(#2)}
newcommand{TestFcn}{Psi}

renewcommand{phi}{varphi}
def la {langle}
def ra {rangle}

newcommand{x}{mathbf{x}}
renewcommand{o}{mbox{o}}
renewcommand{O}{mbox{O}}
newcommand{h}{mathbf{H}}
newcommand{va}{mbox{var}}
renewcommand{d}{mbox{d}}
renewcommand{C}{mathcal C}
newcommand{qed}{hfill $square$}
begin{document}

lecture{10}{Moni Naor}{Jan 2, 2011}{Itay Gonshorovitz}



end{document}






lyx






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 13 '11 at 22:54

























asked Mar 13 '11 at 21:55







user4165



















  • Welcome to tex.sx! It's not necessary to sign your questions (as there is already a box with your username below it) or to begin them with a greeting. A tip: if you change 1) to 1. etc. the enumeration is automatically formatted.
    – Martin Scharrer
    Mar 13 '11 at 22:04








  • 2




    It is very complicated to say what's going on if we don't have your teachers code. E.g. if he uses documentclass in his template it will clash with the one defined in lyx or your exported document. To say something is "ruined" is not a good problem description either. If you want to have a good answer, you have to show some code here.
    – Martin H
    Mar 13 '11 at 22:14










  • Okay, i edited the question and added some code - I was just trying before to be concise so as to not put too much information in the question. Hope now it will be more clear.
    – user4165
    Mar 13 '11 at 22:56


















  • Welcome to tex.sx! It's not necessary to sign your questions (as there is already a box with your username below it) or to begin them with a greeting. A tip: if you change 1) to 1. etc. the enumeration is automatically formatted.
    – Martin Scharrer
    Mar 13 '11 at 22:04








  • 2




    It is very complicated to say what's going on if we don't have your teachers code. E.g. if he uses documentclass in his template it will clash with the one defined in lyx or your exported document. To say something is "ruined" is not a good problem description either. If you want to have a good answer, you have to show some code here.
    – Martin H
    Mar 13 '11 at 22:14










  • Okay, i edited the question and added some code - I was just trying before to be concise so as to not put too much information in the question. Hope now it will be more clear.
    – user4165
    Mar 13 '11 at 22:56
















Welcome to tex.sx! It's not necessary to sign your questions (as there is already a box with your username below it) or to begin them with a greeting. A tip: if you change 1) to 1. etc. the enumeration is automatically formatted.
– Martin Scharrer
Mar 13 '11 at 22:04






Welcome to tex.sx! It's not necessary to sign your questions (as there is already a box with your username below it) or to begin them with a greeting. A tip: if you change 1) to 1. etc. the enumeration is automatically formatted.
– Martin Scharrer
Mar 13 '11 at 22:04






2




2




It is very complicated to say what's going on if we don't have your teachers code. E.g. if he uses documentclass in his template it will clash with the one defined in lyx or your exported document. To say something is "ruined" is not a good problem description either. If you want to have a good answer, you have to show some code here.
– Martin H
Mar 13 '11 at 22:14




It is very complicated to say what's going on if we don't have your teachers code. E.g. if he uses documentclass in his template it will clash with the one defined in lyx or your exported document. To say something is "ruined" is not a good problem description either. If you want to have a good answer, you have to show some code here.
– Martin H
Mar 13 '11 at 22:14












Okay, i edited the question and added some code - I was just trying before to be concise so as to not put too much information in the question. Hope now it will be more clear.
– user4165
Mar 13 '11 at 22:56




Okay, i edited the question and added some code - I was just trying before to be concise so as to not put too much information in the question. Hope now it will be more clear.
– user4165
Mar 13 '11 at 22:56










4 Answers
4






active

oldest

votes

















up vote
3
down vote













There's an issue with the Latex file you give: page layout parameters are duplicated, with some, such as topmargin being defined in two different ways.



I've imported this into Lyx without too much bother. Instructions:




  1. Cut and paste an excerpt from the above snippet into the Latex preamble from the DocumentSettings panel, starting from the line newcommand{handout}[5]{ and ending before begin{document}.

  2. On the Fonts tag of the settings panel, set the Base Size to 11pt.

  3. Insert a Tex code block into the document, and paste the body of the Latex file (i.e., inside the begin-end-document environment).


This will then compile.



An issue with this: Lyx will automatically import AMS packages and some others that it knows of, if it sees that you need them, but as I have it, it won't import the other packages defined in the Latex file you gave us. You can paste in the needed usepackage lines if you need them, but if you use Lyx for writing, you probably will not need these.






share|improve this answer




























    up vote
    2
    down vote













    Have a look into one of the predefined LyX laout files, they all are saved in a directory named layouts and have the file extensions .layout. In LInux they are saved under /usr/share/lyx/. I don't know what directory it is under Windows. Look for the file slides.layout how such a file has to be defined.



    However, it is much more simpler to use directly pdflatex instead of running LyX with creating an own layout file ...






    share|improve this answer





















    • I doubt that the predefined layouts will include anything useful for the qner.
      – Charles Stewart
      Mar 14 '11 at 9:46










    • @Charles: no, they won't ...
      – Herbert
      Mar 14 '11 at 9:57


















    up vote
    0
    down vote













    I had a look through you code and with all those definition that your teacher wants you to use it seems a lot easier to write in code rather than lyx (I know this is not an direct answer to your question.)



    However, in order to make this code work (with pdflatex) I came up with this



    documentclass[11pt]{article}
    usepackage{amssymb}
    usepackage{amsfonts}
    usepackage{amsmath}
    usepackage{bm}
    usepackage{latexsym}

    %usepackage{epsfig}
    usepackage{graphicx}

    usepackage[normalem]{ulem}

    usepackage[
    top=80pt,
    bottom=80pt,
    left=85pt,
    right=85pt,
    showframe %show the margin frame
    ]{geometry}
    usepackage{setspace} onehalfspacing

    %Better use the geometry package above
    %to define your margins
    %setlength{evensidemargin}{.25in} setlength{textwidth}{6in}
    %setlength{topmargin}{-0.4in}
    %setlength{textheight}{8.5in}

    %hyperref should usually be loaded
    %as the last package (few exemptions)
    usepackage{hyperref}

    newcommand{handout}[5]{
    renewcommand{thepage}{#1-arabic{page}}
    noindent
    begin{center}
    framebox{
    vbox{
    hbox to 5.78in {{sf Randomized Algorithms}
    hfill sf #2 }
    vspace{4mm}
    hbox to 5.78in { {Large hfill #5 hfill} }
    vspace{2mm}
    hbox to 5.78in { {em #3 hfill #4} }
    }
    }
    end{center}
    vspace*{4mm}
    }

    newcommand{lecture}[4]{handout{#1}{#2}{Lecture date: #3}{Scribe:
    #4}{Lecture #1}}

    %Define the margins with the geometry package above!!!
    %This is the second time the margins are defined
    % textwidth=6in oddsidemargin=0.25in evensidemargin=0.25in
    %topmargin=-0.1in
    % footskip=0.8in
    % parindent=0.0cm

    %Maybe use oparskip package
    % parskip=0.3cm
    % textheight=8.00in

    setcounter{tocdepth} {3}
    setcounter{secnumdepth} {2}

    %Sure you want to use sloppy??
    % sloppy

    begin{document}

    lecture{10}{Moni Naor}{Jan 2, 2011}{Itay Gonshorovitz}
    tableofcontents
    section{Some section}

    end{document}


    I noticed that the margins are multiply defined but I think using the geometry package is the right way to go here.



    Also look up what the sloppy command does, I think your document will look better without it.



    enter image description here






    share|improve this answer




























      up vote
      0
      down vote














      mwe




      Without any layouts is not very complicated:




      • Make a New Document

      • Go to Document > Settings...



        • Document classClass options → Custom → 11 pt


        • LaTeX Preamble→ Paste in the right empty window the code of your teacher, but (1) remove the two first lines (2) comment all the lines loading packages (%usepackage{...}) and (3) remove the last line with the document environment of last lines.




      • Apply > Close


      • Ctrl + L

      • Paste in the ERT (evil red box): lecture{10}{Moni Naor}{Jan 2, 2011}{Itay Gonshorovitz}


      Now is ready to use, but remember the commented packages because:





      1. To use some of your as R (to write ℝ) you have three options:




        1. Do not use the macro at all and write ℝ using Math Panels of LyX (recommended). This will load automatically the amssymb package to use the command mathbb{Z} that really write R. If you have alsousepackage{amssymb}` uncommented in the LateX Preamble, load the package twice will produce an error, but ...

        2. Write R in Math mode (Ctrl + MR). But note that this will not load amssymb automatically, so it could be that you must uncomment usepackage{amssymb} in the LateX Preamble (but only if it is not loaded automatically due to another command managed directly by LyX!)

        3. Write $R$ in a ERT (Ctrl + L$R$). This will not load amssymb either.




      Also take care of do not play with Lyx menus that can change document setting as margins, since this can cause a conflict with the pasted preamble.



      Considering this, personally I prefer edit LaTeX code directly, specially if the alternative will be have a a lot of macros in math mode or in ERT boxes.





      share





















        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "85"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f13341%2fadding-my-own-format-to-lyx%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown
























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        3
        down vote













        There's an issue with the Latex file you give: page layout parameters are duplicated, with some, such as topmargin being defined in two different ways.



        I've imported this into Lyx without too much bother. Instructions:




        1. Cut and paste an excerpt from the above snippet into the Latex preamble from the DocumentSettings panel, starting from the line newcommand{handout}[5]{ and ending before begin{document}.

        2. On the Fonts tag of the settings panel, set the Base Size to 11pt.

        3. Insert a Tex code block into the document, and paste the body of the Latex file (i.e., inside the begin-end-document environment).


        This will then compile.



        An issue with this: Lyx will automatically import AMS packages and some others that it knows of, if it sees that you need them, but as I have it, it won't import the other packages defined in the Latex file you gave us. You can paste in the needed usepackage lines if you need them, but if you use Lyx for writing, you probably will not need these.






        share|improve this answer

























          up vote
          3
          down vote













          There's an issue with the Latex file you give: page layout parameters are duplicated, with some, such as topmargin being defined in two different ways.



          I've imported this into Lyx without too much bother. Instructions:




          1. Cut and paste an excerpt from the above snippet into the Latex preamble from the DocumentSettings panel, starting from the line newcommand{handout}[5]{ and ending before begin{document}.

          2. On the Fonts tag of the settings panel, set the Base Size to 11pt.

          3. Insert a Tex code block into the document, and paste the body of the Latex file (i.e., inside the begin-end-document environment).


          This will then compile.



          An issue with this: Lyx will automatically import AMS packages and some others that it knows of, if it sees that you need them, but as I have it, it won't import the other packages defined in the Latex file you gave us. You can paste in the needed usepackage lines if you need them, but if you use Lyx for writing, you probably will not need these.






          share|improve this answer























            up vote
            3
            down vote










            up vote
            3
            down vote









            There's an issue with the Latex file you give: page layout parameters are duplicated, with some, such as topmargin being defined in two different ways.



            I've imported this into Lyx without too much bother. Instructions:




            1. Cut and paste an excerpt from the above snippet into the Latex preamble from the DocumentSettings panel, starting from the line newcommand{handout}[5]{ and ending before begin{document}.

            2. On the Fonts tag of the settings panel, set the Base Size to 11pt.

            3. Insert a Tex code block into the document, and paste the body of the Latex file (i.e., inside the begin-end-document environment).


            This will then compile.



            An issue with this: Lyx will automatically import AMS packages and some others that it knows of, if it sees that you need them, but as I have it, it won't import the other packages defined in the Latex file you gave us. You can paste in the needed usepackage lines if you need them, but if you use Lyx for writing, you probably will not need these.






            share|improve this answer












            There's an issue with the Latex file you give: page layout parameters are duplicated, with some, such as topmargin being defined in two different ways.



            I've imported this into Lyx without too much bother. Instructions:




            1. Cut and paste an excerpt from the above snippet into the Latex preamble from the DocumentSettings panel, starting from the line newcommand{handout}[5]{ and ending before begin{document}.

            2. On the Fonts tag of the settings panel, set the Base Size to 11pt.

            3. Insert a Tex code block into the document, and paste the body of the Latex file (i.e., inside the begin-end-document environment).


            This will then compile.



            An issue with this: Lyx will automatically import AMS packages and some others that it knows of, if it sees that you need them, but as I have it, it won't import the other packages defined in the Latex file you gave us. You can paste in the needed usepackage lines if you need them, but if you use Lyx for writing, you probably will not need these.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 14 '11 at 9:42









            Charles Stewart

            17.1k355110




            17.1k355110






















                up vote
                2
                down vote













                Have a look into one of the predefined LyX laout files, they all are saved in a directory named layouts and have the file extensions .layout. In LInux they are saved under /usr/share/lyx/. I don't know what directory it is under Windows. Look for the file slides.layout how such a file has to be defined.



                However, it is much more simpler to use directly pdflatex instead of running LyX with creating an own layout file ...






                share|improve this answer





















                • I doubt that the predefined layouts will include anything useful for the qner.
                  – Charles Stewart
                  Mar 14 '11 at 9:46










                • @Charles: no, they won't ...
                  – Herbert
                  Mar 14 '11 at 9:57















                up vote
                2
                down vote













                Have a look into one of the predefined LyX laout files, they all are saved in a directory named layouts and have the file extensions .layout. In LInux they are saved under /usr/share/lyx/. I don't know what directory it is under Windows. Look for the file slides.layout how such a file has to be defined.



                However, it is much more simpler to use directly pdflatex instead of running LyX with creating an own layout file ...






                share|improve this answer





















                • I doubt that the predefined layouts will include anything useful for the qner.
                  – Charles Stewart
                  Mar 14 '11 at 9:46










                • @Charles: no, they won't ...
                  – Herbert
                  Mar 14 '11 at 9:57













                up vote
                2
                down vote










                up vote
                2
                down vote









                Have a look into one of the predefined LyX laout files, they all are saved in a directory named layouts and have the file extensions .layout. In LInux they are saved under /usr/share/lyx/. I don't know what directory it is under Windows. Look for the file slides.layout how such a file has to be defined.



                However, it is much more simpler to use directly pdflatex instead of running LyX with creating an own layout file ...






                share|improve this answer












                Have a look into one of the predefined LyX laout files, they all are saved in a directory named layouts and have the file extensions .layout. In LInux they are saved under /usr/share/lyx/. I don't know what directory it is under Windows. Look for the file slides.layout how such a file has to be defined.



                However, it is much more simpler to use directly pdflatex instead of running LyX with creating an own layout file ...







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 14 '11 at 9:20









                Herbert

                266k23404714




                266k23404714












                • I doubt that the predefined layouts will include anything useful for the qner.
                  – Charles Stewart
                  Mar 14 '11 at 9:46










                • @Charles: no, they won't ...
                  – Herbert
                  Mar 14 '11 at 9:57


















                • I doubt that the predefined layouts will include anything useful for the qner.
                  – Charles Stewart
                  Mar 14 '11 at 9:46










                • @Charles: no, they won't ...
                  – Herbert
                  Mar 14 '11 at 9:57
















                I doubt that the predefined layouts will include anything useful for the qner.
                – Charles Stewart
                Mar 14 '11 at 9:46




                I doubt that the predefined layouts will include anything useful for the qner.
                – Charles Stewart
                Mar 14 '11 at 9:46












                @Charles: no, they won't ...
                – Herbert
                Mar 14 '11 at 9:57




                @Charles: no, they won't ...
                – Herbert
                Mar 14 '11 at 9:57










                up vote
                0
                down vote













                I had a look through you code and with all those definition that your teacher wants you to use it seems a lot easier to write in code rather than lyx (I know this is not an direct answer to your question.)



                However, in order to make this code work (with pdflatex) I came up with this



                documentclass[11pt]{article}
                usepackage{amssymb}
                usepackage{amsfonts}
                usepackage{amsmath}
                usepackage{bm}
                usepackage{latexsym}

                %usepackage{epsfig}
                usepackage{graphicx}

                usepackage[normalem]{ulem}

                usepackage[
                top=80pt,
                bottom=80pt,
                left=85pt,
                right=85pt,
                showframe %show the margin frame
                ]{geometry}
                usepackage{setspace} onehalfspacing

                %Better use the geometry package above
                %to define your margins
                %setlength{evensidemargin}{.25in} setlength{textwidth}{6in}
                %setlength{topmargin}{-0.4in}
                %setlength{textheight}{8.5in}

                %hyperref should usually be loaded
                %as the last package (few exemptions)
                usepackage{hyperref}

                newcommand{handout}[5]{
                renewcommand{thepage}{#1-arabic{page}}
                noindent
                begin{center}
                framebox{
                vbox{
                hbox to 5.78in {{sf Randomized Algorithms}
                hfill sf #2 }
                vspace{4mm}
                hbox to 5.78in { {Large hfill #5 hfill} }
                vspace{2mm}
                hbox to 5.78in { {em #3 hfill #4} }
                }
                }
                end{center}
                vspace*{4mm}
                }

                newcommand{lecture}[4]{handout{#1}{#2}{Lecture date: #3}{Scribe:
                #4}{Lecture #1}}

                %Define the margins with the geometry package above!!!
                %This is the second time the margins are defined
                % textwidth=6in oddsidemargin=0.25in evensidemargin=0.25in
                %topmargin=-0.1in
                % footskip=0.8in
                % parindent=0.0cm

                %Maybe use oparskip package
                % parskip=0.3cm
                % textheight=8.00in

                setcounter{tocdepth} {3}
                setcounter{secnumdepth} {2}

                %Sure you want to use sloppy??
                % sloppy

                begin{document}

                lecture{10}{Moni Naor}{Jan 2, 2011}{Itay Gonshorovitz}
                tableofcontents
                section{Some section}

                end{document}


                I noticed that the margins are multiply defined but I think using the geometry package is the right way to go here.



                Also look up what the sloppy command does, I think your document will look better without it.



                enter image description here






                share|improve this answer

























                  up vote
                  0
                  down vote













                  I had a look through you code and with all those definition that your teacher wants you to use it seems a lot easier to write in code rather than lyx (I know this is not an direct answer to your question.)



                  However, in order to make this code work (with pdflatex) I came up with this



                  documentclass[11pt]{article}
                  usepackage{amssymb}
                  usepackage{amsfonts}
                  usepackage{amsmath}
                  usepackage{bm}
                  usepackage{latexsym}

                  %usepackage{epsfig}
                  usepackage{graphicx}

                  usepackage[normalem]{ulem}

                  usepackage[
                  top=80pt,
                  bottom=80pt,
                  left=85pt,
                  right=85pt,
                  showframe %show the margin frame
                  ]{geometry}
                  usepackage{setspace} onehalfspacing

                  %Better use the geometry package above
                  %to define your margins
                  %setlength{evensidemargin}{.25in} setlength{textwidth}{6in}
                  %setlength{topmargin}{-0.4in}
                  %setlength{textheight}{8.5in}

                  %hyperref should usually be loaded
                  %as the last package (few exemptions)
                  usepackage{hyperref}

                  newcommand{handout}[5]{
                  renewcommand{thepage}{#1-arabic{page}}
                  noindent
                  begin{center}
                  framebox{
                  vbox{
                  hbox to 5.78in {{sf Randomized Algorithms}
                  hfill sf #2 }
                  vspace{4mm}
                  hbox to 5.78in { {Large hfill #5 hfill} }
                  vspace{2mm}
                  hbox to 5.78in { {em #3 hfill #4} }
                  }
                  }
                  end{center}
                  vspace*{4mm}
                  }

                  newcommand{lecture}[4]{handout{#1}{#2}{Lecture date: #3}{Scribe:
                  #4}{Lecture #1}}

                  %Define the margins with the geometry package above!!!
                  %This is the second time the margins are defined
                  % textwidth=6in oddsidemargin=0.25in evensidemargin=0.25in
                  %topmargin=-0.1in
                  % footskip=0.8in
                  % parindent=0.0cm

                  %Maybe use oparskip package
                  % parskip=0.3cm
                  % textheight=8.00in

                  setcounter{tocdepth} {3}
                  setcounter{secnumdepth} {2}

                  %Sure you want to use sloppy??
                  % sloppy

                  begin{document}

                  lecture{10}{Moni Naor}{Jan 2, 2011}{Itay Gonshorovitz}
                  tableofcontents
                  section{Some section}

                  end{document}


                  I noticed that the margins are multiply defined but I think using the geometry package is the right way to go here.



                  Also look up what the sloppy command does, I think your document will look better without it.



                  enter image description here






                  share|improve this answer























                    up vote
                    0
                    down vote










                    up vote
                    0
                    down vote









                    I had a look through you code and with all those definition that your teacher wants you to use it seems a lot easier to write in code rather than lyx (I know this is not an direct answer to your question.)



                    However, in order to make this code work (with pdflatex) I came up with this



                    documentclass[11pt]{article}
                    usepackage{amssymb}
                    usepackage{amsfonts}
                    usepackage{amsmath}
                    usepackage{bm}
                    usepackage{latexsym}

                    %usepackage{epsfig}
                    usepackage{graphicx}

                    usepackage[normalem]{ulem}

                    usepackage[
                    top=80pt,
                    bottom=80pt,
                    left=85pt,
                    right=85pt,
                    showframe %show the margin frame
                    ]{geometry}
                    usepackage{setspace} onehalfspacing

                    %Better use the geometry package above
                    %to define your margins
                    %setlength{evensidemargin}{.25in} setlength{textwidth}{6in}
                    %setlength{topmargin}{-0.4in}
                    %setlength{textheight}{8.5in}

                    %hyperref should usually be loaded
                    %as the last package (few exemptions)
                    usepackage{hyperref}

                    newcommand{handout}[5]{
                    renewcommand{thepage}{#1-arabic{page}}
                    noindent
                    begin{center}
                    framebox{
                    vbox{
                    hbox to 5.78in {{sf Randomized Algorithms}
                    hfill sf #2 }
                    vspace{4mm}
                    hbox to 5.78in { {Large hfill #5 hfill} }
                    vspace{2mm}
                    hbox to 5.78in { {em #3 hfill #4} }
                    }
                    }
                    end{center}
                    vspace*{4mm}
                    }

                    newcommand{lecture}[4]{handout{#1}{#2}{Lecture date: #3}{Scribe:
                    #4}{Lecture #1}}

                    %Define the margins with the geometry package above!!!
                    %This is the second time the margins are defined
                    % textwidth=6in oddsidemargin=0.25in evensidemargin=0.25in
                    %topmargin=-0.1in
                    % footskip=0.8in
                    % parindent=0.0cm

                    %Maybe use oparskip package
                    % parskip=0.3cm
                    % textheight=8.00in

                    setcounter{tocdepth} {3}
                    setcounter{secnumdepth} {2}

                    %Sure you want to use sloppy??
                    % sloppy

                    begin{document}

                    lecture{10}{Moni Naor}{Jan 2, 2011}{Itay Gonshorovitz}
                    tableofcontents
                    section{Some section}

                    end{document}


                    I noticed that the margins are multiply defined but I think using the geometry package is the right way to go here.



                    Also look up what the sloppy command does, I think your document will look better without it.



                    enter image description here






                    share|improve this answer












                    I had a look through you code and with all those definition that your teacher wants you to use it seems a lot easier to write in code rather than lyx (I know this is not an direct answer to your question.)



                    However, in order to make this code work (with pdflatex) I came up with this



                    documentclass[11pt]{article}
                    usepackage{amssymb}
                    usepackage{amsfonts}
                    usepackage{amsmath}
                    usepackage{bm}
                    usepackage{latexsym}

                    %usepackage{epsfig}
                    usepackage{graphicx}

                    usepackage[normalem]{ulem}

                    usepackage[
                    top=80pt,
                    bottom=80pt,
                    left=85pt,
                    right=85pt,
                    showframe %show the margin frame
                    ]{geometry}
                    usepackage{setspace} onehalfspacing

                    %Better use the geometry package above
                    %to define your margins
                    %setlength{evensidemargin}{.25in} setlength{textwidth}{6in}
                    %setlength{topmargin}{-0.4in}
                    %setlength{textheight}{8.5in}

                    %hyperref should usually be loaded
                    %as the last package (few exemptions)
                    usepackage{hyperref}

                    newcommand{handout}[5]{
                    renewcommand{thepage}{#1-arabic{page}}
                    noindent
                    begin{center}
                    framebox{
                    vbox{
                    hbox to 5.78in {{sf Randomized Algorithms}
                    hfill sf #2 }
                    vspace{4mm}
                    hbox to 5.78in { {Large hfill #5 hfill} }
                    vspace{2mm}
                    hbox to 5.78in { {em #3 hfill #4} }
                    }
                    }
                    end{center}
                    vspace*{4mm}
                    }

                    newcommand{lecture}[4]{handout{#1}{#2}{Lecture date: #3}{Scribe:
                    #4}{Lecture #1}}

                    %Define the margins with the geometry package above!!!
                    %This is the second time the margins are defined
                    % textwidth=6in oddsidemargin=0.25in evensidemargin=0.25in
                    %topmargin=-0.1in
                    % footskip=0.8in
                    % parindent=0.0cm

                    %Maybe use oparskip package
                    % parskip=0.3cm
                    % textheight=8.00in

                    setcounter{tocdepth} {3}
                    setcounter{secnumdepth} {2}

                    %Sure you want to use sloppy??
                    % sloppy

                    begin{document}

                    lecture{10}{Moni Naor}{Jan 2, 2011}{Itay Gonshorovitz}
                    tableofcontents
                    section{Some section}

                    end{document}


                    I noticed that the margins are multiply defined but I think using the geometry package is the right way to go here.



                    Also look up what the sloppy command does, I think your document will look better without it.



                    enter image description here







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 14 '11 at 9:42









                    Martin H

                    13.7k24055




                    13.7k24055






















                        up vote
                        0
                        down vote














                        mwe




                        Without any layouts is not very complicated:




                        • Make a New Document

                        • Go to Document > Settings...



                          • Document classClass options → Custom → 11 pt


                          • LaTeX Preamble→ Paste in the right empty window the code of your teacher, but (1) remove the two first lines (2) comment all the lines loading packages (%usepackage{...}) and (3) remove the last line with the document environment of last lines.




                        • Apply > Close


                        • Ctrl + L

                        • Paste in the ERT (evil red box): lecture{10}{Moni Naor}{Jan 2, 2011}{Itay Gonshorovitz}


                        Now is ready to use, but remember the commented packages because:





                        1. To use some of your as R (to write ℝ) you have three options:




                          1. Do not use the macro at all and write ℝ using Math Panels of LyX (recommended). This will load automatically the amssymb package to use the command mathbb{Z} that really write R. If you have alsousepackage{amssymb}` uncommented in the LateX Preamble, load the package twice will produce an error, but ...

                          2. Write R in Math mode (Ctrl + MR). But note that this will not load amssymb automatically, so it could be that you must uncomment usepackage{amssymb} in the LateX Preamble (but only if it is not loaded automatically due to another command managed directly by LyX!)

                          3. Write $R$ in a ERT (Ctrl + L$R$). This will not load amssymb either.




                        Also take care of do not play with Lyx menus that can change document setting as margins, since this can cause a conflict with the pasted preamble.



                        Considering this, personally I prefer edit LaTeX code directly, specially if the alternative will be have a a lot of macros in math mode or in ERT boxes.





                        share

























                          up vote
                          0
                          down vote














                          mwe




                          Without any layouts is not very complicated:




                          • Make a New Document

                          • Go to Document > Settings...



                            • Document classClass options → Custom → 11 pt


                            • LaTeX Preamble→ Paste in the right empty window the code of your teacher, but (1) remove the two first lines (2) comment all the lines loading packages (%usepackage{...}) and (3) remove the last line with the document environment of last lines.




                          • Apply > Close


                          • Ctrl + L

                          • Paste in the ERT (evil red box): lecture{10}{Moni Naor}{Jan 2, 2011}{Itay Gonshorovitz}


                          Now is ready to use, but remember the commented packages because:





                          1. To use some of your as R (to write ℝ) you have three options:




                            1. Do not use the macro at all and write ℝ using Math Panels of LyX (recommended). This will load automatically the amssymb package to use the command mathbb{Z} that really write R. If you have alsousepackage{amssymb}` uncommented in the LateX Preamble, load the package twice will produce an error, but ...

                            2. Write R in Math mode (Ctrl + MR). But note that this will not load amssymb automatically, so it could be that you must uncomment usepackage{amssymb} in the LateX Preamble (but only if it is not loaded automatically due to another command managed directly by LyX!)

                            3. Write $R$ in a ERT (Ctrl + L$R$). This will not load amssymb either.




                          Also take care of do not play with Lyx menus that can change document setting as margins, since this can cause a conflict with the pasted preamble.



                          Considering this, personally I prefer edit LaTeX code directly, specially if the alternative will be have a a lot of macros in math mode or in ERT boxes.





                          share























                            up vote
                            0
                            down vote










                            up vote
                            0
                            down vote










                            mwe




                            Without any layouts is not very complicated:




                            • Make a New Document

                            • Go to Document > Settings...



                              • Document classClass options → Custom → 11 pt


                              • LaTeX Preamble→ Paste in the right empty window the code of your teacher, but (1) remove the two first lines (2) comment all the lines loading packages (%usepackage{...}) and (3) remove the last line with the document environment of last lines.




                            • Apply > Close


                            • Ctrl + L

                            • Paste in the ERT (evil red box): lecture{10}{Moni Naor}{Jan 2, 2011}{Itay Gonshorovitz}


                            Now is ready to use, but remember the commented packages because:





                            1. To use some of your as R (to write ℝ) you have three options:




                              1. Do not use the macro at all and write ℝ using Math Panels of LyX (recommended). This will load automatically the amssymb package to use the command mathbb{Z} that really write R. If you have alsousepackage{amssymb}` uncommented in the LateX Preamble, load the package twice will produce an error, but ...

                              2. Write R in Math mode (Ctrl + MR). But note that this will not load amssymb automatically, so it could be that you must uncomment usepackage{amssymb} in the LateX Preamble (but only if it is not loaded automatically due to another command managed directly by LyX!)

                              3. Write $R$ in a ERT (Ctrl + L$R$). This will not load amssymb either.




                            Also take care of do not play with Lyx menus that can change document setting as margins, since this can cause a conflict with the pasted preamble.



                            Considering this, personally I prefer edit LaTeX code directly, specially if the alternative will be have a a lot of macros in math mode or in ERT boxes.





                            share













                            mwe




                            Without any layouts is not very complicated:




                            • Make a New Document

                            • Go to Document > Settings...



                              • Document classClass options → Custom → 11 pt


                              • LaTeX Preamble→ Paste in the right empty window the code of your teacher, but (1) remove the two first lines (2) comment all the lines loading packages (%usepackage{...}) and (3) remove the last line with the document environment of last lines.




                            • Apply > Close


                            • Ctrl + L

                            • Paste in the ERT (evil red box): lecture{10}{Moni Naor}{Jan 2, 2011}{Itay Gonshorovitz}


                            Now is ready to use, but remember the commented packages because:





                            1. To use some of your as R (to write ℝ) you have three options:




                              1. Do not use the macro at all and write ℝ using Math Panels of LyX (recommended). This will load automatically the amssymb package to use the command mathbb{Z} that really write R. If you have alsousepackage{amssymb}` uncommented in the LateX Preamble, load the package twice will produce an error, but ...

                              2. Write R in Math mode (Ctrl + MR). But note that this will not load amssymb automatically, so it could be that you must uncomment usepackage{amssymb} in the LateX Preamble (but only if it is not loaded automatically due to another command managed directly by LyX!)

                              3. Write $R$ in a ERT (Ctrl + L$R$). This will not load amssymb either.




                            Also take care of do not play with Lyx menus that can change document setting as margins, since this can cause a conflict with the pasted preamble.



                            Considering this, personally I prefer edit LaTeX code directly, specially if the alternative will be have a a lot of macros in math mode or in ERT boxes.






                            share











                            share


                            share










                            answered 5 mins ago









                            Fran

                            50k6111174




                            50k6111174






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.





                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                Please pay close attention to the following guidance:


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f13341%2fadding-my-own-format-to-lyx%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Entries order in /etc/network/interfaces

                                新発田市

                                Grub takes very long (several minutes) to open Menu (in Multi-Boot-System)