Re: [AUCTeX] Is it possible to use the buffer-file-name in a local variable ?
Hello, In such a case wouldn't you need that the compilation command is some lisp fonction that does the prior variable setting prior to launching the usual region compilation --- or maybe some hook function is already available for making this sort of pre-regioning thing easier. Vincent. To: auctex@gnu.org From: t...@gnu.org Date: Fri, 6 Feb 2015 08:30:00 +0100 Subject: Re: [AUCTeX] Is it possible to use the buffer-file-name in a local variable ? Denis Bitouzé dbito...@wanadoo.fr writes: BTW, is it possible to ask for another name for the output file than `_region_'? The name is given by , | TeX-region is a variable defined in `tex-buf.el'. | Its value is _region_ | | Documentation: | *Base name of temporary file for `TeX-command-region' and `TeX-command-buffer'. | | You can customize this variable. ` In particular, is it possible for this name to be the evaluation of (file-name-base buffer-file-name), possibly copied in antother directory? I've never used it that way but feel free to try. Bye, Tassilo ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex
Re: [AUCTeX] Is it possible to use the buffer-file-name in a local variable ?
Le 05/02/15 à 17h52, Nicolas Richard theonewiththeevill...@yahoo.fr a écrit : I deprecated \includeonly in favor of TeX-command-region, and I now do collaborative editing through auto-synchronisation of files (owncloud, dropbox) instead of sending files around. So I'm now a happy one-file-does-it-all kind of LaTeX user. Even big one-files? Size doesn't matter when using TeX-command-region. I'm working on a 400kB beamer file right now, and it's doing pretty well. OK. BTW, is it possible to ask for another name for the output file than `_region_'? In particular, is it possible for this name to be the evaluation of (file-name-base buffer-file-name), possibly copied in antother directory? Maybe Latexmk could be helpful for this. The main advantage for me is ease of searching and refactoring. I know that auctex and friends have tools for working on multi-file documents, but my muscle memory keeps making me press C-s, C-M-%, M-s o etc. My muscle memory keeps making me press C-c C-c instead of C-c C-b (`TeX-command-buffer`) and I often recompile the whole document instead of only the current buffer :( It happens to me too, but then I notice it, hit C-c C-k and C-c C-b again because I know these bindings. I guess all the references, citations, etc. have then to be recomputed... The reftex-*-document commands don't even have bindings afaics. Thanks to this discussion, I had a look into the manual: (info (reftex) Key Bindings). Maybe I'll do that and use them. I don't see your point. -- Denis ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex
Re: [AUCTeX] Is it possible to use the buffer-file-name in a local variable ?
Hi Tassilo, 2015-02-03 8:54 GMT+01:00 Tassilo Horn t...@gnu.org: Denis Bitouzé dbito...@wanadoo.fr writes: I'd like to use the buffer-file-name in a local variable, like this: ┌ │ %%% Local Variables: │ %%% mode: latex │ %%% TeX-master: main │ %%% LaTeX-command: pdflatex '\includeonly{buffer-file-name}\input{main}' │ %%% End: ^^ └ Is it possible? Yes, I think so. You would use a local variable section with something like %%% eval: (setq-local LaTeX-command %%% (concat pdflatex '\includeonly{ %%% (buffer-file-name) %%% }\input{main}') But I don't think `LaTeX-command' is the right variable. Wouldn't it suffice to add the \includeonly to `TeX-command-extra-options'? I'm not sure this would work, but your suggestion to compile just the selected section/region can be indeed useful. Bye, Mosè And as yet another alternative: As I understand, your goal is to speed up compilation by only compiling the chapter you're currently writing on. In that case, there are already predefined commands to do exactly that. See especially ,[ (info (auctex)Starting a Command) ] | -- Command: LaTeX-command-section | ('C-c C-z') Query the user for a command, and apply it to the | current section (or part, chapter, subsection, paragraph, or | subparagraph). What makes the current section is determined by | 'LaTeX-command-section-level' which can be enlarged/shrunken using | 'LaTeX-command-section-change-level' ('C-c M-z'). The given | numeric prefix arg is added to the current value of | 'LaTeX-command-section-level'. By default, | 'LaTeX-command-section-level' is initialized with the current | document's 'LaTeX-largest-level'. The buffer contents are written | into the region file, after extracting the header and trailer from | the master file. The command is then actually run on the region | file. See 'TeX-command-region' for details. ` And that doesn't even require that you split your document into one file per chapter. Bye, Tassilo ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex
Re: [AUCTeX] Is it possible to use the buffer-file-name in a local variable ?
Le 03/02/15 à 08h54, Tassilo Horn t...@gnu.org a écrit : Denis Bitouzé dbito...@wanadoo.fr writes: I'd like to use the buffer-file-name in a local variable, like this: ┌ │ %%% Local Variables: │ %%% mode: latex │ %%% TeX-master: main │ %%% LaTeX-command: pdflatex '\includeonly{buffer-file-name}\input{main}' │ %%% End: ^^ └ Is it possible? Yes, I think so. You would use a local variable section with something like %%% eval: (setq-local LaTeX-command %%% (concat pdflatex '\includeonly{ %%% (buffer-file-name) %%% }\input{main}') That doesn't work as: 1. the backslashes have to be escaped with an extra `\`, 2. the buffer-file-name is the /complete/ name (absolute path) of the underlying file and \includeonly requires the relative path of the subfile from the main one. Hence, it is enough to replace: ┌ │ (buffer-file-name) └ by: ┌ │ (file-name-base buffer-file-name) └ Hence, the following is OK: --8---cut here---start-8--- %%% eval: (setq-local LaTeX-command %%% (concat latex '\\includeonly{ %%% (file-name-base buffer-file-name) %%% }\\input{main}')) --8---cut here---end---8--- But I don't think `LaTeX-command' is the right variable. Wouldn't it suffice to add the \includeonly to `TeX-command-extra-options'? Indeed, the following is OK as well: --8---cut here---start-8--- %%% eval: (setq-local TeX-command-extra-options %%% (concat '\\includeonly{ %%% (file-name-base buffer-file-name) %%% }\\input{main}')) --8---cut here---end---8--- And as yet another alternative: As I understand, your goal is to speed up compilation by only compiling the chapter you're currently writing on. In that case, there are already predefined commands to do exactly that. See especially ,[ (info (auctex)Starting a Command) ] | -- Command: LaTeX-command-section | ('C-c C-z') Query the user for a command, and apply it to the | current section (or part, chapter, subsection, paragraph, or | subparagraph). What makes the current section is determined by | 'LaTeX-command-section-level' which can be enlarged/shrunken using | 'LaTeX-command-section-change-level' ('C-c M-z'). The given | numeric prefix arg is added to the current value of | 'LaTeX-command-section-level'. By default, | 'LaTeX-command-section-level' is initialized with the current | document's 'LaTeX-largest-level'. The buffer contents are written | into the region file, after extracting the header and trailer from | the master file. The command is then actually run on the region | file. See 'TeX-command-region' for details. ` Unfortunately, my real document makes use of deeply customized `sections' and I guess it won't work. But, I had a deeper look at Starting a Command on a Document or Region in AUCTeX documentation and, in fact, `TeX-command-buffer` (C-c C-b) is /exactly/ what I was looking for, and that's much easier: thanks for pointing this out! And that doesn't even require that you split your document into one file per chapter. Well, splitting the document in subfiles is a good practice anyway :) Thanks again! -- Denis ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex
Re: [AUCTeX] Is it possible to use the buffer-file-name in a local variable ?
Denis Bitouzé dbito...@wanadoo.fr writes: I'd like to use the buffer-file-name in a local variable, like this: ┌ │ %%% Local Variables: │ %%% mode: latex │ %%% TeX-master: main │ %%% LaTeX-command: pdflatex '\includeonly{buffer-file-name}\input{main}' │ %%% End: ^^ └ Is it possible? Yes, I think so. You would use a local variable section with something like %%% eval: (setq-local LaTeX-command %%% (concat pdflatex '\includeonly{ %%% (buffer-file-name) %%% }\input{main}') But I don't think `LaTeX-command' is the right variable. Wouldn't it suffice to add the \includeonly to `TeX-command-extra-options'? And as yet another alternative: As I understand, your goal is to speed up compilation by only compiling the chapter you're currently writing on. In that case, there are already predefined commands to do exactly that. See especially ,[ (info (auctex)Starting a Command) ] | -- Command: LaTeX-command-section | ('C-c C-z') Query the user for a command, and apply it to the | current section (or part, chapter, subsection, paragraph, or | subparagraph). What makes the current section is determined by | 'LaTeX-command-section-level' which can be enlarged/shrunken using | 'LaTeX-command-section-change-level' ('C-c M-z'). The given | numeric prefix arg is added to the current value of | 'LaTeX-command-section-level'. By default, | 'LaTeX-command-section-level' is initialized with the current | document's 'LaTeX-largest-level'. The buffer contents are written | into the region file, after extracting the header and trailer from | the master file. The command is then actually run on the region | file. See 'TeX-command-region' for details. ` And that doesn't even require that you split your document into one file per chapter. Bye, Tassilo ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex