Re: Chapterbib: another \bibstyle command error

2017-01-21 Thread Jürgen Spitzmüller
Am Freitag, den 30.12.2016, 16:05 +0100 schrieb Jürgen Spitzmüller:
> Am Freitag, den 30.12.2016, 11:47 -0200 schrieb Rudi Gaelzer:
> > > On the command line, you get the error as well, although you
> > 
> > probably
> > > haven't noticed it.
> > 
> >  
> > It's not quite like that. If I run bibtex for each child
> > individually, the bbl's are generated without a hitch. The error
> > comes when I bibtex'ed the main file.
> > Your bibtexall script does not distinguish between the master and
> > children aux's and processes them all, without issuing any message
> > to
> > the console. 
> 
> Right. The script can be extended to ignore the main file, though.
> Could you try if the (untested) attached bibtexallx script works?

Meanwhile I found the time to try it myself. The attached script works
for me. I also updated the wiki page.

HTH
Jürgen

> Jürgen#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-

# \author Juergen Spitzmueller

# This file is a wrapper on bibtex to let LyX
# process every aux file in the temp directory
# except for the master file's.
# This is needed if you use chapterbib with LyX.
# Place this file somewhere in your PATH , then
# open Tools->Preferences->LaTeX in LyX and change
# the "bibtex command" from "bibtex" to "bibtexallx".

import sys, os
for filename in os.listdir("."):
	if filename.endswith('.aux'):
		f = os.path.splitext(filename)[0]
if f == sys.argv[1]:
continue
		os.popen('bibtex ' + f)


signature.asc
Description: This is a digitally signed message part


Re: Chapterbib: another \bibstyle command error

2016-12-30 Thread Jürgen Spitzmüller
Am Freitag, den 30.12.2016, 11:47 -0200 schrieb Rudi Gaelzer:
> > On the command line, you get the error as well, although you
> probably
> > haven't noticed it.
>  
> It's not quite like that. If I run bibtex for each child
> individually, the bbl's are generated without a hitch. The error
> comes when I bibtex'ed the main file.
> Your bibtexall script does not distinguish between the master and
> children aux's and processes them all, without issuing any message to
> the console. 

Right. The script can be extended to ignore the main file, though.
Could you try if the (untested) attached bibtexallx script works?

Jürgen#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-

# \author Juergen Spitzmueller

# This file is a wrapper on bibtex to let LyX
# process every aux file in the temp directory
# except for the master file's.
# This is needed if you use chapterbib with LyX.
# Place this file somewhere in your PATH , then
# open Tools->Preferences->LaTeX in LyX and change
# the "bibtex command" from "bibtex" to "bibtexallx".

import sys, os
for filename in os.listdir("."):
	if filename.endswith('.aux'):
		f = os.path.splitext(filename)[0]
if f == argv[0]:
continue
		os.popen('bibtex ' + f)


signature.asc
Description: This is a digitally signed message part


Re: Chapterbib: another \bibstyle command error

2016-12-30 Thread Rudi Gaelzer
On Thursday, December 29, 2016 5:22:17 PM BRST Jürgen Spitzmüller wrote:
> Yes, this is an error from bibtex's point of view: you are not supposed
> to enter more than one \bibliographystyle or \bibliography command, but
> this happens for each bibtex inset you insert.
> 
> BibTeX errors were not caught in previous versions of LyX.
> 
> On the command line, you get the error as well, although you probably
> haven't noticed it.

It's not quite like that.  If I run bibtex for each child individually, the 
bbl's are generated 
without a hitch.  The error comes when I bibtex'ed the main file.
Your bibtexall script does not distinguish between the master and children 
aux's and 
processes them all, without issuing any message to the console.  Where is the 
standard error output in this case?

> 
> Hitting the "Show output anyway" button should give you the PDF.

Indeed it does, at least for this small sample.

> 
> Working around the error would require a proper chapterbib support in
> LyX. The better way would probably to switch to biblatex, which
> provides the same (and more) functionality.

I never used biblatex, but I'll take a look and try to come up with an 
equivalent 
implementation.

Thanks.

> 
> HTH
> Jürgen

-- 
Rudi Gaelzer
Institute of Physics
Federal University of Rio Grande do Sul
BRAZIL
Registered Linux user # 153741


Re: Chapterbib: another \bibstyle command error

