Difference between revisions of "Documentation/SL/How Tos/Nastavitev sloga za oštevilčevanje vrstic kode"
Line 5: | Line 5: | ||
== Primer pričakovanega rezultata == | == Primer pričakovanega rezultata == | ||
− | + | Ustvariti želimo slog odstavka za programsko kodo, ki je tako oštevilčen, pri čemer so številke desno poravnane, vsaka vrstica kode je enako zamaknjena in odstavki so dovolj zamaknjeni, da se številke prilegajo v prostor, ki je na voljo. (Vsaka vrstica kode je v ločenem odstavku.) | |
<pre> | <pre> | ||
Line 25: | Line 25: | ||
Postopek ima tri korake: | Postopek ima tri korake: | ||
− | [[# | + | [[#Korak 1. Ustvarite slog oštevilčevanja seznama.|Korak 1. Ustvarite slog oštevilčevanja seznama.]] |
− | [[# | + | [[#Korak 2. Ustvarite slog odstavka.|Korak 2. Ustvarite slog odstavka.]] |
− | [[# | + | [[#Korak 3. Uporabite slog odstavka na izpisu izvorne kode.|Korak 3. Uporabite slog odstavka na izpisu izvorne kode.]] |
− | + | Preden začnete, pritisnite ''F11''. Odpre se okno Slogi in oblikovanje, v kolikor še ni odprto. | |
− | === | + | === Korak 1. Ustvarite slog oštevilčevanja seznama. === |
<ol> | <ol> | ||
<li> | <li> | ||
− | + | Kliknite ikono Slogi seznama na vrhu okna Slogi in oblikovanje (peti z leve).</li> | |
<li>Right-click in the blank area below the list of styles and choose '''New'''. (You could modify one of the existing styles, but it’s easier to remember which style is for what special purpose if you create a new one.)</li> | <li>Right-click in the blank area below the list of styles and choose '''New'''. (You could modify one of the existing styles, but it’s easier to remember which style is for what special purpose if you create a new one.)</li> | ||
− | [[Image:numlist2.png|Starting a new list style]]<br>'' | + | [[Image:numlist2.png|Starting a new list style]]<br>''Slika 2: Starting a new list style.'' |
− | ''' | + | '''Opomba:''' Although the icon at the top of the Styles and Formatting window is labelled List Styles, the dialog that opens is labelled Numbering Style. |
− | <li> | + | <li>Na strani Organizator pogovornega okna Slog oštevilčevanja poimenujte novi slog seznama, npr. OštevilčevanjeKode.</li> |
− | <li> | + | <li>Na strani Možnosti naredite naslednje:</li> |
<ol style="list-style-type:lower-alpha"> | <ol style="list-style-type:lower-alpha"> | ||
− | <li> | + | <li>V polju Raven izberite 1.</li> |
− | <li> | + | <li>Na seznamu Oštevilčevanje izberite 1,2,3.</li> |
<li>Leave the Before and After boxes blank, or delete anything that is in them.</li> | <li>Leave the Before and After boxes blank, or delete anything that is in them.</li> | ||
− | <li> | + | <li>Pustite Slog znakov na nastavitvi Brez.</li> |
<li>Make sure Start at is 1.</li> | <li>Make sure Start at is 1.</li> | ||
Line 88: | Line 88: | ||
</ol> | </ol> | ||
− | === 2. | + | === Korak 2. Ustvarite slog odstavka. === |
<ol> | <ol> | ||
<li>Click the Paragraph Styles icon at the top of the Styles and Formatting window (first icon on the left).</li> | <li>Click the Paragraph Styles icon at the top of the Styles and Formatting window (first icon on the left).</li> | ||
Line 121: | Line 121: | ||
</ol> | </ol> | ||
− | === | + | === Korak 3. Uporabite slog odstavka na izpisu izvorne kode. === |
If you have already entered the lines of code, select them and double-click '''ProgCode''' in the Styles and Formatting window. All the lines should now be numbered, indented, and in the correct font. | If you have already entered the lines of code, select them and double-click '''ProgCode''' in the Styles and Formatting window. All the lines should now be numbered, indented, and in the correct font. |
Revision as of 17:48, 5 May 2008
Ta dokument opisuje, kako nastavitev slog odstavka, ki uporablja za številčenje vrstic slog seznama (dejansko odstavke) v izpisih programske kode.
Contents
Primer pričakovanega rezultata
Ustvariti želimo slog odstavka za programsko kodo, ki je tako oštevilčen, pri čemer so številke desno poravnane, vsaka vrstica kode je enako zamaknjena in odstavki so dovolj zamaknjeni, da se številke prilegajo v prostor, ki je na voljo. (Vsaka vrstica kode je v ločenem odstavku.)
1 Vrstica 1 2 Vrstica 2 3 Vrstica 3 ... 8 Vrstica 8 9 Vrstica 9 10 Vrstica 10 11 Vrstica 11 ... 101 Vrstica 101 1001 Vrstica 1001
Slika 1: Primer seznama.
Postopek ima tri korake:
Korak 1. Ustvarite slog oštevilčevanja seznama.
Korak 2. Ustvarite slog odstavka.
Korak 3. Uporabite slog odstavka na izpisu izvorne kode.
Preden začnete, pritisnite F11. Odpre se okno Slogi in oblikovanje, v kolikor še ni odprto.
Korak 1. Ustvarite slog oštevilčevanja seznama.
- Kliknite ikono Slogi seznama na vrhu okna Slogi in oblikovanje (peti z leve).
- Right-click in the blank area below the list of styles and choose New. (You could modify one of the existing styles, but it’s easier to remember which style is for what special purpose if you create a new one.)
- Na strani Organizator pogovornega okna Slog oštevilčevanja poimenujte novi slog seznama, npr. OštevilčevanjeKode.
- Na strani Možnosti naredite naslednje:
- V polju Raven izberite 1.
- Na seznamu Oštevilčevanje izberite 1,2,3.
- Leave the Before and After boxes blank, or delete anything that is in them.
- Pustite Slog znakov na nastavitvi Brez.
- Make sure Start at is 1.
- Show sublevels should be grayed out. Do not select the checkbox for Consecutive numbering.
- You do not need to do anything with any of the other levels, because this paragraph style is not going to be part of a hierarchy in an outline.
- On the Position page, do this:
- In the Level box, choose 1.
- For Indent, choose 0.5cm. (You may need to adjust this later.)
- For Spacing to text, choose 1.0cm.
- For Minimum space..., choose 0.4cm.
- For Numbering alignment, choose Right.
- Ne naredite ničesar na drugih straneh tega pogovornega okna.
- Kliknite V redu in s tem shranite ta slog.
Slika 2: Starting a new list style.
Opomba: Although the icon at the top of the Styles and Formatting window is labelled List Styles, the dialog that opens is labelled Numbering Style.
Figure 3: Setting up the new CodeNumbering list (numbering) style.
Figure 4: Setting the alignment and indentation for the CodeNumbering style.
Korak 2. Ustvarite slog odstavka.
- Click the Paragraph Styles icon at the top of the Styles and Formatting window (first icon on the left).
- Right-click and choose New.
- On the Organizer page of the Paragraph Style dialog:
- Give the new paragraph style a name. We’ll call it ProgCode.
- In the Next Style box, choose ProgCode (that will make the following paragraph also be in this style, until you choose a different style).
- In Linked with, I recommend choosing -None-.
- Category should be Custom Styles, though I think that doesn't matter.
- On the Font page, choose the font you want, perhaps Courier New, and the size.
- On the Indents & Spacing page, leave all the boxes showing 0.00cm.
- On the Numbering page, choose from the list the CodeNumbering style you just created.
- You should not need to do anything on the other pages of this dialog.
- Click OK to save this style.
Figure 5: Creating the ProgCode paragraph style.
Figure 6: Associating the paragraph style with a numbering style.
Korak 3. Uporabite slog odstavka na izpisu izvorne kode.
If you have already entered the lines of code, select them and double-click ProgCode in the Styles and Formatting window. All the lines should now be numbered, indented, and in the correct font.
Note: If you have previously been applying manual formatting to these paragraphs, first select all the paragraphs, right-click, and choose Default Formatting; then apply the ProgCode style.
If you are starting a new block of code, apply the ProgCode style to the first line (either before or after entering it). Then when you press Enter at the end of that line, the next line will appear in the same ProgCode style but with the next number in the list sequence.
Restarting numbering (if required)
If you have more than one list in a chapter, the second and subsequent lists may continue numbering from the previous list. To restart at 1, place the cursor anywhere in the paragraph you want numbered 1, right-click and choose Restart numbering.
Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY). |