I need help with the latex glossaries package. I just need a footnote within a glossary entry.
Example:
\newglossaryentry{glos:vo}{
name=ValueObject,
description={a very good explanation for valueObject\footnote{S.89ff \cite{aBookInBibliography}}.}}
Texmaker refuses to build PDF. The log file is confusing as always, saying something like this:
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Too many }'s.
So any ideas here? Thank you.
i've got it. it has not been the fault of the footnote or cite. it turned out, my description text has been to long.
whysoever latex accepts description texts just with 1024 characters maximum.
Related
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.
I always like my figures to be placed in between text as opposed to the top or bottom of the page. I also like to talk about the figure before it is shown. So I am trying to have something like this:
By looking at Figure~\ref{fig:VCO} you can see that blah blah blah.
\begin{figure}[h]
\caption{VCO test circuit}\label{fig:VCO}
\begin{center}
\includegraphics[width=0.9\columnwidth]{figures/VCO_circuit.eps}
\end{center}
\end{figure}
This doesn't seem to work because it I guess it is referencing something that hasn't occurred yet? Does anyone have some simple solution? I am still very new to LaTeX.
Generally LaTeX needs at least two passes to resolve all its references, the first time to write them to an auxiliary file and the second time to put them into the final ps/pdf/dvi file. So it does not matter where the reference is.
A third pass will be needed, for example, if your document has a long table-of-contents which will screw up page numbers.
It failed the first time because labeling and referencing are a two-pass process. The first time you processed your latex, all the labels were being indexed so the ref failed. The second time around, since the labels had been indexed the ref knew what it was actually referencing.
I would add that latexmk (link) has proven invaluable to me over the years. This is a LaTeX "build" script written in Perl that is designed to compile .tex source files the right number of times. It parses the output from the latex command and performs dependency checking to ensure that the output document is kept up-to-date with the minimum number of passes. It can also deal with BibTeX bibliography files. Generally speaking, I invoke latexmk from either an Ant or GNU Make makefile and treat it just like I'm compiling C++ code, for example.
I had same problem and I found this solution:
\graphicspath{{images/}}
\DeclareGraphicsExtensions{.jpg}
\makeatletter
\newenvironment{tablehere}
{\def\#captype{table}}
{}
\newenvironment{figurehere}
{\def\#captype{figure}}
{}
\makeatother
\begin{figurehere}
\includegraphics[height=5cm]{2-14aGa-Sur.jpg}
\caption{Hliněná destička s mapou severu Mezopotámie}
\label{fig:Ga-Sur}
\end{figurehere}
\graphicspath{{images/}} is there to declare your path to your pictures
\DeclareGraphicsExtensions{.jpg} is there for declare picture extension (multiple can be with comma (I think ;-))
\makeatletter
\newenvironment{tablehere}
{\def\#captype{table}}
{}
\newenvironment{figurehere}
{\def\#captype{figure}}
{}
\makeatother
is there for precise determination of position here
\begin{figurehere}
\includegraphics[height=5cm]{2-14aGa-Sur.jpg}
\caption{Hliněná destička s mapou severu Mezopotámie}
\label{fig:Ga-Sur}
\end{figurehere}
there is your picture with height specified and caption and label with it...
I hope it will help you ;-).
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}{ }\\
My intuition was
Lorem ipsum\footnote{long footnote
that spans a whole
bunch of
lines.
}
But regardless of where I put the { and } in relation to the footnote text, I get the following error:
Latex Error: ./mydoc.tex:142 Package inputenc Error: Unicode char \u8:― not set up for use with LaTeX.
Footnotes are filled in the availible space just like any other paragraph: you just write
\footnote{
a whole lot of text that goes on and on and on and...
...
and may consists of multiple sentences. But after a while
...
it finally comes to a stop.
}
That is not your problem. looking at the error message (which I don't recognize from personal experience), I'd say your problem is character set or font related.
Is you editor using unicode?
The error you're getting indicates there's a coding setup issue. Googling the error message suggests you may be running TexShop, or you need to install latex unicode support. use
apt-get latex-ucs
or something similar and try it again.
I get this error a lot when I cut text from another document and paste into LaTeX. My plain text editor doesn't warn me that I pasted in some bad character. Although it is tedious, you can
comment out the entire text of your footnote, replace it by XX, and confirm that now your document runs
retype the entire text of your footnote by hand.
This always works for me. As a shortcut, you may be able to see a punctuation mark that is the culprit and simply fix that.
In the example you gave, it looks like maybe you got an em-dash character that needs to be replaced by the standard LaTeX construction of two or three hyphens.
I'm looking for a way to do a substring replace on a string in LaTeX. What I'd like to do is build a command that I can call like this:
\replace{File,New}
and that would generate something like
\textbf{File}$\rightarrow$\textbf{New}
This is a simple example, but I'd like to be able to put formatting/structure in a single command rather than everywhere in the document. I know that I could build several commands that take increasing numbers of parameters, but I'm hoping that there is an easier way.
Edit for clarification
I'm looking for an equivalent of
string.replace(",", "$\rightarrow$)
something that can take an arbitrary string, and replace a substring with another substring.
So I could call the command with \replace{File}, \replace{File,New}, \replace{File,Options,User}, etc., wrap the words with bold formatting, and replace any commas with the right arrow command. Even if the "wrapping with bold" bit is too difficult (as I think it might be), just the replace part would be helpful.
The general case is rather more tricky (when you're not using commas as separators), but the example you gave can be coded without too much trouble with some knowledge of the LaTeX internals.
\documentclass[12pt]{article}
\makeatletter
\newcommand\formatnice[1]{%
\let\#formatsep\#formatsepinit
\#for\#ii:=#1\do{%
\#formatsep
\formatentry{\#ii}%
}%
}
\def\#formatsepinit{\let\#formatsep\formatsep}
\makeatother
\newcommand\formatsep{,}
\newcommand\formatentry[1]{#1}
\begin{document}
\formatnice{abc,def}
\renewcommand\formatsep{\,$\rightarrow$\,}
\renewcommand\formatentry[1]{\textbf{#1}}
\formatnice{abc,def}
\end{document}
it looks like your "spaces" problem is from a bug in that package. If you surround the "\GetTokens" macro with, say, commas, then you'll see that the extra space is inserted by that macro.
Yes there are bugs in tokenizer package. As I said on my blog, the bugfix is to use the following correcting code instead of just "\usepackage[trim]{tokenizer}":
\usepackage[trim]{tokenizer}
\def\SH#GetTokens#1,#2\#empty{%
\def\SH#token{#1}%
\ifx\SH#trimtokens\SH#true% strip spaces if requested
\TrimSpaces\SH#token%
\fi%
\SH#DefineCommand{\SH#FirstArgName}{\SH#token}%
\SH#DefineCommand{\SH#SecondArgName}{#2}%
}
\def\SH#CheckTokenSep#1,#2\#empty{%
\def\SH#CTSArgTwo{#2}%
\ifx\SH#CTSArgTwo\#empty%
\edef\SH#TokenValid{\SH#false}%
\else%
\edef\SH#TokenValid{\SH#true}%
\fi%
}
I will report this bugfix to the developer Sascha Herpers
Try the xstring package:
\usepackage{xstring}
[…]
\StrSubstitute{File,New}{,}{\(\rightarrow\)}
There's a LaTeX package called tokenizer which may help you to do what you want.
Here's a hack (but pure LaTeX, no internals) which gets close to what I think you want, but with some extraneous spaces I haven't quite been able to fix. Perhaps Will Robertson can advise further? Unlike his slightly more polished answer, I haven't parameterised the bits and pieces, Here goes:
\usepackage{forloop}
\usepackage[trim]{tokenizer}
...
\newcounter{rrCount}
\newcommand{\replace}[1]{%
\GetTokens{rrFirst}{rrRest}{#1,}%
\textbf{\rrFirst}%
\forloop{rrCount}{0}{\value{rrCount} < 100}{%
\ifthenelse{\equal{\rrRest}{}}{%
\setcounter{rrCount}{101}%
}{%
\GetTokens{rrFirst}{rrRest}{\rrRest}%
$\rightarrow$\textbf{\rrFirst}%
}%
}%
}%
% -----------------------------------------------------------------
\replace{a1}\\
\replace{a2,b2}\\
\replace{a3,b3,c3}\\
OK, I withdraw this answer. Thanks for clarifying the question.
I suspect this may not be what you want, but here goes anyway:
\newcommand{\replace}[2]{\textbf{#1}$\rightarrow$\textbf{#2}}
\replace{File}{New}
If this isn't what you're looking for, could you clarify the question, please?