ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* searching in subdirectories with project structure
@ 2016-03-30 17:25 Javier M Mora
  2016-03-31  7:42 ` Javier M Mora
  0 siblings, 1 reply; 5+ messages in thread
From: Javier M Mora @ 2016-03-30 17:25 UTC (permalink / raw)
  To: ntg-context

Hi, (this is my first email to the list)

I've created a project for my Thesis. The file tree is:

/prod_thesis/
             /prod_thesis.tex
             /envi_thesis.tex
             /comp_chap1/
                        /comp_chap1.tex
                        /envi_chap1.tex
                        /images/
                               /image1.jpg
                               /image2.jpg
                                 (...)
                        /tables/
                               /table1.tex
                               /table2.tex
                                 (...)
             /comp_chap2/
                        /comp_chap2.tex
                        /envi_chap2.tex
                        /images/
                               /image1b.jpg
                               /image2b.jpg
                                 (...)
                        /tables/
                               /table1b.tex
                               /table2b.tex
                                 (...)

	    (...)

envi_chap1.tex has:

	\startenvironment envi_chap1
	\product prod_thesis
	\usepath[images]
	\usepath[tables]
	\stopenvironment

comp_chap1.tex has:
	\startcomponent comp_chap1.tex
	\product prod_thesis
	\environment envi_chap1

	blah blah blah

	\placefigure[here][fig:img1]{img1}{
		\externalfigure[image1.jpg]
	}

	blah blah blah

	\input tables/table1

	blah blah blah
	\stopcomponent

prod_thesis.tex has:
	\startproduct prod_thesis
	\environment envi_thesis
	
	blah blah blah
	\component comp_chap1
	\component comp_chap2
	(...)

	\stopproduct

and finally, envi_thesis.tex has:
  	\startenvironment envi_thesis

	\usepath[{comp_chap1,comp_chap2}]

	blah (about styles) blah
	\stopenvironment


If I cd into comp_chap1 dir and exec:

	texexec -xtx comp_chap1.tex

the chapter1 is generated without any problem. All images and tables are 
inserted ok. But if I cd into prod_thesis and exec:

	texexec -xtx prod_thesis.tex

all images are replace by "dummy images", and tables are not found 
(raising an error in compilation of document).

In prod_thesis compilation (is it correct to say "compilation of 
document"?), context is looking for file /prod_thesis/tables/table1.tex 
but isn't not looking in /prod_thesis/comp_chap1/tables/table1.tex. I've 
created a copy of tables in /prod_thesis/ and document compiled good. 
But i don't like to pollute prod_thesis directory.


Questions:

What is the canonical way to keep subdirectories of dependencies in a 
component? (to be reused later in product compilation)



I thought \usepath was to indicate where look for input files. I have to 
use "\input tables/table1" to find table 1. \usepath didn't work in 
envi_chap1.tex.

Cheers.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: searching in subdirectories with project structure
  2016-03-30 17:25 searching in subdirectories with project structure Javier M Mora
@ 2016-03-31  7:42 ` Javier M Mora
  2016-04-01  9:47   ` [SOLVED] " Javier M Mora
  0 siblings, 1 reply; 5+ messages in thread
From: Javier M Mora @ 2016-03-31  7:42 UTC (permalink / raw)
  To: ntg-context

On 30/03/16 19:25, Javier M Mora wrote:
> Hi, (this is my first email to the list)
>
> I've created a project for my Thesis. The file tree is:
>
> /prod_thesis/
>   /prod_thesis.tex
>   /envi_thesis.tex
>   /comp_chap1/
>     /comp_chap1.tex
>     /envi_chap1.tex
>     /images/
>       /image1.jpg
>       /image2.jpg
> (...)
>     /tables/
>       /table1.tex
>       /table2.tex
> (...)
>   /comp_chap2/
>     /comp_chap2.tex
>     /envi_chap2.tex
>     /images/
>       /image1b.jpg
>       /image2b.jpg
> (...)
>     /tables/
>       /table1b.tex
>       /table2b.tex
> (...)
>
> (...)
>

[...]

> comp_chap1.tex has:
> \startcomponent comp_chap1.tex
> \product prod_thesis
> \environment envi_chap1
>
> blah blah blah
>
> \placefigure[here][fig:img1]{img1}{
> \externalfigure[image1.jpg]
> }
>
> blah blah blah
>
> \input tables/table1
>
> blah blah blah
> \stopcomponent

First and second answer:

\input command is a tex command and inserts file as is. It is possible 
to use \component inside another component. \component command obey 
\usepath directive.

I can, at this moment, insert tex files into another tex files and keep
directory dependences. But Images doesn't work yet. :-(

>
> Questions:
>
> What is the canonical way to keep subdirectories of dependencies in a
> component? (to be reused later in product compilation)
>

The question is the same (but now for images only).


> I thought \usepath was to indicate where look for input files. I have to
> use "\input tables/table1" to find table 1. \usepath didn't work in
> envi_chap1.tex.

I answered that. \usepath only works with \component, \product, \project 
and it doesn't work with \input.


> Cheers.

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [SOLVED] searching in subdirectories with project structure
  2016-03-31  7:42 ` Javier M Mora
