WO2019019534A1 - 公式的显示方法、装置、终端及计算机可读存储介质 - Google Patents

公式的显示方法、装置、终端及计算机可读存储介质 Download PDF

Info

Publication number
WO2019019534A1
WO2019019534A1 PCT/CN2017/116754 CN2017116754W WO2019019534A1 WO 2019019534 A1 WO2019019534 A1 WO 2019019534A1 CN 2017116754 W CN2017116754 W CN 2017116754W WO 2019019534 A1 WO2019019534 A1 WO 2019019534A1
Authority
WO
WIPO (PCT)
Prior art keywords
elements
line information
alignment line
height
displayed
Prior art date
Application number
PCT/CN2017/116754
Other languages
English (en)
French (fr)
Inventor
古意昌
Original Assignee
广州视源电子科技股份有限公司
广州视睿电子科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 广州视源电子科技股份有限公司, 广州视睿电子科技有限公司 filed Critical 广州视源电子科技股份有限公司
Publication of WO2019019534A1 publication Critical patent/WO2019019534A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Definitions

  • the present invention relates to the field of data processing technologies, and in particular, to a method, an apparatus, a terminal, and a computer readable storage medium for displaying a formula.
  • the teaching touch screen terminal is a multi-functional device developed on the basis of conventional audio-visual education and computer equipment. It also has functions such as teaching, academic report, conference, etc., and meets the requirements of modern education for presentation of various resources.
  • the teacher can write on the whiteboard just like writing on a traditional blackboard.
  • traditional blackboards or whiteboard software it is often the case that the formula is unclear due to the teacher's handwriting.
  • the prior art teaching touch screen terminal can apply the image processing means to recognize the characters and the layout mode in the formula, it cannot align the elements in the arrangement formula and display the formula beautifully.
  • the invention provides a method, a device, a terminal and a computer readable storage medium for displaying a formula, so as to realize an efficient and beautiful display formula and clearly show the formula structure to the student user.
  • the first embodiment of the present invention provides a method for displaying a formula, including:
  • the alignment line information is ordinate information;
  • the alignment line information of the polar element is the arithmetic mean of the highest point ordinate and the lowest point ordinate;
  • the height of the pole element to be displayed is obtained according to the layout mode of the superior element;
  • the formula for arranging the child elements of all expression combinations is displayed according to the positional relationship between the elements and the elements in each nesting level and the height to be displayed of each element.
  • an embodiment of the present invention further provides a display device for a formula, including:
  • the obtaining module is configured to obtain a layout mode of each element of the multi-level nested in the formula to be displayed and a positional relationship between the element and the element in each nesting level; wherein, if the n-level nested one element is embedded Set one or more n+1th nested elements, then the one or more n+1th nested elements are child elements of the nth nested element; elements without child elements are polar elements , elements with child elements are non-polar elements;
  • a calculation module configured to call a height to be displayed and/or alignment line information of one or more sub-elements of the non-polar element according to a layout mode of the non-polar element, and calculate a height or alignment line of the non-polar element to be displayed Information; wherein the alignment line information is ordinate information; the alignment line information of the pole element is an arithmetic mean of the highest point ordinate and the lowest point ordinate; the height of the pole element to be displayed is according to the superior element thereof Layout mode obtained;
  • An arrangement module configured to arrange the sub-elements according to alignment line information of each sub-element of the expression, so that the alignment line information of the sub-elements is the same; wherein the expression combination is a layout mode Envelopes are encapsulated into a set of elements;
  • a display module for displaying a formula for arranging child elements of all expression combinations according to the positional relationship between elements and elements in each nesting level and the height to be displayed of each element.
  • the embodiment of the present invention further provides a terminal, where the terminal includes:
  • One or more processors are One or more processors;
  • Memory for storing one or more programs
  • the one or more programs are executed by the one or more processors such that the one or more processors implement the alignment method of the formula elements described above.
  • the present invention also provides a computer readable storage medium having stored thereon a computer program that, when executed by a processor, implements the alignment method of the above formula elements.
  • the alignment line information or height of the sub-element is read step by step, so that the alignment line information or height is obtained step by step, and each of the expression combinations is aligned by the alignment line information.
  • the sub-element then according to the positional relationship between the elements and the height of the element to be displayed, solves the problem that the prior art cannot align the formula elements, realizes the efficient and beautiful display formula, and clearly shows the effect of the formula structure to the user.
  • FIG. 1 is a flow chart showing a method of displaying a formula in the first embodiment of the present invention
  • FIG. 3 is a schematic view showing the alignment of formula elements in the first embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of a display device of a formula in Embodiment 2 of the present invention.
  • FIG. 5 is a schematic structural diagram of a terminal in Embodiment 3 of the present invention.
  • FIG. 1 is a flowchart of a method for displaying a formula according to Embodiment 1 of the present invention.
  • the structure of the third level elements a and b is nested and the formula is drawn to be displayed to the user.
  • the method can be executed by computer program instructions, including the following steps 110, 120, 130 and 140.
  • Step 110 Obtain a layout mode of each element of the multi-level nesting in the formula to be displayed and a positional relationship between the elements and the elements in each nesting level.
  • n+1th nested elements are nested under one element of the nth level nested
  • the one or more n+1th level nested elements are the nth level nested elements.
  • Child elements; elements without child elements are polar elements, and elements with child elements are non-polar elements.
  • Figure 2 shows the formula using the mathematical markup language MathML.
  • the information including the layout mode of each element, such as mark mfrac, msup, etc., indicates that the layout mode of the element is fractional mode, superscript mode, similar layout modes in MathML, and msqrt, mrow, msubsup, mover, munderover, mmultiscipts, etc.
  • the pole element is an element without a child element.
  • the step 110 is to obtain a layout mode of each element of the multi-level nested in the formula to be displayed, and a positional relationship between the element and the element in each nesting level, which specifically includes:
  • the information of the above formula can be obtained from the terminal with computer processing capability and then obtained by the image processing method.
  • the above example utilizes the mathematical markup language MathML to record the formula information, which is only one specific implementation manner, and the present invention also Formula information can be recorded in other languages.
  • Step 120 Call the height to be displayed and/or the alignment line information of the one or more sub-elements of the non-polar element according to the layout mode of the non-polar element, and calculate the height or alignment line information of the non-polar element to be displayed.
  • the alignment line information is ordinate information; the alignment line information of the polar element is an arithmetic mean of the highest point ordinate and the lowest point ordinate; the height of the pole element to be displayed is according to the layout mode of the superior element acquired.
  • calling the height and/or alignment line information of the one or more child elements to be displayed includes: calling the height and alignment line information of the one or more child elements to be displayed, or calling the height or alignment of the one or more child elements to be displayed.
  • Line information or, to call the height of the one or more child elements to be displayed, the alignment line information of one or more other child elements, and the like. It can be understood that for elements of different layout modes, the relationship between the alignment line information and the height to be displayed is generally different from the child elements. Therefore, for the elements of different layout modes to be displayed with height or alignment information, the called sub-elements may be different.
  • the information of the calling sub-element is that the height to be displayed or the alignment line information is also different.
  • the non-polar element obtains its own alignment line information or height information according to the height and/or alignment line information of the sub-element. If the sub-element is a non-polar element, the step element 120 continues according to the sub-level element. Obtain its own alignment line information or height information, and return it to the superior element for the upper element calculation call; if the child element is a polar element, the alignment line information of the polar element is the arithmetic mean of the highest point ordinate and the lowest point ordinate.
  • the height to be displayed is obtained according to the layout mode of the superior element; that is, step 120, the non-polar element is called according to the layout mode of the non-polar element
  • the height and/or alignment line information of the one or more child elements to be displayed, and the height or alignment line information of the non-polar element to be displayed including:
  • the height and/or alignment line information of the one or more child elements of the non-polar element is called according to the layout mode of the non-polar element, and the calculation is performed. Alignment line information of the non-polar element;
  • the height and/or alignment line information of the one or more sub-elements of the non-polar element are called to calculate the non-polar The height of the child element to be displayed;
  • the height and/or alignment line information of one or more sub-elements of the non-polar element are called to calculate the non-polar Alignment line information for child elements.
  • Step 130 Arrange the sub-elements according to the alignment line information of each sub-element of the expression combination, so that the alignment line information of the sub-elements is the same.
  • the expression combination is an element in which the layout mode is encapsulated into a plurality of expressions, that is, a combination of a plurality of expressions in parallel.
  • expression combinations typically include elements labeled ⁇ math> (which encapsulates the entire formula into a group) and ⁇ mrow> (which represents the grouping of any number of subexpressions into a set of layers that serve as a wrapper). .
  • the alignment display is required to clearly show the data structure.
  • the alignment line information is designed, and the arrangement of the formula is aligned with the alignment line information as a reference.
  • Step 140 According to the positional relationship between elements and elements in each nesting level and the elements The height to be displayed shows the formula for the child elements of all expression combinations.
  • the data structure of the formula needs to obtain the height of the element to be displayed and the positional relationship between the elements and elements in each nesting level (ie, where the multiple elements of the same level are placed, for example, the score
  • the numerator in the element is placed above the denominator, and the alignment expression combination.
  • the child element needs to be arranged according to the alignment line information, and then the alignment line information of the child element is inquired, and the child element queries the height of the next-level child element to be displayed according to the layout mode.
  • each sub-element in the expression combination arranges each sub-element so that the alignment line information is the same, that is, the alignment lines of the elements in the expression combination are aligned.
  • the height to be displayed of each element is also obtained in a stepwise inquiry and a stepwise return. Combining the positional relationship between the element and the element can obtain the display of each element of the formula and realize the display of the formula.
  • the alignment line information or height of the sub-element is read step by step, so that the alignment line information or height is obtained step by step, and the sub-expressions of the expression combination are aligned by the alignment line information.
  • the element displays the formula according to the positional relationship between the elements and the height of the element to be displayed, which solves the problem that the prior art cannot align the formula elements, realizes the efficient and beautiful display formula, and clearly shows the effect of the formula structure to the user.
  • the height of the pole element to be displayed is obtained according to the layout mode of the superior element, including: the height of the pole element to be displayed is obtained according to the layout mode of the element of the previous level, or The height of the sub-element to be displayed is obtained according to the layout mode of the n-level element thereof, n ⁇ 1; the upper-level element includes the upper-level element.
  • the font level is 2).
  • the height of the pole element to be displayed can be obtained directly according to the layout mode of the element of the upper element of the polar element.
  • the embodiment also provides a specific scheme for calculating the height of the pole element of the formula having the multi-layer height change, according to the nested structure of the formula, according to the layout pattern of the element of the upper level. , the height of the child element to be displayed is calculated step by step. That is, the method for obtaining the height of the pole element to be displayed includes:
  • the font size of the sub-element is obtained from the font size of the non-polar element; wherein the font size of the first-level nested element is a preset value;
  • the fourth association table is queried according to the font size of the pole element, and the height of the pole element to be displayed is obtained.
  • the fourth association table records a plurality of font sizes and a height to be displayed corresponding to each font size.
  • the font size relationship corresponding to the score mode, the root mode, and the expression combination mode is the same as the font size of the element and its sub-elements; the font size relationship corresponding to the superscript mode is the element and the first one thereof
  • the font size of the child element is the same, and the font size of the element and its second child element differs by one font size. level.
  • the font size is the same as it is 1.
  • the two sub-element font numbers of the fractional element ⁇ mfrac> are the same, and are also 1.
  • the first child element ⁇ mrow> of the ⁇ mfrac> element it contains 4 child elements ⁇ mo>, ⁇ mi>, ⁇ mo>, ⁇ msqrt>, and the font size of each child element is the same as 1;
  • the ⁇ msqrt> element it contains 5 child elements, ⁇ msup>, ⁇ mo>, ⁇ mn>, ⁇ mi>, ⁇ mi>, and the font size of each child element is 1;
  • the element when set to ⁇ msup
  • the element is > it contains 2 sub-elements ⁇ mi>, ⁇ mn>, because the font size corresponding to the superscript element is the same as the font size of the element and its first sub-element, and the font size of the element and its second sub-element
  • the difference between a font size level, then for ⁇ msup> the first child element is the same as its own font size, and the second child element font size is +1.
  • the font size of all pole elements is finally obtained, as shown by the rightmost column number in Figure 2.
  • the second association table is queried, and the height of the pole element to be displayed can be obtained.
  • the font to be displayed has a height of 64
  • the font size with a font size of 2 is 50% of the font size of the level 1.
  • some formulas with multiple font sizes for example: Including the superscript element And subscript elements In this way, the height of the pole element to be displayed is calculated, and the data structure is more clearly displayed.
  • the non-polar element is calculated by calling the height and/or alignment line information of the one or more sub-elements of the non-polar element according to the layout mode of the non-polar element.
  • the height to be displayed includes:
  • the first association table Querying the first association table according to the layout mode of the non-polar element, and obtaining a height calculation rule to be displayed corresponding to the layout mode of the non-polar element; wherein the first association table records a plurality of layout modes And a height calculation rule to be displayed corresponding to each layout mode; the height calculation rule to be displayed relates to a height to be displayed and/or alignment line information of one or more child elements;
  • the height to be displayed and/or the alignment line information of the child element involved are called, and the height to be displayed of the non-polar element is calculated.
  • step 120 according to the layout mode of the non-polar element, the height and/or alignment line information of the one or more sub-elements of the non-polar element are called, and the alignment line information of the non-polar element is calculated, which specifically includes:
  • the second association table Querying the second association table according to the layout mode of the non-polar element, obtaining an alignment line information calculation rule corresponding to the layout mode of the non-polar element; wherein the second association table records a plurality of layout modes and each Alignment line information calculation rule corresponding to a layout mode; the alignment line information calculation rule relates to height and/or alignment line information of one or more sub-elements to be displayed;
  • the alignment line calculation rule of the fractional mode is that the alignment line information is equal to the highest point ordinate of the fractional mode element, and the first sub-element of the fractional mode element is to be Displaying a sum of a height and a preset first threshold;
  • the alignment pattern calculation rule of the root mode is that the alignment line information is equal to the highest point ordinate of the root mode element, one-half of the child elements to be displayed, and the pre-predetermined height And a sum of the second threshold values;
  • the alignment line calculation rule of the superscript mode is a sum of a highest point ordinate of the superscript mode element and a half height of the first sub-element.
  • the second association table is set to store the alignment line calculation rule of the non-polar element, and the to-be-displayed height and/or the alignment line information of the sub-elements involved by the non-polar element are called according to the alignment rule calculation rule of the non-polar element.
  • the alignment line calculation rule of the score mode is that the alignment line information is equal to the highest point ordinate of the fractional mode element, the to-be-displayed height of the first sub-element of the fractional mode element, and a preset The sum of the first thresholds, then in the formula Calculate fractional elements
  • the alignment of the line you need to call the first child element
  • the height to be displayed that is, the calculation To be displayed height, and Is a combination of expressions that need to be aligned to get their height;
  • the rules for calculating the alignment line need to call the alignment lines of the four child elements, where the non-polar elements
  • the alignment line needs to call the height of its child elements, and so on, and ask the height and alignment line information of the child elements step by step and return them step by step, which can be calculated to the fractional elements.
  • Align line information It should be noted that the alignment line calculation rule corresponding to the above-mentioned score mode, root mode or superscript mode is one of the preferred embodiments, and the application is applied to the ordinate of the formula element at the top of the screen, so that the score is suitable.
  • the alignment line of the element is similar to the position of its score line.
  • the alignment pattern of the root mode is slightly higher than half the height of the child element, and the alignment line of the superscript mode is half of the height of the first child element, and the alignment effect is better.
  • step 130 the sub-elements are arranged according to the alignment line information of each sub-element of the expression, so that the alignment line information of the sub-elements is the same, including:
  • the sub-elements are arranged with the alignment line information of the sub-elements having the highest point ordinate and the alignment line information having the largest difference, so that the alignment line information of the sub-elements is the same as the reference.
  • FIG. 3 it is a schematic diagram of the alignment of the formula elements of step 130, which shows that the sub-elements are arranged with the alignment line information of the elements with the highest height above the alignment line as the reference line, so that the alignment line information of each sub-element is the same as the reference.
  • Specific program Specifically, in the case where the ordinate of the ordinate of the formula element is set at the top of the screen, the height above the alignment line is the largest, that is, the difference between the ordinate information of the highest point of the element and the information of the alignment line is the largest. Therefore, the specific scheme of the above step 130 can realize the vertical display in the formula element.
  • the coordinate zero point is set in the whiteboard software at the top of the screen to make the formula look beautiful.
  • the embodiment sequentially reads the alignment line information or height of the sub-element, thereby obtaining the alignment line information or height step by step, and aligning the expression combination by using the alignment line information.
  • Each sub-element then according to the positional relationship between the elements and the height of the element to be displayed, solves the problem that the prior art cannot align the formula elements, realizes the efficient and beautiful display formula, and clearly shows the effect of the formula structure to the user. .
  • FIG. 4 is a schematic structural diagram of a display device of a formula in Embodiment 2 of the present invention.
  • the display device of the formula includes:
  • the obtaining module 410 is configured to obtain a layout mode of each element of the multi-level nested in the formula to be displayed and a positional relationship between the element and the element in each nesting level; wherein, if the n-th level is nested under an element Nesting one or more n+1th nested elements, the one or more n+1th nested elements are child elements of the nth nested element; elements without child elements are polar Element, element with child element is a non-polar element;
  • the calculating module 420 is configured to, according to a layout mode of the non-polar element, call the height and/or alignment line information of the one or more sub-elements of the non-polar element to calculate the height or alignment of the non-polar element to be displayed.
  • Line information wherein the alignment line information is ordinate information; the alignment line information of the pole element is an arithmetic mean of the highest point ordinate and the lowest point ordinate; the height of the pole element to be displayed is based on the superior element Obtained by the layout mode;
  • the arrangement module 430 is configured to arrange the sub-elements according to the alignment line information of each sub-element of the expression combination, so that the alignment line information of the sub-elements is the same; wherein the expression combination is a layout mode An element that encapsulates a set of expressions into a group;
  • the display module 440 is configured to display a formula for arranging the child elements of all expression combinations according to the positional relationship between the elements and the elements in each nesting level and the height to be displayed of each element.
  • the obtaining module 410 includes:
  • a formula acquisition unit for acquiring a mathematical markup language of a formula to be displayed
  • An information reading unit configured to read, from the mathematical markup language, a layout mode of each element of the multi-level nesting in the formula
  • a position relationship obtaining unit configured to obtain a positional relationship between the elements and the elements in each nesting level according to the layout mode of each of the multi-level nested elements.
  • calculation module 420 includes:
  • a first calling unit configured to: if a non-polar element exists in a child element of the expression combination, according to a layout mode of the non-polar element, call the height of the one or more child elements of the non-polar element to be displayed and/or Or aligning the line information to calculate alignment line information of the non-polar element;
  • a second calling unit configured to call a height and/or alignment of one or more child elements of the non-polar element according to a layout mode of the non-polar element when the height of the to-be-displayed element needs to be called Line information, calculating the height to be displayed of the non-polar element;
  • a third calling unit configured to call, when the alignment line information of the non-polar element needs to be called, the height and/or alignment of the one or more sub-elements of the non-polar element according to the layout mode of the non-polar element Line information, which calculates the alignment line information of the non-polar element.
  • the arrangement module 430 includes:
  • a calculation unit configured to calculate a difference between a highest point ordinate of each sub-element of the expression combination and its alignment line information
  • the aligning unit is configured to arrange each sub-element with reference to the alignment line information of the sub-element with the highest point ordinate and the alignment line information difference, so that the alignment line information of the sub-elements is the same as the reference.
  • FIG. 5 is a schematic structural diagram of a terminal according to Embodiment 3 of the present invention.
  • the terminal includes a processor 510, a memory 520, an input device 530, and an output device 540.
  • the number of processors 510 in the terminal may be One or more, one processor 510 is taken as an example in FIG. 5; the processor 510, the memory 520, the input device 530, and the output device 540 in the terminal may be connected by a bus or other manner, and the bus connection is taken as an example in FIG. .
  • the memory 520 is used as a computer readable storage medium, and can be used to store a software program, a computer executable program, and a module, such as a program instruction/module corresponding to the display method of the formula in the embodiment of the present invention (for example, in a display device of a formula)
  • the processor 510 executes various functional applications and data processing of the terminal by running software programs, instructions, and modules stored in the memory 520, that is, a display method of the above formula.
  • the terminal is a teaching touch screen terminal.
  • the memory 520 may mainly include a storage program area and an storage data area, wherein the storage program area may store an operating system, an application required for at least one function; the storage data area may store data created according to usage of the terminal, and the like. Further, the memory 520 may include a high speed random access memory, and may also include a nonvolatile memory such as at least one magnetic disk storage device, flash memory device, or other nonvolatile solid state storage device. In some examples, memory 520 can further include memory remotely located relative to processor 510, which can be connected to the terminal over a network.
  • the above network Examples include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
  • Input device 530 can be used to receive input digital or character information and to generate key signal inputs related to user settings and function control of the terminal.
  • the output device 540 can include a display device such as a display screen. In the teaching touch screen terminal, the input device 530 and the output device 540 are integrated in the touch screen.
  • Embodiment 4 of the present invention further provides a storage medium including computer executable instructions, where a computer program is stored thereon, and when the program is executed by the processor, the display method of the formula described in the foregoing embodiment is implemented.
  • a storage medium containing computer executable instructions the computer executable instructions are not limited to the method operations as described above, and may also perform the alignment method of the formula elements provided by any embodiment of the present invention. Related operations in .
  • the present invention can be implemented by software and necessary general hardware, and can also be implemented by hardware, but in many cases, the former is a better implementation. .
  • the technical solution of the present invention which is essential or contributes to the prior art, may be embodied in the form of a software product, which may be stored in a computer readable storage medium, such as a floppy disk of a computer. , Read-Only Memory (ROM), Random Access Memory (RAM), Flash (FLASH), hard disk or optical disk, etc., including a number of instructions to make a computer device (can be a personal computer)
  • the server, or network device, etc. performs the methods described in various embodiments of the present invention.
  • each unit and module included is only divided according to functional logic, but is not limited to the above division, as long as the corresponding function can be implemented;
  • the specific names of the functional units are also only for the purpose of distinguishing from each other, and It is intended to limit the scope of protection of the present invention.

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

