Re: [AUCTeX] Is it possible to use the buffer-file-name in a local variable ?

2015-02-02 Thread Tassilo Horn
Denis Bitouzé  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{}\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


[AUCTeX] Is it possible to use the buffer-file-name in a local variable ?

2015-02-02 Thread Denis Bitouzé
Hi,

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{}\input{main}'"
  │ %%% End:   ^^
  └

Is it possible?

Here is the background, if it could be helpful: I have a `main.tex` main
file that `\include`s some subfiles, say `ChapOne.tex` and
`ChapTwo.tex`:

--8<---cut here---start->8---
\begin{filecontents*}{ChapOne.tex}
\chapter{One}
\lipsum[1]
\end{filecontents*}
%
\begin{filecontents*}{ChapTwo.tex}
\chapter{Two}
\lipsum[8-21]
\end{filecontents*}
%
% main.tex file
\documentclass{report}
\usepackage{lipsum}
\begin{document}
\include{ChapOne}
\include{ChapTwo}
\end{document}
--8<---cut here---end--->8---

I'm able to include only `ChapTwo.tex` subfile when compiling the
`main.tex` main file but by running:

  ┌
  │ pdflatex '\includeonly{ChapTwo}\input{main}'
  └

And I'm able to perform this from `ChapTwo.tex` buffer with the
following local variables:

  ┌
  │ %%% Local Variables:
  │ %%% mode: latex
  │ %%% TeX-master: "main"
  │ %%% LaTeX-command: "pdflatex '\includeonly{ChapTwo}\input{main}'"
  │ %%% End:
  └

But, instead of an hard coded `ChapTwo`, I'd like to use
a buffer-file-name that lets me use the same string in each subfile for
the `LaTeX-command` local variable.

Any clue?

Thanks in anticipation.
-- 
Denis

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex