This project is read-only.

A collection of questions

Jan 22, 2016 at 7:34 PM
Since it's cumbersome to go through all the threads I started, I wanted to repeat the ones that are still relevant to me here.
  1. I'd like to have a macro to set the label separator. At the moment it is set to "." but I'd like it to be a ":". So, for example, instead of Table 1. <caption> I get Table 1: <caption>.
  2. I have some problems with the Figure environment:
    • ~ Figure { #graf-test; page-align: topbottom; caption: "Some text"; }
      ![test]
      [test]: ./path/to/figure.pdf { width: 100%; vertical-align: bottom; }
      [^1^a footnote in smaller font size]{ font-size: small; display: block; }
      ~

      Unfortunately the footnote doesn't get displayed correctly. It shows the source code.
    • Another problem is line breaks withing captions. But possibly this isn't supposed to work, not sure:
      ~ Figure { #graf-rueck; caption: "... Text ... &br; ^1^Footnote text ..." }
      ![image]
      [image]: figure.pdf { width: 100%; vertical-align: bottom; }
      ~
  3. Problem with german localized csl bibliography:
    With more than 2 authors there's a comma berfore the "und" (engl. "and") which is correct in english grammar but not in german grammar. I don't know where this is defined (if at all). Perhaps you have an idea where to look at.
Some not so important but perhaps interesting points:
  • The html output text isn't hyphenated. I thought it used to be similarly to the latex output but perhaps I'm just imagining things. Ignore if I'm wrong.
  • At the moment madoko lets you set the language specific names of automatically generated caption prefixes (Figure, Table) and Headings (Contents, References). This works great so far but perhaps it might be possible to use "dynamic defaults"? In latex there's a package called polyglossia which contains the file polyglossia.dtx where all the language specific standard terms (contents, references, tables, etc.) are defined (among lots of other things). Perhaps you could use the definitions from there and set the defaults according to what language the user defines in the preamble?
Jan 22, 2016 at 8:10 PM
ah, this is a good list -- I'll try to work through it; everything seems fixable soon :-)
Jan 23, 2016 at 12:13 AM
1: About the label separator: I already made a nice abstraction for headings etc, where you can say:
heading-endperiod: :
for example. But unfortunately, I forgot about figures and tables -- I will fix this in the next release so you can write:
floating-endperiod: :
... For now though , you would also need to add the following rules until I can push the new prelude:
floating-format   : **&float-name;\ &label;&floating-endperiod;**&nbsp;

.floating {
  after: clear;
  after: '&nl;********* {.figureline}&nl;[[&floating-format;]{.caption-before}[&caption;]{.caption-text}]{.figure-caption; html-elem:fig-caption}&nl;{tag:false}&nl;';
}
Hope this helps.
Jan 23, 2016 at 12:36 AM
Edited Jan 23, 2016 at 12:38 AM
2: The first example does not work because [^1.. looks like the start of a footnote definition (or as a footnote). The solution is to put in a null character \/ to make Madoko aware that this is not a footnote definition, i.e.:
~ Figure { #graf-test; page-align: topbottom; caption: "Some text"; }
![test]

[\/^1^a footnote in smaller font size]{ font-size: small; display: block; }
~

[test]: ./path/to/figure.pdf { width: 100%; vertical-align: bottom; }
(and good practice to move image definitions to top level)

The second example is very tricky :-) Because of the way Madoko expands, the expansion of &br; happens too early... and even if we delay it there are still Latex errors due to line breaks in the caption definition which is a fragile command :-( The best way around this issue is to define your own protected newline command:
.newline {  tex-cmd: "\protect\newline"; }
@if not tex {
  .newline {  before: "&br;";  }
}
and then write:
~ Figure { #graf-rueck; caption: "... Text ... []{.newline}^1^Footnote text ..." }
Not a great solution though... I will see if I can change the definitions in Latex to make this work out of the box. Also, I am not sure how this works out with the table of figures; perhaps you need to set the toc-line attribute to a caption without a line break?
Jan 23, 2016 at 12:51 AM
3: the german delimiter. I think you are using american-sociological-association right? Open the file in the online editor (should be under generated) and copy the contents. Then go to the main document and set your CSL style to, say,:
CSL Style: american-sociological-association-german.csl
wait a second, and then double click the new name and you should be in a fresh empty CSL document; now paste in the contents of the original CSL style. Now we can edit it in the editor and make some changes, find the attribute delimiter-precedes-last="..." (... is probably contextual) and change it into:
delimiter-precedes-last="never"
and things will start to look good. (you may have to refresh or change a reference to regenerate the bibliography to see it happen).

:-)
Jan 23, 2016 at 1:01 AM
Edited Jan 23, 2016 at 1:02 AM
misc: hyphenation in browsers is just no widely supported, there is the hyphen attribute in CSS but Chrome doesn't support it for example. If you need breaks, say, in chapter headings or something you can insert a soft hyphen manually which is resprected by most browsers, the element is &shy;.

Better multi-lingual support would be great. Since you set the locale to german you can already see the file locales-de-DE.xml (link ) under the generated files. This contains all language specific items for the bibliography; It would be nice if Madoko would parse this and extract the terms as elements automatically... unfortunately, it does not contain enough items but it would be a good start and users could add and share translations when necessary. The polyglossia file is not so good for Madoko as it consists of many TeX commands would be hard to process automatically.

Thanks for all the feedback! Madoko has improved already a lot due to your concise observations :-)
Jan 23, 2016 at 10:49 AM
A huge thank you for your fast response!! This is especially great since the deadline for my thesis is quite close now. :-)

ad 1: Thanks for adding the macro. This is just a minor thing and I can use the workaround as it does exactly what I want.

ad 2: The null character did the trick. Should have realized this myself as you mention it in the documentation :( Also, please don't bother with line breaks in the caption. This was a bad idea and I'm doing footnotes inside the Figure environment now (which works fine thanks to you).

ad 3: Somehow I totally missed the online editor. I did as you told me above and now it looks perfect. Thank you!

As for the other points, I just wanted to tell you about my findings. I can see that you thought about these things excessively yourself already. ;) I'm excited to see what ideas you'll come up with in the future!

Thanks again and I hope you're getting well now.
Tobias
Jan 23, 2016 at 1:09 PM
Another thing I just stumbled across:

I defined in latex (spacing package) 1,5 line spacing. Is it possible to overrule that with a CSS attribute? From my example above:
~ Figure { #graf-test; page-align: topbottom; caption: "Some text"; }
![test]

[\/^1^a footnote in smaller font size and long long long long long long long long long long long long long long long long long long long long long long long long long long text with line break.]{ font-size: small; line-height: 1em; text-align: left; display: block; }
~

[test]: ./path/to/figure.pdf { width: 100%; vertical-align: bottom; }
All css attributes get applied except the line-height. There's still 1,5 line spacing. Any idea?
Jan 23, 2016 at 8:27 PM
Great to hear things work out for you and congrats on getting ready with the Thesis -- is this your masters' thesis?
Please consider sharing your thesis source some day as one of the Madoko examples :-)

I just pushed an update that should fix the line-height issue and is compatible with the setspace package. (Madoko used to set the baselineskip directly but now uses baselinestretch just like the setspace package. However, you can use another solution for now, I would write your example as:
~ Figure { #graf-test; page-align: topbottom; caption: "Some text"; }
![test]

^1^a footnote in smaller font size and long long long long long long long long long long long long long long long long long long long long long long long long long long text with line break.
{ font-size: small; text-align: left; tex-env:singlespacing; }
~

[test]: ./path/to/figure.pdf { width: 100%; vertical-align: bottom; }
where we just use the setspace provided environment singlespacing (and write the footnote as a paragraph with paragraph attributes at the end.

Hope this helps,
-- Daan
Jan 23, 2016 at 9:35 PM
Edited Jan 23, 2016 at 9:43 PM
It's my diploma thesis (I'm one of the last aspirants of this title).

I tried your suggested code but somehow the result isn't as expected. I also tried tex-cmd-before:"\singlespacing"but that also didn't have the result I had hoped for. Guess I'll wait till your patch landed and build madoko myself to try it. I will give you feedback here.

Edit: In the TableFigure environment tex-env:singlespacing; somehow adds some extra spacing between the table and the text.

Btw, what is the difference between [Some text ...]{CSS} and
Some text ...
{CSS}
Does former assume display: inline and latter display: block?
Jan 23, 2016 at 10:52 PM
Edited Jan 23, 2016 at 10:53 PM
OK, I just checked out the repository and compiled madoko.

I also found out what was wrong with tex-env:singlespacing;: It must be tex-env:singlespace;. Then the weird side effects are gone but somehow the line spacing still doesn't look "single" to me. Some googling revealed that the setspace package also contains the spacing environment. So my final solution which I'm happy with is:
{ font-size: x-small; text-align: left; tex-env: "spacing{0.6}"; }. :-)

The Floating Endperiod macro also works great, thanks for that!! Will certainly test the url handling too in the coming days. I'll report if sth seems wrong.

Thanks again!
Tobias