本发明公开了一种公式的显示方法,包括:获取待显示的公式中多级嵌套的各元素的布局模式和每一嵌套级别中元素与元素之间的位置关系;根据非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的待显示高度或对齐线信息;根据表达式组合的各子元素的对齐线信息排布所述各子元素,使所述各子元素的对齐线信息相同;按照每一嵌套级别中元素与元素之间的位置关系以及各元素的待显示高度,显示排布好所有表达式组合的子元素的公式。相应地,本发明还公开了一种公式的显示装置、终端及计算机可读存储介质。本发明实现了高效美观地显示公式,清楚地向用户展示公式结构的效果。

Description

公式的显示方法、装置、终端及计算机可读存储介质 技术领域
本发明涉及数据处理技术领域,尤其涉及一种公式的显示方法、装置、终端及计算机可读存储介质。
背景技术
教学触屏终端是在常规电教及计算机设备基础上发展起来的多功能装置,兼具教学、学术报告、会议等功能,满足现代教育对各种资源进行演示的要求。
利用教学触屏终端提供的白板软件,教师能像在传统黑板上书写一样,在白板上书写。然而,无论在传统黑板上还是白板软件上,常常会出现因教师字迹潦草而导致公式显示不清楚的问题。虽然现有技术的教学触屏终端能够应用图像处理的手段识别出公式中的字符及布局模式,但却无法对齐排布公式中的各元素,美观地显示公式。
发明内容
本发明提供一种公式的显示方法、装置、终端及计算机可读存储介质,以实现高效美观地显示公式,清楚地向学生用户展示公式结构。
第一方面,本发明实施例一提供了一种公式的显示方法,包括:
获取待显示的公式中多级嵌套的各元素的布局模式和每一嵌套级别中元素与元素之间的位置关系;其中,若第n级嵌套的一个元素下嵌套一个或多个第n+1级嵌套元素,则所述一个或多个第n+1级嵌套元素为该第n级嵌套元素的 子元素;没有子元素的元素为极子元素,有子元素的元素为非极子元素;
根据非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的待显示高度或对齐线信息;其中,所述对齐线信息为纵坐标信息;极子元素的对齐线信息为自身最高点纵坐标与最低点纵坐标的算术平均值;极子元素的待显示高度是根据其上级元素的布局模式获得的;
根据表达式组合的各子元素的对齐线信息排布所述各子元素,使所述各子元素的对齐线信息相同;其中,所述表达式组合是布局模式为多个表达式封装成一组的元素;
按照每一嵌套级别中元素与元素之间的位置关系以及各元素的待显示高度,显示排布好所有表达式组合的子元素的公式。
第二方面,本发明实施例还提供一种公式的显示装置,包括:
获取模块,用于获取待显示的公式中多级嵌套的各元素的布局模式和每一嵌套级别中元素与元素之间的位置关系;其中,若第n级嵌套的一个元素下嵌套一个或多个第n+1级嵌套元素,则所述一个或多个第n+1级嵌套元素为该第n级嵌套元素的子元素;没有子元素的元素为极子元素,有子元素的元素为非极子元素;
计算模块,用于根据非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的待显示高度或对齐线信息;其中,所述对齐线信息为纵坐标信息;极子元素的对齐线信息为自身最高点纵坐标与最低点纵坐标的算术平均值;极子元素的待显示高度是根据其上级元素的布局模式获得的;
排布模块,用于根据表达式组合的各子元素的对齐线信息排布所述各子元素,使所述各子元素的对齐线信息相同;其中,所述表达式组合是布局模式为多个表达式封装成一组的元素;
显示模块,用于按照每一嵌套级别中元素与元素之间的位置关系以及各元素的待显示高度,显示排布好所有表达式组合的子元素的公式。
第三方面,本发明实施例还提供一种终端,所述终端包括:
一个或多个处理器;
存储器,用于存储一个或多个程序,
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现上述的公式元素的对齐方法。
第四方面,本发明还提供一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述的公式元素的对齐方法。
本发明实施例根据公式中多级嵌套的元素的布局模式,逐级读取子元素的对齐线信息或高度,从而逐级获得对齐线信息或高度,利用对齐线信息对齐表达式组合的各子元素,然后按照元素之间的位置关系和元素的待显示高度显示公式,解决了现有技术无法对齐公式元素的问题,实现高效美观地显示公式,清楚地向用户展示公式结构的效果。
附图说明
图1是本发明实施例一中的公式的显示方法的流程图;
图2是本发明实施例一中的公式信息示意图;
图3是本发明实施例一中的公式元素对齐示意图;
图4是本发明实施例二中的公式的显示装置的结构示意图;
图5是本发明实施例三中的终端的结构示意图。
具体实施方式
下面结合附图和实施例对本发明作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释本发明,而非对本发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本发明相关的部分而非全部结构。
实施例一
图1为本发明实施例一提供的公式的显示方法的流程图,本实施例可适用于教学触屏终端在获取了公式的字符和由字符组成的多级元素嵌套的结构(例如,公式
Figure PCTCN2017116754-appb-000001
中,字符x、=、a和b组成了第一级元素
Figure PCTCN2017116754-appb-000002
嵌套第二级元素x、=和
Figure PCTCN2017116754-appb-000003
第二级元素
Figure PCTCN2017116754-appb-000004
嵌套第三级元素a和b的结构)后绘制公式以显示给用户的情况,该方法可以由计算机程序指令来执行,具体包括如下步骤110、120、130和140。
步骤110、获取待显示的公式中多级嵌套的各元素的布局模式和每一嵌套级别中元素与元素之间的位置关系。
其中,若第n级嵌套的一个元素下嵌套一个或多个第n+1级嵌套元素,则所述一个或多个第n+1级嵌套元素为该第n级嵌套元素的子元素;没有子元素的元素为极子元素,有子元素的元素为非极子元素。
具体可参见图2所示的公式信息示意图;图2使用数学标记语言MathML示出了公式
Figure PCTCN2017116754-appb-000005
的信息,包括各元素的布局模式,例如标记mfrac、msup 等表明元素的布局模式为分数模式、上标模式,在MathML中类似的布局模式还有msqrt、mrow、msubsup、mover、munderover和mmultiscipts等,分别表示根式、多个表达式封装成一组、上下标对、顶部标记、底部标记和顶底部标记等;还包括各元素的嵌套关系,例如第一级嵌套元素的标记<math>表示MathML文档的开始,表示MathML文档结束,中间嵌套了多个子元素;由元素的布局模式,还可获得每一嵌套级别中元素与元素之间的位置关系,比如元素的布局模式为分数,则第一个子元素在分数线上方,第二个子元素在分数线下方。
在图2中,第一级嵌套元素(标记为<Math>)
Figure PCTCN2017116754-appb-000006
下包含三个元素,分别是标识符元素(代表变量、函数名、常量等,标记为<mi>)x、操作符元素(标记为<mo>)=、以及分数元素(标记为<mfrac>)
Figure PCTCN2017116754-appb-000007
则这三个第二级嵌套元素为第一级嵌套元素<math>的子元素。
所述极子元素为没有子元素的元素。例如,在公式
Figure PCTCN2017116754-appb-000008
中,元素<mi>x</mi>、<mo>=</mo>、<mo>-</mo>、<mi>b</mi>、<mo>±<mo>、<mi>b</mi>和<mn>2</mn>都是没有子元素的元素,则定义它们为极子元素,而有子元素的元素则定义为非极子元素;可以理解,该定义名称为解释所用,并非限定本发明的范围。
具体地,步骤110、获取待显示的公式中多级嵌套的各元素的布局模式和每一嵌套级别中元素与元素之间的位置关系,具体包括:
获取待显示的公式的数学标记语言;
从所述数学标记语言中读取所述公式中多级嵌套的各元素的布局模式;
根据所述多级嵌套的各元素的布局模式,获得每一嵌套级别中元素与元素之间的位置关系。
以上公式的信息可从具有计算机处理能力的终端上获取笔迹然后利用图像处理的方法获取得到,显然,上述举例利用了数学标记语言MathML来记载公式信息仅是其中一种具体实施方式,本发明还可以其他语言记载公式信息。
步骤120、根据非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的待显示高度或对齐线信息。
其中,所述对齐线信息为纵坐标信息;极子元素的对齐线信息为自身最高点纵坐标与最低点纵坐标的算术平均值;极子元素的待显示高度是根据其上级元素的布局模式获得的。
具体地,调用一个或多个子元素的待显示高度和/或对齐线信息包括:调用一个或多个子元素的待显示高度和对齐线信息,或者,调用一个或多个子元素的待显示高度或对齐线信息,或者,调用一个或多个子元素的待显示高度以及另外一个或多个子元素的对齐线信息等。可以理解,对于不同布局模式的元素,其对齐线信息和待显示高度跟子元素的关系一般都不同,因此,对于不同布局模式的元素求待显示高度或对齐线信息,调用的子元素可能不同,调用子元素的信息是待显示高度或是对齐线信息也不相同。
具体地,按照步骤120,非极子元素根据子元素的待显示高度和/或对齐线信息获得自身的对齐线信息或高度信息,若子元素为非极子元素,则按照步骤120继续根据下级元素获得自身的对齐线信息或高度信息,返回给上级元素供上级元素计算调用;若子元素为极子元素,则极子元素的对齐线信息为自身最高点纵坐标与最低点纵坐标的算术平均值,待显示高度是根据其上级元素的布局模式获得的;即步骤120、根据非极子元素的布局模式,调用该非极子元素 的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的待显示高度或对齐线信息,具体包括:
若表达式组合的子元素中存在非极子元素,则根据该非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的对齐线信息;
在需要调用非极子元素的待显示高度时,根据该非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的待显示高度;
在需要调用非极子元素的对齐线信息时,根据该非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的对齐线信息。
步骤130、根据表达式组合的各子元素的对齐线信息排布所述各子元素,使所述各子元素的对齐线信息相同。
其中,所述表达式组合是布局模式为多个表达式封装成一组的元素,即并列的多个表达式的组合。在MathML语言中,表达式组合一般包括标记为<math>(将整个公式封装成一组)和<mrow>(表示将任意数目的子表达式水平的分成一组,起到封装的作用)的元素。在数学公式中,需要对齐的是表达式组合元素,比如<math>元素的三个子元素,x、=和
Figure PCTCN2017116754-appb-000009
<mrow>元素(图2中第5行)的子元素-、b、±和
Figure PCTCN2017116754-appb-000010
<mrow>元素(图2中第20行)的子元素2和a。对于这些表达式组合,均需要对齐显示才能清楚展示数据结构,本实施例为其设计对齐线信息,公式的排布以对齐线信息为基准对齐。
步骤140、按照每一嵌套级别中元素与元素之间的位置关系以及各元素的 待显示高度,显示排布好所有表达式组合的子元素的公式。
下面具体说明该公式的显示方法的工作原理:
高效美观显示一个公式,使得公式的数据结构清楚需要获得元素的待显示高度和每一嵌套级别中元素与元素之间的位置关系(即同级多个元素分别置于哪个位置,例如,分数元素中的分子置于分母上方),以及对齐表达式组合。本实施例中,对于表达式组合元素,需要按照对齐线信息排布其子元素,则询问自身子元素的对齐线信息,该子元素根据自身布局模式询问下一级子元素的待显示高度和/或对齐线信息,逐级询问,直至极子元素返回自身待显示高度和/或对齐线信息给极子元素的父元素计算自身待显示高度和/或对齐线信息,逐级返回,计算出表达式组合中各子元素的对齐线信息,将各子元素排布,使得对齐线信息相同,即将表达式组合中各元素的对齐线对准。各元素的待显示高度也按照逐级询问和逐级返回的方式获得。结合元素与元素的位置关系可获得显示公式各要素,实现公式的显示。
本实施例根据公式中多级嵌套的元素的布局模式,逐级读取子元素的对齐线信息或高度,从而逐级获得对齐线信息或高度,利用对齐线信息对齐表达式组合的各子元素,然后按照元素之间的位置关系和元素的待显示高度显示公式,解决了现有技术无法对齐公式元素的问题,实现高效美观地显示公式,清楚地向用户展示公式结构的效果。
在上述方案的基础上,极子元素的待显示高度是根据其上级元素的布局模式获得的,包括:极子元素的待显示高度是根据其上一级元素的布局模式获得的,或者,极子元素的待显示高度是根据其上n级元素的布局模式获得的,n≥1;上级元素包括上n级元素。即视上级元素是何种类型的元素决定子元素是 否需要变更字体大小,比如极子元素<mn>4</mn>,其父元素为分数元素<msqrt>,分数元素的子元素不需要变更字体大小,可与上一级元素保持同样的大小,则字体与上一级元素一致(在图2中,字体大小以最右一列的数字表示字号,极子元素<mn>4</mn>及其上一级元素字号都为1);而第12行的极子元素<mn>2</mn>,其上一级元素为上标元素<msup>,上标元素的第二个子元素需要设置字体偏小,则极子元素<mn>2</mn>的待显示高度为预设的小一号字体的尺寸(在图2中,体现为字体层级为2)。对于仅需显示简易公式的白板软件,可直接根据极子元素的上一级元素的布局模式,获得极子元素的待显示高度。而本实施例还提供了一种可对具有多层高度变更的公式的极子元素的待显示高度进行计算的具体方案,该具体方案根据公式的嵌套结构,根据上一级元素的布局模式,逐级计算子元素的待显示高度。即极子元素的待显示高度的获取方法包括:
根据非极子元素的布局模式,查询第三关联表,获得该非极子元素的布局模式对应的字号关系;其中,所述第三关联表记载了多个布局模式以及与每一元素布局模式对应的字号关系,所述字号关系为元素及其子元素的字号关系;
按照所述非极子元素的布局模式对应的字号关系,由该非极子元素的字号获得其子元素的字号;其中,第一级嵌套元素的字号为预设值;
根据极子元素的字号,查询第四关联表,获得极子元素的待显示高度;其中,所述第四关联表记载了多个字号以及与每一字号对应的待显示高度。
优选地,在所述第一关联表中,分数模式、根式模式和表达式组合模式对应的字号关系为元素及其子元素的字号相同;上标模式对应的字号关系为元素及其第一个子元素的字号相同,且元素及其第二个子元素的字号相差一个字号 级别。
如图2所示的公式
Figure PCTCN2017116754-appb-000011
的数据结构,第一级嵌套元素<math>为表达式组合,字号为1,其子元素(包括标识符元素<mi>:x;操作符元素<mo>:=;以及分数元素<mfrac>:
Figure PCTCN2017116754-appb-000012
)字号都与其相同,都为1。分数元素<mfrac>自身的两个子元素字号与其相同,也为1。对于<mfrac>元素的第一个子元素<mrow>来说,它又包含4个子元素<mo>、<mi>、<mo>、<msqrt>,每个子元素的字号都与其相同为1;当设置到<msqrt>元素的时候,其又包含5个子元素,<msup>、<mo>、<mn>、<mi>、<mi>,每个子元素的字号为1;当设置到<msup>元素的时候,其又包含2个子元素<mi>、<mn>,由于上标元素对应的字号关系为元素及其第一个子元素的字号相同,且元素及其第二个子元素的字号相差一个字号级别,那么对于<msup>来说第一个子元素与自己字号相同为1,第二个子元素字号+1为2。以此类推,最终得到所有极子元素的字号,如图2中最右一列数字所示。根据极子元素的字号,查询第二关联表,可得到极子元素的待显示高度。例如,对于字号为1的字体待显示高度为64,字号为2的字体尺寸为层级为1的字体尺寸的50%。对于一些有多字号级别的公式,例如:
Figure PCTCN2017116754-appb-000013
其中包括上标元素
Figure PCTCN2017116754-appb-000014
和下标元素
Figure PCTCN2017116754-appb-000015
利用此方式计算极子元素的待显示高度,更能清楚显示数据结构。
在上述技术方案的基础上,步骤120中,根据非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的待显示高度,具体包括:
根据非极子元素的布局模式,查询第一关联表,获得所述非极子元素的布局模式对应的待显示高度计算规则;其中,所述第一关联表记载了多个布局模 式以及与每一布局模式对应的待显示高度计算规则;所述待显示高度计算规则涉及一个或多个子元素的待显示高度和/或对齐线信息;
按照所述非极子元素的布局模式对应的待显示高度计算规则,调用其涉及的子元素的待显示高度和/或对齐线信息,计算该非极子元素的待显示高度。
步骤120中,根据非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的对齐线信息,具体包括:
根据非极子元素的布局模式,查询第二关联表,获得所述非极子元素的布局模式对应的对齐线信息计算规则;其中,所述第二关联表记载了多个布局模式以及与每一布局模式对应的对齐线信息计算规则;所述对齐线信息计算规则涉及一个或多个子元素的待显示高度和/或对齐线信息;
按照所述非极子元素的布局模式对应的对齐线信息计算规则,调用其涉及的子元素的待显示高度和/或对齐线信息,计算该非极子元素的对齐线信息。
优选地,在所述第一关联表中,所述分数模式的对齐线计算规则为对齐线信息等于所述分数模式元素的最高点纵坐标、所述分数模式元素的第一个子元素的待显示高度与预设的第一阈值之和;所述根式模式的对齐线计算规则为对齐线信息等于所述根式模式元素的最高点纵坐标、其子元素的二分之一待显示高度与预设的第二阈值之和;所述上标模式的对齐线计算规则为所述上标模式元素的最高点纵坐标与第一个子元素的二分之一高度之和。
上述具体方案,设置了第二关联表存放非极子元素的对齐线计算规则,根据非极子元素的对齐线计算规则调用其涉及的子元素的待显示高度和/或对齐线信息。例如,在第二关联表中,分数模式的对齐线计算规则为对齐线信息等 于所述分数模式元素的最高点纵坐标、所述分数模式元素的第一个子元素的待显示高度与预设的第一阈值之和,则在公式
Figure PCTCN2017116754-appb-000016
计算分数元素
Figure PCTCN2017116754-appb-000017
的对齐线时,需要调用第一个子元素
Figure PCTCN2017116754-appb-000018
的待显示高度,即需要计算
Figure PCTCN2017116754-appb-000019
的待显示高度,而
Figure PCTCN2017116754-appb-000020
是表达式组合,需要对齐后才能获得自身的高度;其对齐线的计算规则需要调用四个子元素的对齐线,其中,非极子元素
Figure PCTCN2017116754-appb-000021
的对齐线需要调用其子元素的高度,依次类推,逐级询问子元素的待显示高度和对齐线信息并逐级返回,可计算到分数元素
Figure PCTCN2017116754-appb-000022
的对齐线信息。需要说明的是,上述分数模式、根式模式或上标模式对应的对齐线计算规则为其中一种优选实施方式,其应用在公式元素显示的纵坐标零点设在屏幕的顶端会比较适用,使得分数元素的对齐线与其分数线位置相近,根式模式的对齐线略高于子元素的一半高度,上标模式的对齐线为第一个子元素的高度的一半,对齐效果更好。
在上述技术方案的基础上,步骤130、根据表达式组合的各子元素的对齐线信息排布所述各子元素,使所述各子元素的对齐线信息相同,具体包括:
计算表达式组合的各子元素的最高点纵坐标与其对齐线信息的差值;
以最高点纵坐标与对齐线信息差值最大的子元素的对齐线信息为基准,排布各子元素,使所述各子元素的对齐线信息与所述基准相同。
参见图3,是步骤130公式元素对齐示意图,其示出了以对齐线上方高度最大的元素的对齐线信息为基准,排布各子元素,使各子元素的对齐线信息与所述基准相同的具体方案。具体地,在公式元素显示的纵坐标零点设在屏幕的顶端的情况下,对齐线上方高度最大,即该元素最高点纵坐标信息与其对齐线信息的差值最大。因此,上述步骤130的具体方案能实现在公式元素显示的纵 坐标零点设在屏幕的顶端的白板软件中,使公式对齐美观。
综上,本实施例根据公式中多级嵌套的元素的布局模式,逐级读取子元素的对齐线信息或高度,从而逐级获得对齐线信息或高度,利用对齐线信息对齐表达式组合的各子元素,然后按照元素之间的位置关系和元素的待显示高度显示公式,解决了现有技术无法对齐公式元素的问题,实现高效美观地显示公式,清楚地向用户展示公式结构的效果。
实施例二
图4为本发明实施例二中的公式的显示装置的结构示意图。该公式的显示装置包括:
获取模块410,用于获取待显示的公式中多级嵌套的各元素的布局模式和每一嵌套级别中元素与元素之间的位置关系;其中,若第n级嵌套的一个元素下嵌套一个或多个第n+1级嵌套元素,则所述一个或多个第n+1级嵌套元素为该第n级嵌套元素的子元素;没有子元素的元素为极子元素,有子元素的元素为非极子元素;
计算模块420,用于根据非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的待显示高度或对齐线信息;其中,所述对齐线信息为纵坐标信息;极子元素的对齐线信息为自身最高点纵坐标与最低点纵坐标的算术平均值;极子元素的待显示高度是根据其上级元素的布局模式获得的;
排布模块430,用于根据表达式组合的各子元素的对齐线信息排布所述各子元素,使所述各子元素的对齐线信息相同;其中,所述表达式组合是布局模 式为多个表达式封装成一组的元素;
显示模块440,用于按照每一嵌套级别中元素与元素之间的位置关系以及各元素的待显示高度,显示排布好所有表达式组合的子元素的公式。
进一步地,获取模块410包括:
公式获取单元,用于获取待显示的公式的数学标记语言;
信息读取单元,用于从所述数学标记语言中读取所述公式中多级嵌套的各元素的布局模式;
位置关系获得单元,用于根据所述多级嵌套的各元素的布局模式,获得每一嵌套级别中元素与元素之间的位置关系。
进一步地,计算模块420包括:
第一调用单元,用于若表达式组合的子元素中存在非极子元素,则根据该非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的对齐线信息;
第二调用单元,用于在需要调用非极子元素的待显示高度时,根据该非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的待显示高度;
第三调用单元,用于在需要调用非极子元素的对齐线信息时,根据该非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的对齐线信息。
进一步地,排布模块430包括:
计算单元,用于计算表达式组合的各子元素的最高点纵坐标与其对齐线信息的差值;
对齐单元,用于以最高点纵坐标与对齐线信息差值最大的子元素的对齐线信息为基准,排布各子元素,使所述各子元素的对齐线信息与所述基准相同。
实施例三
图5为本发明实施例三提供的一种终端的结构示意图,如图5所示,该终端包括处理器510、存储器520、输入装置530和输出装置540;终端中处理器510的数量可以是一个或多个,图5中以一个处理器510为例;终端中的处理器510、存储器520、输入装置530和输出装置540可以通过总线或其他方式连接,图5中以通过总线连接为例。
存储器520作为一种计算机可读存储介质,可用于存储软件程序、计算机可执行程序以及模块,如本发明实施例中的公式的显示方法对应的程序指令/模块(例如,公式的显示装置中的获取模块410、计算模块420、排布模块430和显示模块440)。处理器510通过运行存储在存储器520中的软件程序、指令以及模块,从而执行终端的各种功能应用以及数据处理,即实现上述的公式的显示方法。
作为其中一种实施方式,该终端为教学触屏终端。
存储器520可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序;存储数据区可存储根据终端的使用所创建的数据等。此外,存储器520可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实例中,存储器520可进一步包括相对于处理器510远程设置的存储器,这些远程存储器可以通过网络连接至终端。上述网络的实 例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
输入装置530可用于接收输入的数字或字符信息,以及产生与终端的用户设置以及功能控制有关的键信号输入。输出装置540可包括显示屏等显示设备。在教学触屏终端中,输入装置530与输出装置540集成于触控屏中。
实施例四
本发明实施例四还提供一种包含计算机可执行指令的存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述实施例所述的公式的显示方法。
当然,本发明实施例所提供的一种包含计算机可执行指令的存储介质,其计算机可执行指令不限于如上所述的方法操作,还可以执行本发明任意实施例所提供的公式元素的对齐方法中的相关操作.
通过以上关于实施方式的描述,所属领域的技术人员可以清楚地了解到,本发明可借助软件及必需的通用硬件来实现,当然也可以通过硬件实现,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如计算机的软盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、闪存(FLASH)、硬盘或光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。
值得注意的是,上述公式的显示装置的实施例中,所包括的各个单元和模块只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,各功能单元的具体名称也只是为了便于相互区分,并不 用于限制本发明的保护范围。
注意,上述仅为本发明的较佳实施例及所运用技术原理。本领域技术人员会理解,本发明不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本发明的保护范围。因此,虽然通过以上实施例对本发明进行了较为详细的说明,但是本发明不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本发明的范围由所附的权利要求范围决定。

