Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

options to adjust format of paper background #2137

Closed
fugata opened this issue Jul 27, 2020 · 16 comments
Closed

options to adjust format of paper background #2137

fugata opened this issue Jul 27, 2020 · 16 comments

Comments

@fugata
Copy link

fugata commented Jul 27, 2020

Is your feature request related to a problem? Please describe.

I use xournalpp to present lecture slides + take notes. I often need to sketch graphs so the graph paper background is very helpful. I have lots of equations with subscripts and subscripts, and the grid of the default graph paper is too small.

Describe the solution you'd like

The existing options for paper background are great -- it would be great if the user can tweak the parameters of the background. E.g. for ruled paper: adjust width between the rules; for graph paper: specifiy the size of the grid.

Note that depending on the user input, the background patterns might not "determinate" evenly, i.e. the last row/column might be smaller the rest the regular ones. The "correct" way to address that would have been to adjust the starting point of the background pattern to even things out. But I have not problem having even "uneven" row/column at the end, and the flexibility of being able to tweak these parameters far exceed the small visual uneveness.

Describe alternatives you've considered

I manually created pdf graphpapers and use that as background. But then I would not be able to change the background color, and I would not be able remove the background when I am done (my audience strongly prefer not to see the background patter during presentations).

Additional context

If it takes too much work to add this to the GUI interface, it's be perfectly fine for users to manually change the parameters in a config file (this is likely to be something that a user would tweak once and for all and use it for all documents).

Thanks for the consideration!

@rolandlo
Copy link
Member

rolandlo commented Jul 27, 2020

In case of graph paper that should be pretty easy to implement, since the file format already supports it. For example the following xml file (gzipped and renamed from .gz to .xopp) produces a grid with size 50 pt (instead of 14.17 pt).


<?xml version="1.0" standalone="no"?>
<xournal creator="Xournal++ 1.1.0+dev" fileversion="4">
<title>Xournal++ document - see https://github.com/xournalpp/xournalpp</title>
<page width="595.27559100" height="841.88976400">
<background type="solid" color="#ffffffff" style="graph" config="r1=50.0"/>
<layer/>
</page>
</xournal>

As a workaround you may start with this xml-file (after changing the value of r1 in the xml-file to your needs).

Your feature request definitively should be implemented. There is not much sense having a refined file format, when the gui does not support it.

Edit: <layer/> tag is not strictly needed.

@fugata
Copy link
Author

fugata commented Jul 27, 2020

In case of graph paper that should be pretty easy to implement, since the file format already supports it. For example the following xml file (gzipped and renamed from .gz to .xopp) produces a grid with size 50 pt (instead of 14.17 pt).


<?xml version="1.0" standalone="no"?>
<xournal creator="Xournal++ 1.1.0+dev" fileversion="4">
<title>Xournal++ document - see https://github.com/xournalpp/xournalpp</title>
<page width="595.27559100" height="841.88976400">
<background type="solid" color="#ffffffff" style="graph" config="r1=50.0"/>
<layer/>
</page>
</xournal>

As a workaround you may start with this xml-file (after changing the value of r1 in the xml-file and adding some more pages).

Your feature request definitively should be implemented. There is not much sense having a refined file format, when the gui does not support it.

Thanks for your prompt reply and consideration! Where should I put this .xopp file? And what is this xml-file you mentioned?

I really should familiarize myself with the files system/init etc for xournalpp. Where's a good place to start? Thanks!

@rolandlo
Copy link
Member

The xml file is the one you see above (human readable). A xopp-file is a compressed xml-file (not human readable any more). So you would have to

  1. Copy the content of the above file into a text editor and save it, say under filename "backgroundTemplate", with no file extension. It does not matter where you save it. You should just find it easily.
  2. Modify the "r1=50.0" on the 5th line according to your needs (the number stands for the grid size).
  3. gzip the file (for instance by running gzip backgroundTemplate in the terminal in this folder, assuming you are on Linux; or by right-clicking and choosing "compress" in the context-menu). This should produce the file "backgroundTemplate.gz"
  4. Rename the file to "backgroundTemplate.xopp".

Now whenever you want to have a new document with your new (larger) grid size just open the backgroundTemplate.xopp file in Xournal++, save it under a new name. If you add a page, it will automatically have the same graph background (same grid size).

To learn more about the file format you could consult the Xournal User's manual. It describes the .xoj-format of Xournal, which is a subset of the Xournal++ .xopp-format.

If you need more help, let me know.

@fugata
Copy link
Author

fugata commented Jul 27, 2020

The xml file is the one you see above (human readable). A xopp-file is a compressed xml-file (not human readable any more). So you would have to

1. Copy the content of the above file into a text editor and save it, say under filename "backgroundTemplate", with no file extension. It does not matter where you save it. You should just find it easily.

2. Modify the "r1=50.0" on the 5th line according to your needs (the number stands for the grid size).

3. gzip the file (for instance by running `gzip backgroundTemplate` in the terminal in this folder, assuming you are on Linux; or by right-clicking and choosing "compress" in the context-menu). This should produce the file "backgroundTemplate.gz"

4. Rename the file to "backgroundTemplate.xopp".

Now whenever you want to have a new document with your new (larger) grid size just open the backgroundTemplate.xopp file in Xournal++, save it under a new name. If you add a page, it will automatically have the same graph background (same grid size).

To learn more about the file format you could consult the Xournal User's manual. It describes the .xoj-format of Xournal, which is a subset of the Xournal++ .xopp-format.

If you need more help, let me know.

This works beatifully. Thanks SO MUCH for your help!

@rolandlo
Copy link
Member

rolandlo commented Aug 14, 2020

There is actually a simpler (and better) way to adjust the format of the paper background. That's what you need to do:

  1. Find the relevant pagetemplates.ini file (in the latest Linux version of Xournal++ the file is located in /usr/share/xournalpp/ui/)
  2. Open the file (with writing permissions) and add a new entry like
[largeGraph]
name=Graph with large grid
name[de]=Kariert mit grossem Gitter
format=graph
config=r1=50

  1. Restart Xournal++ and check whether Xournal++ has registered the name page template (under journal->page background) or using the toolbar (next to the "add page" icon).
  2. In case Xournal++ has not added the new page template, then most likely you have several pagetemplates.ini files on the system and you must try another one.

@Tydblair
Copy link

There is actually a simpler (and better) way to adjust the format of the paper background. That's what you need to do:

  1. Find the relevant pagetemplates.ini file (in the latest Linux version of Xournal++ the file is located in /usr/share/xournalpp/ui/)
  2. Open the file (with writing permissions) and add a new entry like
[largeGraph]
name=Graph with large grid
name[de]=Kariert mit grossem Gitter
format=graph
config=r1=50
  1. Restart Xournal++ and check whether Xournal++ has registered the name page template (under journal->page background) or using the toolbar (next to the "add page" icon).
  2. In case Xournal++ has not added the new page template, then most likely you have several pagetemplates.ini files on the system and you must try another one.

Are you able to help me understand the dimentions of these parametres?

im guessing that
r1 = Ruled line dimentions
m1 = Margin dimentions
F1 = Colour in Hex

But I dont understand their relationship to mm, can you point me in the right direction so that I can create some custom templates

@rolandlo
Copy link
Member

rolandlo commented Mar 16, 2021

Are you able to help me understand the dimentions of these parametres?

im guessing that
r1 = Ruled line dimentions
m1 = Margin dimentions
F1 = Colour in Hex

But I dont understand their relationship to mm, can you point me in the right direction so that I can create some custom templates

First of all, the unit is 1 pt = 1/72 inch. So 5mm = 14.17 pt is the default grid size of the graph paper.
r1 = grid size (for graph and dotted paper backgrounds)
m1 = margin (left, right, top and bottom)
f1= primary foreground color (in Hex)

There are also
lw = line width,
rm = boolean with values 0 (false) or 1 (true), if rounding should take place for the margin, so you will have an integral number of grid lines
f2= secondary foreground color (in Hex)
af1= alternative secondary foreground color (in Hex) when page background is dark
af2= alternative secondary foreground color (in Hex) when page background is dark

The following two parameters for ruled/lined backgrounds are only available in the development version (nightly release), not yet in the stable version 1.1.1.

For ruled and lined paper there is the parameter
r1 = spacing between horizontal lines

For lined paper there is also the parameter
m1 = margin for the vertical line (positive values for a vertical lines on the left, negative values for a vertical line on the right)

For isometric paper there is the parameter
r1 = side length of the triangles

Edit: Added af1 and af2.
Edit2: Added m1 and r1 in case of ruled/lined paper (see also the description of PR #3969)
Edit3: Added r1 in case of isometric paper

@prbuen
Copy link

prbuen commented Mar 15, 2022

Is there a config format for ruled backgrounds (format=lined)?

@thedipayanb
Copy link

First of all, the unit is 1 pt = 1/72 inch. So 5mm = 14.17 pt is the default grid size of the graph paper. r1 = grid size (for graph and dotted paper backgrounds) m1 = margin (left, right, top and bottom) f1= primary foreground color (in Hex)

There are also lw = line width, rm = boolean with values 0 (false) or 1 (true), if rounding should take place for the margin, so you will have an integral number of grid lines f2= secondary foreground color (in Hex) af1= alternative secondary foreground color (in Hex) when page background is dark af2= alternative secondary foreground color (in Hex) when page background is dark

Edit: Added af1 and af2.

What is the command for increasing gap between ruled lines ???

@rolandlo
Copy link
Member

rolandlo commented Sep 5, 2022

What is the command for increasing gap between ruled lines ???

The gap between ruled lines can only be adjusted since May 2022 (not yet in the stable version). Use the parameter r1. I have updated the description.

@withdrawn-auditor-craftier
Copy link

withdrawn-auditor-craftier commented Oct 16, 2022

Where is the /usr/share/xournalpp/ui/pagetemplates.ini file located in the flatpak release of xournalpp? Specifically, in Ubuntu 22.04.

@i-zanis
Copy link

i-zanis commented Dec 13, 2022

I am testing the following for Ruled format but nothing changes on Windows11.

[test2]
name=test2
name[de]=Liniert
format=ruled
config=r1=1

@rolandlo
Copy link
Member

@i-zanis What you added works for me, although r1=1 is smaller than you want (it's 1pt = 1/72 inch). Do you use the nightly version? It won't work in the stable version. How do you apply the new page background? When you choose it in the dropdown menu from the toolbar
grafik
you have to add a new page with that format (or open the dropdown again and click "apply to current page") to get it.

@NNoah18
Copy link

NNoah18 commented Feb 15, 2023

Are you able to help me understand the dimentions of these parametres?
im guessing that
r1 = Ruled line dimentions
m1 = Margin dimentions
F1 = Colour in Hex
But I dont understand their relationship to mm, can you point me in the right direction so that I can create some custom templates

First of all, the unit is 1 pt = 1/72 inch. So 5mm = 14.17 pt is the default grid size of the graph paper. r1 = grid size (for graph and dotted paper backgrounds) m1 = margin (left, right, top and bottom) f1= primary foreground color (in Hex)

There are also lw = line width, rm = boolean with values 0 (false) or 1 (true), if rounding should take place for the margin, so you will have an integral number of grid lines f2= secondary foreground color (in Hex) af1= alternative secondary foreground color (in Hex) when page background is dark af2= alternative secondary foreground color (in Hex) when page background is dark

The following two parameters for ruled/lined backgrounds are only available in the development version (nightly release), not yet in the stable version 1.1.1.

For ruled and lined paper there is the parameter r1 = spacing between horizontal lines

For lined paper there is also the parameter m1 = margin for the vertical line (positive values for a vertical lines on the left, negative values for a vertical line on the right)

For isometric paper there is the parameter r1 = side length of the triangles

Edit: Added af1 and af2. Edit2: Added m1 and r1 in case of ruled/lined paper (see also the description of PR #3969) Edit3: Added r1 in case of isometric paper

@rolandlo
I am able to change the vertical line placement for ruled paper using m1=36, but how would I also change the top and bottom margin dimensions? - I want the ruled lines to start sooner on the page and end later on the page

@bhennion
Copy link
Contributor

@rolandlo I am able to change the vertical line placement for ruled paper using m1=36, but how would I also change the top and bottom margin dimensions? - I want the ruled lines to start sooner on the page and end later on the page

Top and bottom margins are currently not configurable. They are hardcoded values.

@Simbi0z
Copy link

Simbi0z commented Jun 21, 2023

Is there any chance for a GUI for modifying these settings?
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants