Latex: add figure to caption - latex

I would like to know how I can add a figure to the caption of a figure. I want to keep the Figure number prefix.
I'm doing the following:
\begin{figure*}[!ht]
\centerline{\includegraphics{results.pdf}}
\caption{Caption, \includegraphics{arrow.pdf} caption.}
\label{fig:01}
\end{figure*}
But latex does not allow \includegraphics in the caption.
Thanks for your help.
Cheers,
ukrania

I just found the solution. It is necessary to use the \protect statement.
Like the following example:
\begin{figure*}[!ht]
\centerline{\includegraphics{results.pdf}}
\caption{Caption, \protect\includegraphics{arrow.pdf} caption.}
\label{fig:01}
\end{figure*}
Hope it helps other people with the same problem.
Cheers,
ukrania

Related

Print parts of bibliography using BibTeX?

For some days I am trying to solve the following problem for which I wasn't able to find a solution. Help is very much appreciated.
I am writing a long document and for some sections I would like to print a subset of items from the total bibliography that will be included at the very end before the appendix.
Is there a way do this? I was playing with refsection and imagining something like:
\documentclass[ twoside,openright,titlepage,numbers=noenddot,
headinclude,footinclude,
cleardoublepage=empty,abstract=on,
BCOR=5mm,paper=a4,fontsize=11pt
]{scrreprt}
\usepackage{biblatex}
\addbibresource[label=ownpubs]{ownpubs.bib}
\addbibresource[label=refs]{references.bib}
\begin{document}
%here I want to print a selection of the complete bibliography
%References are required to be consistent throughout the whole document
\chapter*{Related Publications}
\begin{refsection}[references.bib]
\nocite{*}
\printbibliography[heading=none]
\end{refsection}
%here goes all the other stuff: chapters, sections, whatever
%print complete bibliography
\nocite{*}
\printbibliography
\end{document}
ownpubs.bib:
#article{einstein1935can,
title={Can quantum-mechanical description of physical reality be considered complete?},
author={Einstein, Albert and Podolsky, Boris and Rosen, Nathan},
journal={Physical review},
volume={47},
number={10},
pages={777},
year={1935},
publisher={APS}
}
#article{einstein1905movement,
title={On the movement of small particles suspended in stationary liquids required by the molecularkinetic theory of heat},
author={Einstein, A},
journal={Ann. d. Phys},
volume={17},
number={549-560},
pages={1},
year={1905}
}
references.bib:
#article{schrodinger1935gegenwartige,
title={Die gegenw{\"a}rtige Situation in der Quantenmechanik},
author={Schr{\"o}dinger, Erwin},
journal={Naturwissenschaften},
volume={23},
number={50},
pages={844--849},
year={1935},
publisher={Springer-Verlag}
}
With the above code I got the bibliographies printed, but the references (numbers) are not consistent.
Does anyone know a way to approach this problem? I am in no means restricted to splitting the files up. That was just the only solution I was able to come up with.
Thanks for your help and warm Greetings!
You could use a similar approach as in https://tex.stackexchange.com/a/166018 and automatically add some keyword to all entries in references.bib. This will allow you to filter for those when using \printbibliography:
\documentclass[ twoside,openright,titlepage,numbers=noenddot,
headinclude,footinclude,
cleardoublepage=empty,abstract=on,
BCOR=5mm,paper=a4,fontsize=11pt
]{scrreprt}
\usepackage{biblatex}
\addbibresource[label=ownpubs]{ownpubs.bib}
\addbibresource[label=refs]{references.bib}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]{
\perdatasource{references.bib}
\step[fieldset=keywords, fieldvalue={,Perhalo}, append]
}
}
}
\begin{document}
%here I want to print a selection of the complete bibliography
%References are required to be consistent throughout the whole document
\chapter*{Related Publications}
\printbibliography[heading=none,keyword={Perhalo}]
%here goes all the other stuff: chapters, sections, whatever
%print complete bibliography
\nocite{*}
\printbibliography
\end{document}

Alternative input to LaTex newcommand

