Re: [sphinx-users] 3.2.0 in PyPi, 4.0.0 docs

2020-08-13 Thread Komiya Takeshi
Hi,

>How does one acquire 4.0.0?

It is still in development. Please install it via GitHub.

>Why were the docs released before the code?

No special reason. It contains all of descriptions for older releases.
So I think no problem.

Thanks,
Takeshi KOMIYA

2020年8月14日(金) 9:49 Joshua J. Kugler :
>
> According to PyPi the latest version of Sphinx is 3.2.0, but https://
> www.sphinx-doc.org/en/master/contents.html (And all docs) say the docs are for
> 4.0.0+. How does one acquire 4.0.0? Why were the docs released before the
> code? :)
> --
> Joshua J. Kugler - Fairbanks, Alaska - jos...@azariah.com
> Azariah Enterprises - Programming and Website Design
> PGP Key: http://pgp.mit.edu/  ID 0x68108cbb73b13b6a
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sphinx-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sphinx-users/1932046.MPdnpNZkfA%40hosanna.

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sphinx-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/CAFmkQAMgbQ0o0iqXQ8EbFLfaW1SWp3KjKUuqSN_TJK9NqHiCow%40mail.gmail.com.


[sphinx-users] 3.2.0 in PyPi, 4.0.0 docs

2020-08-13 Thread Joshua J. Kugler
According to PyPi the latest version of Sphinx is 3.2.0, but https://
www.sphinx-doc.org/en/master/contents.html (And all docs) say the docs are for 
4.0.0+. How does one acquire 4.0.0? Why were the docs released before the 
code? :)
-- 
Joshua J. Kugler - Fairbanks, Alaska - jos...@azariah.com
Azariah Enterprises - Programming and Website Design
PGP Key: http://pgp.mit.edu/  ID 0x68108cbb73b13b6a


-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sphinx-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/1932046.MPdnpNZkfA%40hosanna.


Re: [sphinx-users] autodoc-skip-member isn't seeing all functions?

2020-08-13 Thread Joshua J. Kugler
On Thursday, August 13, 2020 7:28:49 AM AKDT Komiya Takeshi wrote:
> Hi Joshua,
> 
> Thank you for reporting. I believe it should be improved. Could you
> file an issue to GitHub, please?
> Then I'll work on it.

Thanks, done! https://github.com/sphinx-doc/sphinx/issues/8119

j

-- 
Joshua J. Kugler - Fairbanks, Alaska - jos...@azariah.com
Azariah Enterprises - Programming and Website Design
PGP Key: http://pgp.mit.edu/  ID 0x68108cbb73b13b6a


-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sphinx-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/2847047.tOWToCAzBV%40hosanna.


[sphinx-users] nodes.rubric always \\subsubsection*

2020-08-13 Thread Yves Chevallier
I was trying to find a way to have **unnumbered titles** then I found 
`rubric` which is quite what I need. However I noticed it is not rendered 
as expected. 

On HTML it is simply a `bold` text while on LaTeX it is always rendered as 
a `subsubsection*` no matter what was the parent title. Why is this the 
case ?

I am looking for some titles that are rendered on LaTeX with the `*` and on 
html as standard `h` tag, but not visible on the toc. 

Any ideas?

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sphinx-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/83a14bbd-2f4f-4eea-b200-6ca381d77351n%40googlegroups.com.


Re: [sphinx-users] autodoc-skip-member isn't seeing all functions?

2020-08-13 Thread Komiya Takeshi
Hi Joshua,

Thank you for reporting. I believe it should be improved. Could you
file an issue to GitHub, please?
Then I'll work on it.

Thanks,
Takeshi KOMIYA

2020年8月12日(水) 9:34 Joshua J. Kugler :
>
> On Monday, August 10, 2020 12:54:59 PM AKDT Joshua Kugler wrote:
> > I have an oddity here. I have a Python project for which I've generated
> > docs. It did well. Almost everything was doc'ed. I know about the default
> > of excluding anything starting with '_' so I created an autodoc-skip-member
> > function that would include those. It works. I see a bunch of private
> > methods and functions included. But...I have a module, let's call it XYZ
> > that has both private and public functions. Sphinx is only doc'ing the
> > public functions of XYZ, but not its private functions. I have other
> > modules that have private functions, and it's doc'ing those.
> >
> > I added a print() to the autodoc-skip-member function and it doesn't even
> > print out the `name` of those private functions so it seems it's not even
> > seeing it.
>
> So, I figured this out. The file concerned had an __all__ statement. So, on 
> one
> hand, I understand the reason it was being excluded, but on the other hand,
> why does __all__ prevent passing the identifiers the autodoc-skip-member
> function?
>
> That said, this is probably doc'ed somewhere, eh?  Anybody got a pointer? :)
>
> j
>
> --
> Joshua J. Kugler - Fairbanks, Alaska - jos...@azariah.com
> Azariah Enterprises - Programming and Website Design
> PGP Key: http://pgp.mit.edu/  ID 0x68108cbb73b13b6a
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sphinx-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sphinx-users/25359779.uLBTZSqOf5%40hosanna.

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sphinx-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/CAFmkQAO8g046c5fikZLYPcRWZqDUv1q%3DP6J7Z5gVzDfRntwb%2BQ%40mail.gmail.com.


