Print parts of bibliography using BibTeX? - latex

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}

Related

How to automatic break lines in latex?

I have searched but nothing useless, only "use \newline" or "use \".
I'm creating a simple latex document to store any texts instead of using .txt, and the problem is that the pdf document contains the lines going towards right until they go out of the paper.
I'm using this simple code
\documentclass[a4paper]{article}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=5mm,
top=20mm,
}
\begin{document}
\section{Text 1}
Loremipsumdolorsitamet,consecteturadipiscingelit,seddoeiusmodtemporincididuntutlabore etdoloremagnaaliqua.Utenimadminimveniam,quisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequat.Duisauteiruredolorinreprehenderitinvoluptatevelitessecillum doloreeufugiatnullapariatur.Excepteursintoccaecatcupidatatnonproident,suntinculpaquiofficiadeseruntmollitanimidestlaborum.
\end{document}
Since latex sees it as a one word, it refuses to break it since it doenst know its hyphenation. But I would like to allow latex to break it regardless. Any thoughts ?
Remarks: I already have used:
\hspace{0pt}
\leavevmode\nobreak\hspace{0pt}
\mbox{Loremip...larorum.}
Nothing worked.
I think I got why nothing worked. See my code below, that I managed to compile successfully after editing your MWE.
You basically have two ways to force hyphenation here.
As in the comment by SamCarter, you manually split words within text, just using \- where necessary. I did it below in line 18 (6 from bottom).
You add to your preamble the command \hyphenation{word-to-split}: I did this below to hyphenate the word in line 20 (4 from bottom). Notice that, in this case, you use - instead of \- within the braces {} enclosing the argument.
\documentclass[a4paper]{article}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=5mm,
top=20mm,
}
\hyphenation{Duisauteiruredolorinre-prehenderitinvoluptatevelitesse-cillum doloreeufugiatnullapariatur}
\begin{document}
\section{Text 1}
Loremipsumdolorsitamet, consecteturadipiscingelit,
seddoeiusmodtemporincididuntutlaboreetdoloremagna.
Uten\-imadminimveniam,
quisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequat.
Duisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeufugiatnullapariatur.
Excepteursintoccaecatcupidatatnonproident,
suntinculpaquiofficiadeseruntmollitanimidestlaborum.
\end{document}
Finally, if the full stop character . is not followed by a space, two separate words may be interpreted as one and the command \hyphenation may not work as expected. Not sure that this was the detail making you write that nothing worked, but be careful to this too.

\afterpage and \endfloat

How do I combine \afterpage and \endfloat to easily switch between having figures and tables at the end of the document or having them in the text?
I want to easily choose between my figures at the end of the document and my figures in the text. Because of that, sometimes I will use \afterpage package and other times I will use \endfloat would be nice to combine both.
Right now, all the times I try to run \endfloat when I have a clear page, I get the following message:
Argument of \efloat#xfloat has an extra }.
I already tried to include after page in the DeclareDelayedFloatFlavor, something like:
\DeclareDelayedFloatFlavor{afterpage}{figure}
It did not work.
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{float}
\usepackage{afterpage}
% ---------------------
%figures at the end
% ---------------------
\usepackage[nolists]{endfloat}
% force landscape at the end
\begin{document}
{\afterpage{
\begin{figure}
\end{figure}
}
\end{document}
If you want to switch between having figures within the text and at the end, I suggest to only use the endfloat package. Commenting or commenting it's optional argument disable will allow you to quickly alternate between figures at the end or in the text.
I'm not entirely certain what the purpose of afterpage was in your example, but if you used it to move the figure to a separate page, this can conveniently be done with the p floating specifier.
\documentclass{article}
\usepackage[
disable
]{endfloat}
\begin{document}
test
\begin{figure}[p]
xxx
\caption{caption}
\end{figure}
test
\end{document}

LaTEX: changing the format of citation in References to list authors' last name first

It seems the format in the Reference section is a little off! Can you please show me how to format the citation to list authors' last name first?
Thanks all.
Here is the current form in the Reference section:
C. B. Grimmond, A. Isard, and J. Belding. Development and evaluation of
continuously weighing mini-lysimeters. Agricultural and Forest Meteorology,
62(3-4):205{218, 1992.
I use BibDesk to organize the citation database. Here is what I am using in the TeXstudio:
\documentclass[]{article}
\usepackage[pdftex]{graphicx}
\usepackage[round]{natbib}
\begin{document}
\bibliographystyle{plainnat}
\bibliography{/Users/me/Citation/citation}
\end{document}
You can try to change the Bibtex Bibliography style to 'acm' or 'apalike'
\bibliographystyle{stylename}
\bibliography{bibfile}
Read more about other styles: https://www.sharelatex.com/learn/Bibtex_bibliography_styles

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.}

How does one change the \paragraph formatting in LaTeX

This stems out of How can one number paragraphs in LaTeX?, which I asked earlier today:
Running with Brent.Longborough's suggestion for how to number paragraphs in a document:
\setcounter{secnumdepth}{5}
...
\paragraph{If we want to}
\paragraph{do something}
This results in LaTeX producing something likeso:
0.0.0.1 If we want to
0.0.0.2 do something
How can one change the numbering scheme of \paragraph{} to produce something like:
1. If we want to
2. do something
or alternatively
A. If we want to
B. do something
Thank you.
To change the number referenced when referring to paragraphs, you want to change \theparagraph. Here's an example:
\documentclass[12pt]{article}
\setcounter{secnumdepth}{5}
\renewcommand\theparagraph{\roman{paragraph}}
\usepackage{lipsum}
\begin{document}
\paragraph{foo} \lipsum[1]
\paragraph{bar} \lipsum[2]
\end{document}
Instead of \roman you can also use \Roman, \arabic, \alph, \Alph. Although if you have lots of paragraphs you'll want to use the alphalph package and use \alphalph to get more than 26 paragraphs.
Note that \paragraph takes an argument for the "paragraph title". If you never want that, you'll probably want to define your own command to simplify things:
\newcommand\PARA{\paragraph{}}
You'll also probably want to remove the way that paragraphs are numbered "within" sections; i.e., they reset from "1" for every new section. You can get around this with something like
\usepackage{remreset}
\makeatletter
\#removefromreset{paragraph}{section}
\makeatother

Resources