Claims (10)

  1. 一种公式的显示方法,其特征在于,包括:
    获取待显示的公式中多级嵌套的各元素的布局模式和每一嵌套级别中元素与元素之间的位置关系;其中,若第n级嵌套的一个元素下嵌套一个或多个第n+1级嵌套元素,则所述一个或多个第n+1级嵌套元素为该第n级嵌套元素的子元素;没有子元素的元素为极子元素,有子元素的元素为非极子元素;
    根据非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的待显示高度或对齐线信息;其中,所述对齐线信息为纵坐标信息;极子元素的对齐线信息为自身最高点纵坐标与最低点纵坐标的算术平均值;极子元素的待显示高度是根据其上级元素的布局模式获得的;
    根据表达式组合的各子元素的对齐线信息排布所述各子元素,使所述各子元素的对齐线信息相同;其中,所述表达式组合是布局模式为多个表达式封装成一组的元素;
    按照每一嵌套级别中元素与元素之间的位置关系以及各元素的待显示高度,显示排布好所有表达式组合的子元素的公式。
  2. 如权利要求1所述的公式的显示方法,其特征在于,所述获取待显示的公式中多级嵌套的各元素的布局模式和每一嵌套级别中元素与元素之间的位置关系,具体包括:
    获取待显示的公式的数学标记语言;
    从所述数学标记语言中读取所述公式中多级嵌套的各元素的布局模式;
    根据所述多级嵌套的各元素的布局模式,获得每一嵌套级别中元素与元素之间的位置关系。
  3. 如权利要求1所述的公式的显示方法,其特征在于,所述根据非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的待显示高度或对齐线信息,具体包括:
    若表达式组合的子元素中存在非极子元素,则根据该非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的对齐线信息;
    在需要调用非极子元素的待显示高度时,根据该非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的待显示高度;
    在需要调用非极子元素的对齐线信息时,根据该非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的对齐线信息。
  4. 如权利要求3所述的公式的显示方法,其特征在于,所述根据非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的待显示高度,具体包括:
    根据非极子元素的布局模式,查询第一关联表,获得所述非极子元素的布局模式对应的待显示高度计算规则;其中,所述第一关联表记载了多个布局模式以及与每一布局模式对应的待显示高度计算规则;所述待显示高度计算规则涉及一个或多个子元素的待显示高度和/或对齐线信息;
    按照所述非极子元素的布局模式对应的待显示高度计算规则,调用其涉及的子元素的待显示高度和/或对齐线信息,计算该非极子元素的待显示高度;
    所述根据非极子元素的布局模式,调用该非极子元素的一个或多个子元素 的待显示高度和/或对齐线信息,计算该非极子元素的对齐线信息,具体包括:
    根据非极子元素的布局模式,查询第二关联表,获得所述非极子元素的布局模式对应的对齐线信息计算规则;其中,所述第二关联表记载了多个布局模式以及与每一布局模式对应的对齐线信息计算规则;所述对齐线信息计算规则涉及一个或多个子元素的待显示高度和/或对齐线信息;
    按照所述非极子元素的布局模式对应的对齐线信息计算规则,调用其涉及的子元素的待显示高度和/或对齐线信息,计算该非极子元素的对齐线信息。
  5. 如权利要求4所述的公式的显示方法,其特征在于,所述极子元素的待显示高度的获取方法包括:
    根据非极子元素的布局模式,查询第三关联表,获得该非极子元素的布局模式对应的字号关系;其中,所述第三关联表记载了多个布局模式以及与每一元素布局模式对应的字号关系,所述字号关系为元素及其子元素的字号关系;
    按照所述非极子元素的布局模式对应的字号关系,由该非极子元素的字号获得其子元素的字号;其中,第一级嵌套元素的字号为预设值;
    根据极子元素的字号,查询第四关联表,获得极子元素的待显示高度;其中,所述第四关联表记载了多个字号以及与每一字号对应的待显示高度。
  6. 如权利要求1至5任一项所述的公式的显示方法,其特征在于,所述根据表达式组合的各子元素的对齐线信息排布所述各子元素,使所述各子元素的对齐线信息相同,具体包括:
    计算表达式组合的各子元素的最高点纵坐标与其对齐线信息的差值;
    以最高点纵坐标与对齐线信息差值最大的子元素的对齐线信息为基准,排布各子元素,使所述各子元素的对齐线信息与所述基准相同。
  7. 如权利要求4所述的公式的显示方法,其特征在于,所述布局模式包括分数模式、根式模式和上标模式;
    在所述第一关联表中,所述分数模式的对齐线计算规则为对齐线信息等于所述分数模式元素的最高点纵坐标、所述分数模式元素的第一个子元素的待显示高度与预设的第一阈值之和;所述根式模式的对齐线计算规则为对齐线信息等于所述根式模式元素的最高点纵坐标、其子元素的二分之一待显示高度与预设的第二阈值之和;所述上标模式的对齐线计算规则为所述上标模式元素的最高点纵坐标与第一个子元素的二分之一高度之和。
  8. 一种公式的显示装置,其特征在于,包括:
    获取模块,用于获取待显示的公式中多级嵌套的各元素的布局模式和每一嵌套级别中元素与元素之间的位置关系;其中,若第n级嵌套的一个元素下嵌套一个或多个第n+1级嵌套元素,则所述一个或多个第n+1级嵌套元素为该第n级嵌套元素的子元素;没有子元素的元素为极子元素,有子元素的元素为非极子元素;
    计算模块,用于根据非极子元素的布局模式,调用该非极子元素的一个或多个子元素的待显示高度和/或对齐线信息,计算该非极子元素的待显示高度或对齐线信息;其中,所述对齐线信息为纵坐标信息;极子元素的对齐线信息为自身最高点纵坐标与最低点纵坐标的算术平均值;极子元素的待显示高度是根据其上级元素的布局模式获得的;
    排布模块,用于根据表达式组合的各子元素的对齐线信息排布所述各子元素,使所述各子元素的对齐线信息相同;其中,所述表达式组合是布局模式为多个表达式封装成一组的元素;
    显示模块,用于按照每一嵌套级别中元素与元素之间的位置关系以及各元素的待显示高度,显示排布好所有表达式组合的子元素的公式。
  9. 一种终端,其特征在于,所述终端包括:
    一个或多个处理器;
    存储器,用于存储一个或多个程序,
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-7中任一所述的公式的显示方法。
  10. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现如权利要求1-7中任一所述的公式的显示方法。
PCT/CN2017/116754 2017-07-27 2017-12-17 公式的显示方法、装置、终端及计算机可读存储介质 WO2019019534A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710622857.0 2017-07-27
CN201710622857.0A CN107390978B (zh) 2017-07-27 2017-07-27 公式的显示方法、装置、终端及计算机可读存储介质

Publications (1)

Publication Number Publication Date
WO2019019534A1 true WO2019019534A1 (zh) 2019-01-31

Family

ID=60342753

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/116754 WO2019019534A1 (zh) 2017-07-27 2017-12-17 公式的显示方法、装置、终端及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN107390978B (zh)
WO (1) WO2019019534A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107390978B (zh) * 2017-07-27 2020-11-03 广州视源电子科技股份有限公司 公式的显示方法、装置、终端及计算机可读存储介质
CN114357944B (zh) * 2021-12-17 2024-02-20 永中软件股份有限公司 大型运算符公式的布局方法和计算机装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW372295B (en) * 1998-08-07 1999-10-21 Arphic Technology Co Ltd Structural graphic display system
WO2001016687A2 (de) * 1999-08-30 2001-03-08 Datango Ag Verfahren und vorrichtung zur positionierung eines markierungsmittels auf einer ausgabeeinheit
CN102193786A (zh) * 2010-03-11 2011-09-21 中国工商银行股份有限公司 一种自适应的图形用户界面构建装置及方法
CN104572577A (zh) * 2014-12-17 2015-04-29 百度在线网络技术(北京)有限公司 数学公式处理方法及装置
CN107390978A (zh) * 2017-07-27 2017-11-24 广州视源电子科技股份有限公司 公式的显示方法、装置、终端及计算机可读存储介质

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101329731A (zh) * 2008-06-06 2008-12-24 南开大学 图像中数学公式的自动识别方法
CN103176954A (zh) * 2013-03-27 2013-06-26 重庆市科学技术研究院 一种基于HTML5 canvas的数学公式显示方法及系统
CN104598185A (zh) * 2014-12-31 2015-05-06 乐视网信息技术(北京)股份有限公司 文字的字体校正方法及系统
JP2017033294A (ja) * 2015-07-31 2017-02-09 株式会社イメージソース 3次元描画システム及び3次元描画プログラム
CN106776525A (zh) * 2016-11-16 2017-05-31 广州视源电子科技股份有限公司 一种公式绘制方法和装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW372295B (en) * 1998-08-07 1999-10-21 Arphic Technology Co Ltd Structural graphic display system
WO2001016687A2 (de) * 1999-08-30 2001-03-08 Datango Ag Verfahren und vorrichtung zur positionierung eines markierungsmittels auf einer ausgabeeinheit
CN102193786A (zh) * 2010-03-11 2011-09-21 中国工商银行股份有限公司 一种自适应的图形用户界面构建装置及方法
CN104572577A (zh) * 2014-12-17 2015-04-29 百度在线网络技术(北京)有限公司 数学公式处理方法及装置
CN107390978A (zh) * 2017-07-27 2017-11-24 广州视源电子科技股份有限公司 公式的显示方法、装置、终端及计算机可读存储介质