Re: [sphinx-users] Re: Problem With \newcommand in latexpdf

2020-08-13 Thread Matthias Geier
On Thu, Aug 13, 2020 at 4:14 PM bradley...@gmail.com wrote:
>
> I am trying to get the same source code to produce both the html pages and a 
> pdf document. I think this is one of the advantages of sphinx ?

Yes it is! But sometimes there are a few unexpected hurdles one has to
overcome ...

> I was not expecting the scope of commands to be different for the two cases, 
> html and pdf.

I hope I can shed a bit of light on this:

As Jean-François said before, if you use \newcommand inside math mode,
the definitions are only visible in the current "scope", in this case
the current math block.

That's just how LaTeX works.

The actual bug is that MathJax doesn't behave like LaTeX in this case.

But there is a way to work around this: The low-level TeX counterpart
to \newcommand is \def, which has the same "scoping rules" as
described above. But there is another command called \gdef, which
defines things that are globally visible.

This is great for your use case, but there is a different problem,
because MathJax doesn't support \gdef by default. But there is a
plugin/extension which can be used, see below.

> I am using a file called preamble.rst to get my definitions for the entire 
> document inside each html page (this includes other commands besides latex 
> command). If I use the latex_elements as suggested above, I have to include 
> the definitions in preamble.rst to build html files and remove them to build 
> latexpdf files. While this doable, it would seem there should be a simpler 
> way.

Some of my colleagues and I came up with a somewhat fiddly solution:

We created an RST file that we can include whenever we need math
definitions (I guess similar to your preamble.rst):

https://github.com/sfstoolbox/sfs-python/blob/master/doc/math-definitions.rst

... which looks something like this:



.. raw:: latex

\marginpar{% Avoid creating empty vertical space for the math definitions

.. rst-class:: hidden
.. math::

\gdef\dirac#1{\mathop{{}\delta}\left(#1\right)}
\gdef\e#1{\operatorname{e}^{#1}}

% ... more \gdef stuff...

.. raw:: latex

}



On each page where we need it, we do this:

.. include:: math-definitions.rst

In order to activate the MathJax plugin mentioned above, we add this
to our conf.py:

mathjax_config = {
'TeX': {
'extensions': ['newcommand.js', 'begingroup.js'],  # Support for \gdef
},
}

See 
https://github.com/sfstoolbox/sfs-python/blob/4d55ff05a1d77438ae914ab3b7b5370bfa9dda98/doc/conf.py#L96-L100

There might be a different way to load those plugins (suggested in
https://github.com/jupyterlab/jupyterlab/pull/5997#issuecomment-475289432),
but I have not yet tested this:



.. raw:: latex

\newcommand{\require}[1]{}

.. math::

\require{begingroup}\require{newcommand}
\gdef\vec#1{\boldsymbol{#1}}
% ...



If you try this, please let me know whether it works or not!

> Perhaps I should ask this with another conservation ?
> I have noticed something strange in the latexpdf output (now that I can get 
> it) . The table of contents in the pdf file only seems to include the toctree 
> command in the index.rst file, and not the toctree commands in other files 
> that get included.

For LaTeX output, all toctree commands are collected to create one big
table of contents at the beginning.

There are no local sub-TOCs like in HTML.

That's yet another difference between HTML and LaTeX output ...

To reduce the differences (if you want that), you can use the :hidden:
option which hides the local TOCs also in HTML output. Depending on
the HTML theme (and its settings, something with "includehidden"),
those hidden entries might be visible in the sidebar or not.

> I am using the Read The Docs theme and the htm_theme_options has 
> 'titles_only' is set to True.

The HTML theme shouldn't affect the LaTeX output (but it might
sneakily run some extension code ... so you never know).

cheers,
Matthias

