LaTeX and HTML formatting issues with upgrade from Mnemosyne 1.2.2 to 2.2.1--help please

181 views
Skip to first unread message

Shawn Elledge

unread,
Jul 27, 2013, 6:12:32 PM7/27/13
to mnemosyne-...@googlegroups.com
Howdy,
I hope that this is the correct place to pose such a question--I am new to this group (though not new to Mnemosyne).

I'm trying to upgrade from Mnemosyne 1.2.2 to 2.2.1 and I'm having some formatting issues. This is a major issue for me as that my screen is tiny and I am super OCD about aesthetics. It would take a significant amount of time to reformat the 15,000+ cards that I have created individually. So, I am preferably looking for a solution that involves changing the Mnemosyne format defaults.

Firstly, all the LaTeX cards rebuild; which in and of itself would be fine except that they rebuild using different formatting and so completely change the appearance of the card. Also, many cards won't compile even close to correctly. For some, it is as if it is ignoring the \usepackage, even though the LaTeX preamble file copied over just fine. For others, it is ignoring entire blocks of text, not even complicated stuff either: plain text, square brackets, subscripts, etc. I've tried moving the compiled png files from one latex folder to the other, but this does not solve the problem--the cards still rebuild.

Secondly, many of the HTML cards are formatting differently. Specifically tables, <table><tr><td> stuff </td></tr><tr><td> more stuff </td></tr></table> has changed the default alignment within the table from left align to center align. The previous default, I believe, was that the principle card environment was center aligned, but then within the HTML table environment the default was left align. I designed all my cards under this assumption, and I would like to restore this behavior. Also, while most cards are still center aligned, some cards will, seemingly randomly, become left aligned.

Under Mnemosyne 1.2.2, the relevant folders were:
C:\Users\shawn\.mnemosyne\
C:\Users\shawn\.mnemosyne\flashCardAudio\
C:\Users\shawn\.mnemosyne\flashCardPictures\
C:\Users\shawn\.mnemosyne\latex\

After uninstalling 1.2.2 and then installing 2.2.1, the relevant folders became:
C:\Users\shawn\AppData\Roaming\Mnemosyne\
C:\Users\shawn\AppData\Roaming\Mnemosyne\default.db_media\flashCardAudio\
C:\Users\shawn\AppData\Roaming\Mnemosyne\default.db_media\flashCardPictures\
C:\Users\shawn\AppData\Roaming\Mnemosyne\default.db_media\_latex\

The audio and picture files migrated just fine (luckily I used relative address). Cards involving no HTML or LaTeX seem to work just fine (but I haven't yet made it through all 15,000+ cards).

Any help would be greatly appreciated.

Cheers,
Shawn Elledge

P.s. Mnemosyne is fantastic, and the new and improved version even more so. Thanks to everyone who made it possible.

Gnome

unread,
Jul 28, 2013, 5:31:43 AM7/28/13
to mnemosyne-...@googlegroups.com

Secondly, many of the HTML cards are formatting differently.  Specifically tables, <table><tr><td> stuff </td></tr><tr><td> more stuff </td></tr></table> has changed the default alignment within the table from left align to center align.  The previous default, I believe, was that the principle card environment was center aligned, but then within the HTML table environment the default was left align.  I designed all my cards under this assumption, and I would like to restore this behavior.  Also, while most cards are still center aligned, some cards will, seemingly randomly, become left aligned.

I can't answer about latex. You mean that tables are aligned on center for 1.x and left for 2.x when nothing else is specified? The 1.x code has been completely rewritten in 2.x. Under early versions of 2.x the tables was aligned to center by default, however I believe this was changed to allow the user to control the alignment of the table using HTML.

Perhaps you can use the align="center" tag to set it to center or perhaps you can try with an CSS file?
to make the work manageable.

Or perhaps a CSS files with the default card styles could be loaded by mnemosyne by default in the HTML template?

Peter Bienstman

unread,
Jul 29, 2013, 5:47:26 AM7/29/13
to mnemosyne-...@googlegroups.com
On 07/28/2013 12:12 AM, Shawn Elledge wrote:

> Firstly, all the LaTeX cards rebuild; which in and of itself would be fine except that they rebuild using different formatting and so completely change the appearance of the card. Also, many cards won't compile even close to correctly. For some, it is as if it is ignoring the \usepackage, even though the LaTeX preamble file copied over just fine. For others, it is ignoring entire blocks of text, not even complicated stuff either: plain text, square brackets, subscripts, etc. I've tried moving the compiled png files from one latex folder to the other, but this does not solve the problem--the cards still rebuild.

The preamble content is now stored in 'config.py' instead of in a
separate file. The upgrade process should have moved your preamble to
config.py, but let me know if it didn't work.

If you still have latex issues, then, please give me a example of card
contents which cause problems.

> Secondly, many of the HTML cards are formatting differently. Specifically tables, <table><tr><td> stuff </td></tr><tr><td> more stuff </td></tr></table> has changed the default alignment within the table from left align to center align. The previous default, I believe, was that the principle card environment was center aligned, but then within the HTML table environment the default was left align. I designed all my cards under this assumption, and I would like to restore this behavior. Also, while most cards are still center aligned, some cards will, seemingly randomly, become left aligned.

It's worth pointing out that as of 2.x, the card contents are always put
inside a table itself, which is center aligned. Normally, the CSS should
have taken care of the fact that only this table is center aligned.
Please give a example of a card which cause problems.

Cheers,

Peter

Peter Bienstman

unread,
Jul 30, 2013, 4:40:11 AM7/30/13
to mnemosyne-...@googlegroups.com
BTW, with respect to tables, make sure you provided you own table tag.

I just verified that 

<table><tr><td>cell</td></tr></table>


aligns left, whereas


<tr><td>cell</td></tr> 


aligns center.


Cheers,


Peter

Shawn Elledge

unread,
Jul 31, 2013, 7:46:19 PM7/31/13
to mnemosyne-...@googlegroups.com
Thank you much for your replies.  So if I understand correctly the changes in the HTML behavior, all tables are now center aligned by default instead of left aligned.  Also all cards are automatically inside a table environment, producing a general centered alignment for cards unless otherwise indicated (which was the previous default, so no change here).  However, I don't understand why the card in EXAMPLE 2 below has become left aligned, whereas I would think it should be center aligned.

Again assuming that I understand this correctly, is there a way to return to the previous default of left aligned table environments without loosing the center alignment of the general cards?  If possible, this would be much easier than redesigning all the cards that contain the HTML table environment, and then loosing the learning information upon re-import.  (I'm not a programmer.)

Here are a few examples that I found.

EXAMPLE 1:  SAME HTML BEHAVIOR FOR 1.2.2 AND 2.2.1
Both the question and answer for the card
    Compute 2<sup>5</sup>.    2<sup>5</sup> = 32
are center aligned.  This is good and correct.

EXAMPLE 2:  DIFFERENT HTML BEHAVIOR FOR 1.2.2 AND 2.2.1
The answer to the card
    Compute 2<sup>2</sup>, 2<sup>3</sup>, 2<sup>4</sup>, 2<sup>5</sup>.    <table><tr><td>2<sup>2</sup> = 4</td></tr><tr><td>2<sup>3</sup> = 8</td></tr><tr><td>2<sup>4</sup> = 16</td></tr><tr><td>2<sup>5</sup> = 32</td></tr></table>
is now left aligned, but was once center aligned.  If I understood correctly, this should be center aligned.

EXAMPLE 3:  DIFFERENT HTML BEHAVIOR FOR 1.2.2 AND 2.2.1
The answer to the card
    What is the primary division of the bones in the axial skeleton of the adult human?    <table><tr><td><table><tr><td>axial skeleton (80)</td></tr><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; skull and associated bones (22+7)</td></tr><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vertebral column (26)</td></tr><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; thorax (25)</td></tr></table></td><td><img src="flashcardpictures/human/anatomy/bones/axial2.png" width="261" height="375"></td></tr></table>
has the table inside the table now center aligned whereas it was once left aligned.  I would like to return the default left aligned to the table within the table without redesigning the card (and all the cards similarly designed).


Also, I've made the appropriate changes to the LaTeX preamble in the config.py file, and that seems to have solved almost all of the problems with the LaTeX, but a few issues remain.  The biggest issue is that sometimes code is simply ignored the first time around; but then if I compile another with the same code, it'll get it right the second time around.

EXAMPLE 4:  DIFFERENT LaTeX BEHAVIOR FOR 1.2.2 AND 2.2.1
The first time I compiled this card
    <latex>\small{\noindent Define the generalized Bernoulli numbers.}</latex>    <latex>\small{\noindent We define the generalized Bernoulli numbers $B_{n,\chi}$ by the \emph{exponential} generating function $$\sum_{a=1}^f \frac{\chi(a)te^{at}}{e^{ft}-1} = \sum_{n\ge0} B_{n,\chi}\frac{t^n}{n!},$$ where $\chi$ is a Dirichlet character of conductor $f$.}</latex>
It ignored the \emph{exponential}, producing the image
    5265f6ce9e670d4e9dd746072b6928d8.png

EXAMPLE 5:  DIFFERENT LaTeX BEHAVIOR FOR 1.2.2 AND 2.2.1
Then I compiled this card
    <latex>\small{\noindent Define the generalized Bernoulli polynomials.}</latex>    <latex>\small{\noindent We define the generalized Bernoulli polynomials $B_{n,\chi}(X)$ by the \emph{exponential} generating function $$\sum_{a=1}^f \frac{\chi(a)te^{(a+X)t}}{e^{ft}-1} = \sum_{n\ge0} B_{n,\chi}(X)\frac{t^n}{n!},$$ where $\chi$ is a Dirichlet character of conductor $f$.}</latex>
and it didn't ignore the \emph{exponential}, producing the image
    575e51b2114b792917227a85b6696bf2.png
which is correct.

So then I deleted
    5265f6ce9e670d4e9dd746072b6928d8.png
and recompiled EXAMPLE 4, which reproduced the image
    5265f6ce9e670d4e9dd746072b6928d8.png
but this time with the \emph{exponential} included, which is correct.

I'm not sure what to do with this.

I really appreciate the effort that everybody has put in, thank you.

Cheers,
Shawn Elledge

attached

5265f6ce9e670d4e9dd746072b6928d8.png
5265f6ce9e670d4e9dd746072b6928d8 (2).png
575e51b2114b792917227a85b6696bf2.png

Peter Bienstman

unread,
Aug 1, 2013, 8:07:19 AM8/1/13
to mnemosyne-...@googlegroups.com
Hi,

It took me a while to recall this, but it's actually a bit more
complicated when it comes to alignment, because there's two types of
alignment:

* alignment of the column positions of the table with respect to the
complete screen. If you create your own table, this uses the html
default of left-align. If you don't have a html table, the table which
contains all the card text is set to centering by the default.

* alignment of the text within each column. This is handled by the
'alignment' flag in settings - card appearance.

So, if you want true left alignment ( and not some hybrid between center
and left as you can see e.g. in <table><tr><td>axial skeleton
(80)</td></tr><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; skull and
associated bones (22+7)</td></tr><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
vertebral column (26)</td></tr><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
thorax (25)</td></tr></table> ) use a default <table> tag and
left-alignment in the options.

In 1.x, this left-aligment was a global setting, but the good news is
that for 2.x you can have different types of formatting per card type.
So, feel free to create a clone of e.g. 'Front-to-Back only', called
'Left-aligned Front-to-Back' and change the alignment option only for
that card type. Then, using the card browser, you can mass move the
required cards to the new card type (multiselect, right click).

As for your latex images being sometimes out-of-date when editing, I
made some fixes which will be in the next release, basically deleting
tmp.aux as well as tmp.dvi before attempting to compile latex.
Hopefully, this should fix your problems.

Thanks for the detailed mail, always very helpful if people include lots
of details!

Cheers,

Peter
Reply all
Reply to author
Forward
0 new messages