pub struct Section {
pub name: String,
/* private fields */
}Expand description
A document Section.
Like the Document type, a Section is more or less just a collection of
Elements. When rendered it will start with \section{Section Name} and
then each element will be rendered in turn.
Fields§
§name: StringThe name of the section.
Implementations§
Source§impl Section
impl Section
Sourcepub fn new(name: &str) -> Section
pub fn new(name: &str) -> Section
Create a new section with the specified name.
Examples found in repository?
More examples
examples/simple.rs (line 17)
5fn create_document() -> Document {
6 let mut doc = Document::new(DocumentClass::Article);
7
8 // Set some metadata for the document
9 doc.preamble.title("My Fancy Document");
10 doc.preamble.author("Michael-F-Bryan");
11
12 doc.push(Element::TitlePage)
13 .push(Element::ClearPage)
14 .push(Element::TableOfContents)
15 .push(Element::ClearPage);
16
17 let mut section_1 = Section::new("Section 1");
18 section_1
19 .push("Here is some text which will be put in paragraph 1.")
20 .push("And here is some more text for paragraph 2.");
21 doc.push(section_1);
22
23 let mut section_2 = Section::new("Section 2");
24 section_2.push("More text...");
25 doc.push(section_2);
26
27 doc
28}examples/complex.rs (line 30)
29fn first_section() -> Section {
30 let mut section_1 = Section::new("Introduction");
31 section_1.push("This is an example paragraph.");
32
33 let mut equations = Align::new();
34 equations
35 .push("y &= mx + c")
36 .push(Equation::with_label("quadratic", "y &= a x^2 + bx + c"));
37
38 section_1
39 .push("Please refer to the equations below:")
40 .push(equations);
41
42 let mut objectives = List::new(ListKind::Enumerate);
43 objectives
44 .push(r"Demonstrate how to use the \textit{latex} library.")
45 .push("Create a reasonably complex document")
46 .push("???")
47 .push("PROFIT!");
48
49 section_1.push("Here are our objectives:").push(objectives);
50
51 section_1
52}Sourcepub fn push<I>(&mut self, element: I) -> &mut Self
pub fn push<I>(&mut self, element: I) -> &mut Self
Add an element to the Section.
Examples found in repository?
More examples
examples/simple.rs (line 19)
5fn create_document() -> Document {
6 let mut doc = Document::new(DocumentClass::Article);
7
8 // Set some metadata for the document
9 doc.preamble.title("My Fancy Document");
10 doc.preamble.author("Michael-F-Bryan");
11
12 doc.push(Element::TitlePage)
13 .push(Element::ClearPage)
14 .push(Element::TableOfContents)
15 .push(Element::ClearPage);
16
17 let mut section_1 = Section::new("Section 1");
18 section_1
19 .push("Here is some text which will be put in paragraph 1.")
20 .push("And here is some more text for paragraph 2.");
21 doc.push(section_1);
22
23 let mut section_2 = Section::new("Section 2");
24 section_2.push("More text...");
25 doc.push(section_2);
26
27 doc
28}examples/complex.rs (line 31)
29fn first_section() -> Section {
30 let mut section_1 = Section::new("Introduction");
31 section_1.push("This is an example paragraph.");
32
33 let mut equations = Align::new();
34 equations
35 .push("y &= mx + c")
36 .push(Equation::with_label("quadratic", "y &= a x^2 + bx + c"));
37
38 section_1
39 .push("Please refer to the equations below:")
40 .push(equations);
41
42 let mut objectives = List::new(ListKind::Enumerate);
43 objectives
44 .push(r"Demonstrate how to use the \textit{latex} library.")
45 .push("Create a reasonably complex document")
46 .push("???")
47 .push("PROFIT!");
48
49 section_1.push("Here are our objectives:").push(objectives);
50
51 section_1
52}Trait Implementations§
impl StructuralPartialEq for Section
Auto Trait Implementations§
impl Freeze for Section
impl RefUnwindSafe for Section
impl Send for Section
impl Sync for Section
impl Unpin for Section
impl UnwindSafe for Section
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more