>
>
> On Thursday, August 13, 2020 at 12:16:22 AM UTC-7 jfbu wrote:
>>
>> Hi,
>>
>> Le 12/08/2020 à 14:19, bradley...@gmail.com a écrit :
>> > The index.rst file below demonstrates that \newcommand does not work with 
>> > latexpdf.
>> >
>> >  Below is my conf.py file 
>> > # For conf.py documentation see
>> > # http://www.sphinx-doc.org/en/master/config
>> > #
>> > project   = 'newcommand'
>> > extensions = [
>> > 'sphinx.ext.mathjax',
>> > ]
>> > - Below is my index.rst file -
>> > Problem With \newcommand in latexpdf
>> > 
>> > This file builds just file,
>> > and displays as intended, with ``make html``,
>> > but with ``make latexpdf`` it generates and
>> > ``Undefined control sequence.`` error for the
>> > macro ``\B``.
>> >
>> > Define Latex Macro
>> > **
>> 

Re: [sphinx-users] Vertical space after latex command

2020-08-13 Thread Matthias Geier
On Wed, Aug 12, 2020 at 1:34 PM bradley...@gmail.com wrote:
>
> Thanks for the suggestion. I used the instructions on
> https://blog.readthedocs.com/custom-css-and-js-in-sphinx/
> to add a style sheet and it worked.

I'm glad it worked for you!

> To be specific, I added the file _static/css/custom.css with the following 
> text:
>
> /* preamble used to add hidden class */
>
> .hidden {
> display: None;
> }
>
> I changed my latex macro to
>
> .. rst-class:: hidden
>
> :math:`\newcommand{\B}[1]{ {\bf #1} }`

Please note that the indentation after the "rst-class" directive is
not necessary (I'm not sure whether it's harmful).

The "rst-class" directive simply applies a CSS class to the following
element, it doesn't create its own element.

cheers,
Matthias

> I added the following at the end of my conf.py
>
> # -- These folders are copied to the documentation's HTML output 
> 
> html_static_path = [ '_static' ]
>
> # -- These paths are either relative to html_static_path 
> 
> # or fully qualified paths (eg. https://...)
> html_css_files = [
> 'css/custom.css',
> ]
>
>
>
> On Tuesday, August 11, 2020 at 3:54:34 AM UTC-7 matthia...@gmail.com wrote:
>>
>> On Tue, Aug 4, 2020 at 1:41 AM bradley...@gmail.com wrote:
>> >
>> > I like to put macro definitions at the top of my latex files. It seems 
>> > that sphinx generates empty vertical space when I do this in rst files. 
>> > Attached is a conf.py and index.rst file that demonstrates this problem:
>> >
>> > Is there some place I can put a set of latex macro definitions and not 
>> > have this problem ?
>>
>> It's a bit of a hack, but you can try something like this:
>>
>> 
>>
>> .. raw:: html
>>
>> 
>>
>> :math:`\newcommand{\B}[1]{{\bf #1}}`
>>
>> .. raw:: html
>>
>> 
>>
>> 
>>
>> Alternatively, you can do it with a CSS class, which makes the .rst
>> file a bit simpler:
>>
>> 
>> .. rst-class:: hidden
>>
>> :math:`\newcommand{\B}[1]{{\bf #1}}`
>> 
>>
>> ... but you need to defined some custom CSS:
>>
>> 
>> .hidden {
>> display: none;
>> }
>> 
>>
>> cheers,
>> Matthias
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sphinx-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sphinx-users/4664d0c2-14c8-4430-87a7-626d9336304an%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sphinx-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/CAFesC-fRcMvbFHzh4G92DyNmc_MCV7iiV6Xeigt6EsB_g55W%2BA%40mail.gmail.com.


[sphinx-users] Re: Problem With \newcommand in latexpdf

2020-08-13 Thread bradley...@gmail.com
I am trying to get the same source code to produce both the html pages and 
a pdf document. I think this is one of the advantages of sphinx ? I was not 
expecting the scope of commands to be different for the two cases, html and 
pdf.

I am using a file called preamble.rst to get my definitions for the entire 
document inside each html page (this includes other commands besides latex 
command). If I use the latex_elements as suggested above, I have to include 
the definitions in preamble.rst to build html files and remove them to 
build latexpdf files. While this doable, it would seem there should be a 
simpler way.

Perhaps I should ask this with another conservation ?
I have noticed something strange in the latexpdf output (now that I can get 
it) . The table of contents in the pdf file only seems to include the 
toctree command in the index.rst file, and not the toctree commands in 
other files that get included. I am using the Read The Docs theme and the 
htm_theme_options has 'titles_only' is set to True.


On Thursday, August 13, 2020 at 12:16:22 AM UTC-7 jfbu wrote:

> Hi,
>
> Le 12/08/2020 à 14:19, bradley...@gmail.com a écrit :
> > The index.rst file below demonstrates that \newcommand does not work 
> with latexpdf.
> > 
> >  Below is my conf.py file 
> > # For conf.py documentation see
> > # http://www.sphinx-doc.org/en/master/config
> > #
> > project   = 'newcommand'
> > extensions = [
> > 'sphinx.ext.mathjax',
> > ]
> > - Below is my index.rst file -
> > Problem With \newcommand in latexpdf
> > 
> > This file builds just file,
> > and displays as intended, with ``make html``,
> > but with ``make latexpdf`` it generates and
> > ``Undefined control sequence.`` error for the
> > macro ``\B``.
> > 
> > Define Latex Macro
> > **
> > ``:math: \newcommand{\B}[1]{{\bf #1}}``
> > :math:`\newcommand{\B}[1]{{\bf #1}}`
> > 
> > Use Latex Macro \B
> > **
> > ``:math: f : \B{R} \rightarrow \B{R}``
> > :math:`f : \B{R} \rightarrow \B{R}`
> > 
>
> the LaTeX has scope limiting constructs such as "environments"
> but also equations, inclusive of inline mathematics
>
> (delimited in the file in LaTeX mark-up produced by make latex by \( ... 
> \) delimiters)
>
> you must locate the \newcommand outside of such scope delimited location
>
> either via
>
> .. raw:: latex
>
> \newcommand{\B}[1]{{\bf #1}}
>
> before it is used (and only once)
>
> or in conf.py
>
> latex_elements = {
> 'preamble': r"\newcommand{\B}[1]{{\bf #1}}",
> }
>
> which is a priori better location, recommended for that usage.
>
>
> Once this is done do not put any other \newcommand{\B} as this will 
> generate an error.
>
> Notice that \bf mark-up has been deprecated by LaTeX developers
> and perhaps {\mathbf{#1}} is more legit
>
> latex_elements = {
> 'preamble': r"\newcommand{\B}[1]{\mathbf{#1}}",
> }
>
>
> or, if you use xelatex with unicode-math, perhaps \symbf
>
>
> Besides LaTeX normative gurus will try to discourage you to define a 
> one-letter
> command such as \B. (the rationale being that depending on language perhaps
> the one-letter command has a meaning already ; anyway if it does the 
> \newcommand
> will then raise an error so you will know).
>
>
> Jean-François
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sphinx-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/5ae0887c-7d93-4fa1-bdb7-63c0b8efd5dcn%40googlegroups.com.


[sphinx-users] Re: Problem With \newcommand in latexpdf

2020-08-13 Thread jfbu

Hi,

Le 12/08/2020 à 14:19, bradley...@gmail.com a écrit :

The index.rst file below demonstrates that \newcommand does not work with 
latexpdf.

 Below is my conf.py file 
# For conf.py documentation see
# http://www.sphinx-doc.org/en/master/config
#
project   = 'newcommand'
extensions = [
     'sphinx.ext.mathjax',
]
- Below is my index.rst file -
Problem With \newcommand in latexpdf

This file builds just file,
and displays as intended, with ``make html``,
but with ``make latexpdf`` it generates and
``Undefined control sequence.`` error for the
macro ``\B``.

Define Latex Macro
**
``:math: \newcommand{\B}[1]{{\bf #1}}``
:math:`\newcommand{\B}[1]{{\bf #1}}`

Use Latex Macro \B
**
``:math: f : \B{R} \rightarrow \B{R}``
:math:`f : \B{R} \rightarrow \B{R}`



the LaTeX has scope limiting constructs such as "environments"
but also equations, inclusive of inline mathematics

(delimited in the file in LaTeX mark-up produced by make latex by \( ... \) 
delimiters)

you must locate the \newcommand outside of such scope delimited location

either via

.. raw:: latex

   \newcommand{\B}[1]{{\bf #1}}

before it is used (and only once)

or in conf.py

latex_elements = {
'preamble': r"\newcommand{\B}[1]{{\bf #1}}",
}

which is a priori better location, recommended for that usage.


Once this is done do not put any other \newcommand{\B} as this will generate an 
error.

Notice that \bf mark-up has been deprecated by LaTeX developers
and perhaps {\mathbf{#1}} is more legit

latex_elements = {
'preamble': r"\newcommand{\B}[1]{\mathbf{#1}}",
}


or, if you use xelatex with unicode-math, perhaps \symbf


Besides LaTeX normative gurus will try to discourage you to define a one-letter
command such as \B. (the rationale being that depending on language perhaps
the one-letter command has a meaning already ; anyway if it does the \newcommand
will then raise an error so you will know).


Jean-François


--
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sphinx-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/rh2pbu%24oi0%241%40ciao.gmane.io.