Re: problem with custom converter (bug?) - workaround provided
Hi Bogdan, I have not yet used it myself but, it seems that this is a typical situation to be handled with branches in Lyx, no? One branch for only the questions and another one for questions and answers? SO, you can selectively compile the branch that interests you. 2012/1/2 Bogdan > Actually, I just discovered that the expansion of $$i is put at the end of > the actual command LyX launches no matter what I use for the converter > command, e.g. if the converter command is: > > pdflatexna $$i 20 20 > > then LyX is actually executing: > > pdflatexna 20 20 sheet.tex > > Nasty :) > > Bogdan. > > > > On 02-Jan-12 12:08 am, Bogdan wrote: > >> As part of my course, I've been traditionally maintaining a problem >> sheet in latex and compile two versions, one with answers, and one >> without. To achieve that, I hide the answers based on whether a certain >> variable was defined in latex or not and then compile it accordingly: >> >> with answers: pdflatex sheet.tex >> without answers: pdflatex "\def\noanswers{yes}\input{**sheet.tex}" >> >> I defined a new converter in LyX do achieve the same but I could not do >> it without wrapping the 2nd command in a shell script (I'm using >> windows). What I did: >> >> - defined a new file format pdf6: PDF (pdflatex-na) with the same >> settings as pdf2: PDF (pdflatex). >> - defined a converter Latex (pdflatex) -> PDF (pdflatex-na) with the >> following for converter: pdflatex "\def\noanswers{yes}\input{$$**i}" >> >> Checking the lyx preferences file, I see it correctly escaped as: >> >> \converter "pdflatex" "pdf6" "pdflatex >> \"\\def\\noanswers{yes}\\**input{$$i}\"" "latex=pdflatex" >> >> However, when I try to use it (update or export) then LyX launches the >> converter and keeps waiting for it to terminate. Investigating the >> matter with a task manager like Process Hacker or Process Explorer, in >> order to see what command was actually executed, I notice that LyX >> started a cmd shell which in fact executed the following: >> >> pdflatex "\def\noanswers{yes}\input{ }" sheet.tex >> >> Note the empty \input{} and the file name sheet.tex at the end, instead >> of inside \input{sheet.tex}. >> >> I tried with the other variables $$b.tex, $$p, $$r etc, to no avail. >> >> Unless I'm missing something, this looks like a bug. Is there a python >> script anywhere that launches the cmd shell? It's probably there and I >> could fix it. >> >> My workaround is to wrap the whole thing in a cmd script pdflatexna.bat >> placed in lyx/bin with the contents: >> >> @pdflatex "\def\noanswers{yes}\input{%~**1}" >> >> (the %~1 instead of %1 is to strip any double quotes) >> >> ... and then use the following command for the converter: pdflatexna $$i >> >> Cheers, >> Bogdan. >> >> >> > > -- Prof. Murat Yildizoglu Université Montesquieu Bordeaux IV GREThA (UMR CNRS 5113) Avenue Léon Duguit 33608 Pessac cedex France Bureau : F-331 yi...@u-bordeaux4.fr http://yildizoglu.info http://www.twitter.com/yildizoglu
Re: way to add code before \documentclass{}
On 01/01/2012 06:46 PM, Bogdan wrote: On 01-Jan-12 10:00 pm, Richard Heck wrote: On 01/01/2012 04:27 PM, Bogdan wrote: pdflatex "\def\myvar{true}\input{myfile.tex}" One way to do this, then, would be (a) to define a new file format, call it pdfx (more or less copy over the definition of the PDF (pdflatex) format, but making that one change from pdf2 to pdfx) and then define a custom converter for latex --> pdfx. The one for latex --> pdf2 is: pdflatex $$i so you'd have to get the quotes right, etc, to make that work. Not ideal, I know. But if we fix this, it will be 2.1 before the fix is out, since it will definitely change the file format (probably of layout files). Thanks for replying Richard. I already defined a new converter like the above. I use it to compile two versions of the same problem sheet, one with answers, one without (there is a bug with defining that converter for which I found a workaround but I'll make a separate post about it). However, as you say, it's quite far from ideal for the purpose of paper margins since I'd have to keep modifying the converter and/or file format to fit each document margin requirements etc. Gets the job done for now but it would quite nice to have the possibility of adding code before calling \documentclass{} in the future. Shall I file an enhancement request about this, pointing to this discussion? Sure. Richard
Re: problem with custom converter (bug?) - workaround provided
Actually, I just discovered that the expansion of $$i is put at the end of the actual command LyX launches no matter what I use for the converter command, e.g. if the converter command is: pdflatexna $$i 20 20 then LyX is actually executing: pdflatexna 20 20 sheet.tex Nasty :) Bogdan. On 02-Jan-12 12:08 am, Bogdan wrote: As part of my course, I've been traditionally maintaining a problem sheet in latex and compile two versions, one with answers, and one without. To achieve that, I hide the answers based on whether a certain variable was defined in latex or not and then compile it accordingly: with answers: pdflatex sheet.tex without answers: pdflatex "\def\noanswers{yes}\input{sheet.tex}" I defined a new converter in LyX do achieve the same but I could not do it without wrapping the 2nd command in a shell script (I'm using windows). What I did: - defined a new file format pdf6: PDF (pdflatex-na) with the same settings as pdf2: PDF (pdflatex). - defined a converter Latex (pdflatex) -> PDF (pdflatex-na) with the following for converter: pdflatex "\def\noanswers{yes}\input{$$i}" Checking the lyx preferences file, I see it correctly escaped as: \converter "pdflatex" "pdf6" "pdflatex \"\\def\\noanswers{yes}\\input{$$i}\"" "latex=pdflatex" However, when I try to use it (update or export) then LyX launches the converter and keeps waiting for it to terminate. Investigating the matter with a task manager like Process Hacker or Process Explorer, in order to see what command was actually executed, I notice that LyX started a cmd shell which in fact executed the following: pdflatex "\def\noanswers{yes}\input{ }" sheet.tex Note the empty \input{} and the file name sheet.tex at the end, instead of inside \input{sheet.tex}. I tried with the other variables $$b.tex, $$p, $$r etc, to no avail. Unless I'm missing something, this looks like a bug. Is there a python script anywhere that launches the cmd shell? It's probably there and I could fix it. My workaround is to wrap the whole thing in a cmd script pdflatexna.bat placed in lyx/bin with the contents: @pdflatex "\def\noanswers{yes}\input{%~1}" (the %~1 instead of %1 is to strip any double quotes) ... and then use the following command for the converter: pdflatexna $$i Cheers, Bogdan.
problem with custom converter (bug?) - workaround provided
As part of my course, I've been traditionally maintaining a problem sheet in latex and compile two versions, one with answers, and one without. To achieve that, I hide the answers based on whether a certain variable was defined in latex or not and then compile it accordingly: with answers:pdflatex sheet.tex without answers: pdflatex "\def\noanswers{yes}\input{sheet.tex}" I defined a new converter in LyX do achieve the same but I could not do it without wrapping the 2nd command in a shell script (I'm using windows). What I did: - defined a new file format pdf6: PDF (pdflatex-na) with the same settings as pdf2: PDF (pdflatex). - defined a converter Latex (pdflatex) -> PDF (pdflatex-na) with the following for converter: pdflatex "\def\noanswers{yes}\input{$$i}" Checking the lyx preferences file, I see it correctly escaped as: \converter "pdflatex" "pdf6" "pdflatex \"\\def\\noanswers{yes}\\input{$$i}\"" "latex=pdflatex" However, when I try to use it (update or export) then LyX launches the converter and keeps waiting for it to terminate. Investigating the matter with a task manager like Process Hacker or Process Explorer, in order to see what command was actually executed, I notice that LyX started a cmd shell which in fact executed the following: pdflatex "\def\noanswers{yes}\input{ }" sheet.tex Note the empty \input{} and the file name sheet.tex at the end, instead of inside \input{sheet.tex}. I tried with the other variables $$b.tex, $$p, $$r etc, to no avail. Unless I'm missing something, this looks like a bug. Is there a python script anywhere that launches the cmd shell? It's probably there and I could fix it. My workaround is to wrap the whole thing in a cmd script pdflatexna.bat placed in lyx/bin with the contents: @pdflatex "\def\noanswers{yes}\input{%~1}" (the %~1 instead of %1 is to strip any double quotes) ... and then use the following command for the converter: pdflatexna $$i Cheers, Bogdan.
Re: way to add code before \documentclass{}
On 01-Jan-12 10:00 pm, Richard Heck wrote: On 01/01/2012 04:27 PM, Bogdan wrote: pdflatex "\def\myvar{true}\input{myfile.tex}" One way to do this, then, would be (a) to define a new file format, call it pdfx (more or less copy over the definition of the PDF (pdflatex) format, but making that one change from pdf2 to pdfx) and then define a custom converter for latex --> pdfx. The one for latex --> pdf2 is: pdflatex $$i so you'd have to get the quotes right, etc, to make that work. Not ideal, I know. But if we fix this, it will be 2.1 before the fix is out, since it will definitely change the file format (probably of layout files). Thanks for replying Richard. I already defined a new converter like the above. I use it to compile two versions of the same problem sheet, one with answers, one without (there is a bug with defining that converter for which I found a workaround but I'll make a separate post about it). However, as you say, it's quite far from ideal for the purpose of paper margins since I'd have to keep modifying the converter and/or file format to fit each document margin requirements etc. Gets the job done for now but it would quite nice to have the possibility of adding code before calling \documentclass{} in the future. Shall I file an enhancement request about this, pointing to this discussion? Bogdan.
Biblatex-biber citation problem
Hello, I'm not sure if this is the right place for my question. In that case please either ignore my mail or give me a hint where to place the following problem: I'm using biblatex with backend=bibtex8 and wanted to change to backend=biber. The change went fine but the output of the some of the in-text citation references is now different: I'm using Natbib author/year style. In cases of electronic references (entry type "online") where no author and year are provided (but title, url and urldate) backend=bibtex8 produces the in-text citation (correctly) just with the title. But biber now adds the year of the urldate. I think this is wrong because the date of the url - producing "visited on .." - has nothing to do with the (unknown) time the page was written. Any suggestion? - In the meanwhile I stick to bibtex8 ;-) Peter
Re: Crash with language change in combination with utf8 & float tableau
Thanks for investigating and (I guess) solving the problem. Sorry, but I don't know how to compile the source myself. I will wait for the new LyX release. In the meanwhile I have found a (provisional?) solution: I converted the bib file so I don't need utf8 anymore. Peter PS.: I'm using OS 10.6.8.
Re: way to add code before \documentclass{}
On 01/01/2012 04:27 PM, Bogdan wrote: pdflatex "\def\myvar{true}\input{myfile.tex}" One way to do this, then, would be (a) to define a new file format, call it pdfx (more or less copy over the definition of the PDF (pdflatex) format, but making that one change from pdf2 to pdfx) and then define a custom converter for latex --> pdfx. The one for latex --> pdf2 is: pdflatex $$i so you'd have to get the quotes right, etc, to make that work. Not ideal, I know. But if we fix this, it will be 2.1 before the fix is out, since it will definitely change the file format (probably of layout files). Richard
Re: way to add code before \documentclass{}
On 01-Jan-12 6:07 pm, Uwe Stöhr wrote: Am 01.01.2012 16:15, schrieb Richard Heck: On 12/31/2011 05:51 PM, Bogdan wrote: Is there *any* way to make LyX add latex code before the \documentclass{} call? I do not think so. And I have never seen this and I doubt that this will work because without loading the document class or any package, you cannot do much. For the IEEEtran class for instance, the page margins can be set only by setting some IEEEtran latex variables before the \documentclass{} call ... the use of geometry package or the likes is highly discouraged for IEEEtran. Can you please point me to the IEEEtran documentation where this is described? No example nor the documentation of IEEEtran on CTAN http://ctan.org/tex-archive/macros/latex/contrib/IEEEtran/ describe or use this. Sure, the official FAQ: http://www.michaelshell.org/tex/ieeetran/ Search for the string "incorrect margins". The PDF doc of the IEEEtran does not list many tricks. But what exactly do you want? Can you send me a _small_ LyX file with a short explanation? I'm occasionally using IEEEtran in A4 paper format for other purposes than submitting academic papers to IEEE journals/conferences. IEEEtran fixes the content size regardless of the paper size, hence the top and bottom paper margins become quite large when using the a4paper class option. I want to use shorter top and bottom margins but the usage of the geometry package is highly discouraged in conjunction with IEEEtran. Others ran into the same issue: http://andrejserafim.wordpress.com/2009/04/28/ieeetran-page-margins/ Being able to input code before the \documentclass call is actually not uncommon. In fact, it is mentioned in many latex tutorials/docs indirectly. I'm sure you all know that you can compile a latex file either like: pdflatex myfile.tex or pdflatex "\def\myvar{true}\input{myfile.tex}" e.g. http://en.wikibooks.org/wiki/LaTeX/Customizing_LaTeX#Command-line_LaTeX The 2nd command above is equivalent to declaring "\def\myvar{true}" before \documentclass. This way, \myvar may be used internally by the class, allowing fixing such things like the margin issue in IEEEtran. I hope the above explanations are sufficient but I can still submit a LyX file if you want me. I wouldn't be able to show much in it though since this is what I would like LyX to do: allow me to input code before \documentclass :) Bogdan. p.s. I'm also using the 2nd example to compile two versions of the same latex document, one with just maths questions (for students), and the other with questions+answers (for supervisors). Saves time, different issue though.
Re: way to add code before \documentclass{}
Am 01.01.2012 16:15, schrieb Richard Heck: On 12/31/2011 05:51 PM, Bogdan wrote: Is there *any* way to make LyX add latex code before the \documentclass{} call? I do not think so. And I have never seen this and I doubt that this will work because without loading the document class or any package, you cannot do much. For the IEEEtran class for instance, the page margins can be set only by setting some IEEEtran latex variables before the \documentclass{} call ... the use of geometry package or the likes is highly discouraged for IEEEtran. Can you please point me to the IEEEtran documentation where this is described? No example nor the documentation of IEEEtran on CTAN http://ctan.org/tex-archive/macros/latex/contrib/IEEEtran/ describe or use this. But what exactly do you want? Can you send me a _small_ LyX file with a short explanation? a happy new year and regards Uwe
Re: way to add code before \documentclass{}
On 12/31/2011 05:51 PM, Bogdan wrote: Is there *any* way to make LyX add latex code before the \documentclass{} call? I do not think so. For the IEEEtran class for instance, the page margins can be set only by setting some IEEEtran latex variables before the \documentclass{} call ... the use of geometry package or the likes is highly discouraged for IEEEtran. Highly unusual. ;-) p.s. If not, I think this is a worthy enhancement to have in LyX. Opinions? If it's needed for certain classes, then it's a worthwhile enhancement. Uwe, do you know if there's another way to do this? Richard
example thesis template in LyX
Dear LyX users Happy New Year 2012 I have released the fifth maintenance of uthm-thesis-lyx http://code.google.com/p/uthm-thesis-lyx/ I hope this thesis example will be useful to others too. If you have any suggestions to improve this thesis template project, especially to cleanup many ERT that still appear in the text, or to simplified the LaTeX preamble, please fell free to inform me. Best regards waluyo