2016-12-29 Thread Jürgen Spitzmüller
Am Donnerstag, den 29.12.2016, 13:08 -0200 schrieb Rudi Gaelzer:
> System: Fedora Linux 24
> LyX version: 2.2.2
> 
> So, I followed the instructions here: 
> https://wiki.lyx.org/BibTeX/Tips#secbib
> in order to use chapterbib with LyX.
> 1) The script bibtexall was downloaded, chmod'ed as executable, and
> put in a 
> directory cited by PATH
> 2) Went to Tools -> Preferences... -> Output -> LaTeX.  In
> Bibliography 
> Generation: Processor: Custom - Command: bibtexall
> 3) Created a simple master-child structure (1 master + 2 children).
> 4) In the master's preamble: \usepackage{chapterbib}
> 5) Each child file has its own bibliography.
> 
> When I process the master with pdflatex, the following BibTeX error
> message 
> appears: 
> ==
> This is BibTeX, Version 0.99d (TeX Live 2016/dev)
> Capacity: max_strings=35307, hash_size=35307, hash_prime=30011
> The top-level auxiliary file: main.aux
> A level-1 auxiliary file: 2_home_rudi_temp_lyx_chapbib_c01.aux
> The style file: plain.bst
> A level-1 auxiliary file: 3_home_rudi_temp_lyx_chapbib_c02.aux
> Illegal, another \bibstyle command---line 4 of file 
> 3_home_rudi_temp_lyx_chapbib_c02.aux
>  : \bibstyle
>  :  {plain}
> I'm skipping whatever remains of this command
> Illegal, another \bibdata command---line 5 of file 
> 3_home_rudi_temp_lyx_chapbib_c02.aux

Yes, this is an error from bibtex's point of view: you are not supposed
to enter more than one \bibliographystyle or \bibliography command, but
this happens for each bibtex inset you insert.

BibTeX errors were not caught in previous versions of LyX.

On the command line, you get the error as well, although you probably
haven't noticed it.

Hitting the "Show output anyway" button should give you the PDF.

Working around the error would require a proper chapterbib support in
LyX. The better way would probably to switch to biblatex, which
provides the same (and more) functionality.

HTH
Jürgen


signature.asc
Description: This is a digitally signed message part


Chapterbib: another \bibstyle command error

2016-12-29 Thread Rudi Gaelzer
System: Fedora Linux 24
LyX version: 2.2.2

So, I followed the instructions here: 
https://wiki.lyx.org/BibTeX/Tips#secbib
in order to use chapterbib with LyX.
1) The script bibtexall was downloaded, chmod'ed as executable, and put in a 
directory cited by PATH
2) Went to Tools -> Preferences... -> Output -> LaTeX.  In Bibliography 
Generation: Processor: Custom - Command: bibtexall
3) Created a simple master-child structure (1 master + 2 children).
4) In the master's preamble: \usepackage{chapterbib}
5) Each child file has its own bibliography.

When I process the master with pdflatex, the following BibTeX error message 
appears: 
==
This is BibTeX, Version 0.99d (TeX Live 2016/dev)
Capacity: max_strings=35307, hash_size=35307, hash_prime=30011
The top-level auxiliary file: main.aux
A level-1 auxiliary file: 2_home_rudi_temp_lyx_chapbib_c01.aux
The style file: plain.bst
A level-1 auxiliary file: 3_home_rudi_temp_lyx_chapbib_c02.aux
Illegal, another \bibstyle command---line 4 of file 
3_home_rudi_temp_lyx_chapbib_c02.aux
 : \bibstyle
 :  {plain}
I'm skipping whatever remains of this command
Illegal, another \bibdata command---line 5 of file 
3_home_rudi_temp_lyx_chapbib_c02.aux
 : \bibdata
 : {mysample}
I'm skipping whatever remains of this command
Database file #1: mysample.bib
==

I did not commit any error, LaTeXwise speaking. When I exported everything to 
pdflatex, the following sequence:

pdflatex main
bibtexall
pdflatex main
pdflatex main

produced the expected and correct PDF file.
Below, I'm attaching the files (*.lyx, *.tex, *.bib)
Any ideas?
==(main.lyx)
#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass book
\begin_preamble
\usepackage{chapterbib}
\end_preamble
\use_default_options false
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "lmodern" "default"
\font_sans "lmss" "default"
\font_typewriter "lmtt" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\pdf_title "Chapterbib test 01"
\pdf_author "Rudi Gaelzer - IF/UFRGS"
\pdf_bookmarks true
\pdf_bookmarksnumbered false
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 1
\pdf_breaklinks true
\pdf_pdfborder true
\pdf_colorlinks true
\pdf_backref false
\pdf_pdfusetitle true
\pdf_quoted_options "linkcolor=blue, citecolor=blue"
\papersize a4paper
\use_geometry true
\use_package amsmath 2
\use_package amssymb 2
\use_package cancel 1
\use_package esint 0
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 0
\index Index
\shortcut idx
\color #008000
\end_index
\leftmargin 1in
\topmargin 1in
\rightmargin 0.8in
\bottommargin 1in
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Standard
This is the main file.
\end_layout

\begin_layout Standard
\begin_inset CommandInset include
LatexCommand include
filename "c01.lyx"

\end_inset


\end_layout

\begin_layout Standard
\begin_inset CommandInset include
LatexCommand include
filename "c02.lyx"

\end_inset


\end_layout

\end_body
\end_document
==(c01.lyx)
#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass book
\begin_preamble
\usepackage{chapterbib}
\end_preamble
\use_default_options false
\master main.lyx
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "lmodern" "default"
\font_sans "lmss" "default"
\font_typewriter "lmtt" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\pdf_author "Rudi Gaelzer - IF/UFRGS"