Is there an alternative way to enter multiple arguments to LaTex newcommand constructions? I have defined
\newcommand{\nuc}[2]{\ensuremath{^{\text{#1}}\text{#2}}}
and I would like to call the command through
\nuc{12,C}
and not
\nuc{12}{C}.
I have created other commands with even more arguments and my poor pinky can't handle all the brackets.
Thanks!
Maybe you will like it.
\def\nuc #1,#2.{\ensuremath{^{\text{#1}}\text{#2}}}
Sample of using:
\nuc 12,C.
Note. Use the dot at the end.
I like to praise perltex for defining complicated functions. This isn't complicated, but you can extend it quite impressively.
%myfile.tex
\documentclass{article}
\usepackage{perltex}
\perlnewcommand{\commafrac}[1]{
$input = shift;
#inputs = split(/,/, $input);
return "\\ensuremath{\\frac{$inputs[0]}{$inputs[1]}}";
}
\begin{document}
One half is $\commafrac{1,2}$.
\end{document}
Compile with perltex --latex=pdflatex myfile.tex. I know that \frac wasn't your example, but I find it a visually appealing one.
Use plain TeX \def:
\makeatletter
\newcommand*{\nuc}[1]{\nuc##1\#nil}
\newcommand*{\nuc#}{}
\protected\def\nuc##1,#2\#nil{\ensuremath{^{\text{#1}}\text{#2}}}
\makeatother
As fas as I know \nuc{12}{c} is the only way. If you don't want to put all the "}{"s, let the editor do it. Write \nuc{12,c} first, then replace all commas with "}{"s.

how to rename sections in latex

How can i give another name to the main sections of a scientific paper in Latex? So instead of 'References' i wanna write a different title, instead of 'Abstract' another, and so on.
Regards
Redefine any of the following commands:
Abstract: \abstractname
Appendix: \appendixname
Bibliography: \bibname
Chapter: \chaptername
Contents: \contentsname
Index: \indexname
List of Figures: \listfigurename
List of Tables: \listtablename
Part: \partname
References: \refname
So, for example,
\renewcommand\refname{My References}
The list comes from The LaTeX Companion, 2nd edition, page 34.
For references \bibname is defined in the book class, but not in the article class. The latter is using \refname.
thanks! helped me a lot.
Just to help other fellas, it did not work for me before \begin{document}
I did it just before \part as below:
\renewcommand\partname{Capítulo}
\part{\textit{Conjuntura regulatória}}
\chapter{\large MATRIZ ENERGÉTICA BRASILEIRA}
worked as a charm.

subscript for a join (\bowtie) operation in LyX/LaTeX

I'm using LyX to write some Relational Algebra queries.
I'm using the \bowtie symbol for the join operation but when I try to put a text in subscript directly under the symbol, I get the following error:
...a_{\t{pId}}\t{person}\right)\bowtie\limits
{\t{pId}{1}=\t{pId}_{2}... I'm ignoring this misplaced \limits or
\nolimits command.
Anyone knows how to do what I want? Preferably in LyX, but ERT code snippets will also be appreciated. Thanks!
Edit: \t is a macro for \text.
Better use
\Join
It works fine for me
Your problem is that \bowtie is not math operator such as \int, \sum etc.
Try this in preamble:
\usepackage{amsmath}
\DeclareMathOperator*{\btie}{\bowtie}
and this in document:
\(\btie\limits_{subscript}^{superscript}\)
I hope it's what you're looking for.
From http://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics#Above_and_below:
In preamble:
\usepackage{amsmath}
In equation:
\underset{your_subscript_here}{\bowtie}

Figures occurring after ^ and _ macros (was: LaTeX limitation?)

I've hit an annoying problem in LaTeX. I've got a tex file of about 1000 lines. I've already got a few figures, but when I try to add another figure, It barfs with:
! Undefined control sequence.
<argument> ... \sf#size \z# \selectfont \#currbox
l.937 \begin{figure}[t]
If I move the figure to other parts of the file, I can get similar errors on different lines:
! Undefined control sequence.
<argument> ... \sf#size \z# \selectfont \#currbox
l.657 \paragraph
{A Centering Algorithm}
If I comment out the figure, all is ok.
%\begin{figure}[t]
% \caption{Example decision tree, from Reiter and Dale [2000]}
% \label{fig:relation-decision-tree}
% \centering
% \includegraphics[keepaspectratio=true]{./relation-decision-tree.eps}
%\end{figure}
If I keep just the begin and end like:
\begin{figure}%[t]
% \caption{Example decision tree, from Reiter and Dale [2000]}
% \label{fig:relation-decision-tree}
% \centering
% \includegraphics[keepaspectratio=true]{./relation-decision-tree.eps}
\end{figure}
I get:
! Undefined control sequence.
<argument> ... \sf#size \z# \selectfont \#currbox
l.942 \end
{figure}
At first, I thought maybe LaTeX has hit some limit, and I tried playing with the ulimits, but that didn't help. Any ideas?
i've got other figures with graphics already. my preamble looks like:
\documentclass[acmcsur,acmnow]{acmtrans2n}
\usepackage{array}
\usepackage{lastpage}
\usepackage{pict2e}
\usepackage{amsmath}
\usepackage{varioref}
\usepackage{epsfig}
\usepackage{graphics}
\usepackage{qtree}
\usepackage{rotating}
\usepackage{tree-dvips}
\usepackage{mdwlist}
\makecompactlist{quote*}{quote}
\usepackage{verbatim}
\usepackage{ulem}
I found, not that it's a problem with \textsuperscript, but that it's with a ^ def I picked up from http://anthony.liekens.net/index.php/LaTeX/SubscriptAndSuperscriptInTextMode . The fix is to put the use of ^ in {}, as in I've put entire sections where I use lots of ^ and _ in {}. Hurrah!
During the end of my Master Thesis I also had the problem that after some amount of figures, I got an error without any special error message. After I read you thread, I also tried something with the packages included and in the end I was successful by taking out the \usepackage{pxfonts} and \usepackage{txfonts}. Yeah, finally.. I almost went crazy.. ;)
If I Google for "latex undefined control sequence" I get this.
I've successfully included a graphic into LaTeX using something like this:
\usepackage{amsmath,amsthm,graphicx}
...
I just wanted to test adding an image to a \LaTeX file:
\includegraphics[scale=0.60]{basic-info.png}
I typeset an entire dissertation of 200 pages with lots of figures in LaTeX and didn't run into a limit like that. I'd bet on a syntax problem first before I'd assume a size issue.
Your error lies elsewhere. I wouldn't be the least surprised if it turned out to be the document class. Try altering your document for \documentclass{article} and see where you get. If that fixes the problem you can complain to the ACM (ROTFLMAO—I've dealth with ACM).
If that doesn't fix, the problem, slip in a \tracingall somewhat before the offending figure or section, put the results into http://pastebin.com/, and let us know.
Please receive the thanks of a (formerly) utterly-confounded graduate student. Quick clarification for other users:
{The quickest ^{way} to put this solution into practice is to bracket all sections of text involving the character ``\^'' as shown here.}

Resources