Also Published As

Publication number Publication date
CN107390978A (zh) 2017-11-24
CN107390978B (zh) 2020-11-03

Similar Documents

Publication Publication Date Title
Drucker Graphical approaches to the digital humanities
EP3608795A1 (en) Method and apparatus for generating knowledge graph, device and computer readable storage medium
CN108415978A (zh) 用户标签存储方法、用户画像计算方法及计算设备
US20140258849A1 (en) Automatic Alignment of a Multi-Dimensional Layout
CN104516867A (zh) 一种表格重排方法和系统
CN106062854A (zh) 用于创建和显示多幻灯片演示的系统和方法
CN109144504A (zh) 基于d3的数据可视化图形生成方法及存储介质
CN103729457A (zh) 基于互联网的数字化图书辅助阅读系统及其方法
CN103617296A (zh) 一种地名注记图层的优化显示方法
KR102248823B1 (ko) 데이터 시각화 서비스 시스템, 방법 및 어플리케이션
JP2020524833A (ja) テキスト情報を表示する方法および装置
WO2019019534A1 (zh) 公式的显示方法、装置、终端及计算机可读存储介质
CN104376038A (zh) 一种基于标签云的位置关联文本信息可视化方法
Pollock On Kronecker products, tensor products and matrix differential calculus
Andrienko et al. Geoviz: Interactive maps that help people think
CN110363206A (zh) 数据对象的聚类、数据处理及数据识别方法
US20150149466A1 (en) Condensed hierarchical data viewer
JP2012014608A (ja) 情報処理装置、情報処理方法、及びプログラム
Salim et al. Comparative study of low-cost tools to create effective educational infographics content
JP2012014486A (ja) 情報処理装置、情報処理方法、およびプログラム
Wyke-Smith Stylin'with CSS: a designer's guide
CN108256124A (zh) 网站建立方法、装置、服务器及存储介质
JP2009026201A (ja) 評価結果出力装置、評価結果出力方法、プログラム
Lien Mobile edutainment system--National Palace Museum as an example
JP6926623B2 (ja) 情報処理装置及びプログラム

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17918767

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 29.05.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17918767

Country of ref document: EP

Kind code of ref document: A1