Use fancyhdr in Lyx to position page number - latex

I am trying to customise the position of the page number to make them all appear at the bottom centre in Lyx. I plan to use the fancyhdr package in the preamble section of the document, but I get the following error msg:
'LaTex Error: Command /footruleskip already defined'
I guess it has something to do with me forcing a footnote formatting which may already be defined by fancyhdr package, as i have the following in my preamble:
\setlength{\skip\footins}{0.8cm}
Any suggestion how I get around this problem and set the page number position together with the footnote setting? Many thanks.

This link should help: http://en.wikibooks.org/wiki/LaTeX/Page_Layout#Customising_with_fancyhdr. You can use the lhead, chead, rhead, lfoot, cfoot and rfoot commands to tell it what you what where (section names, page numbers, custom text, etc). I think you still need to specify them even if they are empty. For only a page number at the bottom center, that would be:
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\lhead{}
\chead{}
\rhead{}
\lfoot{}
\cfoot{\thepage}
\rfoot{}
Perhaps your error could be fixed by using \renewcommand instead of trying to define an already existing value.

I'm trying to do my thesis with LyX and small problems like this are killing me because of having to adhere to the strict format of my school. Anyhow, this page came up as I searched for over an hour for the answer to your question. I'm using the memoir layout (kind of, I've already had to edit it) because my school's latex .cls file is supposedly based on memoir.cls (which I couldn't get to work correctly with LyX despite hours of persistence). I ended up putting this code into my preamble and it displayed the page numbers in the bottom-center per my formatting requirements.
\makeevenfoot{headings}{}{\thepage}{}
\makeoddfoot{headings}{}{\thepage}{}
\makeevenhead{headings}{}{}{}
\makeoddhead{headings}{}{}{}
Hope this helps anyone else that finds this page. Now if I can just figure out how to tell LyX that I have no chapters and I want sections to be 1 instead of 0.1. I'll probably just use section* and call my sections "Section" #. Anyway, I hope this helps someone who is as close to punching themselves in the face for using LyX as I am.

Related

Latex - how can I make a text to stand out more?

I'm designing my diploma thesis and would like to make a big question mark to every problem and a exclamation mark to every solution. It should like like this:
Do you know any Latex-Libraries to accomplish that behaviour? If there is no such library I would be more than happy if you could help me getting started writing my own Latex-Command.
Here is one basic approach. No packages are involved.
A particular thing about your layout is the use of the margin, correlated with that line of text. One way about it is to define a simple environment, which uses Latex command for margin notes, \marginpar. Then you can also set up fonts as you please, within this environment. Below I also insert an unrelated margin note, as an example in case you are not familiar with those.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\newenvironment{Q} {\hspace{\stretch{1}} \Huge} {\marginpar{ \Huge{?} } \newline}
\newenvironment{A} {\hspace{\stretch{1}} \Huge} {\marginpar{ \Huge{!} } \newline}
\begin{document}
\section{First section}
Some text ... Margin note entered {\em here} \marginpar{NOTE} ... more text \\
\vspace{0.5in}
\begin{Q} Here is a question \end{Q}
State your question ... \\
\begin{A} This is an answer \end{A}
Go with the answer ... \\
New paragraph, for other text ...
\end{document}
See this page in Latex Wikibooks for a very clear explanation of how to define a new environment. If you end up wanting more control see the package environ.
Margin notes provide you with a few options. If you want to reverse the logic of where they are placed, use \reversemarginpar. You can also set up different text to appear depending on which margin the note goes in by using \marginpar[left text]{right text}. See the Wikibooks article on footnotes and margin notes, which spells out where notes go based on the document type.
Here are some posts for more specialized uses: on notes in both margins, and on notes in narrow margnins. For doing far more with margin notes see package magrinnote, and there are yet other packages, like todonotes. See this post for a visual show off of what it can do.
I've used a basic way to change font size, and no special symbols. A list of these fonts can be found in this post, for example. You can use very particular fonts and/or symbols if you like, which are convenient to set up in the new environment. See, for example, this post, which also has another way of formatting for your Q&A. Also informative may be this post.
Note that you can also use existing environments inside this new one, if you wish. You can also set up a counter, and have an ability to cross-reference these. See this post for an example.

Latex paragraph spacing and page Margins

My latex file is:
\title{\large\textbf{Optimizarea rela\c tiei dintre structur\u a \c si comportament \^in modelarea UML}}
\author{
Sorin Oltean \\
\textit{Universitatea Transilvania din Bra\c sov} \\
\small\textit{oltean.s#gmail.com, sorin.oltean#romtelecom.ro} \\
\small Tel.: 0752/314288
}
\documentclass[12pt]{article}
\begin{document}
\maketitle
\renewcommand\abstractname{\textit{\textbf{Abstract}}}
\begin{abstract}
Something..... text.........
\end{abstract}\\\
\textbf{Cuvinte cheie:} \textit{sistem, structur\u a, comportament, UML}
\section{Introducere}
\paragraph{ }
Para11.............
\paragraph{ }
Para2......
\bibliographystyle{abbrv}
\bibliography{main}
\end{document}
After para1, i wanna start a new paragraph, but between the paragraphs there is a blank line, how can i start the 2nd paragraph below the 1st one, without that blank space?
Also, how can i define the margins (top, down, left, right) of the document? There is too much space from the left, right, top and down, i wanna just 2cm space from the left and right, and 3cm from the top and down. Sorry for my bad english..
Also how can i specify the font name and size of the document?
Thanks!
I see you make several mistakes that are typical for beginners:
Don't use the standard classes for generic documents (article, report, book), they are too inflexible. Use the KOMA-Script classes (scrartcl, scrreprt, scrbook) or the memoir class instead.
Don't change the default settings until you have read books or articles about typography.
In particular, the default page margins are OK, there is no need to change them. Margins of 2 cm would be way too narrow.
When it comes to fonts, the answer depends on which engine you use: pdfTeX-based documents require specially-crafted packages, whereas modern engines (XeTeX and LuaTeX) can access system fonts. Like before, don't switch fonts light-heartedly. Only very few fonts of high quality are available to normal users. In particular, never use Arial or Times New Roman. On Mac OS X, you could use Hoefler Text, on Windows Cambria, for example.
Don't include formatting commands in token lists that are intended for plain strings like \title or \abstractname; use the formatting commands that your document class provides.
\paragraph is a sectioning commands that creates a heading; use blank lines to separate simple text paragraphs.
Load the inputenc package (only necessary in the case of pdfTeX) so that you can enter non-ASCII characters directly.
The \documentclass command must come first.
Don't use the geometry package unless you have very specific and unavoidable requirements.
Avoid the parskip package; modern document classes already include its functionality; and normally, paragraphs should be marked by indents, not by vertical space, so no changes to the default are required.
Never use the fullpage package, it's completely outdated.
Like the others said, start by reading some introductory material about LaTeX like the Short Introduction.
Read the document Obsolete packages and commands.
Use the geometry package. It allows full control over margins etc.
\usepackage{geometry}
\geometry{margin=2cm}
The space between paragraphs can be set via parskip:
\setlength{\parskip}{0cm}
However, parskip does not work for paragarphs introduced by \paragraph. But if your paragraphs do not need a caption (as I assume since you wrote \paragraph{}, it may be better to begin paragraphs just with a blank line:
\setlength{\parskip}{0cm}
Here goes the first paragraph.
Here the second. With no space. Note that this paragraph was introduced with a blank line.
\paragraph{The third paragraph} This paragraph will have a small offset, since it is introduced explicitly with paragraph command.
I would suggest this as a good reference to start with. Familarize yourself with the way documents are prepared for LaTeX.
1) There is no need to use \paragraph{}, just an empty line between paragraphs is enough. This will create a visible vertical space between paragraphs (that's why you wanted different paragraphs, right?). If you are bothered by the default indention for the new paragraph have a look at the documentation for \noindent or \parskip.
2) If you really have to start tweaking the page layout (i.e. your university/journal/employer doesn't already provide an accepted class or style) have a look at the geometry package.
3) There should be some fonts available in your installation already (beton, helvet, palatino?), and these can be loaded as packages. It really depends on what exactly you need to do.
For paragraphs, try putting your text inside the {} so that you have
\paragraph{
Para11.............
}
But normally I think you can just put two lines between each paragraph and not bother with \paragraph{}. Otherwise, you can change the parskip value. Wikibooks shows how but I'm not allowed to post a 2nd link. It's in the Document Structure part of the Latex wikibook.
You can use the geometry package to specify your margins:
\usepackage{geometry}
\geometry{top=3cm, left=2cm, right=2cm, bottom=3cm}
Documentation
For less margins I recommend using fullpage, i.e.
\usepackage{fullpage}
see fullpage documentation for more information
Use the geometry package to change the margins of the document
\usepackage[top=3cm,left=2cm,right=2cm,bottom=3cm]{geometry}
I think the space between the paragraphs can be configured with the package:
\usepackage{parskip}
Documentation in CTAN is here. I haven't really tested it though.
For the margins you could do it manually with , the esaiest way is to do it the following package:
\usepackage[margin=2.5cm]{geometry}
You can check documentation here.

How to manually equalize columns in an IEEE paper if using BibTex?

IEEE conference publications in two-column format require authors to manually equalize the lengths of the columns on the last page of the final submission. I have typically done this by inserting a \newpage where necessary -- which usually ends up being somewhere amidst my (manually entered) references.
However, I have recently begun using BibTeX to manage references, and have now run into a problem: my last page contains only a few (generated) references, and I can't figure out how to manually equalize the columns.
The last page is the tail end of what is generated by:
\bibliographystyle{IEEEtran}
\bibliography{IEEEabrv,library}
Any ideas on how I can equalize the columns while continuing to use BibTeX?
I have submitted to both ACM and IEEE conferences and the easiest thing for me has been using:
\usepackage{flushend}
I've heard it doesn't always work well, but it's been great for me
http://www.ctan.org/pkg/flushend
I went back to RTFM again, and it turns out this is addressed right in "How to Use the IEEEtran LaTeX Class" by Michael Shell (maintainer). Section XIV notes that IEEEtran helpfully provides the \IEEEtriggeratref{} command for just this purpose. By default, it fires a \newline at the given BibTeX reference number. You can even change the command to fire with \IEEEtriggercmd{}.
It can also be done by using the balance package. You simply include the balance package in the preamble (\usepackage{balance}) and insert \balance some place on the last page of your document (for instance right in front of the references). However, I'm not sure if it's working if the last page (both columns) is completely full of references...
IEEE requires authors to equalize the lengths of the columns on the last page.
ACM makes us do this too. I just wind up inserting \vfill\break by hand either in the main text or somewhere in the .bbl file, wherever it makes the columns balance. By the time camera-ready copy goes to ACM, they want the .bbl file inlined by hand anyway, so tinkering by hand does not present an additional hardship.
The reference-number trick might be nice except I never use numbered references :-)
The multicols environment works only if you're luck and your last page comes out exactly as bibliography.
It would be extremely good (and not so difficult) if some enterprising hacker would build the "balance the two columns in the last page" functionality straight into LateX's \output routine. The flexibility is there in the underlying engine, and it would make a lot of people happy.
Not sure if multicol conflicts with bibtex at all, and I don't have time to check, sorry. But try this:
use the multicol package:
\usepackage{multicol} in your preamble, then:
\begin{multicols}{2}
\bibliographystyle{IEEEtran}
\bibliography{IEEEabrv,library}
\end{multicols}
Multicol automatically balances columns. I would recomend using it through out your document, instead of using the .cls or .sty's twocolumn option.

Problem in Latex: "There's no line here to end"

I'm using Lyx to produce a Latex document, and when i try to convert to pdf, it complains of the error: "there's no line to end", and description is "//".
My Latex document is like 200 lines without many line breaks. How am I supposed to debug this and get this darned pdf converted. I literally am stuck on this for hours, can't submit this pdf. And for 90% of the time while writing this document, the convert to pdf works fine, I don't know know since what point did it start to fail.
Someone give me a quick way to get rid of this error? Otherwise this Latex document is useless.
Thanks.
That may sound stupid, but sometimes Latex needs a sign before the \, therefore:
~\\
That very much depends on the distribution you chose. LyX btw. is kind of crazy, when it comes to LaTeX export. Try auctex if you've got a month or two to spare ;)
IMO this is the problem with LyX; when things go wrong it's hard to know where to look to fix the problem. This is a minimal document that shows an example of the error:
\documentclass{article}
\begin{document}
\\ there
\end{document}
I suggest exporting your LyX document to LaTeX, then compiling it "by hand" (with pdflatex mydoc or whatever) and see where in the document the error is appearing. You should then be able to correlate it with some misbehaving piece of the LyX document.
Do a binary search. Delete half the document, if it compiles then the problem was in the part you deleted. If not, then it's in the half you kept. Repeat the procedure on the offending portion and you should soon find which line is causing it.
Dear Saobi, please post the offending line. Probably you have a "\" in a single-line math environment. If you post the code for the complete environment, I can try to indicate how to prevent this error.
You can go to View -> View Source and click around until you find the offending line. In latex, line break is \\.
After doing that I realized the problem is you can't put a line break (Ctrl+Enter) at the start of a line (or cell). You can cheat by forcing a space (Ctrl+Space) before the line break. :)
My approach for locating compilation errors in LaTeX documents is based on a binary search approach. I suppose that a similar approach can be used in LyX.
The key idea is to divide your document in two parts of approximately the same size. At the boundary between these two parts a line containing \end{document} is inserted. If the document now can compile with no problems, the problem were located in the second half part of the document (otherwise it were in the first half part).
\documentclass{article}
\begin{document}
% First half part of the document
\section{Hello}
% Location for inserting \end{document}
% Second half part of the document
% in which the error is located
\section{World
\end{document}
In addition, check out that your LaTex lines already have content. I wrote an empty line, and It also causes error, from my experience.
\vspace{1cm}{ }\\

Excluding a chapter from TOC

In my LaTeX document I've got a table of contents that is automatically generated by collecting everything that is of the form \chapter.
However, I've got an acknowledgements chapter before the table of contents and I don't want it to be automatically labelled "Chapter 1" or captured in the table of contents. Should I be avoiding \chapter altogether and use \section instead? I want to keep the font/formatting that other chapters have though.
The usual way to handle that kind of thing is with the \frontmatter command. Put it after the \begin{document}, and then put \mainmatter right before the \chapter you want to correspond to chapter 1. This may only work in the book class. If you're using \chapter in a report, then \chapter* should also create a chapter that has no number and won't show up in the table of contents.
Indeed, as unknown (google) mentioned, using \frontmatter and \mainmatter is the best solution. This will also adjust your page numbering to lowercase roman numerals for the front matter. However, it works only on book and similar document classes.
In case you're using report, try \chapter*. This will create a chapter without a number that does not appear in the table of contents.
For articles \chapter* does not appear to work. Instead use \section*.

Resources