@ 2016-04-01  9:47   ` Javier M Mora
  2016-05-05 10:24     ` luigi scarso
  2016-05-06 10:02     ` Hans Hagen
  0 siblings, 2 replies; 5+ messages in thread
From: Javier M Mora @ 2016-04-01  9:47 UTC (permalink / raw)
  To: ntg-context

On 31/03/16 09:42, Javier M Mora wrote:
> On 30/03/16 19:25, Javier M Mora wrote:
>> Hi, (this is my first email to the list)
>>
>> I've created a project for my Thesis. The file tree is:
>>
>> /prod_thesis/
>>   /prod_thesis.tex
>>   /envi_thesis.tex
>>   /comp_chap1/
>>     /comp_chap1.tex
>>     /envi_chap1.tex
>>     /images/
>>       /image1.jpg
>>       /image2.jpg
>> (...)
>>     /tables/
>>       /table1.tex
>>       /table2.tex
>> (...)
>> Questions:
>>
>> What is the canonical way to keep subdirectories of dependencies in a
>> component? (to be reused later in product compilation)
>>

These are my ideas and my solution (don't hesitate to comment):

* envi_thesis.tex (environment of product) is the general configuration 
of all chapters: margin size, styles, fonts, and general definitions.

* envi_chap1.tex (environment of component) is specific configuration of 
a chapter: where the images used are, the title in the header.

* If I compile a component, envi_thesis.tex isn't automatically loaded. 
So, it is necessary include a \environment envi_thesis.tex in each 
envi_chapter I have. (there is no infinite loop in circular environment 
calling, because envi_thesis.tex doesn't load component environments)

* All information of directories are defined in environment of 
components, but the reference directory is different when I compile a 
product than a component. So in envi_chapter.tex I have a structure of

   \doifmodeelse{*product}{
     <directory configuration for product>
   }{
     <directory configuration for component>
   }

So, I keep in only one place directory information regardless I compile 
a component or a product.




My solution:

envi_thesis.tex -------------------------------------

\startenvironment envi_thesis

%% PATHS
\usepath[{comp_chapter1,comp_chapter2}]

blah blah blah

\stopenvironment

prod_thesis.tex --------------------------------------

\startproduct prod_thesis
\environment envi_thesis

blah blah

\startbodymatter
   \component comp_chapter1
   \component comp_chapter2
blah blah
\stopbodymatter

\stopproduct

comp_chapter1.tex ------------------------------------

\startcomponent comp_chapter1
\product prod_thesis
\environment envi_chapter1

\chapter{Preprocesado de las piezas}

blah blah blah

\stopcomponent

envi_chapter1.tex -------------------------------------

\startenvironment envi_chapter1
\product prod_thesis
\environment envi_thesis  % <- to get global configuration

%% path
\usepath[tables]

\doifmodeelse{*product} {
   \setupexternalfigures[directory={comp_chapter1/images}]
   other conf
}{
   \setupexternalfigures[directory={images}]
   other conf
}

\stopenvironment


That's all.

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [SOLVED] searching in subdirectories with project structure
  2016-04-01  9:47   ` [SOLVED] " Javier M Mora
@ 2016-05-05 10:24     ` luigi scarso
  2016-05-06 10:02     ` Hans Hagen
  1 sibling, 0 replies; 5+ messages in thread
From: luigi scarso @ 2016-05-05 10:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 869 bytes --]

On Fri, Apr 1, 2016 at 11:47 AM, Javier M Mora <jmmora@us.es> wrote:

> On 31/03/16 09:42, Javier M Mora wrote:
>
>> On 30/03/16 19:25, Javier M Mora wrote:
>>
>>> Hi, (this is my first email to the list)
>>>
>>> I've created a project for my Thesis. The file tree is:
>>>
>>> /prod_thesis/
>>>   /prod_thesis.tex
>>>   /envi_thesis.tex
>>>   /comp_chap1/
>>>     /comp_chap1.tex
>>>     /envi_chap1.tex
>>>     /images/
>>>       /image1.jpg
>>>       /image2.jpg
>>> (...)
>>>     /tables/
>>>       /table1.tex
>>>       /table2.tex
>>> (...)
>>> Questions:
>>>
>>> What is the canonical way to keep subdirectories of dependencies in a
>>> component? (to be reused later in product compilation)
>>>
>>>
> These are my ideas and my solution (don't hesitate to comment):


Sorry for delay, we were busy with the texlive deadline.
Thank you for your code.



-- 
luigi

[-- Attachment #1.2: Type: text/html, Size: 1656 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [SOLVED] searching in subdirectories with project structure
  2016-04-01  9:47   ` [SOLVED] " Javier M Mora
  2016-05-05 10:24     ` luigi scarso
@ 2016-05-06 10:02     ` Hans Hagen
  1 sibling, 0 replies; 5+ messages in thread
From: Hans Hagen @ 2016-05-06 10:02 UTC (permalink / raw)
  To: ntg-context

On 4/1/2016 11:47 AM, Javier M Mora wrote:

> * If I compile a component, envi_thesis.tex isn't automatically loaded.
> So, it is necessary include a \environment envi_thesis.tex in each
> envi_chapter I have. (there is no infinite loop in circular environment
> calling, because envi_thesis.tex doesn't load component environments)

indeed no loop as environments are only loaded once (just like modules)

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-06 10:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-30 17:25 searching in subdirectories with project structure Javier M Mora
2016-03-31  7:42 ` Javier M Mora
2016-04-01  9:47   ` [SOLVED] " Javier M Mora
2016-05-05 10:24     ` luigi scarso
2016-05-06 10:02     ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).